PolygonOps Class

Various (static method) computations for arrays of points interpreted as a polygon.

Methods

Name Description
addSecondMomentAreaProducts(points: IndexedXYZCollection, origin: Point3d, moments: Matrix4d): void Static Accumulate to the matrix of area products of a polygon with respect to an origin.  
addSecondMomentVolumeProducts(points: IndexedXYZCollection, origin: Point3d, moments: Matrix4d): void Static Accumulate to the matrix of volume products of a polygon with respect to an origin.  
area(points: Point3d[]): number Static return the area of the polygon.  
areaNormal(points: Point3d[], result?: Vector3d): Vector3d Static return a vector which is perpendicular to the polygon and has magnitude equal to the polygon area.  
areaNormalGo(points: IndexedXYZCollection, result?: Vector3d): Vector3d | undefined Static return a vector which is perpendicular to the polygon and has magnitude equal to the polygon area.  
areaXY(points: Point3d[] | IndexedXYZCollection): number Static return the projected XY area of the polygon.  
centroidAndAreaXY(points: Point2d[], centroid: Point2d): number | undefined Static * Return (in caller-allocated centroid) the centroid of the xy polygon.  
centroidAreaNormal(points: IndexedXYZCollection | Point3d[]): Ray3d | undefined Static Return a Ray3d with (assuming the polygon is planar and not self-intersecting)  
classifyPointInPolygon(x: number, y: number, points: XAndY[]): number | undefined Static Test if point (x,y) is IN, OUT or ON a polygon.  
classifyPointInPolygonXY(x: number, y: number, points: IndexedXYZCollection): number | undefined Static Test if point (x,y) is IN, OUT or ON a polygon.  
orientLoopsCCWForOutwardNormalInPlace(loops: IndexedReadWriteXYZCollection | IndexedReadWriteXYZCollection[], outwardNormal: Vector3d): number Static Reverse loops as necessary to make them all have CCW orientation for given outward normal.  
sortOuterAndHoleLoopsXY(loops: IndexedReadWriteXYZCollection[]): IndexedReadWriteXYZCollection[][] Static If reverse loops as necessary to make them all have CCW orientation for given outward normal.  
sumTriangleAreas(points: Point3d[] | GrowableXYZArray): number Static Sum areas of triangles from points[0] to each far edge.  
sumTriangleAreasXY(points: Point3d[]): number Static Sum areas of triangles from points[0] to each far edge.  
testXYPolygonTurningDirections(pPointArray: Point2d[] | Point3d[]): number Static Test the direction of turn at the vertices of the polygon, ignoring z-coordinates.  
unitNormal(points: IndexedXYZCollection, result: Vector3d): boolean Static Return a unit normal to the plane of the polygon.  

Defined in

Last Updated: 13 June, 2024