PolygonOps Class
Various static methods to perform computations on an array of points interpreted as a polygon.
Methods
Name | Description | |
---|---|---|
constructor(): PolygonOps | ||
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): undefined | Vector3d Static | return a vector which is perpendicular to the polygon and has magnitude equal to the polygon area. | |
areaXY(points: IndexedXYZCollection | Point3d[]): number Static | return the projected XY area of the polygon. | |
centroidAndAreaXY(points: Point2d[], centroid: Point2d): undefined | number Static | * Return (in caller-allocated centroid) the centroid of the xy polygon. | |
centroidAreaNormal(points: IndexedXYZCollection | Point3d[]): undefined | Ray3d Static | Return a Ray3d with (assuming the polygon is planar and not self-intersecting): | |
classifyPointInPolygon(x: number, y: number, points: Readonly<WritableXAndY>[]): undefined | number Static | Test if point (x,y) is IN, OUT or ON a polygon. | |
classifyPointInPolygonXY(x: number, y: number, points: IndexedXYZCollection): undefined | number Static | Test if point (x,y) is IN, OUT or ON a polygon. | |
closestApproach(polygonA: IndexedXYZCollection | Point3d[], polygonB: IndexedXYZCollection | Point3d[], dMax: numberNumber.MAX_VALUE, _searchInterior: booleanfalse): undefined | PolygonLocationDetailPair Static | Find smallest distance between polygons. | |
closestPoint(polygon: IndexedXYZCollection | Point3d[], testPoint: Point3d, tolerance: numberGeometry.smallMetricDistance, result?: PolygonLocationDetail): PolygonLocationDetail Static | Compute the closest point on the polygon boundary or its interior to the given point. | |
closestPointOnBoundary(polygon: IndexedXYZCollection | Point3d[], testPoint: Point3d, tolerance: numberGeometry.smallMetricDistance, result?: PolygonLocationDetail): PolygonLocationDetail Static | Compute the closest point on the polygon boundary to the given point. | |
convexBarycentricCoordinates(polygon: IndexedXYZCollection | Point3d[], point: Point3d, tolerance: numberGeometry.smallMetricDistance): undefined | number[] Static | Compute the barycentric coordinates for a point inside a convex polygon. | |
ensureClosed(polygon: IndexedXYZCollection | Point3d[], tolerance: numberGeometry.smallMetricDistance): IndexedXYZCollection | Point3d[] Static | Return a closed polygon, cloning only if necessary. | |
forceClosure(polygon: Point3d[] | GrowableXYZArray, tolerance: numberGeometry.smallMetricDistance): void Static | Force the polygon to be closed. | |
intersectRay3d(polygon: IndexedXYZCollection | Point3d[], ray: Ray3d, tolerance: numberGeometry.smallMetricDistance, result?: PolygonLocationDetail): PolygonLocationDetail Static | Compute the intersection of a line (parameterized as a ray) with the plane of this polygon. | |
intersectSegment(polygon: IndexedXYZCollection | Point3d[], point0: Point3d, point1: Point3d, tolerance: numberGeometry.smallMetricDistance, result?: PolygonLocationDetail): PolygonLocationDetail Static | Compute the intersection of a line (parameterized as a line segment) with the plane of this polygon. | |
isConvex(polygon: IndexedXYZCollection | Point3d[]): boolean Static | Determine whether the polygon is convex. | |
orientLoopsCCWForOutwardNormalInPlace(loops: IndexedReadWriteXYZCollection | IndexedReadWriteXYZCollection[], outwardNormal: Vector3d): number Static | Reverse loops as necessary to make them all have CCW orientation for given outward normal. | |
sortOuterAndHoleLoops(loops: IndexedReadWriteXYZCollection[], defaultNormal: Vector3d): IndexedReadWriteXYZCollection[][] Static | Exactly like sortOuterAndHoleLoopsXY but allows loops in any plane. |
|
sortOuterAndHoleLoopsXY(loops: IndexedReadWriteXYZCollection[]): IndexedReadWriteXYZCollection[][] Static | Reverse and reorder loops in the xy-plane for consistency and containment. | |
sumAreaXY(polygons: Point3d[][]): number Static | Sum the areaXY () values for multiple polygons | |
sumTriangleAreas(points: Point3d[] | GrowableXYZArray): number Static | Sum areas of triangles from points[0] to each far edge. | |
sumTriangleAreasPerpendicularToUpVector(points: Point3d[] | GrowableXYZArray, upVector: Vector3d): number Static | Sum areas of triangles from points[0] to each far edge, as viewed with upVector pointing up. | |
sumTriangleAreasXY(points: Point3d[]): number Static | Sum areas of triangles from points[0] to each far edge. | |
testXYPolygonTurningDirections(points: Point3d[] | Point2d[]): 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
- geometry3d/PolygonOps.ts Line 346
Last Updated: 14 November, 2024
Found something wrong, missing, or unclear on this page?Raise an issue in our repo.