public STRtree generateTinIndex ( Double maxEdgeLength ) { double maxEdge = maxEdgeLength != null ? maxEdgeLength : 0.0 ; pm . beginTask ( "Creating tin indexes..." , tinGeometries . length ) ; final STRtree tinTree = new STRtree ( tinGeometries . length ) ; for ( Geometry geometry : tinGeometries ) { if ( maxEdgeLength != null ) { Coordinate [ ] coordinates = geometry . getCoordinates ( ) ; double maxLength = distance3d ( coordinates [ 0 ] , coordinates [ 1 ] , null ) ; double tmpLength = distance3d ( coordinates [ 1 ] , coordinates [ 2 ] , null ) ; if ( tmpLength > maxLength ) { maxLength = tmpLength ; } tmpLength = distance3d ( coordinates [ 2 ] , coordinates [ 0 ] , null ) ; if ( tmpLength > maxLength ) { maxLength = tmpLength ; } // triangles below a certain edge length are not adapted if ( maxLength < maxEdge ) { continue ; } } tinTree . insert ( geometry . getEnvelopeInternal ( ) , geometry ) ; } pm . done ( ) ; return tinTree ; }
Generate a spatial index on the tin geometries .