idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
26,100
public static String geometryToJson ( SpatialReference spatialReference , Geometry geometry ) { OperatorExportToJson exporter = ( OperatorExportToJson ) factory . getOperator ( Operator . Type . ExportToJson ) ; return exporter . execute ( spatialReference , geometry ) ; }
Exports the specified geometry instance to it s JSON representation . M and Z values are not imported from JSON representation .
26,101
public static Geometry geometryFromEsriShape ( byte [ ] esriShapeBuffer , Geometry . Type geometryType ) { OperatorImportFromESRIShape op = ( OperatorImportFromESRIShape ) factory . getOperator ( Operator . Type . ImportFromESRIShape ) ; return op . execute ( ShapeImportFlags . ShapeImportNonTrusted , geometryType , ByteBuffer . wrap ( esriShapeBuffer ) . order ( ByteOrder . LITTLE_ENDIAN ) ) ; }
Imports geometry from the ESRI shape file format .
26,102
public static byte [ ] geometryToEsriShape ( Geometry geometry ) { if ( geometry == null ) throw new IllegalArgumentException ( ) ; OperatorExportToESRIShape op = ( OperatorExportToESRIShape ) factory . getOperator ( Operator . Type . ExportToESRIShape ) ; return op . execute ( 0 , geometry ) . array ( ) ; }
Exports geometry to the ESRI shape file format .
26,103
public static Geometry geometryFromWkt ( String wkt , int importFlags , Geometry . Type geometryType ) { OperatorImportFromWkt op = ( OperatorImportFromWkt ) factory . getOperator ( Operator . Type . ImportFromWkt ) ; return op . execute ( importFlags , geometryType , wkt , null ) ; }
Imports a geometry from a WKT string .
26,104
public static String geometryToWkt ( Geometry geometry , int exportFlags ) { OperatorExportToWkt op = ( OperatorExportToWkt ) factory . getOperator ( Operator . Type . ExportToWkt ) ; return op . execute ( exportFlags , geometry , null ) ; }
Exports a geometry to a string in WKT format .
26,105
public static Geometry union ( Geometry [ ] geometries , SpatialReference spatialReference ) { OperatorUnion op = ( OperatorUnion ) factory . getOperator ( Operator . Type . Union ) ; SimpleGeometryCursor inputGeometries = new SimpleGeometryCursor ( geometries ) ; GeometryCursor result = op . execute ( inputGeometries , spatialReference , null ) ; return result . next ( ) ; }
Constructs a new geometry by union an array of geometries . All inputs must be of the same type of geometries and share one spatial reference .
26,106
public static Geometry difference ( Geometry geometry1 , Geometry substractor , SpatialReference spatialReference ) { OperatorDifference op = ( OperatorDifference ) factory . getOperator ( Operator . Type . Difference ) ; Geometry result = op . execute ( geometry1 , substractor , spatialReference , null ) ; return result ; }
Creates the difference of two geometries . The dimension of geometry2 has to be equal to or greater than that of geometry1 .
26,107
public static Geometry symmetricDifference ( Geometry leftGeometry , Geometry rightGeometry , SpatialReference spatialReference ) { OperatorSymmetricDifference op = ( OperatorSymmetricDifference ) factory . getOperator ( Operator . Type . SymmetricDifference ) ; Geometry result = op . execute ( leftGeometry , rightGeometry , spatialReference , null ) ; return result ; }
Creates the symmetric difference of two geometries .
26,108
public static boolean disjoint ( Geometry geometry1 , Geometry geometry2 , SpatialReference spatialReference ) { OperatorDisjoint op = ( OperatorDisjoint ) factory . getOperator ( Operator . Type . Disjoint ) ; boolean result = op . execute ( geometry1 , geometry2 , spatialReference , null ) ; return result ; }
See OperatorDisjoint .
26,109
static Geometry [ ] intersect ( Geometry [ ] inputGeometries , Geometry geometry , SpatialReference spatialReference ) { OperatorIntersection op = ( OperatorIntersection ) factory . getOperator ( Operator . Type . Intersection ) ; SimpleGeometryCursor inputGeometriesCursor = new SimpleGeometryCursor ( inputGeometries ) ; SimpleGeometryCursor intersectorCursor = new SimpleGeometryCursor ( geometry ) ; GeometryCursor result = op . execute ( inputGeometriesCursor , intersectorCursor , spatialReference , null ) ; ArrayList < Geometry > resultGeoms = new ArrayList < Geometry > ( ) ; Geometry g ; while ( ( g = result . next ( ) ) != null ) { resultGeoms . add ( g ) ; } Geometry [ ] resultarr = resultGeoms . toArray ( new Geometry [ 0 ] ) ; return resultarr ; }
Constructs the set - theoretic intersection between an array of geometries and another geometry .
26,110
public static Geometry intersect ( Geometry geometry1 , Geometry intersector , SpatialReference spatialReference ) { OperatorIntersection op = ( OperatorIntersection ) factory . getOperator ( Operator . Type . Intersection ) ; Geometry result = op . execute ( geometry1 , intersector , spatialReference , null ) ; return result ; }
Creates a geometry through intersection between two geometries .
26,111
public static boolean within ( Geometry geometry1 , Geometry geometry2 , SpatialReference spatialReference ) { OperatorWithin op = ( OperatorWithin ) factory . getOperator ( Operator . Type . Within ) ; boolean result = op . execute ( geometry1 , geometry2 , spatialReference , null ) ; return result ; }
Indicates if one geometry is within another geometry .
26,112
public static boolean contains ( Geometry geometry1 , Geometry geometry2 , SpatialReference spatialReference ) { OperatorContains op = ( OperatorContains ) factory . getOperator ( Operator . Type . Contains ) ; boolean result = op . execute ( geometry1 , geometry2 , spatialReference , null ) ; return result ; }
Indicates if one geometry contains another geometry .
26,113
public static boolean crosses ( Geometry geometry1 , Geometry geometry2 , SpatialReference spatialReference ) { OperatorCrosses op = ( OperatorCrosses ) factory . getOperator ( Operator . Type . Crosses ) ; boolean result = op . execute ( geometry1 , geometry2 , spatialReference , null ) ; return result ; }
Indicates if one geometry crosses another geometry .
26,114
public static boolean touches ( Geometry geometry1 , Geometry geometry2 , SpatialReference spatialReference ) { OperatorTouches op = ( OperatorTouches ) factory . getOperator ( Operator . Type . Touches ) ; boolean result = op . execute ( geometry1 , geometry2 , spatialReference , null ) ; return result ; }
Indicates if one geometry touches another geometry .
26,115
public static boolean overlaps ( Geometry geometry1 , Geometry geometry2 , SpatialReference spatialReference ) { OperatorOverlaps op = ( OperatorOverlaps ) factory . getOperator ( Operator . Type . Overlaps ) ; boolean result = op . execute ( geometry1 , geometry2 , spatialReference , null ) ; return result ; }
Indicates if one geometry overlaps another geometry .
26,116
public static boolean relate ( Geometry geometry1 , Geometry geometry2 , SpatialReference spatialReference , String relation ) { OperatorRelate op = ( OperatorRelate ) factory . getOperator ( Operator . Type . Relate ) ; boolean result = op . execute ( geometry1 , geometry2 , spatialReference , relation , null ) ; return result ; }
Indicates if the given relation holds for the two geometries .
26,117
public static double distance ( Geometry geometry1 , Geometry geometry2 , SpatialReference spatialReference ) { OperatorDistance op = ( OperatorDistance ) factory . getOperator ( Operator . Type . Distance ) ; double result = op . execute ( geometry1 , geometry2 , null ) ; return result ; }
Calculates the 2D planar distance between two geometries .
26,118
public static Geometry clip ( Geometry geometry , Envelope envelope , SpatialReference spatialReference ) { OperatorClip op = ( OperatorClip ) factory . getOperator ( Operator . Type . Clip ) ; Geometry result = op . execute ( geometry , Envelope2D . construct ( envelope . getXMin ( ) , envelope . getYMin ( ) , envelope . getXMax ( ) , envelope . getYMax ( ) ) , spatialReference , null ) ; return result ; }
Calculates the clipped geometry from a target geometry using an envelope .
26,119
public static Geometry [ ] cut ( Geometry cuttee , Polyline cutter , SpatialReference spatialReference ) { if ( cuttee == null || cutter == null ) return null ; OperatorCut op = ( OperatorCut ) factory . getOperator ( Operator . Type . Cut ) ; GeometryCursor cursor = op . execute ( true , cuttee , cutter , spatialReference , null ) ; ArrayList < Geometry > cutsList = new ArrayList < Geometry > ( ) ; Geometry geometry ; while ( ( geometry = cursor . next ( ) ) != null ) { if ( ! geometry . isEmpty ( ) ) { cutsList . add ( geometry ) ; } } return cutsList . toArray ( new Geometry [ 0 ] ) ; }
Calculates the cut geometry from a target geometry using a polyline . For Polylines all left cuts will be grouped together in the first Geometry Right cuts and coincident cuts are grouped in the second Geometry and each undefined cut along with any uncut parts are output as separate Polylines . For Polygons all left cuts are grouped in the first Polygon all right cuts are in the second Polygon and each undefined cut along with any left - over parts after cutting are output as a separate Polygon . If there were no cuts then the array will be empty . An undefined cut will only be produced if a left cut or right cut was produced and there was a part left over after cutting or a cut is bounded to the left and right of the cutter .
26,120
public static Polygon [ ] buffer ( Geometry [ ] geometries , SpatialReference spatialReference , double [ ] distances , boolean toUnionResults ) { double [ ] bufferDistances = distances ; OperatorBuffer op = ( OperatorBuffer ) factory . getOperator ( Operator . Type . Buffer ) ; if ( toUnionResults ) { SimpleGeometryCursor inputGeometriesCursor = new SimpleGeometryCursor ( geometries ) ; GeometryCursor result = op . execute ( inputGeometriesCursor , spatialReference , bufferDistances , toUnionResults , null ) ; ArrayList < Polygon > resultGeoms = new ArrayList < Polygon > ( ) ; Geometry g ; while ( ( g = result . next ( ) ) != null ) { resultGeoms . add ( ( Polygon ) g ) ; } Polygon [ ] buffers = resultGeoms . toArray ( new Polygon [ 0 ] ) ; return buffers ; } else { Polygon [ ] buffers = new Polygon [ geometries . length ] ; for ( int i = 0 ; i < geometries . length ; i ++ ) { buffers [ i ] = ( Polygon ) op . execute ( geometries [ i ] , spatialReference , bufferDistances [ i ] , null ) ; } return buffers ; } }
Calculates a buffer polygon for each geometry at each of the corresponding specified distances . It is assumed that all geometries have the same spatial reference . There is an option to union the returned geometries .
26,121
public static Polygon buffer ( Geometry geometry , SpatialReference spatialReference , double distance ) { double bufferDistance = distance ; OperatorBuffer op = ( OperatorBuffer ) factory . getOperator ( Operator . Type . Buffer ) ; Geometry result = op . execute ( geometry , spatialReference , bufferDistance , null ) ; return ( Polygon ) result ; }
Calculates a buffer polygon of the geometry as specified by the distance input . The buffer is implemented in the xy - plane .
26,122
public static Geometry convexHull ( Geometry geometry ) { OperatorConvexHull op = ( OperatorConvexHull ) factory . getOperator ( Operator . Type . ConvexHull ) ; return op . execute ( geometry , null ) ; }
Calculates the convex hull geometry .
26,123
public static Geometry [ ] convexHull ( Geometry [ ] geometries , boolean b_merge ) { OperatorConvexHull op = ( OperatorConvexHull ) factory . getOperator ( Operator . Type . ConvexHull ) ; SimpleGeometryCursor simple_cursor = new SimpleGeometryCursor ( geometries ) ; GeometryCursor cursor = op . execute ( simple_cursor , b_merge , null ) ; ArrayList < Geometry > resultGeoms = new ArrayList < Geometry > ( ) ; Geometry g ; while ( ( g = cursor . next ( ) ) != null ) { resultGeoms . add ( g ) ; } Geometry [ ] output = new Geometry [ resultGeoms . size ( ) ] ; for ( int i = 0 ; i < resultGeoms . size ( ) ; i ++ ) output [ i ] = resultGeoms . get ( i ) ; return output ; }
Calculates the convex hull .
26,124
public static Proximity2DResult getNearestCoordinate ( Geometry geometry , Point inputPoint , boolean bTestPolygonInterior ) { OperatorProximity2D proximity = ( OperatorProximity2D ) factory . getOperator ( com . esri . core . geometry . Operator . Type . Proximity2D ) ; Proximity2DResult result = proximity . getNearestCoordinate ( geometry , inputPoint , bTestPolygonInterior ) ; return result ; }
Finds the coordinate of the geometry which is closest to the specified point .
26,125
public static Proximity2DResult [ ] getNearestVertices ( Geometry geometry , Point inputPoint , double searchRadius , int maxVertexCountToReturn ) { OperatorProximity2D proximity = ( OperatorProximity2D ) factory . getOperator ( com . esri . core . geometry . Operator . Type . Proximity2D ) ; Proximity2DResult [ ] results = proximity . getNearestVertices ( geometry , inputPoint , searchRadius , maxVertexCountToReturn ) ; return results ; }
Finds all vertices in the given distance from the specified point sorted from the closest to the furthest .
26,126
public static Geometry simplify ( Geometry geometry , SpatialReference spatialReference ) { OperatorSimplify op = ( OperatorSimplify ) factory . getOperator ( Operator . Type . Simplify ) ; Geometry result = op . execute ( geometry , spatialReference , false , null ) ; return result ; }
Performs the simplify operation on the geometry .
26,127
static boolean isSimple ( Geometry geometry , SpatialReference spatialReference ) { OperatorSimplify op = ( OperatorSimplify ) factory . getOperator ( Operator . Type . Simplify ) ; boolean result = op . isSimpleAsFeature ( geometry , spatialReference , null ) ; return result ; }
Checks if the Geometry is simple .
26,128
public void setRightSide ( boolean bRight ) { if ( bRight ) m_info |= ( int ) OperatorProximity2D . ProxResultInfo . rightSide ; else m_info &= ~ ( int ) OperatorProximity2D . ProxResultInfo . rightSide ; }
Sets the right_side info to true or false .
26,129
public Segment nextSegment ( ) { if ( m_currentSegmentIndex != m_nextSegmentIndex ) _updateSegment ( ) ; if ( m_bCirculator ) { m_nextSegmentIndex = ( m_nextSegmentIndex + 1 ) % m_segmentCount ; } else { if ( m_nextSegmentIndex == m_segmentCount ) throw new IndexOutOfBoundsException ( ) ; m_nextSegmentIndex ++ ; } return m_currentSegment ; }
Moves the iterator to next segment and returns the segment .
26,130
public void resetToPath ( int pathIndex ) { if ( pathIndex < 0 ) throw new IndexOutOfBoundsException ( ) ; m_nextPathIndex = pathIndex ; m_currentPathIndex = - 1 ; m_currentSegmentIndex = - 1 ; m_nextSegmentIndex = - 1 ; m_segmentCount = - 1 ; m_pathBegin = - 1 ; }
Resets the iterator such that the subsequent call to the NextPath will set the iterator to the first segment of the given path . The call to PreviousPath will reset the iterator to the last segment of path pathIndex - 1 .
26,131
public double execute ( Geometry geom1 , Geometry geom2 , ProgressTracker progressTracker ) { if ( null == geom1 || null == geom2 ) { throw new IllegalArgumentException ( ) ; } Geometry geometryA = geom1 ; Geometry geometryB = geom2 ; if ( geometryA . isEmpty ( ) || geometryB . isEmpty ( ) ) return NumberUtils . TheNaN ; Polygon polygonA ; Polygon polygonB ; MultiPoint multiPointA ; MultiPoint multiPointB ; Geometry . Type gtA = geometryA . getType ( ) ; Geometry . Type gtB = geometryB . getType ( ) ; if ( gtA == Geometry . Type . Point ) { if ( gtB == Geometry . Type . Point ) { return Point2D . distance ( ( ( Point ) geometryA ) . getXY ( ) , ( ( Point ) geometryB ) . getXY ( ) ) ; } else if ( gtB == Geometry . Type . Envelope ) { Envelope2D envB = new Envelope2D ( ) ; geometryB . queryEnvelope2D ( envB ) ; return envB . distance ( ( ( Point ) geometryA ) . getXY ( ) ) ; } multiPointA = new MultiPoint ( ) ; multiPointA . add ( ( Point ) geometryA ) ; geometryA = multiPointA ; } else if ( gtA == Geometry . Type . Envelope ) { if ( gtB == Geometry . Type . Envelope ) { Envelope2D envA = new Envelope2D ( ) ; geometryA . queryEnvelope2D ( envA ) ; Envelope2D envB = new Envelope2D ( ) ; geometryB . queryEnvelope2D ( envB ) ; return envB . distance ( envA ) ; } polygonA = new Polygon ( ) ; polygonA . addEnvelope ( ( Envelope ) geometryA , false ) ; geometryA = polygonA ; } if ( gtB == Geometry . Type . Point ) { multiPointB = new MultiPoint ( ) ; multiPointB . add ( ( Point ) geometryB ) ; geometryB = multiPointB ; } else if ( gtB == Geometry . Type . Envelope ) { polygonB = new Polygon ( ) ; polygonB . addEnvelope ( ( Envelope ) geometryB , false ) ; geometryB = polygonB ; } DistanceCalculator distanceCalculator = new DistanceCalculator ( progressTracker ) ; double distance = distanceCalculator . calculate ( geometryA , geometryB ) ; return distance ; }
Performs the Distance operation on two geometries
26,132
static int hash ( int n ) { int hash = 5381 ; hash = ( ( hash << 5 ) + hash ) + ( n & 0xFF ) ; hash = ( ( hash << 5 ) + hash ) + ( ( n >> 8 ) & 0xFF ) ; hash = ( ( hash << 5 ) + hash ) + ( ( n >> 16 ) & 0xFF ) ; hash = ( ( hash << 5 ) + hash ) + ( ( n >> 24 ) & 0xFF ) ; hash &= 0x7FFFFFFF ; return hash ; }
makes a hash out of an int
26,133
static int hash ( int hashIn , int n ) { int hash = ( ( hashIn << 5 ) + hashIn ) + ( n & 0xFF ) ; hash = ( ( hash << 5 ) + hash ) + ( ( n >> 8 ) & 0xFF ) ; hash = ( ( hash << 5 ) + hash ) + ( ( n >> 16 ) & 0xFF ) ; hash = ( ( hash << 5 ) + hash ) + ( ( n >> 24 ) & 0xFF ) ; hash &= 0x7FFFFFFF ; return hash ; }
adds an int to a hash value
26,134
public void add ( double x , double y ) { resize ( m_pointCount + 1 ) ; Point2D pt = new Point2D ( ) ; pt . setCoords ( x , y ) ; setXY ( m_pointCount - 1 , pt ) ; }
Adds a Point to this MultiPoint with given x y coordinates .
26,135
public void add ( double x , double y , double z ) { resize ( m_pointCount + 1 ) ; Point3D pt = new Point3D ( ) ; pt . setCoords ( x , y , z ) ; setXYZ ( m_pointCount - 1 , pt ) ; }
Adds a Point to this MultiPoint with given x y z coordinates .
26,136
public void add ( MultiVertexGeometryImpl src , int beginIndex , int endIndex ) { int endIndexC = endIndex < 0 ? src . getPointCount ( ) : endIndex ; if ( beginIndex < 0 || beginIndex > src . getPointCount ( ) || endIndexC < beginIndex ) throw new IllegalArgumentException ( ) ; if ( beginIndex == endIndexC ) return ; mergeVertexDescription ( src . getDescription ( ) ) ; int count = endIndexC - beginIndex ; int oldPointCount = m_pointCount ; resize ( m_pointCount + count ) ; _verifyAllStreams ( ) ; for ( int iattrib = 0 , nattrib = src . getDescription ( ) . getAttributeCount ( ) ; iattrib < nattrib ; iattrib ++ ) { int semantics = src . getDescription ( ) . _getSemanticsImpl ( iattrib ) ; int ncomps = VertexDescription . getComponentCount ( semantics ) ; AttributeStreamBase stream = getAttributeStreamRef ( semantics ) ; AttributeStreamBase srcStream = src . getAttributeStreamRef ( semantics ) ; stream . insertRange ( oldPointCount * ncomps , srcStream , beginIndex * ncomps , count * ncomps , true , 1 , oldPointCount * ncomps ) ; } }
Appends points from another MultiVertexGeometryImpl at the end of this one .
26,137
public static RasterizedGeometry2D create ( Geometry geom , double toleranceXY , int rasterSizeBytes ) { if ( ! canUseAccelerator ( geom ) ) throw new IllegalArgumentException ( ) ; RasterizedGeometry2DImpl gc = RasterizedGeometry2DImpl . createImpl ( geom , toleranceXY , rasterSizeBytes ) ; return ( RasterizedGeometry2D ) gc ; }
Creates a rasterized geometry from a given Geometry .
26,138
public int pushSegment ( Segment seg ) { assert ( m_input_segments . size ( ) < 2 ) ; m_input_segments . add ( newIntersectionPart_ ( seg ) ) ; return ( int ) m_input_segments . size ( ) - 1 ; }
Two segments has to be pushed for the intersect method to succeed .
26,139
int createList ( int listData ) { int list = newList_ ( ) ; m_lists . setField ( list , 3 , m_list_of_lists ) ; m_lists . setField ( list , 4 , 0 ) ; m_lists . setField ( list , 5 , listData ) ; if ( m_list_of_lists != nullNode ( ) ) setPrevList_ ( m_list_of_lists , list ) ; m_list_of_lists = list ; return list ; }
listData is user s info associated with the list
26,140
int deleteList ( int list ) { clear ( list ) ; int prevList = m_lists . getField ( list , 2 ) ; int nextList = m_lists . getField ( list , 3 ) ; if ( prevList != nullNode ( ) ) setNextList_ ( prevList , nextList ) ; else m_list_of_lists = nextList ; if ( nextList != nullNode ( ) ) setPrevList_ ( nextList , prevList ) ; freeList_ ( list ) ; return nextList ; }
Deletes a list and returns the index of the next list .
26,141
int insertElement ( int list , int beforeNode , int data ) { int node = newNode_ ( ) ; int prev = - 1 ; if ( beforeNode != nullNode ( ) ) { prev = getPrev ( beforeNode ) ; setPrev_ ( beforeNode , node ) ; } setNext_ ( node , beforeNode ) ; if ( prev != nullNode ( ) ) setNext_ ( prev , node ) ; int head = m_lists . getField ( list , 0 ) ; if ( beforeNode == head ) m_lists . setField ( list , 0 , node ) ; if ( beforeNode == nullNode ( ) ) { int tail = m_lists . getField ( list , 1 ) ; setPrev_ ( node , tail ) ; if ( tail != - 1 ) setNext_ ( tail , node ) ; m_lists . setField ( list , 1 , node ) ; } setData ( node , data ) ; setListSize_ ( list , getListSize ( list ) + 1 ) ; if ( m_b_store_list_index_with_node ) setList_ ( node , list ) ; return node ; }
Inserts a new node before the given one .
26,142
int deleteElement ( int list , int node ) { int prev = getPrev ( node ) ; int next = getNext ( node ) ; if ( prev != nullNode ( ) ) setNext_ ( prev , next ) ; else m_lists . setField ( list , 0 , next ) ; if ( next != nullNode ( ) ) setPrev_ ( next , prev ) ; else m_lists . setField ( list , 1 , prev ) ; freeNode_ ( node ) ; setListSize_ ( list , getListSize ( list ) - 1 ) ; return next ; }
Deletes a node from a list . Returns the next node after the deleted one .
26,143
void clear ( int list ) { int last = getLast ( list ) ; while ( last != nullNode ( ) ) { int n = last ; last = getPrev ( n ) ; freeNode_ ( n ) ; } m_lists . setField ( list , 0 , - 1 ) ; m_lists . setField ( list , 1 , - 1 ) ; setListSize_ ( list , 0 ) ; }
Clears all nodes from the list .
26,144
public void setZero ( ) { xx = 0.0 ; yx = 0.0 ; zx = 0.0 ; xy = 0.0 ; yy = 0.0 ; zy = 0.0 ; xz = 0.0 ; yz = 0.0 ; zz = 0.0 ; xd = 0.0 ; yd = 0.0 ; zd = 0.0 ; }
Sets all elements to 0 thus producing and invalid transformation .
26,145
public Envelope3D transform ( Envelope3D env ) { if ( env . isEmpty ( ) ) return env ; Point3D [ ] buf = new Point3D [ 8 ] ; env . queryCorners ( buf ) ; transform ( buf , 8 , buf ) ; env . setFromPoints ( buf ) ; return env ; }
Transforms an envelope . The result is the bounding box of the transformed envelope .
26,146
public static void inverse ( Transformation3D src , Transformation3D result ) { double det = src . xx * ( src . yy * src . zz - src . zy * src . yz ) - src . yx * ( src . xy * src . zz - src . zy * src . xz ) + src . zx * ( src . xy * src . yz - src . yy * src . xz ) ; if ( det != 0 ) { double xx , yx , zx ; double xy , yy , zy ; double xz , yz , zz ; double xd , yd , zd ; double det_1 = 1.0 / det ; xx = ( src . yy * src . zz - src . zy * src . yz ) * det_1 ; xy = - ( src . xy * src . zz - src . zy * src . xz ) * det_1 ; xz = ( src . xy * src . yz - src . yy * src . xz ) * det_1 ; yx = - ( src . yx * src . zz - src . yz * src . zx ) * det_1 ; yy = ( src . xx * src . zz - src . zx * src . xz ) * det_1 ; yz = - ( src . xx * src . yz - src . yx * src . xz ) * det_1 ; zx = ( src . yx * src . zy - src . zx * src . yy ) * det_1 ; zy = - ( src . xx * src . zy - src . zx * src . xy ) * det_1 ; zz = ( src . xx * src . yy - src . yx * src . xy ) * det_1 ; xd = - ( src . xd * xx + src . yd * xy + src . zd * xz ) ; yd = - ( src . xd * yx + src . yd * yy + src . zd * yz ) ; zd = - ( src . xd * zx + src . yd * zy + src . zd * zz ) ; result . xx = xx ; result . yx = yx ; result . zx = zx ; result . xy = xy ; result . yy = yy ; result . zy = zy ; result . xz = xz ; result . yz = yz ; result . zz = zz ; result . xd = xd ; result . yd = yd ; result . zd = zd ; } else { throw new GeometryException ( "math singularity" ) ; } }
Calculates the Inverse transformation .
26,147
private static boolean relationCompare_ ( int [ ] matrix , String scl ) { for ( int i = 0 ; i < 9 ; i ++ ) { switch ( scl . charAt ( i ) ) { case 'T' : assert ( matrix [ i ] != - 2 ) ; if ( matrix [ i ] == - 1 ) return false ; break ; case 'F' : assert ( matrix [ i ] != - 2 ) ; if ( matrix [ i ] != - 1 ) return false ; break ; case '0' : assert ( matrix [ i ] != - 2 ) ; if ( matrix [ i ] != 0 ) return false ; break ; case '1' : assert ( matrix [ i ] != - 2 ) ; if ( matrix [ i ] != 1 ) return false ; break ; case '2' : assert ( matrix [ i ] != - 2 ) ; if ( matrix [ i ] != 2 ) return false ; break ; default : break ; } } return true ; }
Compares the DE - 9I matrix against the scl string .
26,148
private static int getPredefinedRelation_ ( String scl , int dim_a , int dim_b ) { if ( equals_ ( scl ) ) return RelationalOperations . Relation . equals ; if ( disjoint_ ( scl ) ) return RelationalOperations . Relation . disjoint ; if ( touches_ ( scl , dim_a , dim_b ) ) return RelationalOperations . Relation . touches ; if ( crosses_ ( scl , dim_a , dim_b ) ) return RelationalOperations . Relation . crosses ; if ( contains_ ( scl ) ) return RelationalOperations . Relation . contains ; if ( overlaps_ ( scl , dim_a , dim_b ) ) return RelationalOperations . Relation . overlaps ; return RelationalOperations . Relation . unknown ; }
Checks whether scl string is a predefined relation .
26,149
private static boolean equals_ ( String scl ) { if ( scl . charAt ( 0 ) == 'T' && scl . charAt ( 1 ) == '*' && scl . charAt ( 2 ) == 'F' && scl . charAt ( 3 ) == '*' && scl . charAt ( 4 ) == '*' && scl . charAt ( 5 ) == 'F' && scl . charAt ( 6 ) == 'F' && scl . charAt ( 7 ) == 'F' && scl . charAt ( 8 ) == '*' ) return true ; return false ; }
Checks whether the scl string is the equals relation .
26,150
private static boolean disjoint_ ( String scl ) { if ( scl . charAt ( 0 ) == 'F' && scl . charAt ( 1 ) == 'F' && scl . charAt ( 2 ) == '*' && scl . charAt ( 3 ) == 'F' && scl . charAt ( 4 ) == 'F' && scl . charAt ( 5 ) == '*' && scl . charAt ( 6 ) == '*' && scl . charAt ( 7 ) == '*' && scl . charAt ( 8 ) == '*' ) return true ; return false ; }
Checks whether the scl string is the disjoint relation .
26,151
private static boolean touches_ ( String scl , int dim_a , int dim_b ) { if ( dim_a == 0 && dim_b == 0 ) return false ; if ( ! ( dim_a == 2 && dim_b == 2 ) ) { if ( scl . charAt ( 0 ) == 'F' && scl . charAt ( 1 ) == '*' && scl . charAt ( 2 ) == '*' && scl . charAt ( 3 ) == 'T' && scl . charAt ( 4 ) == '*' && scl . charAt ( 5 ) == '*' && scl . charAt ( 6 ) == '*' && scl . charAt ( 7 ) == '*' && scl . charAt ( 8 ) == '*' ) return true ; if ( dim_a == 1 && dim_b == 1 ) { if ( scl . charAt ( 0 ) == 'F' && scl . charAt ( 1 ) == 'T' && scl . charAt ( 2 ) == '*' && scl . charAt ( 3 ) == '*' && scl . charAt ( 4 ) == '*' && scl . charAt ( 5 ) == '*' && scl . charAt ( 6 ) == '*' && scl . charAt ( 7 ) == '*' && scl . charAt ( 8 ) == '*' ) return true ; } } if ( dim_b != 0 ) { if ( scl . charAt ( 0 ) == 'F' && scl . charAt ( 1 ) == '*' && scl . charAt ( 2 ) == '*' && scl . charAt ( 3 ) == '*' && scl . charAt ( 4 ) == 'T' && scl . charAt ( 5 ) == '*' && scl . charAt ( 6 ) == '*' && scl . charAt ( 7 ) == '*' && scl . charAt ( 8 ) == '*' ) return true ; } return false ; }
Checks whether the scl string is the touches relation .
26,152
private static boolean crosses_ ( String scl , int dim_a , int dim_b ) { if ( dim_a > dim_b ) { if ( scl . charAt ( 0 ) == 'T' && scl . charAt ( 1 ) == '*' && scl . charAt ( 2 ) == '*' && scl . charAt ( 3 ) == '*' && scl . charAt ( 4 ) == '*' && scl . charAt ( 5 ) == '*' && scl . charAt ( 6 ) == 'T' && scl . charAt ( 7 ) == '*' && scl . charAt ( 8 ) == '*' ) return true ; return false ; } if ( dim_a == 1 && dim_b == 1 ) { if ( scl . charAt ( 0 ) == '0' && scl . charAt ( 1 ) == '*' && scl . charAt ( 2 ) == '*' && scl . charAt ( 3 ) == '*' && scl . charAt ( 4 ) == '*' && scl . charAt ( 5 ) == '*' && scl . charAt ( 6 ) == '*' && scl . charAt ( 7 ) == '*' && scl . charAt ( 8 ) == '*' ) return true ; } return false ; }
Checks whether the scl string is the crosses relation .
26,153
private static boolean contains_ ( String scl ) { if ( scl . charAt ( 0 ) == 'T' && scl . charAt ( 1 ) == '*' && scl . charAt ( 2 ) == '*' && scl . charAt ( 3 ) == '*' && scl . charAt ( 4 ) == '*' && scl . charAt ( 5 ) == '*' && scl . charAt ( 6 ) == 'F' && scl . charAt ( 7 ) == 'F' && scl . charAt ( 8 ) == '*' ) return true ; return false ; }
Checks whether the scl string is the contains relation .
26,154
private static boolean overlaps_ ( String scl , int dim_a , int dim_b ) { if ( dim_a == dim_b ) { if ( dim_a != 1 ) { if ( scl . charAt ( 0 ) == 'T' && scl . charAt ( 1 ) == '*' && scl . charAt ( 2 ) == 'T' && scl . charAt ( 3 ) == '*' && scl . charAt ( 4 ) == '*' && scl . charAt ( 5 ) == '*' && scl . charAt ( 6 ) == 'T' && scl . charAt ( 7 ) == '*' && scl . charAt ( 8 ) == '*' ) return true ; return false ; } if ( scl . charAt ( 0 ) == '1' && scl . charAt ( 1 ) == '*' && scl . charAt ( 2 ) == 'T' && scl . charAt ( 3 ) == '*' && scl . charAt ( 4 ) == '*' && scl . charAt ( 5 ) == '*' && scl . charAt ( 6 ) == 'T' && scl . charAt ( 7 ) == '*' && scl . charAt ( 8 ) == '*' ) return true ; } return false ; }
Checks whether the scl string is the overlaps relation .
26,155
private void setPredicates_ ( String scl ) { m_scl = scl ; for ( int i = 0 ; i < 9 ; i ++ ) { if ( m_scl . charAt ( i ) != '*' ) { m_perform_predicates [ i ] = true ; m_predicate_count ++ ; } else m_perform_predicates [ i ] = false ; } }
Sets the relation predicates from the scl string .
26,156
private void setRemainingPredicatesToFalse_ ( ) { for ( int i = 0 ; i < 9 ; i ++ ) { if ( m_perform_predicates [ i ] && m_matrix [ i ] == - 2 ) { m_matrix [ i ] = - 1 ; m_perform_predicates [ i ] = false ; } } }
Sets the remaining predicates to false
26,157
private boolean isPredicateKnown_ ( int predicate ) { assert ( m_scl . charAt ( predicate ) != '*' ) ; if ( m_matrix [ predicate ] == - 2 ) return false ; if ( m_matrix [ predicate ] == - 1 ) { m_perform_predicates [ predicate ] = false ; m_predicate_count -- ; return true ; } if ( m_scl . charAt ( predicate ) != 'T' && m_scl . charAt ( predicate ) != 'F' ) { if ( m_matrix [ predicate ] < m_max_dim [ predicate ] ) { return false ; } else { m_perform_predicates [ predicate ] = false ; m_predicate_count -- ; return true ; } } else { m_perform_predicates [ predicate ] = false ; m_predicate_count -- ; return true ; } }
Checks whether the predicate is known .
26,158
private void setAreaAreaPredicates_ ( ) { m_predicates_half_edge = Predicates . AreaAreaPredicates ; m_max_dim [ MatrixPredicate . InteriorInterior ] = 2 ; m_max_dim [ MatrixPredicate . InteriorBoundary ] = 1 ; m_max_dim [ MatrixPredicate . InteriorExterior ] = 2 ; m_max_dim [ MatrixPredicate . BoundaryInterior ] = 1 ; m_max_dim [ MatrixPredicate . BoundaryBoundary ] = 1 ; m_max_dim [ MatrixPredicate . BoundaryExterior ] = 1 ; m_max_dim [ MatrixPredicate . ExteriorInterior ] = 2 ; m_max_dim [ MatrixPredicate . ExteriorBoundary ] = 1 ; m_max_dim [ MatrixPredicate . ExteriorExterior ] = 2 ; if ( m_perform_predicates [ MatrixPredicate . ExteriorExterior ] ) { m_matrix [ MatrixPredicate . ExteriorExterior ] = 2 ; m_perform_predicates [ MatrixPredicate . ExteriorExterior ] = false ; m_predicate_count -- ; } }
Sets the area - area predicates function .
26,159
private void setAreaLinePredicates_ ( ) { m_predicates_half_edge = Predicates . AreaLinePredicates ; m_predicates_cluster = Predicates . AreaPointPredicates ; m_max_dim [ MatrixPredicate . InteriorInterior ] = 1 ; m_max_dim [ MatrixPredicate . InteriorBoundary ] = 0 ; m_max_dim [ MatrixPredicate . InteriorExterior ] = 2 ; m_max_dim [ MatrixPredicate . BoundaryInterior ] = 1 ; m_max_dim [ MatrixPredicate . BoundaryBoundary ] = 0 ; m_max_dim [ MatrixPredicate . BoundaryExterior ] = 1 ; m_max_dim [ MatrixPredicate . ExteriorInterior ] = 1 ; m_max_dim [ MatrixPredicate . ExteriorBoundary ] = 0 ; m_max_dim [ MatrixPredicate . ExteriorExterior ] = 2 ; if ( m_perform_predicates [ MatrixPredicate . ExteriorExterior ] ) { m_matrix [ MatrixPredicate . ExteriorExterior ] = 2 ; m_perform_predicates [ MatrixPredicate . ExteriorExterior ] = false ; m_predicate_count -- ; } }
Sets the area - line predicate function .
26,160
private void setLineLinePredicates_ ( ) { m_predicates_half_edge = Predicates . LineLinePredicates ; m_predicates_cluster = Predicates . LinePointPredicates ; m_max_dim [ MatrixPredicate . InteriorInterior ] = 1 ; m_max_dim [ MatrixPredicate . InteriorBoundary ] = 0 ; m_max_dim [ MatrixPredicate . InteriorExterior ] = 1 ; m_max_dim [ MatrixPredicate . BoundaryInterior ] = 0 ; m_max_dim [ MatrixPredicate . BoundaryBoundary ] = 0 ; m_max_dim [ MatrixPredicate . BoundaryExterior ] = 0 ; m_max_dim [ MatrixPredicate . ExteriorInterior ] = 1 ; m_max_dim [ MatrixPredicate . ExteriorBoundary ] = 0 ; m_max_dim [ MatrixPredicate . ExteriorExterior ] = 2 ; if ( m_perform_predicates [ MatrixPredicate . ExteriorExterior ] ) { m_matrix [ MatrixPredicate . ExteriorExterior ] = 2 ; m_perform_predicates [ MatrixPredicate . ExteriorExterior ] = false ; m_predicate_count -- ; } }
Sets the line - line predicates function .
26,161
private void setAreaPointPredicates_ ( ) { m_predicates_cluster = Predicates . AreaPointPredicates ; m_max_dim [ MatrixPredicate . InteriorInterior ] = 0 ; m_max_dim [ MatrixPredicate . InteriorBoundary ] = - 1 ; m_max_dim [ MatrixPredicate . InteriorExterior ] = 2 ; m_max_dim [ MatrixPredicate . BoundaryInterior ] = 0 ; m_max_dim [ MatrixPredicate . BoundaryBoundary ] = - 1 ; m_max_dim [ MatrixPredicate . BoundaryExterior ] = 1 ; m_max_dim [ MatrixPredicate . ExteriorInterior ] = 0 ; m_max_dim [ MatrixPredicate . ExteriorBoundary ] = - 1 ; m_max_dim [ MatrixPredicate . ExteriorExterior ] = 2 ; if ( m_perform_predicates [ MatrixPredicate . InteriorBoundary ] ) { m_matrix [ MatrixPredicate . InteriorBoundary ] = - 1 ; m_perform_predicates [ MatrixPredicate . InteriorBoundary ] = false ; m_predicate_count -- ; } if ( m_perform_predicates [ MatrixPredicate . BoundaryBoundary ] ) { m_matrix [ MatrixPredicate . BoundaryBoundary ] = - 1 ; m_perform_predicates [ MatrixPredicate . BoundaryBoundary ] = false ; m_predicate_count -- ; } if ( m_perform_predicates [ MatrixPredicate . ExteriorBoundary ] ) { m_matrix [ MatrixPredicate . ExteriorBoundary ] = - 1 ; m_perform_predicates [ MatrixPredicate . ExteriorBoundary ] = false ; m_predicate_count -- ; } if ( m_perform_predicates [ MatrixPredicate . ExteriorExterior ] ) { m_matrix [ MatrixPredicate . ExteriorExterior ] = 2 ; m_perform_predicates [ MatrixPredicate . ExteriorExterior ] = false ; m_predicate_count -- ; } }
Sets the area - point predicate function .
26,162
private boolean areaAreaPredicates_ ( int half_edge , int id_a , int id_b ) { boolean bRelationKnown = true ; if ( m_perform_predicates [ MatrixPredicate . InteriorInterior ] ) { interiorAreaInteriorArea_ ( half_edge , id_a , id_b ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . InteriorInterior ) ; } if ( m_perform_predicates [ MatrixPredicate . InteriorBoundary ] ) { interiorAreaBoundaryArea_ ( half_edge , id_a , MatrixPredicate . InteriorBoundary ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . InteriorBoundary ) ; } if ( m_perform_predicates [ MatrixPredicate . InteriorExterior ] ) { interiorAreaExteriorArea_ ( half_edge , id_a , id_b , MatrixPredicate . InteriorExterior ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . InteriorExterior ) ; } if ( m_perform_predicates [ MatrixPredicate . BoundaryInterior ] ) { interiorAreaBoundaryArea_ ( half_edge , id_b , MatrixPredicate . BoundaryInterior ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . BoundaryInterior ) ; } if ( m_perform_predicates [ MatrixPredicate . BoundaryBoundary ] ) { boundaryAreaBoundaryArea_ ( half_edge , id_a , id_b ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . BoundaryBoundary ) ; } if ( m_perform_predicates [ MatrixPredicate . BoundaryExterior ] ) { boundaryAreaExteriorArea_ ( half_edge , id_a , id_b , MatrixPredicate . BoundaryExterior ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . BoundaryExterior ) ; } if ( m_perform_predicates [ MatrixPredicate . ExteriorInterior ] ) { interiorAreaExteriorArea_ ( half_edge , id_b , id_a , MatrixPredicate . ExteriorInterior ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . ExteriorInterior ) ; } if ( m_perform_predicates [ MatrixPredicate . ExteriorBoundary ] ) { boundaryAreaExteriorArea_ ( half_edge , id_b , id_a , MatrixPredicate . ExteriorBoundary ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . ExteriorBoundary ) ; } return bRelationKnown ; }
Invokes the 9 relational predicates of area vs area .
26,163
private boolean areaLinePredicates_ ( int half_edge , int id_a , int id_b ) { boolean bRelationKnown = true ; if ( m_perform_predicates [ MatrixPredicate . InteriorInterior ] ) { interiorAreaInteriorLine_ ( half_edge , id_a , id_b ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . InteriorInterior ) ; } if ( m_perform_predicates [ MatrixPredicate . InteriorBoundary ] ) { interiorAreaBoundaryLine_ ( half_edge , id_a , id_b , m_cluster_index_b ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . InteriorBoundary ) ; } if ( m_perform_predicates [ MatrixPredicate . InteriorExterior ] ) { interiorAreaExteriorLine_ ( half_edge , id_a , id_b ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . InteriorExterior ) ; } if ( m_perform_predicates [ MatrixPredicate . BoundaryInterior ] ) { boundaryAreaInteriorLine_ ( half_edge , id_a , id_b , m_cluster_index_b ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . BoundaryInterior ) ; } if ( m_perform_predicates [ MatrixPredicate . BoundaryBoundary ] ) { boundaryAreaBoundaryLine_ ( half_edge , id_a , id_b , m_cluster_index_b ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . BoundaryBoundary ) ; } if ( m_perform_predicates [ MatrixPredicate . BoundaryExterior ] ) { boundaryAreaExteriorLine_ ( half_edge , id_a , id_b ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . BoundaryExterior ) ; } if ( m_perform_predicates [ MatrixPredicate . ExteriorInterior ] ) { exteriorAreaInteriorLine_ ( half_edge , id_a ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . ExteriorInterior ) ; } if ( m_perform_predicates [ MatrixPredicate . ExteriorBoundary ] ) { exteriorAreaBoundaryLine_ ( half_edge , id_a , id_b , m_cluster_index_b ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . ExteriorBoundary ) ; } return bRelationKnown ; }
Invokes the 9 relational predicates of area vs Line .
26,164
private boolean lineLinePredicates_ ( int half_edge , int id_a , int id_b ) { boolean bRelationKnown = true ; if ( m_perform_predicates [ MatrixPredicate . InteriorInterior ] ) { interiorLineInteriorLine_ ( half_edge , id_a , id_b , m_cluster_index_a , m_cluster_index_b ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . InteriorInterior ) ; } if ( m_perform_predicates [ MatrixPredicate . InteriorBoundary ] ) { interiorLineBoundaryLine_ ( half_edge , id_a , id_b , m_cluster_index_a , m_cluster_index_b , MatrixPredicate . InteriorBoundary ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . InteriorBoundary ) ; } if ( m_perform_predicates [ MatrixPredicate . InteriorExterior ] ) { interiorLineExteriorLine_ ( half_edge , id_a , id_b , MatrixPredicate . InteriorExterior ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . InteriorExterior ) ; } if ( m_perform_predicates [ MatrixPredicate . BoundaryInterior ] ) { interiorLineBoundaryLine_ ( half_edge , id_b , id_a , m_cluster_index_b , m_cluster_index_a , MatrixPredicate . BoundaryInterior ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . BoundaryInterior ) ; } if ( m_perform_predicates [ MatrixPredicate . BoundaryBoundary ] ) { boundaryLineBoundaryLine_ ( half_edge , id_a , id_b , m_cluster_index_a , m_cluster_index_b ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . BoundaryBoundary ) ; } if ( m_perform_predicates [ MatrixPredicate . BoundaryExterior ] ) { boundaryLineExteriorLine_ ( half_edge , id_a , id_b , m_cluster_index_a , MatrixPredicate . BoundaryExterior ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . BoundaryExterior ) ; } if ( m_perform_predicates [ MatrixPredicate . ExteriorInterior ] ) { interiorLineExteriorLine_ ( half_edge , id_b , id_a , MatrixPredicate . ExteriorInterior ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . ExteriorInterior ) ; } if ( m_perform_predicates [ MatrixPredicate . ExteriorBoundary ] ) { boundaryLineExteriorLine_ ( half_edge , id_b , id_a , m_cluster_index_b , MatrixPredicate . ExteriorBoundary ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . ExteriorBoundary ) ; } return bRelationKnown ; }
Invokes the 9 relational predicates of Line vs Line .
26,165
private boolean areaPointPredicates_ ( int cluster , int id_a , int id_b ) { boolean bRelationKnown = true ; if ( m_perform_predicates [ MatrixPredicate . InteriorInterior ] ) { interiorAreaInteriorPoint_ ( cluster , id_a ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . InteriorInterior ) ; } if ( m_perform_predicates [ MatrixPredicate . InteriorExterior ] ) { interiorAreaExteriorPoint_ ( cluster , id_a ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . InteriorExterior ) ; } if ( m_perform_predicates [ MatrixPredicate . BoundaryInterior ] ) { boundaryAreaInteriorPoint_ ( cluster , id_a , id_b ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . BoundaryInterior ) ; } if ( m_perform_predicates [ MatrixPredicate . BoundaryExterior ] ) { boundaryAreaExteriorPoint_ ( cluster , id_a ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . BoundaryExterior ) ; } if ( m_perform_predicates [ MatrixPredicate . ExteriorInterior ] ) { exteriorAreaInteriorPoint_ ( cluster , id_a ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . ExteriorInterior ) ; } return bRelationKnown ; }
Invokes the 9 relational predicates of area vs Point .
26,166
private boolean linePointPredicates_ ( int cluster , int id_a , int id_b ) { boolean bRelationKnown = true ; if ( m_perform_predicates [ MatrixPredicate . InteriorInterior ] ) { interiorLineInteriorPoint_ ( cluster , id_a , id_b , m_cluster_index_a ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . InteriorInterior ) ; } if ( m_perform_predicates [ MatrixPredicate . InteriorExterior ] ) { interiorLineExteriorPoint_ ( cluster , id_a , id_b , m_cluster_index_a ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . InteriorExterior ) ; } if ( m_perform_predicates [ MatrixPredicate . BoundaryInterior ] ) { boundaryLineInteriorPoint_ ( cluster , id_a , id_b , m_cluster_index_a ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . BoundaryInterior ) ; } if ( m_perform_predicates [ MatrixPredicate . BoundaryExterior ] ) { boundaryLineExteriorPoint_ ( cluster , id_a , id_b , m_cluster_index_a ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . BoundaryExterior ) ; } if ( m_perform_predicates [ MatrixPredicate . ExteriorInterior ] ) { exteriorLineInteriorPoint_ ( cluster , id_a , id_b ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . ExteriorInterior ) ; } return bRelationKnown ; }
Invokes the 9 relational predicates of Line vs Point .
26,167
private boolean pointPointPredicates_ ( int cluster , int id_a , int id_b ) { boolean bRelationKnown = true ; if ( m_perform_predicates [ MatrixPredicate . InteriorInterior ] ) { interiorPointInteriorPoint_ ( cluster , id_a , id_b ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . InteriorInterior ) ; } if ( m_perform_predicates [ MatrixPredicate . InteriorExterior ] ) { interiorPointExteriorPoint_ ( cluster , id_a , id_b , MatrixPredicate . InteriorExterior ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . InteriorExterior ) ; } if ( m_perform_predicates [ MatrixPredicate . ExteriorInterior ] ) { interiorPointExteriorPoint_ ( cluster , id_b , id_a , MatrixPredicate . ExteriorInterior ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . ExteriorInterior ) ; } return bRelationKnown ; }
Invokes the 9 relational predicates of Point vs Point .
26,168
private void interiorAreaInteriorArea_ ( int half_edge , int id_a , int id_b ) { if ( m_matrix [ MatrixPredicate . InteriorInterior ] == 2 ) return ; int faceParentage = m_topo_graph . getHalfEdgeFaceParentage ( half_edge ) ; if ( ( faceParentage & id_a ) != 0 && ( faceParentage & id_b ) != 0 ) m_matrix [ MatrixPredicate . InteriorInterior ] = 2 ; }
with the interior of area B .
26,169
private static Geometry convertGeometry_ ( Geometry geometry , double tolerance ) { int gt = geometry . getType ( ) . value ( ) ; if ( Geometry . isSegment ( gt ) ) { Polyline polyline = new Polyline ( geometry . getDescription ( ) ) ; polyline . addSegment ( ( Segment ) geometry , true ) ; return polyline ; } if ( gt == Geometry . GeometryType . Envelope ) { Envelope envelope = ( Envelope ) ( geometry ) ; Envelope2D env = new Envelope2D ( ) ; geometry . queryEnvelope2D ( env ) ; if ( env . getHeight ( ) <= tolerance && env . getWidth ( ) <= tolerance ) { Point point = new Point ( geometry . getDescription ( ) ) ; envelope . getCenter ( point ) ; return point ; } if ( env . getHeight ( ) <= tolerance || env . getWidth ( ) <= tolerance ) { Polyline polyline = new Polyline ( geometry . getDescription ( ) ) ; Point p = new Point ( ) ; envelope . queryCornerByVal ( 0 , p ) ; polyline . startPath ( p ) ; envelope . queryCornerByVal ( 2 , p ) ; polyline . lineTo ( p ) ; return polyline ; } Polygon polygon = new Polygon ( geometry . getDescription ( ) ) ; polygon . addEnvelope ( envelope , false ) ; return polygon ; } return geometry ; }
Upgrades the geometry to a feature geometry .
26,170
static private boolean PE_EQ ( double a , double b ) { return ( a == b ) || PE_ABS ( a - b ) <= PE_EPS * ( 1 + ( PE_ABS ( a ) + PE_ABS ( b ) ) / 2 ) ; }
Determine if two doubles are equal within a default tolerance
26,171
void addPoint ( GraphicPoint offPt , int i_src ) { if ( m_offsetPtCount == 0 ) { addPoint ( offPt ) ; return ; } int n_src = m_srcPtCount ; GraphicPoint pt1 , pt ; pt1 = m_srcPts . get ( i_src == 0 ? n_src - 1 : i_src - 1 ) ; pt = m_srcPts . get ( i_src ) ; double s = scal ( pt1 , pt , m_offsetPts . get ( m_offsetPtCount - 1 ) , offPt ) ; if ( s > 0 ) { addPoint ( offPt ) ; return ; } if ( s < 0 ) { if ( scal ( pt1 , pt , pt , m_offsetPts . get ( m_offsetPtCount - 1 ) ) > 0 ) { GraphicPoint p ; int k ; if ( i_src == 0 ) k = n_src - 2 ; else if ( i_src == 1 ) k = n_src - 1 ; else k = i_src - 2 ; GraphicPoint pt0 = m_srcPts . get ( k ) ; double a = Math . atan2 ( pt1 . y - pt0 . y , pt1 . x - pt0 . x ) ; p = new GraphicPoint ( pt1 , m_distance , a - half_pi ) ; m_offsetPts . set ( m_offsetPtCount - 1 , p ) ; if ( m_joins == OperatorOffset . JoinType . Bevel || m_joins == OperatorOffset . JoinType . Miter ) { p = new GraphicPoint ( p , pt1 ) ; addPoint ( p ) ; p = new GraphicPoint ( pt1 , m_distance , m_a1 + half_pi ) ; GraphicPoint p_ = new GraphicPoint ( p , pt1 ) ; p_ . type |= BAD_SEG ; addPoint ( p_ ) ; addPoint ( p ) ; } else { p = new GraphicPoint ( pt1 , m_distance , m_a1 + half_pi ) ; p . type |= BAD_SEG ; addPoint ( p ) ; } addPoint ( offPt , i_src ) ; } else { GraphicPoint p ; p = new GraphicPoint ( pt , m_distance , m_a1 + half_pi ) ; addPoint ( p ) ; if ( m_joins == OperatorOffset . JoinType . Bevel || m_joins == OperatorOffset . JoinType . Miter ) { p = new GraphicPoint ( p , pt ) ; addPoint ( p ) ; p = new GraphicPoint ( pt , m_distance , m_a2 - half_pi ) ; GraphicPoint p_ = new GraphicPoint ( p , pt ) ; p_ . type |= BAD_SEG ; addPoint ( p_ ) ; addPoint ( p ) ; } else { p = new GraphicPoint ( pt , m_distance , m_a2 - half_pi ) ; p . type |= BAD_SEG ; addPoint ( p ) ; } } } }
this situation is handled here by adding an additional bad segment
26,172
void compressOffsetArray ( int i0 ) { int i_ = i0 ; while ( m_offsetPts . get ( i_ ) . m_prev < i_ ) i_ = m_offsetPts . get ( i_ ) . m_prev ; int j = 0 , i = i_ ; do { GraphicPoint pt = m_offsetPts . get ( i ) ; m_offsetPts . set ( j , pt ) ; i = pt . m_next ; j ++ ; } while ( i != i_ ) ; m_offsetPts . set ( j , m_offsetPts . get ( 0 ) ) ; m_offsetPtCount = j + 1 ; }
is its the index of a point that isn t part of a deleted loop
26,173
public int compare ( Point2D other ) { return y < other . y ? - 1 : ( y > other . y ? 1 : ( x < other . x ? - 1 : ( x > other . x ? 1 : 0 ) ) ) ; }
Compares two vertices lexicographically by y .
26,174
int compareX ( Point2D other ) { return x < other . x ? - 1 : ( x > other . x ? 1 : ( y < other . y ? - 1 : ( y > other . y ? 1 : 0 ) ) ) ; }
Compares two vertices lexicographically by x .
26,175
double _norm ( int metric ) { if ( metric < 0 || _isNan ( ) ) return NumberUtils . NaN ( ) ; switch ( metric ) { case 0 : return Math . abs ( x ) >= Math . abs ( y ) ? Math . abs ( x ) : Math . abs ( y ) ; case 1 : return Math . abs ( x ) + Math . abs ( y ) ; case 2 : return Math . sqrt ( x * x + y * y ) ; default : return Math . pow ( Math . pow ( x , ( double ) metric ) + Math . pow ( y , ( double ) metric ) , 1.0 / ( double ) metric ) ; } }
for predefined metrics use the DistanceMetricEnum defined in WKSPoint . h
26,176
public static int orientationRobust ( Point2D p , Point2D q , Point2D r ) { ECoordinate det_ec = new ECoordinate ( ) ; det_ec . set ( q . x ) ; det_ec . sub ( p . x ) ; ECoordinate rp_y_ec = new ECoordinate ( ) ; rp_y_ec . set ( r . y ) ; rp_y_ec . sub ( p . y ) ; ECoordinate qp_y_ec = new ECoordinate ( ) ; qp_y_ec . set ( q . y ) ; qp_y_ec . sub ( p . y ) ; ECoordinate rp_x_ec = new ECoordinate ( ) ; rp_x_ec . set ( r . x ) ; rp_x_ec . sub ( p . x ) ; det_ec . mul ( rp_y_ec ) ; qp_y_ec . mul ( rp_x_ec ) ; det_ec . sub ( qp_y_ec ) ; if ( ! det_ec . isFuzzyZero ( ) ) { double det_ec_value = det_ec . value ( ) ; if ( det_ec_value < 0.0 ) return - 1 ; if ( det_ec_value > 0.0 ) return 1 ; return 0 ; } BigDecimal det_mp = new BigDecimal ( q . x ) ; BigDecimal px_mp = new BigDecimal ( p . x ) ; BigDecimal py_mp = new BigDecimal ( p . y ) ; det_mp = det_mp . subtract ( px_mp ) ; BigDecimal rp_y_mp = new BigDecimal ( r . y ) ; rp_y_mp = rp_y_mp . subtract ( py_mp ) ; BigDecimal qp_y_mp = new BigDecimal ( q . y ) ; qp_y_mp = qp_y_mp . subtract ( py_mp ) ; BigDecimal rp_x_mp = new BigDecimal ( r . x ) ; rp_x_mp = rp_x_mp . subtract ( px_mp ) ; det_mp = det_mp . multiply ( rp_y_mp ) ; qp_y_mp = qp_y_mp . multiply ( rp_x_mp ) ; det_mp = det_mp . subtract ( qp_y_mp ) ; return det_mp . signum ( ) ; }
Calculates the orientation of the triangle formed by p q r . Returns 1 for counter - clockwise - 1 for clockwise and 0 for collinear . May use high precision arithmetics for some special degenerate cases .
26,177
void log ( ECoordinate v ) { double d = v . m_eps / v . m_value ; m_value = Math . log ( v . m_value ) ; m_eps = d * ( 1.0 + 0.5 * d ) + epsCoordinate ( ) * Math . abs ( m_value ) ; }
Calculates natural log of v and assigns to this coordinate
26,178
boolean tolEq ( ECoordinate v , double tolerance ) { return Math . abs ( m_value - v . m_value ) <= tolerance || eq ( v ) ; }
user defined tolerance .
26,179
void addGeometry ( Geometry geometry ) { if ( geometry . isEmpty ( ) ) return ; int type = geometry . getType ( ) . value ( ) ; if ( MultiVertexGeometry . isMultiVertex ( type ) ) addMultiVertexGeometry_ ( ( MultiVertexGeometry ) geometry ) ; else if ( MultiPath . isSegment ( type ) ) addSegment_ ( ( Segment ) geometry ) ; else if ( type == Geometry . GeometryType . Envelope ) addEnvelope_ ( ( Envelope ) geometry ) ; else if ( type == Geometry . GeometryType . Point ) addPoint_ ( ( Point ) geometry ) ; else throw new IllegalArgumentException ( "invalid shape type" ) ; }
Adds a geometry to the current bounding geometry using an incremental algorithm for dynamic insertion .
26,180
Geometry getBoundingGeometry ( ) { Point point = new Point ( ) ; int first = m_tree_hull . getFirst ( - 1 ) ; Polygon hull = new Polygon ( m_shape . getVertexDescription ( ) ) ; if ( m_tree_hull . size ( - 1 ) == 0 ) return hull ; m_shape . queryPoint ( m_tree_hull . getElement ( first ) , point ) ; hull . startPath ( point ) ; for ( int i = m_tree_hull . getNext ( first ) ; i != - 1 ; i = m_tree_hull . getNext ( i ) ) { m_shape . queryPoint ( m_tree_hull . getElement ( i ) , point ) ; hull . lineTo ( point ) ; } return hull ; }
Gets the current bounding geometry . Returns a Geometry .
26,181
static int construct ( Point2D [ ] points , int count , int [ ] out_convex_hull ) { ConvexHull convex_hull = new ConvexHull ( points , count ) ; int t0 = 0 , tm = 1 ; Point2D pt_0 = points [ t0 ] ; while ( tm < count && points [ tm ] . isEqual ( pt_0 , NumberUtils . doubleEps ( ) ) ) tm ++ ; convex_hull . m_tree_hull . addElement ( t0 , - 1 ) ; if ( tm < count ) { convex_hull . m_tree_hull . addBiggestElement ( tm , - 1 ) ; for ( int tp = tm + 1 ; tp < count ; tp ++ ) { Point2D pt_p = points [ tp ] ; int p = convex_hull . treeHull_ ( pt_p ) ; if ( p != - 1 ) convex_hull . m_tree_hull . setElement ( p , tp ) ; } } int out_count = 0 ; for ( int i = convex_hull . m_tree_hull . getFirst ( - 1 ) ; i != - 1 ; i = convex_hull . m_tree_hull . getNext ( i ) ) out_convex_hull [ out_count ++ ] = convex_hull . m_tree_hull . getElement ( i ) ; return out_count ; }
Static method to construct the convex hull from an array of points . The out_convex_hull array will be populated with the subset of index positions which contribute to the convex hull . Returns the number of points in the convex hull . \ param points The points used to create the convex hull . \ param count The number of points in the input Point2D array . \ param out_convex_hull An index array allocated by the user at least as big as the size of the input points array .
26,182
static boolean isPathConvex ( MultiPath multi_path , int path_index , ProgressTracker progress_tracker ) { MultiPathImpl mimpl = ( MultiPathImpl ) multi_path . _getImpl ( ) ; int path_start = mimpl . getPathStart ( path_index ) ; int path_end = mimpl . getPathEnd ( path_index ) ; boolean bxyclosed = ! mimpl . isClosedPath ( path_index ) && mimpl . isClosedPathInXYPlane ( path_index ) ; AttributeStreamOfDbl position = ( AttributeStreamOfDbl ) ( mimpl . getAttributeStreamRef ( VertexDescription . Semantics . POSITION ) ) ; int position_start = 2 * path_start ; int position_end = 2 * path_end ; if ( bxyclosed ) position_end -= 2 ; if ( position_end - position_start < 6 ) return true ; Point2D pt_0 = new Point2D ( ) , pt_m = new Point2D ( ) , pt_pivot = new Point2D ( ) ; position . read ( position_start , pt_0 ) ; position . read ( position_start + 2 , pt_m ) ; position . read ( position_start + 4 , pt_pivot ) ; ECoordinate det_ec = determinant_ ( pt_m , pt_pivot , pt_0 ) ; if ( det_ec . isFuzzyZero ( ) || ! isClockwise_ ( det_ec . value ( ) ) ) return false ; Point2D pt_1 = new Point2D ( pt_m . x , pt_m . y ) ; Point2D pt_m_prev = new Point2D ( ) ; for ( int i = position_start + 6 ; i < position_end ; i += 2 ) { pt_m_prev . setCoords ( pt_m ) ; pt_m . setCoords ( pt_pivot ) ; position . read ( i , pt_pivot ) ; det_ec = determinant_ ( pt_m , pt_pivot , pt_0 ) ; if ( det_ec . isFuzzyZero ( ) || ! isClockwise_ ( det_ec . value ( ) ) ) return false ; det_ec = determinant_ ( pt_1 , pt_pivot , pt_0 ) ; if ( det_ec . isFuzzyZero ( ) || ! isClockwise_ ( det_ec . value ( ) ) ) return false ; det_ec = determinant_ ( pt_m , pt_pivot , pt_m_prev ) ; if ( det_ec . isFuzzyZero ( ) || ! isClockwise_ ( det_ec . value ( ) ) ) return false ; } return true ; }
Returns true if the given path of the input MultiPath is convex . Returns false otherwise . \ param multi_path The MultiPath to check if the path is convex . \ param path_index The path of the MultiPath to check if its convex .
26,183
private void addMultiVertexGeometry_ ( MultiVertexGeometry mvg ) { Point point = new Point ( ) ; Point2D pt_p = new Point2D ( ) ; for ( int i = 0 ; i < mvg . getPointCount ( ) ; i ++ ) { mvg . getXY ( i , pt_p ) ; int p = addPoint_ ( pt_p ) ; if ( p != - 1 ) { mvg . getPointByVal ( i , point ) ; int tp = m_shape . addPoint ( m_path_handle , point ) ; m_tree_hull . setElement ( p , tp ) ; } } }
Dynamically inserts each geometry into the convex hull .
26,184
public final Point2D getXY ( ) { if ( isEmptyImpl ( ) ) throw new GeometryException ( "This operation should not be performed on an empty geometry." ) ; Point2D pt = new Point2D ( ) ; pt . setCoords ( m_attributes [ 0 ] , m_attributes [ 1 ] ) ; return pt ; }
Returns XY coordinates of this point .
26,185
public Point3D getXYZ ( ) { if ( isEmptyImpl ( ) ) throw new GeometryException ( "This operation should not be performed on an empty geometry." ) ; Point3D pt = new Point3D ( ) ; pt . x = m_attributes [ 0 ] ; pt . y = m_attributes [ 1 ] ; if ( m_description . hasZ ( ) ) pt . z = m_attributes [ 2 ] ; else pt . z = VertexDescription . getDefaultValue ( Semantics . Z ) ; return pt ; }
Returns XYZ coordinates of the point . Z will be set to 0 if Z is missing .
26,186
public void setXYZ ( Point3D pt ) { _touch ( ) ; boolean bHasZ = hasAttribute ( Semantics . Z ) ; if ( ! bHasZ && ! VertexDescription . isDefaultValue ( Semantics . Z , pt . z ) ) { addAttribute ( Semantics . Z ) ; bHasZ = true ; } if ( m_attributes == null ) _setToDefault ( ) ; m_attributes [ 0 ] = pt . x ; m_attributes [ 1 ] = pt . y ; if ( bHasZ ) m_attributes [ 2 ] = pt . z ; }
Sets the XYZ coordinates of this point .
26,187
public int getAttributeAsInt ( int semantics , int ordinate ) { if ( isEmptyImpl ( ) ) throw new GeometryException ( "This operation was performed on an Empty Geometry." ) ; int ncomps = VertexDescription . getComponentCount ( semantics ) ; if ( ordinate >= ncomps ) throw new IndexOutOfBoundsException ( ) ; int attributeIndex = m_description . getAttributeIndex ( semantics ) ; if ( attributeIndex >= 0 ) return ( int ) m_attributes [ m_description . _getPointAttributeOffset ( attributeIndex ) + ordinate ] ; else return ( int ) VertexDescription . getDefaultValue ( semantics ) ; }
Returns value of the given vertex attribute s ordinate . The ordinate is always 0 because integer attributes always have one component .
26,188
public void setAttribute ( int semantics , int ordinate , double value ) { _touch ( ) ; int ncomps = VertexDescription . getComponentCount ( semantics ) ; if ( ncomps < ordinate ) throw new IndexOutOfBoundsException ( ) ; int attributeIndex = m_description . getAttributeIndex ( semantics ) ; if ( attributeIndex < 0 ) { addAttribute ( semantics ) ; attributeIndex = m_description . getAttributeIndex ( semantics ) ; } if ( m_attributes == null ) _setToDefault ( ) ; m_attributes [ m_description . _getPointAttributeOffset ( attributeIndex ) + ordinate ] = value ; }
Sets the value of the attribute .
26,189
void _setToDefault ( ) { resizeAttributes ( m_description . getTotalComponentCount ( ) ) ; Point . attributeCopy ( m_description . _getDefaultPointAttributes ( ) , m_attributes , m_description . getTotalComponentCount ( ) ) ; m_attributes [ 0 ] = NumberUtils . NaN ( ) ; m_attributes [ 1 ] = NumberUtils . NaN ( ) ; }
Sets the Point to a default non - empty state .
26,190
public void setXY ( double x , double y ) { _touch ( ) ; if ( m_attributes == null ) _setToDefault ( ) ; m_attributes [ 0 ] = x ; m_attributes [ 1 ] = y ; }
Set the X and Y coordinate of the point .
26,191
void removeShape ( ) { if ( m_shape == null ) return ; if ( m_geometryIDIndex != - 1 ) { m_shape . removeGeometryUserIndex ( m_geometryIDIndex ) ; m_geometryIDIndex = - 1 ; } if ( m_clusterIndex != - 1 ) { m_shape . removeUserIndex ( m_clusterIndex ) ; m_clusterIndex = - 1 ; } if ( m_halfEdgeIndex != - 1 ) { m_shape . removeUserIndex ( m_halfEdgeIndex ) ; m_halfEdgeIndex = - 1 ; } if ( m_tmpHalfEdgeParentageIndex != - 1 ) { deleteUserIndexForHalfEdges ( m_tmpHalfEdgeParentageIndex ) ; m_tmpHalfEdgeParentageIndex = - 1 ; } if ( m_tmpHalfEdgeWindingNumberIndex != - 1 ) { deleteUserIndexForHalfEdges ( m_tmpHalfEdgeWindingNumberIndex ) ; m_tmpHalfEdgeWindingNumberIndex = - 1 ; } if ( m_tmpHalfEdgeOddEvenNumberIndex != - 1 ) { deleteUserIndexForHalfEdges ( m_tmpHalfEdgeOddEvenNumberIndex ) ; m_tmpHalfEdgeOddEvenNumberIndex = - 1 ; } m_shape = null ; m_clusterData . deleteAll ( true ) ; m_clusterVertices . deleteAll ( true ) ; m_firstCluster = - 1 ; m_lastCluster = - 1 ; if ( m_halfEdgeData != null ) m_halfEdgeData . deleteAll ( true ) ; if ( m_edgeIndices != null ) m_edgeIndices . clear ( ) ; if ( m_clusterIndices != null ) m_clusterIndices . clear ( ) ; if ( m_chainIndices != null ) m_chainIndices . clear ( ) ; if ( m_chainData != null ) m_chainData . deleteAll ( true ) ; m_universeChain = - 1 ; m_chainAreas = null ; }
the edit shape .
26,192
void getXY ( int cluster , Point2D pt ) { int vindex = getClusterVertexIndex_ ( cluster ) ; m_shape . getXYWithIndex ( vindex , pt ) ; }
Returns the coordinates of the cluster
26,193
int getClusterUserIndex ( int cluster , int index ) { int i = getClusterIndex_ ( cluster ) ; AttributeStreamOfInt32 stream = m_clusterIndices . get ( index ) ; if ( stream . size ( ) <= i ) return - 1 ; return stream . read ( i ) ; }
Returns a user index value for the cluster .
26,194
void setClusterUserIndex ( int cluster , int index , int value ) { int i = getClusterIndex_ ( cluster ) ; AttributeStreamOfInt32 stream = m_clusterIndices . get ( index ) ; if ( stream . size ( ) <= i ) stream . resize ( m_clusterData . size ( ) , - 1 ) ; stream . write ( i , value ) ; }
Sets a user index value for the cluster .
26,195
int createUserIndexForClusters ( ) { if ( m_clusterIndices == null ) { m_clusterIndices = new ArrayList < AttributeStreamOfInt32 > ( 3 ) ; } AttributeStreamOfInt32 new_stream = new AttributeStreamOfInt32 ( m_clusterData . capacity ( ) , - 1 ) ; for ( int i = 0 , n = m_clusterIndices . size ( ) ; i < n ; i ++ ) { if ( m_clusterIndices . get ( i ) == null ) { m_clusterIndices . set ( i , new_stream ) ; return i ; } } m_clusterIndices . add ( new_stream ) ; return m_clusterIndices . size ( ) - 1 ; }
Creates a new user index for the cluster . The index values are set to - 1 .
26,196
int getHalfEdgeUserIndex ( int half_edge , int index ) { int i = getHalfEdgeIndex_ ( half_edge ) ; AttributeStreamOfInt32 stream = m_edgeIndices . get ( index ) ; if ( stream . size ( ) <= i ) return - 1 ; return stream . read ( i ) ; }
Returns a user index value for the half edge
26,197
void setHalfEdgeUserIndex ( int half_edge , int index , int value ) { int i = getHalfEdgeIndex_ ( half_edge ) ; AttributeStreamOfInt32 stream = m_edgeIndices . get ( index ) ; if ( stream . size ( ) <= i ) stream . resize ( m_halfEdgeData . size ( ) , - 1 ) ; stream . write ( i , value ) ; }
Sets a user index value for a half edge
26,198
int createUserIndexForHalfEdges ( ) { if ( m_edgeIndices == null ) m_edgeIndices = new ArrayList < AttributeStreamOfInt32 > ( 3 ) ; AttributeStreamOfInt32 new_stream = new AttributeStreamOfInt32 ( m_halfEdgeData . capacity ( ) , - 1 ) ; for ( int i = 0 , n = m_edgeIndices . size ( ) ; i < n ; i ++ ) { if ( m_edgeIndices . get ( i ) == null ) { m_edgeIndices . set ( i , new_stream ) ; return i ; } } m_edgeIndices . add ( new_stream ) ; return m_edgeIndices . size ( ) - 1 ; }
create a new user index for half edges . The index values are set to - 1 .
26,199
void deleteUserIndexForHalfEdges ( int userIndex ) { assert ( m_edgeIndices . get ( userIndex ) != null ) ; m_edgeIndices . set ( userIndex , null ) ; }
Deletes the given user index for half edges