@itwin/core-geometry 4.0.0-dev.22 → 4.0.0-dev.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/Geometry.d.ts +23 -0
- package/lib/cjs/Geometry.d.ts.map +1 -1
- package/lib/cjs/Geometry.js +25 -1
- package/lib/cjs/Geometry.js.map +1 -1
- package/lib/cjs/geometry3d/BarycentricTriangle.d.ts +195 -8
- package/lib/cjs/geometry3d/BarycentricTriangle.d.ts.map +1 -1
- package/lib/cjs/geometry3d/BarycentricTriangle.js +459 -11
- package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYArray.d.ts +1 -1
- package/lib/cjs/geometry3d/GrowableXYArray.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYArray.js +1 -1
- package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYCollection.d.ts +22 -7
- package/lib/cjs/geometry3d/IndexedXYCollection.d.ts.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYCollection.js +41 -5
- package/lib/cjs/geometry3d/IndexedXYCollection.js.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts +58 -4
- package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYZCollection.js +102 -4
- package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
- package/lib/cjs/geometry3d/Point2dArrayCarrier.d.ts +10 -0
- package/lib/cjs/geometry3d/Point2dArrayCarrier.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point2dArrayCarrier.js +14 -0
- package/lib/cjs/geometry3d/Point2dArrayCarrier.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dArrayCarrier.d.ts +0 -6
- package/lib/cjs/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point3dArrayCarrier.js +0 -6
- package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js +2 -2
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.d.ts +14 -1
- package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.js +33 -1
- package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.d.ts +120 -10
- package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.js +412 -12
- package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
- package/lib/cjs/polyface/FacetLocationDetail.d.ts +264 -0
- package/lib/cjs/polyface/FacetLocationDetail.d.ts.map +1 -0
- package/lib/cjs/polyface/FacetLocationDetail.js +378 -0
- package/lib/cjs/polyface/FacetLocationDetail.js.map +1 -0
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts +2 -5
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.js +5 -2
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts +20 -14
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.js +21 -17
- package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.d.ts +1 -1
- package/lib/cjs/polyface/PolyfaceData.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.d.ts +22 -1
- package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.js +52 -2
- package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/cjs/solid/Sphere.d.ts +5 -5
- package/lib/cjs/solid/Sphere.js +5 -5
- package/lib/cjs/solid/Sphere.js.map +1 -1
- package/lib/esm/Geometry.d.ts +23 -0
- package/lib/esm/Geometry.d.ts.map +1 -1
- package/lib/esm/Geometry.js +24 -0
- package/lib/esm/Geometry.js.map +1 -1
- package/lib/esm/geometry3d/BarycentricTriangle.d.ts +195 -8
- package/lib/esm/geometry3d/BarycentricTriangle.d.ts.map +1 -1
- package/lib/esm/geometry3d/BarycentricTriangle.js +459 -12
- package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
- package/lib/esm/geometry3d/GrowableXYArray.d.ts +1 -1
- package/lib/esm/geometry3d/GrowableXYArray.d.ts.map +1 -1
- package/lib/esm/geometry3d/GrowableXYArray.js +1 -1
- package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
- package/lib/esm/geometry3d/IndexedXYCollection.d.ts +22 -7
- package/lib/esm/geometry3d/IndexedXYCollection.d.ts.map +1 -1
- package/lib/esm/geometry3d/IndexedXYCollection.js +41 -5
- package/lib/esm/geometry3d/IndexedXYCollection.js.map +1 -1
- package/lib/esm/geometry3d/IndexedXYZCollection.d.ts +58 -4
- package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
- package/lib/esm/geometry3d/IndexedXYZCollection.js +103 -5
- package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
- package/lib/esm/geometry3d/Point2dArrayCarrier.d.ts +10 -0
- package/lib/esm/geometry3d/Point2dArrayCarrier.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point2dArrayCarrier.js +14 -0
- package/lib/esm/geometry3d/Point2dArrayCarrier.js.map +1 -1
- package/lib/esm/geometry3d/Point3dArrayCarrier.d.ts +0 -6
- package/lib/esm/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point3dArrayCarrier.js +0 -6
- package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.js +2 -2
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.d.ts +14 -1
- package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.js +33 -1
- package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.d.ts +120 -10
- package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.js +411 -12
- package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
- package/lib/esm/polyface/FacetLocationDetail.d.ts +264 -0
- package/lib/esm/polyface/FacetLocationDetail.d.ts.map +1 -0
- package/lib/esm/polyface/FacetLocationDetail.js +371 -0
- package/lib/esm/polyface/FacetLocationDetail.js.map +1 -0
- package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts +2 -5
- package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.js +5 -2
- package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.d.ts +20 -14
- package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.js +21 -17
- package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/esm/polyface/PolyfaceData.d.ts +1 -1
- package/lib/esm/polyface/PolyfaceData.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceData.js.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.d.ts +22 -1
- package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.js +52 -2
- package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/esm/solid/Sphere.d.ts +5 -5
- package/lib/esm/solid/Sphere.js +5 -5
- package/lib/esm/solid/Sphere.js.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BarycentricTriangle.js","sourceRoot":"","sources":["../../../src/geometry3d/BarycentricTriangle.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,OAAO,EAAY,MAAM,mBAAmB,CAAC;AAEtD;;;GAGG;AACH,MAAM,OAAO,mBAAmB;IAG9B;;OAEG;IACH,YAAsB,MAAe,EAAE,MAAe,EAAE,MAAe;QACrE,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACzB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACzB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,eAAe,CAAC,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,MAA4B;QACpK,IAAI,CAAC,MAAM;YAAE,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;QACjH,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;QACjC,MAAM,CAAC,MAAM,CAA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C,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,EAC9D,MAAM,CAAC,CAAC;IACZ,CAAC;IACD,4DAA4D;IACrD,aAAa,CAAC,KAA0B;QAC7C,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;eAC/C,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;eAC7C,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACrD,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\n\r\nimport { Geometry } from \"../Geometry\";\r\nimport { Point3d, Vector3d } from \"./Point3dVector3d\";\r\n\r\n/**\r\n * 3 points defining a triangle to be evaluated with Barycentric coordinates.\r\n * @public\r\n */\r\nexport class BarycentricTriangle {\r\n /** Array of 3 point coordinates for the triangle. */\r\n public points: Point3d[];\r\n /** Constructor.\r\n * * Point references are CAPTURED\r\n */\r\n protected constructor(point0: Point3d, point1: Point3d, point2: Point3d) {\r\n this.points = [];\r\n this.points.push(point0);\r\n this.points.push(point1);\r\n this.points.push(point2);\r\n }\r\n\r\n /**\r\n * Return a `BarycentricTriangle` with coordinates given by enumerated x,y,z of the 3 points.\r\n * @param result optional pre-allocated triangle.\r\n */\r\n public static createXYZXYZXYZ(x0: number, y0: number, z0: number, x1: number, y1: number, z1: number, x2: number, y2: number, z2: number, result?: BarycentricTriangle): BarycentricTriangle {\r\n if (!result) return new this(Point3d.create(x0, y0, z0), Point3d.create(x1, y1, z1), Point3d.create(x2, y2, z2));\r\n result.points[0].set(x0, y0, z0);\r\n result.points[1].set(x1, y1, z1);\r\n result.points[2].set(x2, y2, z2);\r\n return result;\r\n }\r\n /** create a triangle with coordinates cloned from given points. */\r\n public static create(point0: Point3d, point1: Point3d, point2: Point3d, result?: BarycentricTriangle): BarycentricTriangle {\r\n if (!result)\r\n return new this(point0.clone(), point1.clone(), point2.clone());\r\n result.set(point0, point1, point2);\r\n return result;\r\n }\r\n /** Return a new `BarycentricTriangle` with the same coordinates. */\r\n public clone(result?: BarycentricTriangle): BarycentricTriangle {\r\n return BarycentricTriangle.create(this.points[0], this.points[1], this.points[2], result);\r\n }\r\n\r\n /** Return area divided by sum of squared lengths. */\r\n public get aspectRatio(): number {\r\n return Geometry.safeDivideFraction(0.5 * this.points[0].crossProductToPointsMagnitude(this.points[1], this.points[2]),\r\n (this.points[0].distanceSquared(this.points[1]) + this.points[1].distanceSquared(this.points[2]) + this.points[2].distanceSquared(this.points[0])), 0);\r\n }\r\n /** Return the area of the triangle. */\r\n public get area(): number {\r\n return 0.5 * this.points[0].crossProductToPointsMagnitude(this.points[1], this.points[2]);\r\n }\r\n /** Sum the points with given scales.\r\n * * In normal use, the scales will add to 1 and the result point is in the plane of the triangle.\r\n * * If scales do not add to 1, the point is in the triangle scaled (by the scale sum) from the origin.\r\n */\r\n public fractionToPoint(a0: number, a1: number, a2: number, result?: Point3d): Point3d {\r\n return Point3d.createAdd3Scaled(this.points[0], a0, this.points[1], a1, this.points[2], a2, result);\r\n }\r\n\r\n /** Copy all values from `other`\r\n */\r\n public setFrom(other: BarycentricTriangle) {\r\n this.points[0].setFromPoint3d(other.points[0]);\r\n this.points[1].setFromPoint3d(other.points[1]);\r\n this.points[2].setFromPoint3d(other.points[2]);\r\n }\r\n /** copy contents of (not pointers to) the given points. */\r\n public set(point0: Point3d | undefined, point1: Point3d | undefined, point2: Point3d | undefined) {\r\n this.points[0].setFromPoint3d(point0);\r\n this.points[1].setFromPoint3d(point1);\r\n this.points[2].setFromPoint3d(point2);\r\n\r\n }\r\n private static _workVector0?: Vector3d;\r\n private static _workVector1?: Vector3d;\r\n /**\r\n * * For `this` and `other` BarycentricTriangles, compute cross products of vectors from point0 to point1 and from point0 to point2.\r\n * * return the dot product of those two\r\n */\r\n public dotProductOfCrossProductsFromOrigin(other: BarycentricTriangle): number {\r\n BarycentricTriangle._workVector0 = this.points[0].crossProductToPoints(this.points[1], this.points[2], BarycentricTriangle._workVector0);\r\n BarycentricTriangle._workVector1 = other.points[0].crossProductToPoints(other.points[1], other.points[2], BarycentricTriangle._workVector1);\r\n return BarycentricTriangle._workVector0.dotProduct(BarycentricTriangle._workVector1);\r\n }\r\n /** Return the centroid of the 3 points. */\r\n public centroid(result?: Point3d): Point3d {\r\n // write it out to get single scale application.\r\n // Do the scale as true division (rather than multiply by precomputed 1/3). This might protect one bit of result.\r\n return Point3d.create(\r\n (this.points[0].x + this.points[1].x + this.points[2].x) / 3.0,\r\n (this.points[0].y + this.points[1].y + this.points[2].y) / 3.0,\r\n (this.points[0].z + this.points[1].z + this.points[2].z) / 3.0,\r\n result);\r\n }\r\n /** test for point-by-point `isAlmostEqual` relationship. */\r\n public isAlmostEqual(other: BarycentricTriangle): boolean {\r\n return this.points[0].isAlmostEqual(other.points[0])\r\n && this.points[1].isAlmostEqual(other.points[1])\r\n && this.points[2].isAlmostEqual(other.points[2]);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"BarycentricTriangle.js","sourceRoot":"","sources":["../../../src/geometry3d/BarycentricTriangle.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE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AC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACnH,CAAC;IAED;;OAEG;IACI,eAAe,CAAC,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU;QAC3F,uDAAuD;QACvD,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IACpK,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\n\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { Geometry, PolygonLocation } from \"../Geometry\";\r\nimport { Matrix3d } from \"./Matrix3d\";\r\nimport { Point3d, Vector3d } from \"./Point3dVector3d\";\r\nimport { Ray3d } from \"./Ray3d\";\r\n\r\n/**\r\n * Carries data about a location in the plane of a triangle.\r\n * * Each instance carries both world and barycentric coordinates for the point, and provides query services on the latter.\r\n * * No tolerance is used when querying barycentric coordinates (e.g., `isInsideOrOn`, `classify`). Use `snapLocalToEdge`\r\n * to adjust the barycentric coordinates to a triangle edge if they lie within a parametric tolerance.\r\n *\r\n * Properties of the barycentric coordinates (b0, b1, b2) of a point p in the plane of a triangle T with vertices p0, p1, p2:\r\n * * 1 = b0 + b1 + b2\r\n * * p = b0 * p0 + b1 * p1 + b2 * p2\r\n * * If T is spanned by the vectors U=p1-p0 and V=p2-p0, then the vector P=p-p0 can be written P = b1 * U + b2 * V.\r\n * * The coordinates are all nonnegative if and only if p is inside or on T.\r\n * * Exactly one coordinate is zero if and only if p lies on an (infinitely extended) edge of T.\r\n * * Exactly two coordinates are zero if and only if p coincides with a vertex of T.\r\n * @public\r\n */\r\nexport class TriangleLocationDetail {\r\n /** The Cartesian coordinates of the point p. */\r\n public world: Point3d;\r\n /** The barycentric coordinates of p with respect to the triangle. Assumed to sum to one. */\r\n public local: Point3d;\r\n /** Application-specific number */\r\n public a: number;\r\n /** Index of the triangle vertex at the base of the edge closest to p. */\r\n public closestEdgeIndex: number;\r\n /** The parameter along the closest edge of the projection of p. */\r\n public closestEdgeParam: number;\r\n\r\n private constructor() {\r\n this.world = new Point3d();\r\n this.local = new Point3d();\r\n this.a = 0.0;\r\n this.closestEdgeIndex = 0;\r\n this.closestEdgeParam = 0.0;\r\n }\r\n /** Invalidate this detail. */\r\n public invalidate() {\r\n this.world.setZero();\r\n this.local.setZero();\r\n this.a = 0.0;\r\n this.closestEdgeIndex = 0;\r\n this.closestEdgeParam = 0.0;\r\n }\r\n /** Create an invalid detail.\r\n * @param result optional pre-allocated object to fill and return\r\n */\r\n public static create(result?: TriangleLocationDetail): TriangleLocationDetail {\r\n if (undefined === result)\r\n result = new TriangleLocationDetail();\r\n else\r\n result.invalidate();\r\n return result;\r\n }\r\n /** Set the instance contents from the other detail.\r\n * @param other detail to clone\r\n */\r\n public copyContentsFrom(other: TriangleLocationDetail) {\r\n this.world.setFrom(other.world);\r\n this.local.setFrom(other.local);\r\n this.a = other.a;\r\n this.closestEdgeIndex = other.closestEdgeIndex;\r\n this.closestEdgeParam = other.closestEdgeParam;\r\n }\r\n /** Whether this detail is invalid. */\r\n public get isValid(): boolean {\r\n return !this.local.isZero;\r\n }\r\n /** Queries the barycentric coordinates to determine whether this instance specifies a location inside or on the triangle.\r\n * @see classify\r\n */\r\n public get isInsideOrOn(): boolean {\r\n return this.isValid && this.local.x >= 0.0 && this.local.y >= 0.0 && this.local.z >= 0.0;\r\n }\r\n /** Queries this detail to classify the location of this instance with respect to the triangle.\r\n * @returns location code\r\n * @see isInsideOrOn\r\n */\r\n public get classify(): PolygonLocation {\r\n if (!this.isValid)\r\n return PolygonLocation.Unknown;\r\n if (this.isInsideOrOn) {\r\n let numZero = 0;\r\n if (Math.abs(this.local.x) === 0.0)\r\n ++numZero;\r\n if (Math.abs(this.local.y) === 0.0)\r\n ++numZero;\r\n if (Math.abs(this.local.z) === 0.0)\r\n ++numZero;\r\n if (2 === numZero)\r\n return PolygonLocation.OnPolygonVertex;\r\n if (1 === numZero)\r\n return PolygonLocation.OnPolygonEdgeInterior;\r\n return PolygonLocation.InsidePolygonProjectsToEdgeInterior;\r\n }\r\n return (this.closestEdgeParam === 0.0) ? PolygonLocation.OutsidePolygonProjectsToVertex : PolygonLocation.OutsidePolygonProjectsToEdgeInterior;\r\n }\r\n}\r\n\r\n/**\r\n * 3 points defining a triangle to be evaluated with barycentric coordinates.\r\n * @public\r\n */\r\nexport class BarycentricTriangle {\r\n /** Array of 3 point coordinates for the triangle. */\r\n public points: Point3d[];\r\n\r\n /** Edge length squared cache, indexed by opposite vertex index */\r\n protected edgeLength2: number[];\r\n\r\n /** Constructor.\r\n * * Point references are CAPTURED\r\n */\r\n protected constructor(point0: Point3d, point1: Point3d, point2: Point3d) {\r\n this.points = [];\r\n this.points.push(point0);\r\n this.points.push(point1);\r\n this.points.push(point2);\r\n this.edgeLength2 = [];\r\n this.edgeLength2.push(point1.distanceSquared(point2));\r\n this.edgeLength2.push(point0.distanceSquared(point2));\r\n this.edgeLength2.push(point0.distanceSquared(point1));\r\n }\r\n\r\n /**\r\n * Return a `BarycentricTriangle` with coordinates given by enumerated x,y,z of the 3 points.\r\n * @param result optional pre-allocated triangle.\r\n */\r\n public static createXYZXYZXYZ(x0: number, y0: number, z0: number, x1: number, y1: number, z1: number, x2: number, y2: number, z2: number, result?: BarycentricTriangle): BarycentricTriangle {\r\n if (!result) return new this(Point3d.create(x0, y0, z0), Point3d.create(x1, y1, z1), Point3d.create(x2, y2, z2));\r\n result.points[0].set(x0, y0, z0);\r\n result.points[1].set(x1, y1, z1);\r\n result.points[2].set(x2, y2, z2);\r\n return result;\r\n }\r\n /** create a triangle with coordinates cloned from given points. */\r\n public static create(point0: Point3d, point1: Point3d, point2: Point3d, result?: BarycentricTriangle): BarycentricTriangle {\r\n if (!result)\r\n return new this(point0.clone(), point1.clone(), point2.clone());\r\n result.set(point0, point1, point2);\r\n return result;\r\n }\r\n /** Return a new `BarycentricTriangle` with the same coordinates. */\r\n public clone(result?: BarycentricTriangle): BarycentricTriangle {\r\n return BarycentricTriangle.create(this.points[0], this.points[1], this.points[2], result);\r\n }\r\n\r\n /** Return area divided by sum of squared lengths. */\r\n public get aspectRatio(): number {\r\n return Geometry.safeDivideFraction(this.area, this.edgeLengthSquared(0) + this.edgeLengthSquared(1) + this.edgeLengthSquared(2), 0);\r\n }\r\n /** Return the area of the triangle. */\r\n public get area(): number {\r\n return 0.5 * this.points[0].crossProductToPointsMagnitude(this.points[1], this.points[2]);\r\n }\r\n\r\n /** Return the perimeter of the triangle */\r\n public get perimeter(): number {\r\n return this.edgeLength(0) + this.edgeLength(1) + this.edgeLength(2);\r\n }\r\n\r\n /** Sum the points with given scales.\r\n * * If the scales sum to 1, they are barycentric coordinates, and hence the result point is in the plane of the triangle.\r\n * * If the scales do not sum to 1, the point is in the triangle scaled (by the scale sum) from the origin.\r\n * @param b0 scale to apply to vertex 0\r\n * @param b1 scale to apply to vertex 1\r\n * @param b2 scale to apply to vertex 2\r\n * @param result optional pre-allocated point to fill and return\r\n * @return linear combination of the vertices of this triangle\r\n * @see pointToFraction\r\n */\r\n public fractionToPoint(b0: number, b1: number, b2: number, result?: Point3d): Point3d {\r\n return Point3d.createAdd3Scaled(this.points[0], b0, this.points[1], b1, this.points[2], b2, result);\r\n }\r\n\r\n private static _workPoint?: Point3d;\r\n private static _workVector0?: Vector3d;\r\n private static _workVector1?: Vector3d;\r\n private static _workRay?: Ray3d;\r\n private static _workMatrix?: Matrix3d;\r\n\r\n /** Compute the projection of the given point onto the plane of this triangle.\r\n * @param point point p to project\r\n * @param result optional pre-allocated object to fill and return\r\n * @returns details d of the projection point P = `d.point`:\r\n * * `d.isValid` returns true if and only if `this.normal()` is defined.\r\n * * `d.classify` can be used to determine where P lies with respect to the triangle.\r\n * * `d.a` is the signed projection distance: P = p + a * `this.normal()`.\r\n * @see fractionToPoint\r\n */\r\n public pointToFraction(point: Point3d, result?: TriangleLocationDetail): TriangleLocationDetail {\r\n const normal = BarycentricTriangle._workVector0 = this.normal(BarycentricTriangle._workVector0);\r\n if (undefined === normal)\r\n return TriangleLocationDetail.create(result);\r\n const ray = BarycentricTriangle._workRay = Ray3d.create(point, normal, BarycentricTriangle._workRay);\r\n return this.intersectRay3d(ray, result); // is free to use workVector0\r\n }\r\n\r\n /** Convert from opposite-vertex to start-vertex edge indexing. */\r\n public static edgeOppositeVertexIndexToStartVertexIndex(edgeIndex: number): number {\r\n return Geometry.cyclic3dAxis(edgeIndex + 1);\r\n }\r\n\r\n /** Convert from start-vertex to opposite-vertex edge indexing. */\r\n public static edgeStartVertexIndexToOppositeVertexIndex(startVertexIndex: number): number {\r\n return Geometry.cyclic3dAxis(startVertexIndex - 1);\r\n }\r\n\r\n /** Examine a point's barycentric coordinates to determine if it lies inside the triangle but not on an edge/vertex.\r\n * * No parametric tolerance is used.\r\n * * It is assumed b0 + b1 + b2 = 1.\r\n * @returns whether the point with barycentric coordinates is strictly inside the triangle.\r\n */\r\n public static isInsideTriangle(b0: number, b1: number, b2: number): boolean {\r\n return b0 > 0 && b1 > 0 && b2 > 0;\r\n }\r\n\r\n /** Examine a point's barycentric coordinates to determine if it lies inside the triangle or on an edge/vertex.\r\n * * No parametric tolerance is used.\r\n * * It is assumed b0 + b1 + b2 = 1.\r\n * @returns whether the point with barycentric coordinates is inside or on the triangle.\r\n */\r\n public static isInsideOrOnTriangle(b0: number, b1: number, b2: number): boolean {\r\n return b0 >= 0 && b1 >= 0 && b2 >= 0;\r\n }\r\n\r\n /** Examine a point's barycentric coordinates to determine if it lies \"outside\" an edge of the triangle.\r\n * * No parametric tolerance is used.\r\n * * It is assumed b0 + b1 + b2 = 1.\r\n * @returns index of vertex/edge i for which b_i < 0 and b_j >= 0 and b_k >= 0, or -1\r\n */\r\n private static isInRegionBeyondEdge(b0: number, b1: number, b2: number): number {\r\n if (b0 < 0 && b1 >= 0 && b2 >= 0)\r\n return 0;\r\n if (b0 >= 0 && b1 < 0 && b2 >= 0)\r\n return 1;\r\n if (b0 >= 0 && b1 >= 0 && b2 < 0)\r\n return 2;\r\n return -1;\r\n }\r\n\r\n /** Examine a point's barycentric coordinates to determine if it lies \"outside\" a vertex of the triangle.\r\n * * No parametric tolerance is used.\r\n * * It is assumed b0 + b1 + b2 = 1.\r\n * @returns index of vertex i for which and b_j < 0 and b_k < 0, or -1\r\n */\r\n private static isInRegionBeyondVertex(b0: number, b1: number, b2: number): number {\r\n if (b1 < 0 && b2 < 0)\r\n return 0;\r\n if (b0 < 0 && b2 < 0)\r\n return 1;\r\n if (b0 < 0 && b1 < 0)\r\n return 2;\r\n return -1;\r\n }\r\n\r\n /** Examine a point's barycentric coordinates to determine if it lies on a vertex of the triangle.\r\n * * No parametric tolerance is used.\r\n * * It is assumed b0 + b1 + b2 = 1.\r\n * @returns index of vertex i for which b_i = 1 and b_j = b_k = 0, or -1\r\n */\r\n private static isOnVertex(b0: number, b1: number, b2: number): number {\r\n if (b0 === 1 && b1 === 0 && b2 === 0)\r\n return 0;\r\n if (b0 === 0 && b1 === 1 && b2 === 0)\r\n return 1;\r\n if (b0 === 0 && b1 === 0 && b2 === 1)\r\n return 2;\r\n return -1;\r\n }\r\n\r\n /** Examine a point's barycentric coordinates to determine if it lies on a bounded edge of the triangle.\r\n * * No parametric tolerance is used.\r\n * * It is assumed b0 + b1 + b2 = 1.\r\n * @returns index of vertex/edge i for which b_i = 0 and b_j > 0 and b_k > 0, or -1\r\n */\r\n private static isOnBoundedEdge(b0: number, b1: number, b2: number): number {\r\n if (b0 === 0 && b1 > 0 && b2 > 0)\r\n return 0;\r\n if (b0 > 0 && b1 === 0 && b2 > 0)\r\n return 1;\r\n if (b0 > 0 && b1 > 0 && b2 === 0)\r\n return 2;\r\n return -1;\r\n }\r\n\r\n /** @returns edge/vertex index (0,1,2) for which the function has a minimum value */\r\n private static indexOfMinimum(fn: (edgeIndex: number) => number): number {\r\n let i = 0;\r\n let min = fn(0);\r\n const val = fn(1);\r\n if (min > val) {\r\n i = 1;\r\n min = val;\r\n }\r\n if (min > fn(2))\r\n i = 2;\r\n return i;\r\n }\r\n\r\n /** Return the index of the closest triangle vertex to the point given by its barycentric coordinates. */\r\n public closestVertexIndex(b0: number, b1: number, b2: number): number {\r\n return BarycentricTriangle.indexOfMinimum((i: number) => {\r\n const a = BarycentricTriangle._workPoint = Point3d.createZero(BarycentricTriangle._workPoint);\r\n a.setAt(i, 1.0);\r\n return this.distanceSquared(a.x, a.y, a.z, b0, b1, b2);\r\n });\r\n }\r\n\r\n /** Compute the projection of barycentric point p onto the (unbounded) edge e_k(v_i,v_j) of the triangle T(v_i,v_j,v_k).\r\n * @param k vertex v_k is opposite the edge e_k\r\n * @param b barycentric coordinates of point to project\r\n * @returns parameter s along e_k, such that:\r\n * * the projection point is q = v_i + s * (v_j - v_i)\r\n * * the barycentric coords of the projection are q_ijk = (1 - s, s, 0)\r\n */\r\n private computeProjectionToEdge(k: number, b: number[]): number {\r\n // Let U=v_j-v_i and V=v_k-v_i. Then\r\n // 0 = (p-q).(v_j-v_i) = ((p-v_i)-(q-v_i)).(v_j-v_i) = (b[j]U + b[k]V - sU).U = b[j]U.U + b[k]U.V - sU.U\r\n // Thus s = b[j] + b[k]U.V/U.U\r\n k = Geometry.cyclic3dAxis(k);\r\n const i = Geometry.cyclic3dAxis(k + 1);\r\n const j = Geometry.cyclic3dAxis(i + 1);\r\n return b[j] + b[k] * this.dotProductOfEdgeVectorsAtVertex(i) / this.edgeLengthSquared(k);\r\n }\r\n\r\n /** Compute the projection of a barycentric point p to the triangle T(v_0,v_1,v_2).\r\n * @param b0 barycentric coordinate of p corresponding to v_0\r\n * @param b1 barycentric coordinate of p corresponding to v_1\r\n * @param b2 barycentric coordinate of p corresponding to v_2\r\n * @returns closest edge start vertex index i and projection parameter u such that the projection q = v_i + u * (v_j - v_i).\r\n */\r\n public closestPoint(b0: number, b1: number, b2: number): { closestEdgeIndex: number, closestEdgeParam: number } {\r\n const b: number[] = [b0, b1, b2];\r\n let edgeIndex = -1; // opposite-vertex index\r\n let edgeParam = 0.0;\r\n if (BarycentricTriangle.isInsideTriangle(b0, b1, b2)) { // projects to any edge\r\n edgeIndex = BarycentricTriangle.indexOfMinimum((i: number) => {\r\n // We want smallest projection distance d_i of p to e_i.\r\n // Since b[i]=d_i|e_i|/2A we can compare quantities b[i]/|e_i|.\r\n return b[i] * b[i] / this.edgeLengthSquared(i); // avoid sqrt\r\n });\r\n edgeParam = this.computeProjectionToEdge(edgeIndex, b);\r\n } else if ((edgeIndex = BarycentricTriangle.isInRegionBeyondVertex(b0, b1, b2)) >= 0) { // projects to other edges, or any vertex\r\n edgeIndex = Geometry.cyclic3dAxis(edgeIndex + 1);\r\n edgeParam = this.computeProjectionToEdge(edgeIndex, b);\r\n if (edgeParam < 0 || edgeParam > 1) {\r\n edgeIndex = Geometry.cyclic3dAxis(edgeIndex + 1);\r\n edgeParam = this.computeProjectionToEdge(edgeIndex, b);\r\n if (edgeParam < 0 || edgeParam > 1) {\r\n edgeParam = 0.0;\r\n edgeIndex = BarycentricTriangle.edgeStartVertexIndexToOppositeVertexIndex(this.closestVertexIndex(b0, b1, b2));\r\n }\r\n }\r\n } else if ((edgeIndex = BarycentricTriangle.isInRegionBeyondEdge(b0, b1, b2)) >= 0) { // projects to the edge or its vertices\r\n edgeParam = this.computeProjectionToEdge(edgeIndex, b);\r\n if (edgeParam < 0) {\r\n edgeParam = 0.0; // start of this edge\r\n } else if (edgeParam > 1) {\r\n edgeParam = 0.0;\r\n edgeIndex = Geometry.cyclic3dAxis(edgeIndex + 1); // end of this edge = start of next edge\r\n }\r\n } else if ((edgeIndex = BarycentricTriangle.isOnBoundedEdge(b0, b1, b2)) >= 0) {\r\n edgeParam = 1 - b[BarycentricTriangle.edgeOppositeVertexIndexToStartVertexIndex(edgeIndex)];\r\n } else if ((edgeIndex = BarycentricTriangle.isOnVertex(b0, b1, b2)) >= 0) {\r\n edgeParam = 0.0;\r\n edgeIndex = BarycentricTriangle.edgeStartVertexIndexToOppositeVertexIndex(edgeIndex);\r\n }\r\n // invalid edgeIndex shouldn't happen, but propagate it anyway\r\n assert(edgeIndex === 0 || edgeIndex === 1 || edgeIndex === 2);\r\n return {\r\n closestEdgeIndex: (edgeIndex < 0) ? -1 : BarycentricTriangle.edgeOppositeVertexIndexToStartVertexIndex(edgeIndex),\r\n closestEdgeParam: edgeParam,\r\n };\r\n }\r\n /** Compute the intersection of a line (parameterized as a ray) with the plane of this triangle.\r\n * @param ray infinite line to intersect, as a ray\r\n * @param result optional pre-allocated object to fill and return\r\n * @returns details d of the line-plane intersection `d.point`:\r\n * * `d.isValid` returns true if and only if the line intersects the plane.\r\n * * `d.classify` can be used to determine where the intersection lies with respect to the triangle.\r\n * * `d.a` is the intersection parameter. If `d.a` >= 0, the ray intersects the plane of the triangle.\r\n * @see pointToFraction\r\n */\r\n public intersectRay3d(ray: Ray3d, result?: TriangleLocationDetail): TriangleLocationDetail {\r\n result = TriangleLocationDetail.create(result);\r\n // Let r0 = ray.origin, d = ray.direction. Write intersection point p two ways for unknown scalars s,b0,b1,b2:\r\n // r0 + s*d = p = b0*p0 + b1*p1 + b2*p2\r\n // Subtract p0 from both ends, let u=p1-p0, v=p2-p0, c=r0-p0, and enforce b0+b1+b2=1:\r\n // b1*u + b2*v - s*d = c\r\n // This is a linear system Mx=c where M has columns u,v,d and solution x=(b1,b2,-s).\r\n const r0 = ray.origin;\r\n const d = ray.direction;\r\n const u = BarycentricTriangle._workVector0 = Vector3d.createStartEnd(this.points[0], this.points[1], BarycentricTriangle._workVector0);\r\n const v = BarycentricTriangle._workVector1 = Vector3d.createStartEnd(this.points[0], this.points[2], BarycentricTriangle._workVector1);\r\n const M = BarycentricTriangle._workMatrix = Matrix3d.createColumns(u, v, d, BarycentricTriangle._workMatrix);\r\n const c = Vector3d.createStartEnd(this.points[0], r0, BarycentricTriangle._workVector0); // reuse workVector0\r\n const solution = BarycentricTriangle._workVector1; // reuse workVector1\r\n if (undefined === M.multiplyInverse(c, solution))\r\n return result; // invalid\r\n result.a = -solution.z;\r\n ray.fractionToPoint(result.a, result.world);\r\n result.local.set(1.0 - solution.x - solution.y, solution.x, solution.y);\r\n const proj = this.closestPoint(result.local.x, result.local.y, result.local.z);\r\n result.closestEdgeIndex = proj.closestEdgeIndex;\r\n result.closestEdgeParam = proj.closestEdgeParam;\r\n return result;\r\n }\r\n\r\n /** Compute the intersection of a line (parameterized as a line segment) with the plane of this triangle.\r\n * @param point0 start point of segment on line to intersect\r\n * @param point1 end point of segment on line to intersect\r\n * @param result optional pre-allocated object to fill and return\r\n * @returns details d of the line-plane intersection `d.point`:\r\n * * `d.isValid` returns true if and only if the line intersects the plane.\r\n * * `d.classify` can be used to determine where the intersection lies with respect to the triangle.\r\n * * `d.a` is the intersection parameter. If `d.a` is in [0,1], the segment intersects the plane of the triangle.\r\n * @see intersectRay3d\r\n */\r\n public intersectSegment(point0: Point3d, point1: Point3d, result?: TriangleLocationDetail): TriangleLocationDetail {\r\n BarycentricTriangle._workRay = Ray3d.createStartEnd(point0, point1, BarycentricTriangle._workRay);\r\n return this.intersectRay3d(BarycentricTriangle._workRay, result);\r\n }\r\n\r\n /** Adjust the location to an edge of the triangle if within either given tolerance.\r\n * @param location details of a point in the plane of the triangle, `location.local` and `location.world` possibly updated to lie on a triangle edge\r\n * @param distanceTolerance absolute distance tolerance (or zero to ignore)\r\n * @param parameterTolerance barycentric coordinate fractional tolerance (or zero to ignore)\r\n * @return whether the location was adjusted\r\n */\r\n public snapLocationToEdge(location: TriangleLocationDetail, distanceTolerance: number = Geometry.smallMetricDistance, parameterTolerance: number = Geometry.smallFraction): boolean {\r\n if (!location.isValid)\r\n return false;\r\n // first try parametric tol to zero barycentric coordinate (no vertices or world distances used!)\r\n if (parameterTolerance > 0.0) {\r\n let numSnapped = 0;\r\n let newSum = 0.0;\r\n for (let i = 0; i < 3; i++) {\r\n const barycentricDist = Math.abs(location.local.at(i));\r\n if (barycentricDist > 0.0 && barycentricDist < parameterTolerance) {\r\n location.local.setAt(i, 0.0);\r\n numSnapped++;\r\n }\r\n newSum += location.local.at(i);\r\n }\r\n if (numSnapped > 0 && newSum > 0.0) {\r\n location.local.scaleInPlace(1.0 / newSum);\r\n if (1 === numSnapped) {\r\n location.closestEdgeIndex = BarycentricTriangle.edgeOppositeVertexIndexToStartVertexIndex(BarycentricTriangle.isOnBoundedEdge(location.local.x, location.local.y, location.local.z));\r\n location.closestEdgeParam = 1.0 - location.local.at(location.closestEdgeIndex);\r\n } else { // 2 snapped, at vertex\r\n location.closestEdgeIndex = BarycentricTriangle.isOnVertex(location.local.x, location.local.y, location.local.z);\r\n location.closestEdgeParam = 0.0;\r\n }\r\n this.fractionToPoint(location.local.x, location.local.y, location.local.z, location.world);\r\n return true;\r\n }\r\n }\r\n // failing that, try distance tol to closest edge projection\r\n if (distanceTolerance > 0.0) {\r\n const i = location.closestEdgeIndex;\r\n const j = (i + 1) % 3;\r\n const k = (j + 1) % 3;\r\n const edgeProjection = BarycentricTriangle._workPoint = this.points[i].interpolate(location.closestEdgeParam, this.points[j], BarycentricTriangle._workPoint);\r\n const dist = location.world.distance(edgeProjection);\r\n if (dist > 0.0 && dist < distanceTolerance) {\r\n location.local.setAt(i, 1.0 - location.closestEdgeParam);\r\n location.local.setAt(j, location.closestEdgeParam);\r\n location.local.setAt(k, 0.0);\r\n location.world.setFrom(edgeProjection);\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n /** Copy all values from `other`\r\n */\r\n public setFrom(other: BarycentricTriangle) {\r\n for (let i = 0; i < 3; ++i) {\r\n this.points[i].setFromPoint3d(other.points[i]);\r\n this.edgeLength2[i] = other.edgeLength2[i];\r\n }\r\n }\r\n /** Copy contents of (not pointers to) the given points. A vertex is zeroed if its corresponding input point is undefined. */\r\n public set(point0: Point3d | undefined, point1: Point3d | undefined, point2: Point3d | undefined) {\r\n this.points[0].setFromPoint3d(point0);\r\n this.points[1].setFromPoint3d(point1);\r\n this.points[2].setFromPoint3d(point2);\r\n this.edgeLength2[0] = this.points[1].distanceSquared(this.points[2]);\r\n this.edgeLength2[1] = this.points[0].distanceSquared(this.points[2]);\r\n this.edgeLength2[2] = this.points[0].distanceSquared(this.points[1]);\r\n }\r\n /**\r\n * * For `this` and `other` BarycentricTriangles, compute cross products of vectors from point0 to point1 and from point0 to point2.\r\n * * return the dot product of those two\r\n */\r\n public dotProductOfCrossProductsFromOrigin(other: BarycentricTriangle): number {\r\n BarycentricTriangle._workVector0 = this.points[0].crossProductToPoints(this.points[1], this.points[2], BarycentricTriangle._workVector0);\r\n BarycentricTriangle._workVector1 = other.points[0].crossProductToPoints(other.points[1], other.points[2], BarycentricTriangle._workVector1);\r\n return BarycentricTriangle._workVector0.dotProduct(BarycentricTriangle._workVector1);\r\n }\r\n /** Return the centroid of the 3 points. */\r\n public centroid(result?: Point3d): Point3d {\r\n // write it out to get single scale application.\r\n // Do the scale as true division (rather than multiply by precomputed 1/3). This might protect one bit of result.\r\n return Point3d.create(\r\n (this.points[0].x + this.points[1].x + this.points[2].x) / 3.0,\r\n (this.points[0].y + this.points[1].y + this.points[2].y) / 3.0,\r\n (this.points[0].z + this.points[1].z + this.points[2].z) / 3.0,\r\n result);\r\n }\r\n\r\n /** Return the incenter of the triangle. */\r\n public incenter(result?: Point3d): Point3d {\r\n const a = this.edgeLength(0);\r\n const b = this.edgeLength(1);\r\n const c = this.edgeLength(2);\r\n const scale = Geometry.safeDivideFraction(1.0, a + b + c, 0.0);\r\n return this.fractionToPoint(scale * a, scale * b, scale * c, result);\r\n }\r\n\r\n /** Return the circumcenter of the triangle. */\r\n public circumcenter(result?: Point3d): Point3d {\r\n const a2 = this.edgeLengthSquared(0);\r\n const b2 = this.edgeLengthSquared(1);\r\n const c2 = this.edgeLengthSquared(2);\r\n const x = a2 * (b2 + c2 - a2);\r\n const y = b2 * (c2 + a2 - b2);\r\n const z = c2 * (a2 + b2 - c2);\r\n const scale = Geometry.safeDivideFraction(1.0, x + y + z, 0.0);\r\n return this.fractionToPoint(scale * x, scale * y, scale * z, result);\r\n }\r\n\r\n /** Return the unit normal of the triangle.\r\n * @param result optional pre-allocated vector to fill and return.\r\n * @returns unit normal, or undefined if cross product length is too small.\r\n */\r\n public normal(result?: Vector3d): Vector3d | undefined {\r\n const cross = this.points[0].crossProductToPoints(this.points[1], this.points[2], result);\r\n if (cross.tryNormalizeInPlace())\r\n return cross;\r\n return undefined;\r\n }\r\n\r\n /** test for point-by-point `isAlmostEqual` relationship. */\r\n public isAlmostEqual(other: BarycentricTriangle): boolean {\r\n return this.points[0].isAlmostEqual(other.points[0])\r\n && this.points[1].isAlmostEqual(other.points[1])\r\n && this.points[2].isAlmostEqual(other.points[2]);\r\n }\r\n\r\n /** Compute length of the triangle edge opposite the vertex with the given index.\r\n * @see edgeStartVertexIndexToOppositeVertexIndex\r\n */\r\n public edgeLength(oppositeVertexIndex: number): number {\r\n return Math.sqrt(this.edgeLengthSquared(oppositeVertexIndex));\r\n }\r\n\r\n /** Compute squared length of the triangle edge opposite the vertex with the given index.\r\n * @see edgeStartVertexIndexToOppositeVertexIndex\r\n */\r\n public edgeLengthSquared(oppositeVertexIndex: number): number {\r\n return this.edgeLength2[Geometry.cyclic3dAxis(oppositeVertexIndex)];\r\n }\r\n\r\n /** Compute dot product of the edge vectors based at the vertex with the given index. */\r\n public dotProductOfEdgeVectorsAtVertex(baseVertexIndex: number): number {\r\n const i = Geometry.cyclic3dAxis(baseVertexIndex);\r\n const j = Geometry.cyclic3dAxis(i + 1);\r\n const k = Geometry.cyclic3dAxis(j + 1);\r\n return Geometry.dotProductXYZXYZ(this.points[j].x - this.points[i].x, this.points[j].y - this.points[i].y, this.points[j].z - this.points[i].z,\r\n this.points[k].x - this.points[i].x, this.points[k].y - this.points[i].y, this.points[k].z - this.points[i].z);\r\n }\r\n\r\n /** Compute the squared distance between two points given by their barycentric coordinates.\r\n * * It is assumed that a0 + a1 + a2 = b0 + b1 + b2 = 1.\r\n */\r\n public distanceSquared(a0: number, a1: number, a2: number, b0: number, b1: number, b2: number): number {\r\n // the barycentric displacement vector distance formula\r\n return -this.edgeLengthSquared(0) * (b1 - a1) * (b2 - a2) - this.edgeLengthSquared(1) * (b2 - a2) * (b0 - a0) - this.edgeLengthSquared(2) * (b0 - a0) * (b1 - a1);\r\n }\r\n}\r\n"]}
|
|
@@ -113,7 +113,7 @@ export declare class GrowableXYArray extends IndexedXYCollection {
|
|
|
113
113
|
*/
|
|
114
114
|
getXAtUncheckedPointIndex(pointIndex: number): number;
|
|
115
115
|
/**
|
|
116
|
-
* Get y coordinate by index, with no index checking
|
|
116
|
+
* Get y coordinate by point index, with no index checking
|
|
117
117
|
* @param pointIndex index to access
|
|
118
118
|
*/
|
|
119
119
|
getYAtUncheckedPointIndex(pointIndex: number): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GrowableXYArray.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/GrowableXYArray.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACt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AAE,SAAS,GAAE,MAAqC,GAAG,OAAO;CAYxG"}
|
|
@@ -211,7 +211,7 @@ export class GrowableXYArray extends IndexedXYCollection {
|
|
|
211
211
|
return this._data[2 * pointIndex];
|
|
212
212
|
}
|
|
213
213
|
/**
|
|
214
|
-
* Get y coordinate by index, with no index checking
|
|
214
|
+
* Get y coordinate by point index, with no index checking
|
|
215
215
|
* @param pointIndex index to access
|
|
216
216
|
*/
|
|
217
217
|
getYAtUncheckedPointIndex(pointIndex) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GrowableXYArray.js","sourceRoot":"","sources":["../../../src/geometry3d/GrowableXYArray.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,oCAAoC,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAKhG;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,mBAAmB;IAkBtD;;;OAGG;IACH,YAAmB,YAAoB,CAAC,EAAE,YAAqB;QAC7D,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,KAAK,GAAG,IAAI,YAAY,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,CAAG,qBAAqB;QACrE,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;QAClB,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;QAC7B,IAAI,CAAC,aAAa,GAAG,CAAC,SAAS,KAAK,YAAY,IAAI,YAAY,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CA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G,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;YAC5B,IAAI,EAAE,GAAG,EAAE;gBAAE,OAAO,CAAC,CAAC;YACtB,IAAI,EAAE,GAAG,EAAE;gBAAE,OAAO,CAAC,CAAC,CAAC;SACxB;QACD,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,wDAAwD;IAC1E,CAAC;IAED,oFAAoF;IAC7E,SAAS,CAAC,UAAkB,EAAE,cAAsB;QACzD,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,UAAU,GAAG,cAAc,CAAC,CAAC;IACrD,CAAC;IACD,+BAA+B;IACxB,aAAa,CAAC,KAAsB,EAAE,YAAoB,QAAQ,CAAC,mBAAmB;QAC3F,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC5B,IAAI,KAAK,CAAC,QAAQ,KAAK,KAAK;YAC1B,OAAO,KAAK,CAAC;QACf,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAC1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE;YAClC,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS;gBAC3C,OAAO,KAAK,CAAC;SAChB;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module ArraysAndInterfaces\r\n */\r\n\r\nimport { Geometry } from \"../Geometry\";\r\nimport { MultiLineStringDataVariant } from \"../topology/Triangulation\";\r\nimport { GrowableXYZArray } from \"./GrowableXYZArray\";\r\nimport { IndexedXYCollection } from \"./IndexedXYCollection\";\r\nimport { Matrix3d } from \"./Matrix3d\";\r\nimport { Point2d, Vector2d } from \"./Point2dVector2d\";\r\nimport { Point3d } from \"./Point3dVector3d\";\r\nimport { PointStreamGrowableXYZArrayCollector, VariantPointDataStream } from \"./PointStreaming\";\r\nimport { Range2d } from \"./Range\";\r\nimport { Transform } from \"./Transform\";\r\nimport { XAndY, XYAndZ } from \"./XYZProps\";\r\n\r\n/** `GrowableXYArray` manages a (possibly growing) Float64Array to pack xy coordinates.\r\n * @public\r\n */\r\nexport class GrowableXYArray extends IndexedXYCollection {\r\n /**\r\n * array of packed xy xy xy components\r\n */\r\n private _data: Float64Array;\r\n /**\r\n * Number of xy tuples (not floats) in the array\r\n */\r\n private _xyInUse: number;\r\n /**\r\n * capacity in xy tuples. (not floats)\r\n */\r\n private _xyCapacity: number;\r\n /**\r\n * multiplier used by ensureCapacity to expand requested reallocation size\r\n */\r\n private _growthFactor: number;\r\n\r\n /** Construct a new GrowablePoint2d array.\r\n * @param numPoints initial capacity in xy tuples (default 8)\r\n * @param growthFactor used by ensureCapacity to expand requested reallocation size (default 1.5)\r\n */\r\n public constructor(numPoints: number = 8, growthFactor?: number) {\r\n super();\r\n this._data = new Float64Array(numPoints * 2); // 2 values per point\r\n this._xyInUse = 0;\r\n this._xyCapacity = numPoints;\r\n this._growthFactor = (undefined !== growthFactor && growthFactor >= 1.0) ? growthFactor : 1.5;\r\n }\r\n\r\n /** Copy xy points from source array. Does not reallocate or change active point count.\r\n * @param source array to copy from\r\n * @param sourceCount copy the first sourceCount points; all points if undefined\r\n * @param destOffset copy to instance array starting at this point index; zero if undefined\r\n * @return count and offset of points copied\r\n */\r\n protected copyData(source: Float64Array | number[], sourceCount?: number, destOffset?: number): {count: number, offset: number} {\r\n // validate inputs and convert from points to entries\r\n let myOffset = (undefined !== destOffset) ? destOffset * 2 : 0;\r\n if (myOffset < 0)\r\n myOffset = 0;\r\n if (myOffset >= this._data.length)\r\n return {count: 0, offset: 0};\r\n let myCount = (undefined !== sourceCount) ? sourceCount * 2 : source.length;\r\n if (myCount > 0) {\r\n if (myCount > source.length)\r\n myCount = source.length;\r\n if (myOffset + myCount > this._data.length)\r\n myCount = this._data.length - myOffset;\r\n if (myCount % 2 !== 0)\r\n myCount -= myCount % 2;\r\n }\r\n if (myCount <= 0)\r\n return {count: 0, offset: 0};\r\n if (myCount === source.length)\r\n this._data.set(source, myOffset);\r\n else if (source instanceof Float64Array)\r\n this._data.set(source.subarray(0, myCount), myOffset);\r\n else\r\n this._data.set(source.slice(0, myCount), myOffset);\r\n return {count: myCount / 2, offset: myOffset / 2};\r\n }\r\n\r\n /** The number of points in use. When the length is increased, the array is padded with zeroes. */\r\n public get length() { return this._xyInUse; }\r\n public set length(newLength: number) { this.resize(newLength, true); }\r\n\r\n /** Return the number of float64 in use. */\r\n public get float64Length() { return this._xyInUse * 2; }\r\n /** Return the raw packed data.\r\n * * Note that the length of the returned Float64Array is a count of doubles, and includes the excess capacity\r\n */\r\n public float64Data(): Float64Array { return this._data; }\r\n\r\n /** If necessary, increase the capacity to a new pointCount. Current coordinates and point count (length) are unchanged. */\r\n public ensureCapacity(pointCapacity: number, applyGrowthFactor: boolean = true) {\r\n if (pointCapacity > this._xyCapacity) {\r\n if (applyGrowthFactor)\r\n pointCapacity *= this._growthFactor;\r\n const prevData = this._data;\r\n this._data = new Float64Array(pointCapacity * 2);\r\n this.copyData(prevData, this._xyInUse);\r\n this._xyCapacity = pointCapacity;\r\n }\r\n }\r\n /**\r\n * * If pointCount is less than current length, just reset current length to pointCount, effectively trimming active points but preserving original capacity.\r\n * * If pointCount is greater than current length, reallocate to exactly pointCount, copy existing points, and optionally pad excess with zero.\r\n * @param pointCount new number of active points in array\r\n * @param padWithZero when increasing point count, whether to zero out new points (default false)\r\n */\r\n public resize(pointCount: number, padWithZero?: boolean) {\r\n if (pointCount >= 0 && pointCount < this._xyInUse)\r\n this._xyInUse = pointCount;\r\n else if (pointCount > this._xyInUse) {\r\n this.ensureCapacity(pointCount, false);\r\n if (padWithZero ?? false)\r\n this._data.fill(0, this._xyInUse * 2);\r\n this._xyInUse = pointCount;\r\n }\r\n }\r\n /**\r\n * Make a copy of the (active) points in this array.\r\n * (The clone does NOT get excess capacity)\r\n */\r\n public clone(): GrowableXYArray {\r\n const newPoints = new GrowableXYArray(this.length);\r\n newPoints.copyData(this._data, this.length);\r\n newPoints._xyInUse = this.length;\r\n return newPoints;\r\n }\r\n /** Create an array populated from\r\n * * An array of Point2d\r\n * * An array of Point3d (hidden as XAndY)\r\n * * An array of objects with keyed values, et `{x:1, y:1}`\r\n * * A `GrowableXYZArray`\r\n */\r\n public static create(data: XAndY[] | GrowableXYZArray): GrowableXYArray {\r\n const newPoints = new GrowableXYArray(data.length);\r\n if (data instanceof GrowableXYZArray) {\r\n newPoints.pushAllXYAndZ(data);\r\n } else {\r\n newPoints.pushAll(data);\r\n }\r\n return newPoints;\r\n }\r\n\r\n /** Restructure MultiLineStringDataVariant as array of GrowableXYZArray */\r\n public static createArrayOfGrowableXYZArray(data: MultiLineStringDataVariant): GrowableXYZArray[] | undefined {\r\n const collector = new PointStreamGrowableXYZArrayCollector();\r\n VariantPointDataStream.streamXYZ(data, collector);\r\n return collector.claimArrayOfGrowableXYZArray();\r\n }\r\n /** push a point to the end of the array */\r\n public push(toPush: XAndY) {\r\n this.pushXY(toPush.x, toPush.y);\r\n }\r\n\r\n /** push all points of an array */\r\n public pushAll(points: XAndY[]) {\r\n this.ensureCapacity(this._xyInUse + points.length, false);\r\n for (const p of points) this.push(p);\r\n }\r\n /** push all points of an array */\r\n public pushAllXYAndZ(points: XYAndZ[] | GrowableXYZArray) {\r\n this.ensureCapacity(this._xyInUse + points.length, false);\r\n if (points instanceof GrowableXYZArray) {\r\n const xyzBuffer = points.float64Data();\r\n const n = points.length * 3;\r\n for (let i = 0; i + 2 < n; i += 3)\r\n this.pushXY(xyzBuffer[i], xyzBuffer[i + 1]);\r\n } else {\r\n for (const p of points) this.pushXY(p.x, p.y);\r\n }\r\n }\r\n\r\n /**\r\n * Replicate numWrap xy values from the front of the array as new values at the end.\r\n * @param numWrap number of xy values to replicate\r\n */\r\n public pushWrap(numWrap: number) {\r\n if (this._xyInUse >= numWrap) {\r\n this.ensureCapacity(this._xyInUse + numWrap, false);\r\n for (let i = 0; i < numWrap; i++) {\r\n const k = 2 * i;\r\n this.pushXY(this._data[k], this._data[k + 1]);\r\n }\r\n }\r\n }\r\n /** push a point given by x,y coordinates */\r\n public pushXY(x: number, y: number) {\r\n this.ensureCapacity(this._xyInUse + 1);\r\n const index = this._xyInUse * 2;\r\n this._data[index] = x;\r\n this._data[index + 1] = y;\r\n this._xyInUse++;\r\n }\r\n\r\n /** Remove one point from the back.\r\n * * NOTE that (in the manner of std::vector native) this is \"just\" removing the point -- no point is NOT returned.\r\n * * Use `back ()` to get the last x,y assembled into a `Point2d `\r\n */\r\n public pop() {\r\n if (this._xyInUse > 0)\r\n this._xyInUse--;\r\n }\r\n /**\r\n * Test if index is valid for an xy (point or vector) within this array\r\n * @param index xy index to test.\r\n */\r\n public isIndexValid(index: number): boolean {\r\n if (index >= this._xyInUse || index < 0)\r\n return false;\r\n return true;\r\n }\r\n /**\r\n * Clear all xy data, but leave capacity unchanged.\r\n */\r\n public clear() {\r\n this._xyInUse = 0;\r\n }\r\n /**\r\n * Get a point by index, strongly typed as a Point2d. This is unchecked. Use atPoint2dIndex to have validity test.\r\n * @param pointIndex index to access\r\n * @param result optional result\r\n */\r\n public getPoint2dAtUncheckedPointIndex(pointIndex: number, result?: Point2d): Point2d {\r\n const index = 2 * pointIndex;\r\n return Point2d.create(this._data[index], this._data[index + 1], result);\r\n }\r\n\r\n /**\r\n * Get x coordinate by point index, with no index checking\r\n * @param pointIndex index to access\r\n */\r\n public getXAtUncheckedPointIndex(pointIndex: number): number {\r\n return this._data[2 * pointIndex];\r\n }\r\n\r\n /**\r\n * Get y coordinate by index, with no index checking\r\n * @param pointIndex index to access\r\n */\r\n public getYAtUncheckedPointIndex(pointIndex: number): number {\r\n return this._data[2 * pointIndex + 1];\r\n }\r\n\r\n /**\r\n * Gather all points as a Point2d[]\r\n */\r\n public getPoint2dArray(): Point2d[] {\r\n const n = 2 * this._xyInUse;\r\n const result = [];\r\n const data = this._data;\r\n for (let i = 0; i < n; i += 2)\r\n result.push(Point2d.create(data[i], data[i + 1]));\r\n return result;\r\n }\r\n\r\n /** copy xy into strongly typed Point2d */\r\n public getPoint2dAtCheckedPointIndex(pointIndex: number, result?: Point2d): Point2d | undefined {\r\n if (this.isIndexValid(pointIndex)) {\r\n const index = 2 * pointIndex;\r\n return Point2d.create(this._data[index], this._data[index + 1], result);\r\n }\r\n return undefined;\r\n }\r\n\r\n /** copy xy into strongly typed Vector2d */\r\n public getVector2dAtCheckedVectorIndex(vectorIndex: number, result?: Vector2d): Vector2d | undefined {\r\n if (this.isIndexValid(vectorIndex)) {\r\n const index = 2 * vectorIndex;\r\n return Vector2d.create(this._data[index], this._data[index + 1], result);\r\n }\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Read coordinates from source array, place them at index within this array.\r\n * @param destIndex point index where coordinates are to be placed in this array\r\n * @param source source array\r\n * @param sourceIndex point index in source array\r\n * @returns true if destIndex and sourceIndex are both valid.\r\n */\r\n public transferFromGrowableXYArray(destIndex: number, source: GrowableXYArray, sourceIndex: number): boolean {\r\n if (this.isIndexValid(destIndex) && source.isIndexValid(sourceIndex)) {\r\n const i = destIndex * 2;\r\n const j = sourceIndex * 2;\r\n this._data[i] = source._data[j];\r\n this._data[i + 1] = source._data[j + 1];\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * push coordinates from the source array to the end of this array.\r\n * @param source source array\r\n * @param sourceIndex xy index within the source. If undefined, push entire contents of source\r\n * @returns number of points pushed.\r\n */\r\n public pushFromGrowableXYArray(source: GrowableXYArray, sourceIndex?: number): number {\r\n // full array push . . .\r\n if (sourceIndex === undefined) {\r\n const numXYAdd = source.length;\r\n this.ensureCapacity(this.length + numXYAdd, false);\r\n this.copyData(source._data, numXYAdd, this.length);\r\n this._xyInUse += numXYAdd;\r\n return numXYAdd;\r\n }\r\n // single point push . . .\r\n if (source.isIndexValid(sourceIndex)) {\r\n const j = sourceIndex * 2;\r\n this.pushXY(source._data[j], source._data[j + 1]);\r\n return 1;\r\n }\r\n return 0;\r\n }\r\n\r\n /**\r\n * * Compute a point at fractional coordinate between points i and j of source\r\n * * push onto this array.\r\n */\r\n public pushInterpolatedFromGrowableXYArray(source: GrowableXYArray, i: number, fraction: number, j: number) {\r\n if (source.isIndexValid(i) && source.isIndexValid(j)) {\r\n const fraction0 = 1.0 - fraction;\r\n const data = source._data;\r\n i = 2 * i;\r\n j = 2 * j;\r\n this.pushXY(\r\n fraction0 * data[i] + fraction * data[j],\r\n fraction0 * data[i + 1] + fraction * data[j + 1]);\r\n }\r\n }\r\n\r\n /**\r\n * Create an array of xy points from source xyz points.\r\n * @param source source array of xyz\r\n * @param transform optional transform to apply to xyz points.\r\n * @param dest optional result.\r\n */\r\n public static createFromGrowableXYZArray(source: GrowableXYZArray, transform?: Transform, dest?: GrowableXYArray) {\r\n const numPoints = source.length;\r\n if (!dest)\r\n dest = new GrowableXYArray(numPoints);\r\n else {\r\n dest.ensureCapacity(numPoints, false);\r\n dest.clear();\r\n }\r\n if (transform) {\r\n const packedXYZ = source.float64Data();\r\n const nDouble = 3 * numPoints;\r\n let x, y, z;\r\n for (let i = 0; i < nDouble; i += 3) {\r\n x = packedXYZ[i];\r\n y = packedXYZ[i + 1];\r\n z = packedXYZ[i + 2];\r\n dest.pushXY(transform.multiplyComponentXYZ(0, x, y, z), transform.multiplyComponentXYZ(1, x, y, z));\r\n }\r\n } else {\r\n dest.pushAllXYAndZ(source);\r\n }\r\n return dest;\r\n }\r\n /**\r\n * Return the first point, or undefined if the array is empty.\r\n */\r\n public front(result?: Point2d): Point2d | undefined {\r\n if (this._xyInUse === 0) return undefined;\r\n return this.getPoint2dAtUncheckedPointIndex(0, result);\r\n }\r\n /**\r\n * Return the last point, or undefined if the array is empty.\r\n */\r\n public back(result?: Point2d): Point2d | undefined {\r\n if (this._xyInUse < 1) return undefined;\r\n return this.getPoint2dAtUncheckedPointIndex(this._xyInUse - 1, result);\r\n }\r\n /**\r\n * Set the coordinates of a single point.\r\n * @param pointIndex index of point to set\r\n * @param value coordinates to set\r\n */\r\n public setAtCheckedPointIndex(pointIndex: number, value: XAndY): boolean {\r\n if (!this.isIndexValid(pointIndex))\r\n return false;\r\n const index = pointIndex * 2;\r\n this._data[index] = value.x;\r\n this._data[index + 1] = value.y;\r\n return true;\r\n }\r\n /**\r\n * Set the coordinates of a single point given as coordinates.\r\n * @param pointIndex index of point to set\r\n * @param x x coordinate\r\n * @param y y coordinate\r\n */\r\n public setXYAtCheckedPointIndex(pointIndex: number, x: number, y: number): boolean {\r\n if (!this.isIndexValid(pointIndex))\r\n return false;\r\n const index = pointIndex * 2;\r\n this._data[index] = x;\r\n this._data[index + 1] = y;\r\n return true;\r\n }\r\n /**\r\n * Set the coordinates of a single point given as coordinates.\r\n * @deprecated in 3.x. Use setXYAtCheckedPointIndex instead\r\n */\r\n public setXYZAtCheckedPointIndex(pointIndex: number, x: number, y: number): boolean {\r\n return this.setXYAtCheckedPointIndex(pointIndex, x, y);\r\n }\r\n\r\n /**\r\n * Copy all points into a simple array of Point3d with given z.\r\n */\r\n public getPoint3dArray(z: number = 0): Point3d[] {\r\n const n = 2 * this._xyInUse;\r\n const result = [];\r\n const data = this._data;\r\n for (let i = 0; i < n; i += 2)\r\n result.push(Point3d.create(data[i], data[i + 1], z));\r\n return result;\r\n }\r\n /** reverse the order of points. */\r\n public reverseInPlace() {\r\n const n = this.length;\r\n let j0, j1;\r\n let a;\r\n const data = this._data;\r\n for (let i0 = 0, i1 = n - 1; i0 < i1; i0++, i1--) {\r\n j0 = 2 * i0;\r\n j1 = 2 * i1;\r\n a = data[j0]; data[j0] = data[j1]; data[j1] = a;\r\n j0++;\r\n j1++;\r\n a = data[j0]; data[j0] = data[j1]; data[j1] = a;\r\n }\r\n }\r\n\r\n /** multiply each point by the transform, replace values. */\r\n public multiplyTransformInPlace(transform: Transform) {\r\n const data = this._data;\r\n const nDouble = this.float64Length;\r\n const coffs = transform.matrix.coffs;\r\n const origin = transform.origin;\r\n const x0 = origin.x;\r\n const y0 = origin.y;\r\n let x = 0;\r\n let y = 0;\r\n for (let i = 0; i + 1 < nDouble; i += 2) {\r\n x = data[i];\r\n y = data[i + 1];\r\n data[i] = coffs[0] * x + coffs[1] * y + x0;\r\n data[i + 1] = coffs[3] * x + coffs[4] * y + y0;\r\n }\r\n }\r\n\r\n /** multiply each xy (as a vector) by matrix, replace values. */\r\n public multiplyMatrix3dInPlace(matrix: Matrix3d) {\r\n const data = this._data;\r\n const nDouble = this.float64Length;\r\n const coffs = matrix.coffs;\r\n let x = 0;\r\n let y = 0;\r\n for (let i = 0; i + 1 < nDouble; i += 2) {\r\n x = data[i];\r\n y = data[i + 1];\r\n data[i] = coffs[0] * x + coffs[1] * y;\r\n data[i + 1] = coffs[3] * x + coffs[4] * y;\r\n }\r\n }\r\n\r\n /** multiply each point by the transform, replace values. */\r\n public tryTransformInverseInPlace(transform: Transform): boolean {\r\n const data = this._data;\r\n const nDouble = this.float64Length;\r\n const matrix = transform.matrix;\r\n matrix.computeCachedInverse(true);\r\n const coffs = matrix.inverseCoffs;\r\n if (!coffs)\r\n return false;\r\n const origin = transform.origin;\r\n const x0 = origin.x;\r\n const y0 = origin.y;\r\n let x = 0;\r\n let y = 0;\r\n for (let i = 0; i + 1 < nDouble; i += 2) {\r\n x = data[i] - x0;\r\n y = data[i + 1] - y0;\r\n data[i] = coffs[0] * x + coffs[1] * y;\r\n data[i + 1] = coffs[3] * x + coffs[4] * y;\r\n }\r\n return true;\r\n }\r\n /** Extend a `Range2d`, optionally transforming the points. */\r\n public extendRange(rangeToExtend: Range2d, transform?: Transform) {\r\n const numDouble = this.float64Length;\r\n const data = this._data;\r\n if (transform) {\r\n for (let i = 0; i + 1 < numDouble; i += 2)\r\n rangeToExtend.extendTransformedXY(transform, data[i], data[i + 1]);\r\n } else {\r\n for (let i = 0; i + 1 < numDouble; i += 2)\r\n rangeToExtend.extendXY(data[i], data[i + 1]);\r\n\r\n }\r\n }\r\n /** sum the lengths of segments between points. */\r\n public sumLengths(): number {\r\n let sum = 0.0;\r\n const n = 2 * (this._xyInUse - 1); // Length already takes into account what specifically is in use\r\n const data = this._data;\r\n for (let i = 0; i < n; i += 2) sum += Geometry.hypotenuseXY(\r\n data[i + 2] - data[i],\r\n data[i + 3] - data[i + 1]);\r\n return sum;\r\n }\r\n /**\r\n * Multiply each x,y by the scale factor.\r\n * @param factor\r\n */\r\n public scaleInPlace(factor: number) {\r\n if (this._data) {\r\n const numFloat = this.float64Length;\r\n for (let i = 0; i < numFloat; i++)\r\n this._data[i] = this._data[i] * factor;\r\n }\r\n }\r\n /** Compute a point at fractional coordinate between points i and j */\r\n public interpolate(i: number, fraction: number, j: number, result?: Point2d): Point2d | undefined {\r\n if (this.isIndexValid(i) && this.isIndexValid(j)) {\r\n const fraction0 = 1.0 - fraction;\r\n const data = this._data;\r\n i = 2 * i;\r\n j = 2 * j;\r\n return Point2d.create(\r\n fraction0 * data[i] + fraction * data[j],\r\n fraction0 * data[i + 1] + fraction * data[j + 1], result);\r\n }\r\n return undefined;\r\n }\r\n\r\n /** Sum the signed areas of the projection to xy plane */\r\n public areaXY(): number {\r\n let area = 0.0;\r\n const n = 2 * this._xyInUse; // float count !!\r\n if (n > 4) {\r\n const x0 = this._data[n - 2];\r\n const y0 = this._data[n - 1];\r\n let dx1 = this._data[0] - x0;\r\n let dy1 = this._data[1] - y0;\r\n let dx2 = 0;\r\n let dy2 = 0;\r\n for (let i = 2; i < n; i += 2, dx1 = dx2, dy1 = dy2) {\r\n dx2 = this._data[i] - x0;\r\n dy2 = this._data[i + 1] - y0;\r\n area += Geometry.crossProductXYXY(dx1, dy1, dx2, dy2);\r\n }\r\n }\r\n return 0.5 * area;\r\n }\r\n\r\n /** Compute a vector from index origin i to indexed target j */\r\n public vectorIndexIndex(i: number, j: number, result?: Vector2d): Vector2d | undefined {\r\n if (!this.isIndexValid(i) || !this.isIndexValid(j))\r\n return undefined;\r\n const data = this._data;\r\n i = 2 * i;\r\n j = 2 * j;\r\n return Vector2d.create(data[j] - data[i], data[j + 1] - data[i + 1], result);\r\n }\r\n\r\n /** Compute a vector from origin to indexed target j */\r\n public vectorXAndYIndex(origin: XAndY, j: number, result?: Vector2d): Vector2d | undefined {\r\n if (this.isIndexValid(j)) {\r\n const data = this._data;\r\n j = 2 * j;\r\n return Vector2d.create(\r\n data[j] - origin.x,\r\n data[j + 1] - origin.y, result);\r\n }\r\n return undefined;\r\n }\r\n\r\n /** Compute the cross product of vectors from from indexed origin to indexed targets i and j */\r\n public crossProductIndexIndexIndex(originIndex: number, targetAIndex: number, targetBIndex: number): number | undefined {\r\n if (this.isIndexValid(originIndex) && this.isIndexValid(targetAIndex) && this.isIndexValid(targetBIndex)) {\r\n const i = originIndex * 2;\r\n const j = targetAIndex * 2;\r\n const k = targetBIndex * 2;\r\n const data = this._data;\r\n return Geometry.crossProductXYXY(\r\n data[j] - data[i], data[j + 1] - data[i + 1],\r\n data[k] - data[i], data[k + 1] - data[i + 1]);\r\n }\r\n return undefined;\r\n }\r\n\r\n /** Compute the cross product of vectors from from origin to indexed targets i and j */\r\n public crossProductXAndYIndexIndex(origin: XAndY, targetAIndex: number, targetBIndex: number): number | undefined {\r\n if (this.isIndexValid(targetAIndex) && this.isIndexValid(targetBIndex)) {\r\n const j = targetAIndex * 2;\r\n const k = targetBIndex * 2;\r\n const data = this._data;\r\n return Geometry.crossProductXYXY(\r\n data[j] - origin.x, data[j + 1] - origin.y,\r\n data[k] - origin.x, data[k + 1] - origin.y);\r\n }\r\n return undefined;\r\n }\r\n\r\n /** Return the distance between two points in the array. */\r\n public distance(i: number, j: number): number | undefined {\r\n if (this.isIndexValid(i) && this.isIndexValid(j)) {\r\n const i0 = 2 * i;\r\n const j0 = 2 * j;\r\n return Geometry.hypotenuseXY(\r\n this._data[j0] - this._data[i0],\r\n this._data[j0 + 1] - this._data[i0 + 1]);\r\n }\r\n return undefined;\r\n }\r\n /** Return the distance between an array point and the input point. */\r\n public distanceIndexToPoint(i: number, spacePoint: Point2d): number | undefined {\r\n if (this.isIndexValid(i)) {\r\n const i0 = 2 * i;\r\n return Geometry.hypotenuseXY(\r\n spacePoint.x - this._data[i0],\r\n spacePoint.y - this._data[i0 + 1]);\r\n }\r\n return undefined;\r\n }\r\n /** Test for nearly equal arrays. */\r\n public static isAlmostEqual(dataA: GrowableXYArray | undefined, dataB: GrowableXYArray | undefined): boolean {\r\n if (dataA && dataB) {\r\n if (dataA.length !== dataB.length)\r\n return false;\r\n for (let i = 0; i < dataA.length; i++)\r\n if (!dataA.getPoint2dAtUncheckedPointIndex(i).isAlmostEqual(dataB.getPoint2dAtUncheckedPointIndex(i)))\r\n return false;\r\n return true;\r\n }\r\n // if both are null it is equal, otherwise unequal\r\n return (!dataA && !dataB);\r\n }\r\n\r\n /** Return an array of block indices sorted per compareLexicalBlock function */\r\n public sortIndicesLexical(): Uint32Array {\r\n const n = this._xyInUse;\r\n // let numCompare = 0;\r\n const result = new Uint32Array(n);\r\n for (let i = 0; i < n; i++) result[i] = i;\r\n result.sort(\r\n (blockIndexA: number, blockIndexB: number) => {\r\n // numCompare++;\r\n return this.compareLexicalBlock(blockIndexA, blockIndexB);\r\n });\r\n // console.log (n, numCompare);\r\n return result;\r\n }\r\n\r\n /** compare two blocks in simple lexical order. */\r\n public compareLexicalBlock(ia: number, ib: number): number {\r\n let ax = 0;\r\n let bx = 0;\r\n for (let i = 0; i < 2; i++) {\r\n ax = this._data[ia * 2 + i];\r\n bx = this._data[ib * 2 + i];\r\n if (ax > bx) return 1;\r\n if (ax < bx) return -1;\r\n }\r\n return ia - ib; // so original order is maintained among duplicates !!!!\r\n }\r\n\r\n /** Access a single double at offset within a block. This has no index checking. */\r\n public component(pointIndex: number, componentIndex: number): number {\r\n return this._data[2 * pointIndex + componentIndex];\r\n }\r\n /** Toleranced equality test */\r\n public isAlmostEqual(other: GrowableXYArray, tolerance: number = Geometry.smallMetricDistance): boolean {\r\n const numXY = this._xyInUse;\r\n if (other._xyInUse !== numXY)\r\n return false;\r\n const dataA = this._data;\r\n const dataB = other._data;\r\n for (let i = 0; i < 2 * numXY; i++) {\r\n if (Math.abs(dataA[i] - dataB[i]) > tolerance)\r\n return false;\r\n }\r\n return true;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"GrowableXYArray.js","sourceRoot":"","sources":["../../../src/geometry3d/GrowableXYArray.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,oCAAoC,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAKhG;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,mBAAmB;IAkBtD;;;OAGG;IACH,YAAmB,YAAoB,CAAC,EAAE,YAAqB;QAC7D,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,KAAK,GAAG,IAAI,YAAY,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,CAAG,qBAAqB;QACrE,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;QAClB,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;QAC7B,IAAI,CAAC,aAAa,GAAG,CAAC,SAAS,KAAK,YAAY,IAAI,YAAY,IAAI,GAAG,CAAC,CAA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AG,CAAC,CAAC,CAAC;YAC5B,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;YAC5B,IAAI,EAAE,GAAG,EAAE;gBAAE,OAAO,CAAC,CAAC;YACtB,IAAI,EAAE,GAAG,EAAE;gBAAE,OAAO,CAAC,CAAC,CAAC;SACxB;QACD,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,wDAAwD;IAC1E,CAAC;IAED,oFAAoF;IAC7E,SAAS,CAAC,UAAkB,EAAE,cAAsB;QACzD,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,UAAU,GAAG,cAAc,CAAC,CAAC;IACrD,CAAC;IACD,+BAA+B;IACxB,aAAa,CAAC,KAAsB,EAAE,YAAoB,QAAQ,CAAC,mBAAmB;QAC3F,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC5B,IAAI,KAAK,CAAC,QAAQ,KAAK,KAAK;YAC1B,OAAO,KAAK,CAAC;QACf,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAC1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE;YAClC,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS;gBAC3C,OAAO,KAAK,CAAC;SAChB;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module ArraysAndInterfaces\r\n */\r\n\r\nimport { Geometry } from \"../Geometry\";\r\nimport { MultiLineStringDataVariant } from \"../topology/Triangulation\";\r\nimport { GrowableXYZArray } from \"./GrowableXYZArray\";\r\nimport { IndexedXYCollection } from \"./IndexedXYCollection\";\r\nimport { Matrix3d } from \"./Matrix3d\";\r\nimport { Point2d, Vector2d } from \"./Point2dVector2d\";\r\nimport { Point3d } from \"./Point3dVector3d\";\r\nimport { PointStreamGrowableXYZArrayCollector, VariantPointDataStream } from \"./PointStreaming\";\r\nimport { Range2d } from \"./Range\";\r\nimport { Transform } from \"./Transform\";\r\nimport { XAndY, XYAndZ } from \"./XYZProps\";\r\n\r\n/** `GrowableXYArray` manages a (possibly growing) Float64Array to pack xy coordinates.\r\n * @public\r\n */\r\nexport class GrowableXYArray extends IndexedXYCollection {\r\n /**\r\n * array of packed xy xy xy components\r\n */\r\n private _data: Float64Array;\r\n /**\r\n * Number of xy tuples (not floats) in the array\r\n */\r\n private _xyInUse: number;\r\n /**\r\n * capacity in xy tuples. (not floats)\r\n */\r\n private _xyCapacity: number;\r\n /**\r\n * multiplier used by ensureCapacity to expand requested reallocation size\r\n */\r\n private _growthFactor: number;\r\n\r\n /** Construct a new GrowablePoint2d array.\r\n * @param numPoints initial capacity in xy tuples (default 8)\r\n * @param growthFactor used by ensureCapacity to expand requested reallocation size (default 1.5)\r\n */\r\n public constructor(numPoints: number = 8, growthFactor?: number) {\r\n super();\r\n this._data = new Float64Array(numPoints * 2); // 2 values per point\r\n this._xyInUse = 0;\r\n this._xyCapacity = numPoints;\r\n this._growthFactor = (undefined !== growthFactor && growthFactor >= 1.0) ? growthFactor : 1.5;\r\n }\r\n\r\n /** Copy xy points from source array. Does not reallocate or change active point count.\r\n * @param source array to copy from\r\n * @param sourceCount copy the first sourceCount points; all points if undefined\r\n * @param destOffset copy to instance array starting at this point index; zero if undefined\r\n * @return count and offset of points copied\r\n */\r\n protected copyData(source: Float64Array | number[], sourceCount?: number, destOffset?: number): {count: number, offset: number} {\r\n // validate inputs and convert from points to entries\r\n let myOffset = (undefined !== destOffset) ? destOffset * 2 : 0;\r\n if (myOffset < 0)\r\n myOffset = 0;\r\n if (myOffset >= this._data.length)\r\n return {count: 0, offset: 0};\r\n let myCount = (undefined !== sourceCount) ? sourceCount * 2 : source.length;\r\n if (myCount > 0) {\r\n if (myCount > source.length)\r\n myCount = source.length;\r\n if (myOffset + myCount > this._data.length)\r\n myCount = this._data.length - myOffset;\r\n if (myCount % 2 !== 0)\r\n myCount -= myCount % 2;\r\n }\r\n if (myCount <= 0)\r\n return {count: 0, offset: 0};\r\n if (myCount === source.length)\r\n this._data.set(source, myOffset);\r\n else if (source instanceof Float64Array)\r\n this._data.set(source.subarray(0, myCount), myOffset);\r\n else\r\n this._data.set(source.slice(0, myCount), myOffset);\r\n return {count: myCount / 2, offset: myOffset / 2};\r\n }\r\n\r\n /** The number of points in use. When the length is increased, the array is padded with zeroes. */\r\n public override get length() { return this._xyInUse; }\r\n public set length(newLength: number) { this.resize(newLength, true); }\r\n\r\n /** Return the number of float64 in use. */\r\n public get float64Length() { return this._xyInUse * 2; }\r\n /** Return the raw packed data.\r\n * * Note that the length of the returned Float64Array is a count of doubles, and includes the excess capacity\r\n */\r\n public float64Data(): Float64Array { return this._data; }\r\n\r\n /** If necessary, increase the capacity to a new pointCount. Current coordinates and point count (length) are unchanged. */\r\n public ensureCapacity(pointCapacity: number, applyGrowthFactor: boolean = true) {\r\n if (pointCapacity > this._xyCapacity) {\r\n if (applyGrowthFactor)\r\n pointCapacity *= this._growthFactor;\r\n const prevData = this._data;\r\n this._data = new Float64Array(pointCapacity * 2);\r\n this.copyData(prevData, this._xyInUse);\r\n this._xyCapacity = pointCapacity;\r\n }\r\n }\r\n /**\r\n * * If pointCount is less than current length, just reset current length to pointCount, effectively trimming active points but preserving original capacity.\r\n * * If pointCount is greater than current length, reallocate to exactly pointCount, copy existing points, and optionally pad excess with zero.\r\n * @param pointCount new number of active points in array\r\n * @param padWithZero when increasing point count, whether to zero out new points (default false)\r\n */\r\n public resize(pointCount: number, padWithZero?: boolean) {\r\n if (pointCount >= 0 && pointCount < this._xyInUse)\r\n this._xyInUse = pointCount;\r\n else if (pointCount > this._xyInUse) {\r\n this.ensureCapacity(pointCount, false);\r\n if (padWithZero ?? false)\r\n this._data.fill(0, this._xyInUse * 2);\r\n this._xyInUse = pointCount;\r\n }\r\n }\r\n /**\r\n * Make a copy of the (active) points in this array.\r\n * (The clone does NOT get excess capacity)\r\n */\r\n public clone(): GrowableXYArray {\r\n const newPoints = new GrowableXYArray(this.length);\r\n newPoints.copyData(this._data, this.length);\r\n newPoints._xyInUse = this.length;\r\n return newPoints;\r\n }\r\n /** Create an array populated from\r\n * * An array of Point2d\r\n * * An array of Point3d (hidden as XAndY)\r\n * * An array of objects with keyed values, et `{x:1, y:1}`\r\n * * A `GrowableXYZArray`\r\n */\r\n public static create(data: XAndY[] | GrowableXYZArray): GrowableXYArray {\r\n const newPoints = new GrowableXYArray(data.length);\r\n if (data instanceof GrowableXYZArray) {\r\n newPoints.pushAllXYAndZ(data);\r\n } else {\r\n newPoints.pushAll(data);\r\n }\r\n return newPoints;\r\n }\r\n\r\n /** Restructure MultiLineStringDataVariant as array of GrowableXYZArray */\r\n public static createArrayOfGrowableXYZArray(data: MultiLineStringDataVariant): GrowableXYZArray[] | undefined {\r\n const collector = new PointStreamGrowableXYZArrayCollector();\r\n VariantPointDataStream.streamXYZ(data, collector);\r\n return collector.claimArrayOfGrowableXYZArray();\r\n }\r\n /** push a point to the end of the array */\r\n public push(toPush: XAndY) {\r\n this.pushXY(toPush.x, toPush.y);\r\n }\r\n\r\n /** push all points of an array */\r\n public pushAll(points: XAndY[]) {\r\n this.ensureCapacity(this._xyInUse + points.length, false);\r\n for (const p of points) this.push(p);\r\n }\r\n /** push all points of an array */\r\n public pushAllXYAndZ(points: XYAndZ[] | GrowableXYZArray) {\r\n this.ensureCapacity(this._xyInUse + points.length, false);\r\n if (points instanceof GrowableXYZArray) {\r\n const xyzBuffer = points.float64Data();\r\n const n = points.length * 3;\r\n for (let i = 0; i + 2 < n; i += 3)\r\n this.pushXY(xyzBuffer[i], xyzBuffer[i + 1]);\r\n } else {\r\n for (const p of points) this.pushXY(p.x, p.y);\r\n }\r\n }\r\n\r\n /**\r\n * Replicate numWrap xy values from the front of the array as new values at the end.\r\n * @param numWrap number of xy values to replicate\r\n */\r\n public pushWrap(numWrap: number) {\r\n if (this._xyInUse >= numWrap) {\r\n this.ensureCapacity(this._xyInUse + numWrap, false);\r\n for (let i = 0; i < numWrap; i++) {\r\n const k = 2 * i;\r\n this.pushXY(this._data[k], this._data[k + 1]);\r\n }\r\n }\r\n }\r\n /** push a point given by x,y coordinates */\r\n public pushXY(x: number, y: number) {\r\n this.ensureCapacity(this._xyInUse + 1);\r\n const index = this._xyInUse * 2;\r\n this._data[index] = x;\r\n this._data[index + 1] = y;\r\n this._xyInUse++;\r\n }\r\n\r\n /** Remove one point from the back.\r\n * * NOTE that (in the manner of std::vector native) this is \"just\" removing the point -- no point is NOT returned.\r\n * * Use `back ()` to get the last x,y assembled into a `Point2d `\r\n */\r\n public pop() {\r\n if (this._xyInUse > 0)\r\n this._xyInUse--;\r\n }\r\n /**\r\n * Test if index is valid for an xy (point or vector) within this array\r\n * @param index xy index to test.\r\n */\r\n public isIndexValid(index: number): boolean {\r\n if (index >= this._xyInUse || index < 0)\r\n return false;\r\n return true;\r\n }\r\n /**\r\n * Clear all xy data, but leave capacity unchanged.\r\n */\r\n public clear() {\r\n this._xyInUse = 0;\r\n }\r\n /**\r\n * Get a point by index, strongly typed as a Point2d. This is unchecked. Use atPoint2dIndex to have validity test.\r\n * @param pointIndex index to access\r\n * @param result optional result\r\n */\r\n public getPoint2dAtUncheckedPointIndex(pointIndex: number, result?: Point2d): Point2d {\r\n const index = 2 * pointIndex;\r\n return Point2d.create(this._data[index], this._data[index + 1], result);\r\n }\r\n\r\n /**\r\n * Get x coordinate by point index, with no index checking\r\n * @param pointIndex index to access\r\n */\r\n public override getXAtUncheckedPointIndex(pointIndex: number): number {\r\n return this._data[2 * pointIndex];\r\n }\r\n\r\n /**\r\n * Get y coordinate by point index, with no index checking\r\n * @param pointIndex index to access\r\n */\r\n public override getYAtUncheckedPointIndex(pointIndex: number): number {\r\n return this._data[2 * pointIndex + 1];\r\n }\r\n\r\n /**\r\n * Gather all points as a Point2d[]\r\n */\r\n public getPoint2dArray(): Point2d[] {\r\n const n = 2 * this._xyInUse;\r\n const result = [];\r\n const data = this._data;\r\n for (let i = 0; i < n; i += 2)\r\n result.push(Point2d.create(data[i], data[i + 1]));\r\n return result;\r\n }\r\n\r\n /** copy xy into strongly typed Point2d */\r\n public override getPoint2dAtCheckedPointIndex(pointIndex: number, result?: Point2d): Point2d | undefined {\r\n if (this.isIndexValid(pointIndex)) {\r\n const index = 2 * pointIndex;\r\n return Point2d.create(this._data[index], this._data[index + 1], result);\r\n }\r\n return undefined;\r\n }\r\n\r\n /** copy xy into strongly typed Vector2d */\r\n public override getVector2dAtCheckedVectorIndex(vectorIndex: number, result?: Vector2d): Vector2d | undefined {\r\n if (this.isIndexValid(vectorIndex)) {\r\n const index = 2 * vectorIndex;\r\n return Vector2d.create(this._data[index], this._data[index + 1], result);\r\n }\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Read coordinates from source array, place them at index within this array.\r\n * @param destIndex point index where coordinates are to be placed in this array\r\n * @param source source array\r\n * @param sourceIndex point index in source array\r\n * @returns true if destIndex and sourceIndex are both valid.\r\n */\r\n public transferFromGrowableXYArray(destIndex: number, source: GrowableXYArray, sourceIndex: number): boolean {\r\n if (this.isIndexValid(destIndex) && source.isIndexValid(sourceIndex)) {\r\n const i = destIndex * 2;\r\n const j = sourceIndex * 2;\r\n this._data[i] = source._data[j];\r\n this._data[i + 1] = source._data[j + 1];\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * push coordinates from the source array to the end of this array.\r\n * @param source source array\r\n * @param sourceIndex xy index within the source. If undefined, push entire contents of source\r\n * @returns number of points pushed.\r\n */\r\n public pushFromGrowableXYArray(source: GrowableXYArray, sourceIndex?: number): number {\r\n // full array push . . .\r\n if (sourceIndex === undefined) {\r\n const numXYAdd = source.length;\r\n this.ensureCapacity(this.length + numXYAdd, false);\r\n this.copyData(source._data, numXYAdd, this.length);\r\n this._xyInUse += numXYAdd;\r\n return numXYAdd;\r\n }\r\n // single point push . . .\r\n if (source.isIndexValid(sourceIndex)) {\r\n const j = sourceIndex * 2;\r\n this.pushXY(source._data[j], source._data[j + 1]);\r\n return 1;\r\n }\r\n return 0;\r\n }\r\n\r\n /**\r\n * * Compute a point at fractional coordinate between points i and j of source\r\n * * push onto this array.\r\n */\r\n public pushInterpolatedFromGrowableXYArray(source: GrowableXYArray, i: number, fraction: number, j: number) {\r\n if (source.isIndexValid(i) && source.isIndexValid(j)) {\r\n const fraction0 = 1.0 - fraction;\r\n const data = source._data;\r\n i = 2 * i;\r\n j = 2 * j;\r\n this.pushXY(\r\n fraction0 * data[i] + fraction * data[j],\r\n fraction0 * data[i + 1] + fraction * data[j + 1]);\r\n }\r\n }\r\n\r\n /**\r\n * Create an array of xy points from source xyz points.\r\n * @param source source array of xyz\r\n * @param transform optional transform to apply to xyz points.\r\n * @param dest optional result.\r\n */\r\n public static createFromGrowableXYZArray(source: GrowableXYZArray, transform?: Transform, dest?: GrowableXYArray) {\r\n const numPoints = source.length;\r\n if (!dest)\r\n dest = new GrowableXYArray(numPoints);\r\n else {\r\n dest.ensureCapacity(numPoints, false);\r\n dest.clear();\r\n }\r\n if (transform) {\r\n const packedXYZ = source.float64Data();\r\n const nDouble = 3 * numPoints;\r\n let x, y, z;\r\n for (let i = 0; i < nDouble; i += 3) {\r\n x = packedXYZ[i];\r\n y = packedXYZ[i + 1];\r\n z = packedXYZ[i + 2];\r\n dest.pushXY(transform.multiplyComponentXYZ(0, x, y, z), transform.multiplyComponentXYZ(1, x, y, z));\r\n }\r\n } else {\r\n dest.pushAllXYAndZ(source);\r\n }\r\n return dest;\r\n }\r\n /**\r\n * Return the first point, or undefined if the array is empty.\r\n */\r\n public front(result?: Point2d): Point2d | undefined {\r\n if (this._xyInUse === 0) return undefined;\r\n return this.getPoint2dAtUncheckedPointIndex(0, result);\r\n }\r\n /**\r\n * Return the last point, or undefined if the array is empty.\r\n */\r\n public back(result?: Point2d): Point2d | undefined {\r\n if (this._xyInUse < 1) return undefined;\r\n return this.getPoint2dAtUncheckedPointIndex(this._xyInUse - 1, result);\r\n }\r\n /**\r\n * Set the coordinates of a single point.\r\n * @param pointIndex index of point to set\r\n * @param value coordinates to set\r\n */\r\n public setAtCheckedPointIndex(pointIndex: number, value: XAndY): boolean {\r\n if (!this.isIndexValid(pointIndex))\r\n return false;\r\n const index = pointIndex * 2;\r\n this._data[index] = value.x;\r\n this._data[index + 1] = value.y;\r\n return true;\r\n }\r\n /**\r\n * Set the coordinates of a single point given as coordinates.\r\n * @param pointIndex index of point to set\r\n * @param x x coordinate\r\n * @param y y coordinate\r\n */\r\n public setXYAtCheckedPointIndex(pointIndex: number, x: number, y: number): boolean {\r\n if (!this.isIndexValid(pointIndex))\r\n return false;\r\n const index = pointIndex * 2;\r\n this._data[index] = x;\r\n this._data[index + 1] = y;\r\n return true;\r\n }\r\n /**\r\n * Set the coordinates of a single point given as coordinates.\r\n * @deprecated in 3.x. Use setXYAtCheckedPointIndex instead\r\n */\r\n public setXYZAtCheckedPointIndex(pointIndex: number, x: number, y: number): boolean {\r\n return this.setXYAtCheckedPointIndex(pointIndex, x, y);\r\n }\r\n\r\n /**\r\n * Copy all points into a simple array of Point3d with given z.\r\n */\r\n public getPoint3dArray(z: number = 0): Point3d[] {\r\n const n = 2 * this._xyInUse;\r\n const result = [];\r\n const data = this._data;\r\n for (let i = 0; i < n; i += 2)\r\n result.push(Point3d.create(data[i], data[i + 1], z));\r\n return result;\r\n }\r\n /** reverse the order of points. */\r\n public reverseInPlace() {\r\n const n = this.length;\r\n let j0, j1;\r\n let a;\r\n const data = this._data;\r\n for (let i0 = 0, i1 = n - 1; i0 < i1; i0++, i1--) {\r\n j0 = 2 * i0;\r\n j1 = 2 * i1;\r\n a = data[j0]; data[j0] = data[j1]; data[j1] = a;\r\n j0++;\r\n j1++;\r\n a = data[j0]; data[j0] = data[j1]; data[j1] = a;\r\n }\r\n }\r\n\r\n /** multiply each point by the transform, replace values. */\r\n public multiplyTransformInPlace(transform: Transform) {\r\n const data = this._data;\r\n const nDouble = this.float64Length;\r\n const coffs = transform.matrix.coffs;\r\n const origin = transform.origin;\r\n const x0 = origin.x;\r\n const y0 = origin.y;\r\n let x = 0;\r\n let y = 0;\r\n for (let i = 0; i + 1 < nDouble; i += 2) {\r\n x = data[i];\r\n y = data[i + 1];\r\n data[i] = coffs[0] * x + coffs[1] * y + x0;\r\n data[i + 1] = coffs[3] * x + coffs[4] * y + y0;\r\n }\r\n }\r\n\r\n /** multiply each xy (as a vector) by matrix, replace values. */\r\n public multiplyMatrix3dInPlace(matrix: Matrix3d) {\r\n const data = this._data;\r\n const nDouble = this.float64Length;\r\n const coffs = matrix.coffs;\r\n let x = 0;\r\n let y = 0;\r\n for (let i = 0; i + 1 < nDouble; i += 2) {\r\n x = data[i];\r\n y = data[i + 1];\r\n data[i] = coffs[0] * x + coffs[1] * y;\r\n data[i + 1] = coffs[3] * x + coffs[4] * y;\r\n }\r\n }\r\n\r\n /** multiply each point by the transform, replace values. */\r\n public tryTransformInverseInPlace(transform: Transform): boolean {\r\n const data = this._data;\r\n const nDouble = this.float64Length;\r\n const matrix = transform.matrix;\r\n matrix.computeCachedInverse(true);\r\n const coffs = matrix.inverseCoffs;\r\n if (!coffs)\r\n return false;\r\n const origin = transform.origin;\r\n const x0 = origin.x;\r\n const y0 = origin.y;\r\n let x = 0;\r\n let y = 0;\r\n for (let i = 0; i + 1 < nDouble; i += 2) {\r\n x = data[i] - x0;\r\n y = data[i + 1] - y0;\r\n data[i] = coffs[0] * x + coffs[1] * y;\r\n data[i + 1] = coffs[3] * x + coffs[4] * y;\r\n }\r\n return true;\r\n }\r\n /** Extend a `Range2d`, optionally transforming the points. */\r\n public extendRange(rangeToExtend: Range2d, transform?: Transform) {\r\n const numDouble = this.float64Length;\r\n const data = this._data;\r\n if (transform) {\r\n for (let i = 0; i + 1 < numDouble; i += 2)\r\n rangeToExtend.extendTransformedXY(transform, data[i], data[i + 1]);\r\n } else {\r\n for (let i = 0; i + 1 < numDouble; i += 2)\r\n rangeToExtend.extendXY(data[i], data[i + 1]);\r\n\r\n }\r\n }\r\n /** sum the lengths of segments between points. */\r\n public sumLengths(): number {\r\n let sum = 0.0;\r\n const n = 2 * (this._xyInUse - 1); // Length already takes into account what specifically is in use\r\n const data = this._data;\r\n for (let i = 0; i < n; i += 2) sum += Geometry.hypotenuseXY(\r\n data[i + 2] - data[i],\r\n data[i + 3] - data[i + 1]);\r\n return sum;\r\n }\r\n /**\r\n * Multiply each x,y by the scale factor.\r\n * @param factor\r\n */\r\n public scaleInPlace(factor: number) {\r\n if (this._data) {\r\n const numFloat = this.float64Length;\r\n for (let i = 0; i < numFloat; i++)\r\n this._data[i] = this._data[i] * factor;\r\n }\r\n }\r\n /** Compute a point at fractional coordinate between points i and j */\r\n public interpolate(i: number, fraction: number, j: number, result?: Point2d): Point2d | undefined {\r\n if (this.isIndexValid(i) && this.isIndexValid(j)) {\r\n const fraction0 = 1.0 - fraction;\r\n const data = this._data;\r\n i = 2 * i;\r\n j = 2 * j;\r\n return Point2d.create(\r\n fraction0 * data[i] + fraction * data[j],\r\n fraction0 * data[i + 1] + fraction * data[j + 1], result);\r\n }\r\n return undefined;\r\n }\r\n\r\n /** Sum the signed areas of the projection to xy plane */\r\n public areaXY(): number {\r\n let area = 0.0;\r\n const n = 2 * this._xyInUse; // float count !!\r\n if (n > 4) {\r\n const x0 = this._data[n - 2];\r\n const y0 = this._data[n - 1];\r\n let dx1 = this._data[0] - x0;\r\n let dy1 = this._data[1] - y0;\r\n let dx2 = 0;\r\n let dy2 = 0;\r\n for (let i = 2; i < n; i += 2, dx1 = dx2, dy1 = dy2) {\r\n dx2 = this._data[i] - x0;\r\n dy2 = this._data[i + 1] - y0;\r\n area += Geometry.crossProductXYXY(dx1, dy1, dx2, dy2);\r\n }\r\n }\r\n return 0.5 * area;\r\n }\r\n\r\n /** Compute a vector from index origin i to indexed target j */\r\n public override vectorIndexIndex(i: number, j: number, result?: Vector2d): Vector2d | undefined {\r\n if (!this.isIndexValid(i) || !this.isIndexValid(j))\r\n return undefined;\r\n const data = this._data;\r\n i = 2 * i;\r\n j = 2 * j;\r\n return Vector2d.create(data[j] - data[i], data[j + 1] - data[i + 1], result);\r\n }\r\n\r\n /** Compute a vector from origin to indexed target j */\r\n public override vectorXAndYIndex(origin: XAndY, j: number, result?: Vector2d): Vector2d | undefined {\r\n if (this.isIndexValid(j)) {\r\n const data = this._data;\r\n j = 2 * j;\r\n return Vector2d.create(\r\n data[j] - origin.x,\r\n data[j + 1] - origin.y, result);\r\n }\r\n return undefined;\r\n }\r\n\r\n /** Compute the cross product of vectors from from indexed origin to indexed targets i and j */\r\n public override crossProductIndexIndexIndex(originIndex: number, targetAIndex: number, targetBIndex: number): number | undefined {\r\n if (this.isIndexValid(originIndex) && this.isIndexValid(targetAIndex) && this.isIndexValid(targetBIndex)) {\r\n const i = originIndex * 2;\r\n const j = targetAIndex * 2;\r\n const k = targetBIndex * 2;\r\n const data = this._data;\r\n return Geometry.crossProductXYXY(\r\n data[j] - data[i], data[j + 1] - data[i + 1],\r\n data[k] - data[i], data[k + 1] - data[i + 1]);\r\n }\r\n return undefined;\r\n }\r\n\r\n /** Compute the cross product of vectors from from origin to indexed targets i and j */\r\n public override crossProductXAndYIndexIndex(origin: XAndY, targetAIndex: number, targetBIndex: number): number | undefined {\r\n if (this.isIndexValid(targetAIndex) && this.isIndexValid(targetBIndex)) {\r\n const j = targetAIndex * 2;\r\n const k = targetBIndex * 2;\r\n const data = this._data;\r\n return Geometry.crossProductXYXY(\r\n data[j] - origin.x, data[j + 1] - origin.y,\r\n data[k] - origin.x, data[k + 1] - origin.y);\r\n }\r\n return undefined;\r\n }\r\n\r\n /** Return the distance between two points in the array. */\r\n public distance(i: number, j: number): number | undefined {\r\n if (this.isIndexValid(i) && this.isIndexValid(j)) {\r\n const i0 = 2 * i;\r\n const j0 = 2 * j;\r\n return Geometry.hypotenuseXY(\r\n this._data[j0] - this._data[i0],\r\n this._data[j0 + 1] - this._data[i0 + 1]);\r\n }\r\n return undefined;\r\n }\r\n /** Return the distance between an array point and the input point. */\r\n public distanceIndexToPoint(i: number, spacePoint: Point2d): number | undefined {\r\n if (this.isIndexValid(i)) {\r\n const i0 = 2 * i;\r\n return Geometry.hypotenuseXY(\r\n spacePoint.x - this._data[i0],\r\n spacePoint.y - this._data[i0 + 1]);\r\n }\r\n return undefined;\r\n }\r\n /** Test for nearly equal arrays. */\r\n public static isAlmostEqual(dataA: GrowableXYArray | undefined, dataB: GrowableXYArray | undefined): boolean {\r\n if (dataA && dataB) {\r\n if (dataA.length !== dataB.length)\r\n return false;\r\n for (let i = 0; i < dataA.length; i++)\r\n if (!dataA.getPoint2dAtUncheckedPointIndex(i).isAlmostEqual(dataB.getPoint2dAtUncheckedPointIndex(i)))\r\n return false;\r\n return true;\r\n }\r\n // if both are null it is equal, otherwise unequal\r\n return (!dataA && !dataB);\r\n }\r\n\r\n /** Return an array of block indices sorted per compareLexicalBlock function */\r\n public sortIndicesLexical(): Uint32Array {\r\n const n = this._xyInUse;\r\n // let numCompare = 0;\r\n const result = new Uint32Array(n);\r\n for (let i = 0; i < n; i++) result[i] = i;\r\n result.sort(\r\n (blockIndexA: number, blockIndexB: number) => {\r\n // numCompare++;\r\n return this.compareLexicalBlock(blockIndexA, blockIndexB);\r\n });\r\n // console.log (n, numCompare);\r\n return result;\r\n }\r\n\r\n /** compare two blocks in simple lexical order. */\r\n public compareLexicalBlock(ia: number, ib: number): number {\r\n let ax = 0;\r\n let bx = 0;\r\n for (let i = 0; i < 2; i++) {\r\n ax = this._data[ia * 2 + i];\r\n bx = this._data[ib * 2 + i];\r\n if (ax > bx) return 1;\r\n if (ax < bx) return -1;\r\n }\r\n return ia - ib; // so original order is maintained among duplicates !!!!\r\n }\r\n\r\n /** Access a single double at offset within a block. This has no index checking. */\r\n public component(pointIndex: number, componentIndex: number): number {\r\n return this._data[2 * pointIndex + componentIndex];\r\n }\r\n /** Toleranced equality test */\r\n public isAlmostEqual(other: GrowableXYArray, tolerance: number = Geometry.smallMetricDistance): boolean {\r\n const numXY = this._xyInUse;\r\n if (other._xyInUse !== numXY)\r\n return false;\r\n const dataA = this._data;\r\n const dataB = other._data;\r\n for (let i = 0; i < 2 * numXY; i++) {\r\n if (Math.abs(dataA[i] - dataB[i]) > tolerance)\r\n return false;\r\n }\r\n return true;\r\n }\r\n}\r\n"]}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/** @packageDocumentation
|
|
2
2
|
* @module ArraysAndInterfaces
|
|
3
3
|
*/
|
|
4
|
-
import { Point2d, Vector2d } from "./Point2dVector2d";
|
|
4
|
+
import { Point2d, Vector2d, XY } from "./Point2dVector2d";
|
|
5
5
|
import { XAndY } from "./XYZProps";
|
|
6
6
|
/**
|
|
7
|
-
* abstract base class for access to
|
|
8
|
-
* * This allows algorithms to work with Point2d[] or
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* * In addition to "point by point" accessors,
|
|
7
|
+
* abstract base class for access to XY data with indexed reference.
|
|
8
|
+
* * This allows algorithms to work with Point2d[] or GrowableXY.
|
|
9
|
+
* * GrowableXYArray implements these for its data.
|
|
10
|
+
* * Point2dArrayCarrier carries a (reference to) a Point2d[] and implements the methods with calls on that array reference.
|
|
11
|
+
* * In addition to "point by point" accessors, other abstract members compute commonly useful vector data "between points".
|
|
12
12
|
* * Methods that create vectors among multiple indices allow callers to avoid creating temporaries.
|
|
13
13
|
* @public
|
|
14
14
|
*/
|
|
@@ -62,8 +62,23 @@ export declare abstract class IndexedXYCollection {
|
|
|
62
62
|
*/
|
|
63
63
|
abstract crossProductIndexIndexIndex(origin: number, indexA: number, indexB: number): number | undefined;
|
|
64
64
|
/**
|
|
65
|
-
* read-only property for number of
|
|
65
|
+
* read-only property for number of XY in the collection.
|
|
66
66
|
*/
|
|
67
67
|
abstract get length(): number;
|
|
68
|
+
private static _workPoint?;
|
|
69
|
+
/** access x of indexed point
|
|
70
|
+
* * Subclasses may wish to override with a more efficient implementation.
|
|
71
|
+
*/
|
|
72
|
+
getXAtUncheckedPointIndex(pointIndex: number): number;
|
|
73
|
+
/** access y of indexed point
|
|
74
|
+
* * Subclasses may wish to override with a more efficient implementation.
|
|
75
|
+
*/
|
|
76
|
+
getYAtUncheckedPointIndex(pointIndex: number): number;
|
|
77
|
+
/** Compute the linear combination s of the indexed p_i and given scales s_i.
|
|
78
|
+
* @param scales array of scales. For best results, scales should have same length as the instance.
|
|
79
|
+
* @param result optional pre-allocated object to fill and return
|
|
80
|
+
* @return s = sum(p_i * s_i), where i ranges from 0 to min(this.length, scales.length).
|
|
81
|
+
*/
|
|
82
|
+
linearCombination(scales: number[], result?: Point2d | Vector2d): XY;
|
|
68
83
|
}
|
|
69
84
|
//# sourceMappingURL=IndexedXYCollection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IndexedXYCollection.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/IndexedXYCollection.ts"],"names":[],"mappings":"AAKA;;GAEG;
|
|
1
|
+
{"version":3,"file":"IndexedXYCollection.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/IndexedXYCollection.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC;;;;;;;;GAQG;AACH,8BAAsB,mBAAmB;IACvC;;;;;OAKG;aACa,6BAA6B,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS;IACnG;;;;;OAKG;aACa,+BAA+B,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS;IACvG;;;;;;OAMG;aACa,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS;IACzG;;;;;;OAMG;aACa,gBAAgB,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS;IAExG;;;;;;;OAOG;aACa,2BAA2B,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAC9G;;;;;;;OAOG;aACa,2BAA2B,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAE/G;;OAEG;IACH,aAAoB,MAAM,IAAI,MAAM,CAAC;IAErC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAU;IAEpC;;OAEG;IACI,yBAAyB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;IAO5D;;OAEG;IACI,yBAAyB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;IAO5D;;;;OAIG;IACI,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,EAAE;CAS5E"}
|
|
@@ -2,15 +2,51 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/** @packageDocumentation
|
|
6
|
+
* @module ArraysAndInterfaces
|
|
7
|
+
*/
|
|
8
|
+
import { Point2d, Vector2d } from "./Point2dVector2d";
|
|
5
9
|
/**
|
|
6
|
-
* abstract base class for access to
|
|
7
|
-
* * This allows algorithms to work with Point2d[] or
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* * In addition to "point by point" accessors,
|
|
10
|
+
* abstract base class for access to XY data with indexed reference.
|
|
11
|
+
* * This allows algorithms to work with Point2d[] or GrowableXY.
|
|
12
|
+
* * GrowableXYArray implements these for its data.
|
|
13
|
+
* * Point2dArrayCarrier carries a (reference to) a Point2d[] and implements the methods with calls on that array reference.
|
|
14
|
+
* * In addition to "point by point" accessors, other abstract members compute commonly useful vector data "between points".
|
|
11
15
|
* * Methods that create vectors among multiple indices allow callers to avoid creating temporaries.
|
|
12
16
|
* @public
|
|
13
17
|
*/
|
|
14
18
|
export class IndexedXYCollection {
|
|
19
|
+
/** access x of indexed point
|
|
20
|
+
* * Subclasses may wish to override with a more efficient implementation.
|
|
21
|
+
*/
|
|
22
|
+
getXAtUncheckedPointIndex(pointIndex) {
|
|
23
|
+
const pt = this.getPoint2dAtCheckedPointIndex(pointIndex, IndexedXYCollection._workPoint);
|
|
24
|
+
if (undefined === IndexedXYCollection._workPoint)
|
|
25
|
+
IndexedXYCollection._workPoint = pt; // allocate the cache
|
|
26
|
+
return pt ? pt.x : 0.0;
|
|
27
|
+
}
|
|
28
|
+
/** access y of indexed point
|
|
29
|
+
* * Subclasses may wish to override with a more efficient implementation.
|
|
30
|
+
*/
|
|
31
|
+
getYAtUncheckedPointIndex(pointIndex) {
|
|
32
|
+
const pt = this.getPoint2dAtCheckedPointIndex(pointIndex, IndexedXYCollection._workPoint);
|
|
33
|
+
if (undefined === IndexedXYCollection._workPoint)
|
|
34
|
+
IndexedXYCollection._workPoint = pt; // allocate the cache
|
|
35
|
+
return pt ? pt.y : 0.0;
|
|
36
|
+
}
|
|
37
|
+
/** Compute the linear combination s of the indexed p_i and given scales s_i.
|
|
38
|
+
* @param scales array of scales. For best results, scales should have same length as the instance.
|
|
39
|
+
* @param result optional pre-allocated object to fill and return
|
|
40
|
+
* @return s = sum(p_i * s_i), where i ranges from 0 to min(this.length, scales.length).
|
|
41
|
+
*/
|
|
42
|
+
linearCombination(scales, result) {
|
|
43
|
+
const n = Math.min(this.length, scales.length);
|
|
44
|
+
const sum = (result instanceof Vector2d) ? Vector2d.createZero(result) : Point2d.createZero(result);
|
|
45
|
+
for (let i = 0; i < n; ++i) {
|
|
46
|
+
sum.x += scales[i] * this.getXAtUncheckedPointIndex(i);
|
|
47
|
+
sum.y += scales[i] * this.getYAtUncheckedPointIndex(i);
|
|
48
|
+
}
|
|
49
|
+
return sum;
|
|
50
|
+
}
|
|
15
51
|
}
|
|
16
52
|
//# sourceMappingURL=IndexedXYCollection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IndexedXYCollection.js","sourceRoot":"","sources":["../../../src/geometry3d/IndexedXYCollection.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;
|
|
1
|
+
{"version":3,"file":"IndexedXYCollection.js","sourceRoot":"","sources":["../../../src/geometry3d/IndexedXYCollection.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAM,MAAM,mBAAmB,CAAC;AAI1D;;;;;;;;GAQG;AACH,MAAM,OAAgB,mBAAmB;IA0DvC;;OAEG;IACI,yBAAyB,CAAC,UAAkB;QACjD,MAAM,EAAE,GAAG,IAAI,CAAC,6BAA6B,CAAC,UAAU,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC;QAC1F,IAAI,SAAS,KAAK,mBAAmB,CAAC,UAAU;YAC9C,mBAAmB,CAAC,UAAU,GAAG,EAAE,CAAC,CAAE,qBAAqB;QAC7D,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IACzB,CAAC;IAED;;OAEG;IACI,yBAAyB,CAAC,UAAkB;QACjD,MAAM,EAAE,GAAG,IAAI,CAAC,6BAA6B,CAAC,UAAU,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC;QAC1F,IAAI,SAAS,KAAK,mBAAmB,CAAC,UAAU;YAC9C,mBAAmB,CAAC,UAAU,GAAG,EAAE,CAAC,CAAE,qBAAqB;QAC7D,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IACzB,CAAC;IAED;;;;OAIG;IACI,iBAAiB,CAAC,MAAgB,EAAE,MAA2B;QACpE,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;QAC/C,MAAM,GAAG,GAAG,CAAC,MAAM,YAAY,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACpG,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,EAAE;YAC1B,GAAG,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC;YACvD,GAAG,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC;SACxD;QACD,OAAO,GAAG,CAAC;IACb,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module ArraysAndInterfaces\r\n */\r\n\r\nimport { Point2d, Vector2d, XY } from \"./Point2dVector2d\";\r\n/* eslint-disable @typescript-eslint/naming-convention, no-empty */\r\nimport { XAndY } from \"./XYZProps\";\r\n\r\n/**\r\n * abstract base class for access to XY data with indexed reference.\r\n * * This allows algorithms to work with Point2d[] or GrowableXY.\r\n * * GrowableXYArray implements these for its data.\r\n * * Point2dArrayCarrier carries a (reference to) a Point2d[] and implements the methods with calls on that array reference.\r\n * * In addition to \"point by point\" accessors, other abstract members compute commonly useful vector data \"between points\".\r\n * * Methods that create vectors among multiple indices allow callers to avoid creating temporaries.\r\n * @public\r\n */\r\nexport abstract class IndexedXYCollection {\r\n /**\r\n * Get from `index` as a `Point2d`\r\n * @param index index of point within the array\r\n * @param result optional caller-allocated destination\r\n * @returns undefined if the index is out of bounds\r\n */\r\n public abstract getPoint2dAtCheckedPointIndex(index: number, result?: Point2d): Point2d | undefined;\r\n /**\r\n * Get from `index` as a `Vector2d`\r\n * @param index index of point within the array\r\n * @param result optional caller-allocated destination\r\n * @returns undefined if the index is out of bounds\r\n */\r\n public abstract getVector2dAtCheckedVectorIndex(index: number, result?: Vector2d): Vector2d | undefined;\r\n /**\r\n * Return a vector from the point at `indexA` to the point at `indexB`\r\n * @param indexA index of point within the array\r\n * @param indexB index of point within the array\r\n * @param result optional caller-allocated vector.\r\n * @returns undefined if either index is out of bounds\r\n */\r\n public abstract vectorIndexIndex(indexA: number, indexB: number, result?: Vector2d): Vector2d | undefined;\r\n /**\r\n * Return a vector from given origin to the point at `indexB`\r\n * @param origin origin for vector\r\n * @param indexB index of point within the array\r\n * @param result optional caller-allocated vector.\r\n * @returns undefined if index is out of bounds\r\n */\r\n public abstract vectorXAndYIndex(origin: XAndY, indexB: number, result?: Vector2d): Vector2d | undefined;\r\n\r\n /**\r\n * Return the cross product of vectors from `origin` to points at `indexA` and `indexB`\r\n * @param origin origin for vector\r\n * @param indexA index of first target within the array\r\n * @param indexB index of second target within the array\r\n * @param result optional caller-allocated vector.\r\n * @returns undefined if either index is out of bounds\r\n */\r\n public abstract crossProductXAndYIndexIndex(origin: XAndY, indexA: number, indexB: number): number | undefined;\r\n /**\r\n * Return the cross product of vectors from origin point at `indexA` to target points at `indexB` and `indexC`\r\n * @param origin index of origin\r\n * @param indexA index of first target within the array\r\n * @param indexB index of second target within the array\r\n * @param result optional caller - allocated vector.\r\n * @returns return true if indexA, indexB both valid\r\n */\r\n public abstract crossProductIndexIndexIndex(origin: number, indexA: number, indexB: number): number | undefined;\r\n\r\n /**\r\n * read-only property for number of XY in the collection.\r\n */\r\n public abstract get length(): number;\r\n\r\n private static _workPoint?: Point2d;\r\n\r\n /** access x of indexed point\r\n * * Subclasses may wish to override with a more efficient implementation.\r\n */\r\n public getXAtUncheckedPointIndex(pointIndex: number): number {\r\n const pt = this.getPoint2dAtCheckedPointIndex(pointIndex, IndexedXYCollection._workPoint);\r\n if (undefined === IndexedXYCollection._workPoint)\r\n IndexedXYCollection._workPoint = pt; // allocate the cache\r\n return pt ? pt.x : 0.0;\r\n }\r\n\r\n /** access y of indexed point\r\n * * Subclasses may wish to override with a more efficient implementation.\r\n */\r\n public getYAtUncheckedPointIndex(pointIndex: number): number {\r\n const pt = this.getPoint2dAtCheckedPointIndex(pointIndex, IndexedXYCollection._workPoint);\r\n if (undefined === IndexedXYCollection._workPoint)\r\n IndexedXYCollection._workPoint = pt; // allocate the cache\r\n return pt ? pt.y : 0.0;\r\n }\r\n\r\n /** Compute the linear combination s of the indexed p_i and given scales s_i.\r\n * @param scales array of scales. For best results, scales should have same length as the instance.\r\n * @param result optional pre-allocated object to fill and return\r\n * @return s = sum(p_i * s_i), where i ranges from 0 to min(this.length, scales.length).\r\n */\r\n public linearCombination(scales: number[], result?: Point2d | Vector2d): XY {\r\n const n = Math.min(this.length, scales.length);\r\n const sum = (result instanceof Vector2d) ? Vector2d.createZero(result) : Point2d.createZero(result);\r\n for (let i = 0; i < n; ++i) {\r\n sum.x += scales[i] * this.getXAtUncheckedPointIndex(i);\r\n sum.y += scales[i] * this.getYAtUncheckedPointIndex(i);\r\n }\r\n return sum;\r\n }\r\n}\r\n"]}
|