@itwin/core-geometry 4.5.0-dev.4 → 4.5.0-dev.7
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/curve/CoordinateXYZ.d.ts +10 -13
- package/lib/cjs/curve/CoordinateXYZ.d.ts.map +1 -1
- package/lib/cjs/curve/CoordinateXYZ.js +16 -15
- package/lib/cjs/curve/CoordinateXYZ.js.map +1 -1
- package/lib/cjs/curve/GeometryQuery.d.ts +17 -17
- package/lib/cjs/curve/GeometryQuery.d.ts.map +1 -1
- package/lib/cjs/curve/GeometryQuery.js +16 -15
- package/lib/cjs/curve/GeometryQuery.js.map +1 -1
- package/lib/cjs/curve/PointString3d.d.ts +17 -13
- package/lib/cjs/curve/PointString3d.d.ts.map +1 -1
- package/lib/cjs/curve/PointString3d.js +35 -20
- package/lib/cjs/curve/PointString3d.js.map +1 -1
- package/lib/cjs/polyface/Polyface.d.ts +155 -118
- package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
- package/lib/cjs/polyface/Polyface.js +244 -162
- package/lib/cjs/polyface/Polyface.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.d.ts +12 -7
- package/lib/cjs/polyface/PolyfaceData.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.js +13 -6
- package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
- package/lib/esm/curve/CoordinateXYZ.d.ts +10 -13
- package/lib/esm/curve/CoordinateXYZ.d.ts.map +1 -1
- package/lib/esm/curve/CoordinateXYZ.js +16 -15
- package/lib/esm/curve/CoordinateXYZ.js.map +1 -1
- package/lib/esm/curve/GeometryQuery.d.ts +17 -17
- package/lib/esm/curve/GeometryQuery.d.ts.map +1 -1
- package/lib/esm/curve/GeometryQuery.js +16 -15
- package/lib/esm/curve/GeometryQuery.js.map +1 -1
- package/lib/esm/curve/PointString3d.d.ts +17 -13
- package/lib/esm/curve/PointString3d.d.ts.map +1 -1
- package/lib/esm/curve/PointString3d.js +35 -20
- package/lib/esm/curve/PointString3d.js.map +1 -1
- package/lib/esm/polyface/Polyface.d.ts +155 -118
- package/lib/esm/polyface/Polyface.d.ts.map +1 -1
- package/lib/esm/polyface/Polyface.js +244 -162
- package/lib/esm/polyface/Polyface.js.map +1 -1
- package/lib/esm/polyface/PolyfaceData.d.ts +12 -7
- package/lib/esm/polyface/PolyfaceData.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceData.js +13 -6
- package/lib/esm/polyface/PolyfaceData.js.map +1 -1
- package/package.json +3 -3
|
@@ -11,44 +11,41 @@ import { GeometryQuery } from "./GeometryQuery";
|
|
|
11
11
|
* @public
|
|
12
12
|
*/
|
|
13
13
|
export declare class CoordinateXYZ extends GeometryQuery {
|
|
14
|
-
/** String name for interface properties */
|
|
14
|
+
/** String name for interface properties. */
|
|
15
15
|
readonly geometryCategory = "point";
|
|
16
16
|
private _xyz;
|
|
17
17
|
/** Return a (REFERENCE TO) the coordinate data. */
|
|
18
18
|
get point(): Point3d;
|
|
19
19
|
/**
|
|
20
|
+
* Constructor
|
|
20
21
|
* @param xyz point to be CAPTURED.
|
|
21
22
|
*/
|
|
22
23
|
private constructor();
|
|
23
|
-
/** Create a new CoordinateXYZ containing a CLONE of point */
|
|
24
|
+
/** Create a new CoordinateXYZ containing a CLONE of point. */
|
|
24
25
|
static create(point: Point3d): CoordinateXYZ;
|
|
25
|
-
/** Create a new CoordinateXYZ */
|
|
26
|
+
/** Create a new CoordinateXYZ. */
|
|
26
27
|
static createXYZ(x?: number, y?: number, z?: number): CoordinateXYZ;
|
|
27
|
-
/** Return the range of the point */
|
|
28
|
+
/** Return the range of the point. */
|
|
28
29
|
range(): Range3d;
|
|
29
|
-
/** Extend `rangeToExtend` to include this point (optionally transformed) */
|
|
30
|
+
/** Extend `rangeToExtend` to include this point (optionally transformed). */
|
|
30
31
|
extendRange(rangeToExtend: Range3d, transform?: Transform): void;
|
|
31
32
|
/** Apply transform to the Coordinate's point. */
|
|
32
33
|
tryTransformInPlace(transform: Transform): boolean;
|
|
33
|
-
/** Return a transformed clone */
|
|
34
|
+
/** Return a transformed clone. */
|
|
34
35
|
cloneTransformed(transform: Transform): GeometryQuery | undefined;
|
|
35
|
-
/** Return a clone */
|
|
36
|
+
/** Return a clone. */
|
|
36
37
|
clone(): GeometryQuery | undefined;
|
|
37
|
-
/**
|
|
38
|
-
* Return GeometryQuery children for recursive queries.
|
|
39
|
-
* * Leaf classes do not need to implement.
|
|
40
|
-
*/
|
|
41
38
|
/** Test if (other instanceof Coordinate). */
|
|
42
39
|
isSameGeometryClass(other: GeometryQuery): boolean;
|
|
43
40
|
/**
|
|
44
41
|
* Test for exact structure and nearly identical geometry.
|
|
45
|
-
* * Leaf classes must implement
|
|
42
|
+
* * Leaf classes must implement.
|
|
46
43
|
* * Base class implementation recurses through children.
|
|
47
44
|
* * Base implementation is complete for classes with children and no properties.
|
|
48
45
|
* * Classes with both children and properties must implement for properties, call super for children.
|
|
49
46
|
*/
|
|
50
47
|
isAlmostEqual(other: GeometryQuery): boolean;
|
|
51
|
-
/** Second step of double dispatch:
|
|
48
|
+
/** Second step of double dispatch: call `handler.handleCoordinateXYZ(this)` */
|
|
52
49
|
dispatchToGeometryHandler(handler: GeometryHandler): any;
|
|
53
50
|
}
|
|
54
51
|
//# sourceMappingURL=CoordinateXYZ.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoordinateXYZ.d.ts","sourceRoot":"","sources":["../../../src/curve/CoordinateXYZ.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;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O;IAG5D,+EAA+E;IACxE,yBAAyB,CAAC,OAAO,EAAE,eAAe,GAAG,GAAG;CAGhE"}
|
|
@@ -10,27 +10,32 @@ const GeometryQuery_1 = require("./GeometryQuery");
|
|
|
10
10
|
*/
|
|
11
11
|
class CoordinateXYZ extends GeometryQuery_1.GeometryQuery {
|
|
12
12
|
/** Return a (REFERENCE TO) the coordinate data. */
|
|
13
|
-
get point() {
|
|
13
|
+
get point() {
|
|
14
|
+
return this._xyz;
|
|
15
|
+
}
|
|
14
16
|
/**
|
|
17
|
+
* Constructor
|
|
15
18
|
* @param xyz point to be CAPTURED.
|
|
16
19
|
*/
|
|
17
20
|
constructor(xyz) {
|
|
18
21
|
super();
|
|
19
|
-
/** String name for interface properties */
|
|
22
|
+
/** String name for interface properties. */
|
|
20
23
|
this.geometryCategory = "point";
|
|
21
24
|
this._xyz = xyz;
|
|
22
25
|
}
|
|
23
|
-
/** Create a new CoordinateXYZ containing a CLONE of point */
|
|
26
|
+
/** Create a new CoordinateXYZ containing a CLONE of point. */
|
|
24
27
|
static create(point) {
|
|
25
28
|
return new CoordinateXYZ(point.clone());
|
|
26
29
|
}
|
|
27
|
-
/** Create a new CoordinateXYZ */
|
|
30
|
+
/** Create a new CoordinateXYZ. */
|
|
28
31
|
static createXYZ(x = 0, y = 0, z = 0) {
|
|
29
32
|
return new CoordinateXYZ(Point3dVector3d_1.Point3d.create(x, y, z));
|
|
30
33
|
}
|
|
31
|
-
/** Return the range of the point */
|
|
32
|
-
range() {
|
|
33
|
-
|
|
34
|
+
/** Return the range of the point. */
|
|
35
|
+
range() {
|
|
36
|
+
return Range_1.Range3d.create(this._xyz);
|
|
37
|
+
}
|
|
38
|
+
/** Extend `rangeToExtend` to include this point (optionally transformed). */
|
|
34
39
|
extendRange(rangeToExtend, transform) {
|
|
35
40
|
if (transform)
|
|
36
41
|
rangeToExtend.extendTransformedXYZ(transform, this._xyz.x, this._xyz.y, this._xyz.z);
|
|
@@ -42,27 +47,23 @@ class CoordinateXYZ extends GeometryQuery_1.GeometryQuery {
|
|
|
42
47
|
transform.multiplyPoint3d(this._xyz, this._xyz);
|
|
43
48
|
return true;
|
|
44
49
|
}
|
|
45
|
-
/** Return a transformed clone */
|
|
50
|
+
/** Return a transformed clone. */
|
|
46
51
|
cloneTransformed(transform) {
|
|
47
52
|
const result = new CoordinateXYZ(this._xyz.clone());
|
|
48
53
|
result.tryTransformInPlace(transform);
|
|
49
54
|
return result;
|
|
50
55
|
}
|
|
51
|
-
/** Return a clone */
|
|
56
|
+
/** Return a clone. */
|
|
52
57
|
clone() {
|
|
53
58
|
return new CoordinateXYZ(this._xyz.clone());
|
|
54
59
|
}
|
|
55
|
-
/**
|
|
56
|
-
* Return GeometryQuery children for recursive queries.
|
|
57
|
-
* * Leaf classes do not need to implement.
|
|
58
|
-
*/
|
|
59
60
|
/** Test if (other instanceof Coordinate). */
|
|
60
61
|
isSameGeometryClass(other) {
|
|
61
62
|
return other instanceof CoordinateXYZ;
|
|
62
63
|
}
|
|
63
64
|
/**
|
|
64
65
|
* Test for exact structure and nearly identical geometry.
|
|
65
|
-
* * Leaf classes must implement
|
|
66
|
+
* * Leaf classes must implement.
|
|
66
67
|
* * Base class implementation recurses through children.
|
|
67
68
|
* * Base implementation is complete for classes with children and no properties.
|
|
68
69
|
* * Classes with both children and properties must implement for properties, call super for children.
|
|
@@ -70,7 +71,7 @@ class CoordinateXYZ extends GeometryQuery_1.GeometryQuery {
|
|
|
70
71
|
isAlmostEqual(other) {
|
|
71
72
|
return (other instanceof CoordinateXYZ) && this._xyz.isAlmostEqual(other._xyz);
|
|
72
73
|
}
|
|
73
|
-
/** Second step of double dispatch:
|
|
74
|
+
/** Second step of double dispatch: call `handler.handleCoordinateXYZ(this)` */
|
|
74
75
|
dispatchToGeometryHandler(handler) {
|
|
75
76
|
return handler.handleCoordinateXYZ(this);
|
|
76
77
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoordinateXYZ.js","sourceRoot":"","sources":["../../../src/curve/CoordinateXYZ.ts"],"names":[],"mappings":";;;AAQA,mEAAwD;AACxD,+CAA8C;AAE9C,mDAAgD;AAEhD;;;GAGG;AACH,MAAa,aAAc,SAAQ,6BAAa;
|
|
1
|
+
{"version":3,"file":"CoordinateXYZ.js","sourceRoot":"","sources":["../../../src/curve/CoordinateXYZ.ts"],"names":[],"mappings":";;;AAQA,mEAAwD;AACxD,+CAA8C;AAE9C,mDAAgD;AAEhD;;;GAGG;AACH,MAAa,aAAc,SAAQ,6BAAa;IAI9C,mDAAmD;IACnD,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IACD;;;OAGG;IACH,YAAoB,GAAY;QAC9B,KAAK,EAAE,CAAC;QAZV,4CAA4C;QAC5B,qBAAgB,GAAG,OAAO,CAAC;QAYzC,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;IAClB,CAAC;IACD,8DAA8D;IACvD,MAAM,CAAC,MAAM,CAAC,KAAc;QACjC,OAAO,IAAI,aAAa,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;IAC1C,CAAC;IACD,kCAAkC;IAC3B,MAAM,CAAC,SAAS,CAAC,IAAY,CAAC,EAAE,IAAY,CAAC,EAAE,IAAY,CAAC;QACjE,OAAO,IAAI,aAAa,CAAC,yBAAO,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACpD,CAAC;IACD,qCAAqC;IACrB,KAAK;QACnB,OAAO,eAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IACD,6EAA6E;IACtE,WAAW,CAAC,aAAsB,EAAE,SAAqB;QAC9D,IAAI,SAAS;YACX,aAAa,CAAC,oBAAoB,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;;YAErF,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;IACD,iDAAiD;IAC1C,mBAAmB,CAAC,SAAoB;QAC7C,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAChD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,kCAAkC;IAC3B,gBAAgB,CAAC,SAAoB;QAC1C,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QACpD,MAAM,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;QACtC,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,sBAAsB;IACf,KAAK;QACV,OAAO,IAAI,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IAC9C,CAAC;IACD,8CAA8C;IACvC,mBAAmB,CAAC,KAAoB;QAC7C,OAAO,KAAK,YAAY,aAAa,CAAC;IACxC,CAAC;IACD;;;;;;OAMG;IACa,aAAa,CAAC,KAAoB;QAChD,OAAO,CAAC,KAAK,YAAY,aAAa,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACjF,CAAC;IACD,+EAA+E;IACxE,yBAAyB,CAAC,OAAwB;QACvD,OAAO,OAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;CACF;AApED,sCAoEC","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 Curve\r\n */\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { Point3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { GeometryQuery } from \"./GeometryQuery\";\r\n\r\n/**\r\n * A Coordinate is a Point3d with supporting methods from the GeometryQuery abstraction.\r\n * @public\r\n */\r\nexport class CoordinateXYZ extends GeometryQuery {\r\n /** String name for interface properties. */\r\n public readonly geometryCategory = \"point\";\r\n private _xyz: Point3d;\r\n /** Return a (REFERENCE TO) the coordinate data. */\r\n public get point() {\r\n return this._xyz;\r\n }\r\n /**\r\n * Constructor\r\n * @param xyz point to be CAPTURED.\r\n */\r\n private constructor(xyz: Point3d) {\r\n super();\r\n this._xyz = xyz;\r\n }\r\n /** Create a new CoordinateXYZ containing a CLONE of point. */\r\n public static create(point: Point3d): CoordinateXYZ {\r\n return new CoordinateXYZ(point.clone());\r\n }\r\n /** Create a new CoordinateXYZ. */\r\n public static createXYZ(x: number = 0, y: number = 0, z: number = 0): CoordinateXYZ {\r\n return new CoordinateXYZ(Point3d.create(x, y, z));\r\n }\r\n /** Return the range of the point. */\r\n public override range(): Range3d {\r\n return Range3d.create(this._xyz);\r\n }\r\n /** Extend `rangeToExtend` to include this point (optionally transformed). */\r\n public extendRange(rangeToExtend: Range3d, transform?: Transform): void {\r\n if (transform)\r\n rangeToExtend.extendTransformedXYZ(transform, this._xyz.x, this._xyz.y, this._xyz.z);\r\n else\r\n rangeToExtend.extend(this._xyz);\r\n }\r\n /** Apply transform to the Coordinate's point. */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n transform.multiplyPoint3d(this._xyz, this._xyz);\r\n return true;\r\n }\r\n /** Return a transformed clone. */\r\n public cloneTransformed(transform: Transform): GeometryQuery | undefined {\r\n const result = new CoordinateXYZ(this._xyz.clone());\r\n result.tryTransformInPlace(transform);\r\n return result;\r\n }\r\n /** Return a clone. */\r\n public clone(): GeometryQuery | undefined {\r\n return new CoordinateXYZ(this._xyz.clone());\r\n }\r\n /** Test if (other instanceof Coordinate). */\r\n public isSameGeometryClass(other: GeometryQuery): boolean {\r\n return other instanceof CoordinateXYZ;\r\n }\r\n /**\r\n * Test for exact structure and nearly identical geometry.\r\n * * Leaf classes must implement.\r\n * * Base class implementation recurses through children.\r\n * * Base implementation is complete for classes with children and no properties.\r\n * * Classes with both children and properties must implement for properties, call super for children.\r\n */\r\n public override isAlmostEqual(other: GeometryQuery): boolean {\r\n return (other instanceof CoordinateXYZ) && this._xyz.isAlmostEqual(other._xyz);\r\n }\r\n /** Second step of double dispatch: call `handler.handleCoordinateXYZ(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleCoordinateXYZ(this);\r\n }\r\n}\r\n"]}
|
|
@@ -16,7 +16,7 @@ import { PointString3d } from "./PointString3d";
|
|
|
16
16
|
* ```ts
|
|
17
17
|
* function processGeometryQuery(q: GeometryQuery): void {
|
|
18
18
|
* if ("solid" === q.geometryCategory)
|
|
19
|
-
* alert("Solid type = " + q.solidPrimitiveType; // compiler knows q is an instance of SolidPrimitive
|
|
19
|
+
* alert("Solid type = " + q.solidPrimitiveType); // compiler knows q is an instance of SolidPrimitive
|
|
20
20
|
* // ...etc...
|
|
21
21
|
* ```
|
|
22
22
|
*
|
|
@@ -27,7 +27,7 @@ import { PointString3d } from "./PointString3d";
|
|
|
27
27
|
* - "solid" => [[SolidPrimitive]]
|
|
28
28
|
* - "point" => [[CoordinateXYZ]]
|
|
29
29
|
* - "pointCollection" => [[PointString3d]]
|
|
30
|
-
* - "bsurf" => [[BSpline2dNd]]
|
|
30
|
+
* - "bsurf" => [[BSpline2dNd]] (which is an intermediate class shared by [[BSplineSurface3d]] and [[BSplineSurface3dH]])
|
|
31
31
|
*
|
|
32
32
|
* @see [[AnyGeometryQuery]]
|
|
33
33
|
* @public
|
|
@@ -40,17 +40,17 @@ export type GeometryQueryCategory = "polyface" | "curvePrimitive" | "curveCollec
|
|
|
40
40
|
*/
|
|
41
41
|
export type AnyGeometryQuery = Polyface | CurvePrimitive | CurveCollection | SolidPrimitive | CoordinateXYZ | PointString3d | BSpline2dNd;
|
|
42
42
|
/**
|
|
43
|
-
* Queries to be supported by Curve, Surface, and Solid objects
|
|
43
|
+
* Queries to be supported by Curve, Surface, and Solid objects.
|
|
44
44
|
* * `GeometryQuery` is an abstract base class with (abstract) methods for querying curve, solid primitive, mesh,
|
|
45
|
-
* and bspline surfaces
|
|
45
|
+
* and bspline surfaces.
|
|
46
46
|
* @public
|
|
47
47
|
*/
|
|
48
48
|
export declare abstract class GeometryQuery {
|
|
49
49
|
/** Type discriminator. */
|
|
50
50
|
abstract readonly geometryCategory: GeometryQueryCategory;
|
|
51
|
-
/** Return the range of the entire GeometryQuery tree */
|
|
51
|
+
/** Return the range of the entire GeometryQuery tree. */
|
|
52
52
|
range(transform?: Transform, result?: Range3d): Range3d;
|
|
53
|
-
/** Extend rangeToExtend by the range of this geometry multiplied by the transform */
|
|
53
|
+
/** Extend `rangeToExtend` by the range of this geometry multiplied by the `transform`. */
|
|
54
54
|
abstract extendRange(rangeToExtend: Range3d, transform?: Transform): void;
|
|
55
55
|
/**
|
|
56
56
|
* Attempt to transform in place.
|
|
@@ -58,7 +58,7 @@ export declare abstract class GeometryQuery {
|
|
|
58
58
|
* * Some geometry types may fail if scaling is non-uniform.
|
|
59
59
|
*/
|
|
60
60
|
abstract tryTransformInPlace(transform: Transform): boolean;
|
|
61
|
-
/** Try to move the geometry by dx,dy,dz */
|
|
61
|
+
/** Try to move the geometry by dx,dy,dz. */
|
|
62
62
|
tryTranslateInPlace(dx: number, dy?: number, dz?: number): boolean;
|
|
63
63
|
/** Return a transformed clone. */
|
|
64
64
|
abstract cloneTransformed(transform: Transform): GeometryQuery | undefined;
|
|
@@ -69,28 +69,28 @@ export declare abstract class GeometryQuery {
|
|
|
69
69
|
* * leaf classes do not need to implement.
|
|
70
70
|
*/
|
|
71
71
|
get children(): GeometryQuery[] | undefined;
|
|
72
|
-
/** Test if (other instanceof this.Type)
|
|
72
|
+
/** Test `if (other instanceof this.Type)`. REQUIRED IN ALL CONCRETE CLASSES. */
|
|
73
73
|
abstract isSameGeometryClass(other: GeometryQuery): boolean;
|
|
74
74
|
/**
|
|
75
75
|
* Test for exact structure and nearly identical geometry.
|
|
76
|
-
* * Leaf classes must implement
|
|
77
|
-
* *
|
|
78
|
-
* *
|
|
79
|
-
* *
|
|
76
|
+
* * Leaf classes must implement.
|
|
77
|
+
* * Base class implementation recurses through children.
|
|
78
|
+
* * Base implementation is complete for classes with children and no properties.
|
|
79
|
+
* * Classes with both children and properties must implement for properties, call super for children.
|
|
80
80
|
*/
|
|
81
81
|
isAlmostEqual(other: GeometryQuery): boolean;
|
|
82
82
|
/**
|
|
83
83
|
* Apply instance method [[isAlmostEqual]] if both are defined.
|
|
84
|
-
* *
|
|
85
|
-
* *
|
|
84
|
+
* * Both undefined returns true.
|
|
85
|
+
* * Single defined returns false.
|
|
86
86
|
*/
|
|
87
87
|
static areAlmostEqual(a: GeometryQuery | undefined, b: GeometryQuery | undefined): boolean;
|
|
88
88
|
/**
|
|
89
|
-
*
|
|
90
|
-
* * User code implements a `GeometryHandler` with specialized methods to handle `LineSegment3d`, `Arc3d
|
|
89
|
+
* Double Dispatch call pattern.
|
|
90
|
+
* * User code implements a `GeometryHandler` with specialized methods to handle `LineSegment3d`, `Arc3d`, etc as
|
|
91
91
|
* relevant to its use case.
|
|
92
92
|
* * Each such `GeometryQuery` class implements this method as a one-line method containing the appropriate call
|
|
93
|
-
* such as `handler.handleLineSegment3d
|
|
93
|
+
* such as `handler.handleLineSegment3d())`
|
|
94
94
|
* * This allows each type-specific method to be called without a switch or `instanceof` test.
|
|
95
95
|
* @param handler handler to be called by the particular geometry class
|
|
96
96
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GeometryQuery.d.ts","sourceRoot":"","sources":["../../../src/curve/GeometryQuery.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,eAAe,EA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E;;;;;;OAMG;IACI,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO;IAoBnD;;;;OAIG;WACW,cAAc,CAAC,CAAC,EAAE,aAAa,GAAG,SAAS,EAAE,CAAC,EAAE,aAAa,GAAG,SAAS,GAAG,OAAO;IAOjG;;;;;;;;OAQG;aACa,yBAAyB,CAAC,OAAO,EAAE,eAAe,GAAG,GAAG;CACzE"}
|
|
@@ -4,13 +4,13 @@ exports.GeometryQuery = void 0;
|
|
|
4
4
|
const Range_1 = require("../geometry3d/Range");
|
|
5
5
|
const Transform_1 = require("../geometry3d/Transform");
|
|
6
6
|
/**
|
|
7
|
-
* Queries to be supported by Curve, Surface, and Solid objects
|
|
7
|
+
* Queries to be supported by Curve, Surface, and Solid objects.
|
|
8
8
|
* * `GeometryQuery` is an abstract base class with (abstract) methods for querying curve, solid primitive, mesh,
|
|
9
|
-
* and bspline surfaces
|
|
9
|
+
* and bspline surfaces.
|
|
10
10
|
* @public
|
|
11
11
|
*/
|
|
12
12
|
class GeometryQuery {
|
|
13
|
-
/** Return the range of the entire GeometryQuery tree */
|
|
13
|
+
/** Return the range of the entire GeometryQuery tree. */
|
|
14
14
|
range(transform, result) {
|
|
15
15
|
if (result)
|
|
16
16
|
result.setNull();
|
|
@@ -18,7 +18,7 @@ class GeometryQuery {
|
|
|
18
18
|
this.extendRange(range, transform);
|
|
19
19
|
return range;
|
|
20
20
|
}
|
|
21
|
-
/** Try to move the geometry by dx,dy,dz */
|
|
21
|
+
/** Try to move the geometry by dx,dy,dz. */
|
|
22
22
|
tryTranslateInPlace(dx, dy = 0.0, dz = 0.0) {
|
|
23
23
|
return this.tryTransformInPlace(Transform_1.Transform.createTranslationXYZ(dx, dy, dz));
|
|
24
24
|
}
|
|
@@ -26,13 +26,15 @@ class GeometryQuery {
|
|
|
26
26
|
* Return GeometryQuery children for recursive queries.
|
|
27
27
|
* * leaf classes do not need to implement.
|
|
28
28
|
*/
|
|
29
|
-
get children() {
|
|
29
|
+
get children() {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
30
32
|
/**
|
|
31
33
|
* Test for exact structure and nearly identical geometry.
|
|
32
|
-
* * Leaf classes must implement
|
|
33
|
-
* *
|
|
34
|
-
* *
|
|
35
|
-
* *
|
|
34
|
+
* * Leaf classes must implement.
|
|
35
|
+
* * Base class implementation recurses through children.
|
|
36
|
+
* * Base implementation is complete for classes with children and no properties.
|
|
37
|
+
* * Classes with both children and properties must implement for properties, call super for children.
|
|
36
38
|
*/
|
|
37
39
|
isAlmostEqual(other) {
|
|
38
40
|
if (this.isSameGeometryClass(other)) {
|
|
@@ -47,20 +49,19 @@ class GeometryQuery {
|
|
|
47
49
|
}
|
|
48
50
|
return true;
|
|
49
51
|
}
|
|
50
|
-
else if (childrenA || childrenB) { // CurveCollections start with empty arrays for children
|
|
51
|
-
return false; // plainly different
|
|
52
|
+
else if (childrenA || childrenB) { // CurveCollections start with empty arrays for children so these null pointer cases are never reached.
|
|
53
|
+
return false; // plainly different
|
|
52
54
|
}
|
|
53
55
|
else {
|
|
54
|
-
// both children null
|
|
55
|
-
return true;
|
|
56
|
+
return true; // both children null; call it equal
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
return false;
|
|
59
60
|
}
|
|
60
61
|
/**
|
|
61
62
|
* Apply instance method [[isAlmostEqual]] if both are defined.
|
|
62
|
-
* *
|
|
63
|
-
* *
|
|
63
|
+
* * Both undefined returns true.
|
|
64
|
+
* * Single defined returns false.
|
|
64
65
|
*/
|
|
65
66
|
static areAlmostEqual(a, b) {
|
|
66
67
|
if (a instanceof GeometryQuery && b instanceof GeometryQuery)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GeometryQuery.js","sourceRoot":"","sources":["../../../src/curve/GeometryQuery.ts"],"names":[],"mappings":";;;AASA,+CAA8C;AAC9C,uDAAoD;AAsCpD;;;;;GAKG;AACH,MAAsB,aAAa;IAGjC,
|
|
1
|
+
{"version":3,"file":"GeometryQuery.js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ChB;gBACD,OAAO,IAAI,CAAC;aACb;iBAAM,IAAI,SAAS,IAAI,SAAS,EAAE,EAAE,uGAAuG;gBAC1I,OAAO,KAAK,CAAC,CAAC,oBAAoB;aACnC;iBAAM;gBACL,OAAO,IAAI,CAAC,CAAC,oCAAoC;aAClD;SACF;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD;;;;OAIG;IACI,MAAM,CAAC,cAAc,CAAC,CAA4B,EAAE,CAA4B;QACrF,IAAI,CAAC,YAAY,aAAa,IAAI,CAAC,YAAY,aAAa;YAC1D,OAAO,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;QAC5B,IAAI,CAAC,CAAC,KAAK,SAAS,CAAC,IAAI,CAAC,CAAC,KAAK,SAAS,CAAC;YACxC,OAAO,IAAI,CAAC;QACd,OAAO,KAAK,CAAC;IACf,CAAC;CAWF;AArFD,sCAqFC","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 Curve\r\n */\r\nimport { BSpline2dNd } from \"../bspline/BSplineSurface\";\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { Polyface } from \"../polyface/Polyface\";\r\nimport { SolidPrimitive } from \"../solid/SolidPrimitive\";\r\nimport { CoordinateXYZ } from \"./CoordinateXYZ\";\r\nimport { CurveCollection } from \"./CurveCollection\";\r\nimport { CurvePrimitive } from \"./CurvePrimitive\";\r\nimport { PointString3d } from \"./PointString3d\";\r\n\r\n/**\r\n * Describes the category of a [[GeometryQuery]], enabling type-switching like:\r\n * ```ts\r\n * function processGeometryQuery(q: GeometryQuery): void {\r\n * if (\"solid\" === q.geometryCategory)\r\n * alert(\"Solid type = \" + q.solidPrimitiveType); // compiler knows q is an instance of SolidPrimitive\r\n * // ...etc...\r\n * ```\r\n *\r\n * Each string maps to a particular subclass of [[GeometryQuery]]:\r\n * - \"polyface\" => [[Polyface]]\r\n * - \"curvePrimitive\" => [[CurvePrimitive]]\r\n * - \"curveCollection\" => [[CurveCollection]]\r\n * - \"solid\" => [[SolidPrimitive]]\r\n * - \"point\" => [[CoordinateXYZ]]\r\n * - \"pointCollection\" => [[PointString3d]]\r\n * - \"bsurf\" => [[BSpline2dNd]] (which is an intermediate class shared by [[BSplineSurface3d]] and [[BSplineSurface3dH]])\r\n *\r\n * @see [[AnyGeometryQuery]]\r\n * @public\r\n */\r\nexport type GeometryQueryCategory = \"polyface\" | \"curvePrimitive\" | \"curveCollection\" | \"solid\" | \"point\" | \"pointCollection\" | \"bsurf\";\r\n\r\n/**\r\n * Union type for subclasses of [[GeometryQuery]]. Specific subclasses can be discriminated at compile- or run-time\r\n * using [[GeometryQuery.geometryCategory]].\r\n * @public\r\n */\r\nexport type AnyGeometryQuery = Polyface | CurvePrimitive | CurveCollection | SolidPrimitive | CoordinateXYZ | PointString3d | BSpline2dNd;\r\n\r\n/**\r\n * Queries to be supported by Curve, Surface, and Solid objects.\r\n * * `GeometryQuery` is an abstract base class with (abstract) methods for querying curve, solid primitive, mesh,\r\n * and bspline surfaces.\r\n * @public\r\n */\r\nexport abstract class GeometryQuery {\r\n /** Type discriminator. */\r\n public abstract readonly geometryCategory: GeometryQueryCategory;\r\n /** Return the range of the entire GeometryQuery tree. */\r\n public range(transform?: Transform, result?: Range3d): Range3d {\r\n if (result)\r\n result.setNull();\r\n const range = result ? result : Range3d.createNull();\r\n this.extendRange(range, transform);\r\n return range;\r\n }\r\n /** Extend `rangeToExtend` by the range of this geometry multiplied by the `transform`. */\r\n public abstract extendRange(rangeToExtend: Range3d, transform?: Transform): void;\r\n /**\r\n * Attempt to transform in place.\r\n * * LineSegment3d, Arc3d, LineString3d, BsplineCurve3d always succeed.\r\n * * Some geometry types may fail if scaling is non-uniform.\r\n */\r\n public abstract tryTransformInPlace(transform: Transform): boolean;\r\n /** Try to move the geometry by dx,dy,dz. */\r\n public tryTranslateInPlace(dx: number, dy: number = 0.0, dz: number = 0.0): boolean {\r\n return this.tryTransformInPlace(Transform.createTranslationXYZ(dx, dy, dz));\r\n }\r\n /** Return a transformed clone. */\r\n public abstract cloneTransformed(transform: Transform): GeometryQuery | undefined;\r\n /** Return a clone */\r\n public abstract clone(): GeometryQuery | undefined;\r\n /**\r\n * Return GeometryQuery children for recursive queries.\r\n * * leaf classes do not need to implement.\r\n */\r\n public get children(): GeometryQuery[] | undefined {\r\n return undefined;\r\n }\r\n /** Test `if (other instanceof this.Type)`. REQUIRED IN ALL CONCRETE CLASSES. */\r\n public abstract isSameGeometryClass(other: GeometryQuery): boolean;\r\n /**\r\n * Test for exact structure and nearly identical geometry.\r\n * * Leaf classes must implement.\r\n * * Base class implementation recurses through children.\r\n * * Base implementation is complete for classes with children and no properties.\r\n * * Classes with both children and properties must implement for properties, call super for children.\r\n */\r\n public isAlmostEqual(other: GeometryQuery): boolean {\r\n if (this.isSameGeometryClass(other)) {\r\n const childrenA = this.children;\r\n const childrenB = other.children;\r\n if (childrenA && childrenB) {\r\n if (childrenA.length !== childrenB.length)\r\n return false;\r\n for (let i = 0; i < childrenA.length; i++) {\r\n if (!childrenA[i].isAlmostEqual(childrenB[i]))\r\n return false;\r\n }\r\n return true;\r\n } else if (childrenA || childrenB) { // CurveCollections start with empty arrays for children so these null pointer cases are never reached.\r\n return false; // plainly different\r\n } else {\r\n return true; // both children null; call it equal\r\n }\r\n }\r\n return false;\r\n }\r\n /**\r\n * Apply instance method [[isAlmostEqual]] if both are defined.\r\n * * Both undefined returns true.\r\n * * Single defined returns false.\r\n */\r\n public static areAlmostEqual(a: GeometryQuery | undefined, b: GeometryQuery | undefined): boolean {\r\n if (a instanceof GeometryQuery && b instanceof GeometryQuery)\r\n return a.isAlmostEqual(b);\r\n if ((a === undefined) && (b === undefined))\r\n return true;\r\n return false;\r\n }\r\n /**\r\n * Double Dispatch call pattern.\r\n * * User code implements a `GeometryHandler` with specialized methods to handle `LineSegment3d`, `Arc3d`, etc as\r\n * relevant to its use case.\r\n * * Each such `GeometryQuery` class implements this method as a one-line method containing the appropriate call\r\n * such as `handler.handleLineSegment3d())`\r\n * * This allows each type-specific method to be called without a switch or `instanceof` test.\r\n * @param handler handler to be called by the particular geometry class\r\n */\r\n public abstract dispatchToGeometryHandler(handler: GeometryHandler): any;\r\n}\r\n"]}
|
|
@@ -21,36 +21,40 @@ export declare class PointString3d extends GeometryQuery implements BeJSONFuncti
|
|
|
21
21
|
/** Test if `other` is a PointString3d */
|
|
22
22
|
isSameGeometryClass(other: GeometryQuery): boolean;
|
|
23
23
|
private _points;
|
|
24
|
-
/**
|
|
24
|
+
/** Return a clone of the points array. */
|
|
25
25
|
get points(): Point3d[];
|
|
26
26
|
private constructor();
|
|
27
27
|
/** Clone and apply a transform. */
|
|
28
28
|
cloneTransformed(transform: Transform): PointString3d;
|
|
29
|
+
/**
|
|
30
|
+
* Turn any array (possibly nested) into a "flat" array of objects that are not arrays. This allows processing
|
|
31
|
+
* the objects without recursion into nested arrays.
|
|
32
|
+
*/
|
|
29
33
|
private static flattenArray;
|
|
30
34
|
/** Create a PointString3d from points. */
|
|
31
35
|
static create(...points: any[]): PointString3d;
|
|
32
|
-
/** Add multiple points to the PointString3d */
|
|
36
|
+
/** Add multiple points to the PointString3d. */
|
|
33
37
|
addPoints(...points: any[]): void;
|
|
34
|
-
/** Add a single point to the PointString3d */
|
|
38
|
+
/** Add a single point to the PointString3d. */
|
|
35
39
|
addPoint(point: Point3d): void;
|
|
36
|
-
/** Remove the last point added to the PointString3d */
|
|
40
|
+
/** Remove the last point added to the PointString3d. */
|
|
37
41
|
popPoint(): void;
|
|
38
|
-
/** Replace this PointString3d's point array by a clone of the array in `other
|
|
42
|
+
/** Replace this PointString3d's point array by a clone of the array in `other`. */
|
|
39
43
|
setFrom(other: PointString3d): void;
|
|
40
|
-
/** Create from an array of Point3d */
|
|
44
|
+
/** Create from an array of Point3d. */
|
|
41
45
|
static createPoints(points: Point3d[]): PointString3d;
|
|
42
|
-
/** Create a PointString3d from xyz coordinates packed in a Float64Array */
|
|
46
|
+
/** Create a PointString3d from xyz coordinates packed in a Float64Array. */
|
|
43
47
|
static createFloat64Array(xyzData: Float64Array): PointString3d;
|
|
44
48
|
/** Return a deep clone. */
|
|
45
49
|
clone(): PointString3d;
|
|
46
|
-
/** Replace this instance's points by those from a json array, e.g. `[[1,2,3], [4,
|
|
50
|
+
/** Replace this instance's points by those from a json array, e.g. `[[1,2,3], [4,5,6]]`. */
|
|
47
51
|
setFromJSON(json?: any): void;
|
|
48
52
|
/**
|
|
49
53
|
* Convert an PointString3d to a JSON object.
|
|
50
|
-
* @return {*} [[
|
|
54
|
+
* @return {*} e.g., `[[1,2,3], [4,5,6]]`.
|
|
51
55
|
*/
|
|
52
56
|
toJSON(): XYZProps[];
|
|
53
|
-
/** Create a PointString3d from a json array, e.g. `[[1,2,3], [4,
|
|
57
|
+
/** Create a PointString3d from a json array, e.g. `[[1,2,3], [4,5,6]]`. */
|
|
54
58
|
static fromJSON(json?: any): PointString3d;
|
|
55
59
|
/** Access a single point by index. */
|
|
56
60
|
pointAt(i: number, result?: Point3d): Point3d | undefined;
|
|
@@ -58,7 +62,7 @@ export declare class PointString3d extends GeometryQuery implements BeJSONFuncti
|
|
|
58
62
|
numPoints(): number;
|
|
59
63
|
/** Reverse the point order */
|
|
60
64
|
reverseInPlace(): void;
|
|
61
|
-
/**
|
|
65
|
+
/** Apply transform on points in place. */
|
|
62
66
|
tryTransformInPlace(transform: Transform): boolean;
|
|
63
67
|
/** Return the index and coordinates of the closest point to spacePoint. */
|
|
64
68
|
closestPoint(spacePoint: Point3d): {
|
|
@@ -67,13 +71,13 @@ export declare class PointString3d extends GeometryQuery implements BeJSONFuncti
|
|
|
67
71
|
};
|
|
68
72
|
/** Return true if all points are in the given plane. */
|
|
69
73
|
isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean;
|
|
70
|
-
/** Extend a range to include the points in this PointString3d. */
|
|
74
|
+
/** Extend a range to include the points in this PointString3d (optionally transformed). */
|
|
71
75
|
extendRange(rangeToExtend: Range3d, transform?: Transform): void;
|
|
72
76
|
/** Return true if corresponding points are almost equal. */
|
|
73
77
|
isAlmostEqual(other: GeometryQuery): boolean;
|
|
74
78
|
/** Reduce to empty set of points. */
|
|
75
79
|
clear(): void;
|
|
76
|
-
/** Second step of double dispatch:
|
|
80
|
+
/** Second step of double dispatch: call `handler.handlePointString(this)` */
|
|
77
81
|
dispatchToGeometryHandler(handler: GeometryHandler): any;
|
|
78
82
|
}
|
|
79
83
|
//# sourceMappingURL=PointString3d.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PointString3d.d.ts","sourceRoot":"","sources":["../../../src/curve/PointString3d.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAY,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAC1F,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAExD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIhD;;;;;GAKG;AACH,qBAAa,aAAc,SAAQ,aAAc,YAAW,eAAe;IACzE,wCAAwC;IACxC,SAAgB,gBAAgB,qBAAqB;
|
|
1
|
+
{"version":3,"file":"PointString3d.d.ts","sourceRoot":"","sources":["../../../src/curve/PointString3d.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAY,M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;IACrF,WAAW,CAAC,IAAI,CAAC,EAAE,GAAG;IAQ7B;;;OAGG;IACI,MAAM,IAAI,QAAQ,EAAE;IAM3B,2EAA2E;WAC7D,QAAQ,CAAC,IAAI,CAAC,EAAE,GAAG,GAAG,aAAa;IAKjD,sCAAsC;IAC/B,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS;IAUhE,mCAAmC;IAC5B,SAAS,IAAI,MAAM;IAG1B,8BAA8B;IACvB,cAAc,IAAI,IAAI;IAa7B,0CAA0C;IACnC,mBAAmB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO;IAIzD,2EAA2E;IACpE,YAAY,CAAC,UAAU,EAAE,OAAO,GAAG;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,OAAO,CAAA;KAAE;IASzE,wDAAwD;IACjD,SAAS,CAAC,KAAK,EAAE,4BAA4B,GAAG,OAAO;IAG9D,2FAA2F;IACpF,WAAW,CAAC,aAAa,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,SAAS,GAAG,IAAI;IAGvE,4DAA4D;IAC5C,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO;IAK5D,qCAAqC;IAC9B,KAAK;IAGZ,6EAA6E;IACtE,yBAAyB,CAAC,OAAO,EAAE,eAAe,GAAG,GAAG;CAGhE"}
|
|
@@ -21,9 +21,13 @@ const GeometryQuery_1 = require("./GeometryQuery");
|
|
|
21
21
|
*/
|
|
22
22
|
class PointString3d extends GeometryQuery_1.GeometryQuery {
|
|
23
23
|
/** Test if `other` is a PointString3d */
|
|
24
|
-
isSameGeometryClass(other) {
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
isSameGeometryClass(other) {
|
|
25
|
+
return other instanceof PointString3d;
|
|
26
|
+
}
|
|
27
|
+
/** Return a clone of the points array. */
|
|
28
|
+
get points() {
|
|
29
|
+
return this._points;
|
|
30
|
+
}
|
|
27
31
|
constructor() {
|
|
28
32
|
super();
|
|
29
33
|
/** String name for schema properties */
|
|
@@ -33,11 +37,18 @@ class PointString3d extends GeometryQuery_1.GeometryQuery {
|
|
|
33
37
|
/** Clone and apply a transform. */
|
|
34
38
|
cloneTransformed(transform) {
|
|
35
39
|
const c = this.clone();
|
|
36
|
-
c.tryTransformInPlace(transform);
|
|
40
|
+
c.tryTransformInPlace(transform); // we know tryTransformInPlace succeeds
|
|
37
41
|
return c;
|
|
38
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Turn any array (possibly nested) into a "flat" array of objects that are not arrays. This allows processing
|
|
45
|
+
* the objects without recursion into nested arrays.
|
|
46
|
+
*/
|
|
39
47
|
static flattenArray(arr) {
|
|
40
|
-
return arr.reduce(
|
|
48
|
+
return arr.reduce(
|
|
49
|
+
// a callback function to execute for each element in the array. Its return value becomes
|
|
50
|
+
// the value of the "flat" parameter on the next invocation of the callback function.
|
|
51
|
+
(flat, toFlatten) => {
|
|
41
52
|
return flat.concat(Array.isArray(toFlatten) ? PointString3d.flattenArray(toFlatten) : toFlatten);
|
|
42
53
|
}, []);
|
|
43
54
|
}
|
|
@@ -47,7 +58,7 @@ class PointString3d extends GeometryQuery_1.GeometryQuery {
|
|
|
47
58
|
result.addPoints(points);
|
|
48
59
|
return result;
|
|
49
60
|
}
|
|
50
|
-
/** Add multiple points to the PointString3d */
|
|
61
|
+
/** Add multiple points to the PointString3d. */
|
|
51
62
|
addPoints(...points) {
|
|
52
63
|
const toAdd = PointString3d.flattenArray(points);
|
|
53
64
|
for (const p of toAdd) {
|
|
@@ -55,25 +66,25 @@ class PointString3d extends GeometryQuery_1.GeometryQuery {
|
|
|
55
66
|
this._points.push(p);
|
|
56
67
|
}
|
|
57
68
|
}
|
|
58
|
-
/** Add a single point to the PointString3d */
|
|
69
|
+
/** Add a single point to the PointString3d. */
|
|
59
70
|
addPoint(point) {
|
|
60
71
|
this._points.push(point);
|
|
61
72
|
}
|
|
62
|
-
/** Remove the last point added to the PointString3d */
|
|
73
|
+
/** Remove the last point added to the PointString3d. */
|
|
63
74
|
popPoint() {
|
|
64
75
|
this._points.pop();
|
|
65
76
|
}
|
|
66
|
-
/** Replace this PointString3d's point array by a clone of the array in `other
|
|
77
|
+
/** Replace this PointString3d's point array by a clone of the array in `other`. */
|
|
67
78
|
setFrom(other) {
|
|
68
79
|
this._points = PointHelpers_1.Point3dArray.clonePoint3dArray(other._points);
|
|
69
80
|
}
|
|
70
|
-
/** Create from an array of Point3d */
|
|
81
|
+
/** Create from an array of Point3d. */
|
|
71
82
|
static createPoints(points) {
|
|
72
83
|
const ps = new PointString3d();
|
|
73
84
|
ps._points = PointHelpers_1.Point3dArray.clonePoint3dArray(points);
|
|
74
85
|
return ps;
|
|
75
86
|
}
|
|
76
|
-
/** Create a PointString3d from xyz coordinates packed in a Float64Array */
|
|
87
|
+
/** Create a PointString3d from xyz coordinates packed in a Float64Array. */
|
|
77
88
|
static createFloat64Array(xyzData) {
|
|
78
89
|
const ps = new PointString3d();
|
|
79
90
|
for (let i = 0; i + 3 <= xyzData.length; i += 3)
|
|
@@ -86,7 +97,7 @@ class PointString3d extends GeometryQuery_1.GeometryQuery {
|
|
|
86
97
|
retVal.setFrom(this);
|
|
87
98
|
return retVal;
|
|
88
99
|
}
|
|
89
|
-
/** Replace this instance's points by those from a json array, e.g. `[[1,2,3], [4,
|
|
100
|
+
/** Replace this instance's points by those from a json array, e.g. `[[1,2,3], [4,5,6]]`. */
|
|
90
101
|
setFromJSON(json) {
|
|
91
102
|
this._points.length = 0;
|
|
92
103
|
if (Array.isArray(json)) {
|
|
@@ -97,7 +108,7 @@ class PointString3d extends GeometryQuery_1.GeometryQuery {
|
|
|
97
108
|
}
|
|
98
109
|
/**
|
|
99
110
|
* Convert an PointString3d to a JSON object.
|
|
100
|
-
* @return {*} [[
|
|
111
|
+
* @return {*} e.g., `[[1,2,3], [4,5,6]]`.
|
|
101
112
|
*/
|
|
102
113
|
toJSON() {
|
|
103
114
|
const value = [];
|
|
@@ -105,7 +116,7 @@ class PointString3d extends GeometryQuery_1.GeometryQuery {
|
|
|
105
116
|
value.push(p.toJSON());
|
|
106
117
|
return value;
|
|
107
118
|
}
|
|
108
|
-
/** Create a PointString3d from a json array, e.g. `[[1,2,3], [4,
|
|
119
|
+
/** Create a PointString3d from a json array, e.g. `[[1,2,3], [4,5,6]]`. */
|
|
109
120
|
static fromJSON(json) {
|
|
110
121
|
const ps = new PointString3d();
|
|
111
122
|
ps.setFromJSON(json);
|
|
@@ -123,14 +134,16 @@ class PointString3d extends GeometryQuery_1.GeometryQuery {
|
|
|
123
134
|
return undefined;
|
|
124
135
|
}
|
|
125
136
|
/** Return the number of points. */
|
|
126
|
-
numPoints() {
|
|
137
|
+
numPoints() {
|
|
138
|
+
return this._points.length;
|
|
139
|
+
}
|
|
127
140
|
/** Reverse the point order */
|
|
128
141
|
reverseInPlace() {
|
|
129
142
|
if (this._points.length >= 2) {
|
|
130
143
|
let i0 = 0;
|
|
131
144
|
let i1 = this._points.length - 1;
|
|
132
145
|
while (i0 < i1) {
|
|
133
|
-
const a = this._points[
|
|
146
|
+
const a = this._points[i1];
|
|
134
147
|
this._points[i1] = this._points[i0];
|
|
135
148
|
this._points[i0] = a;
|
|
136
149
|
i0++;
|
|
@@ -138,7 +151,7 @@ class PointString3d extends GeometryQuery_1.GeometryQuery {
|
|
|
138
151
|
}
|
|
139
152
|
}
|
|
140
153
|
}
|
|
141
|
-
/**
|
|
154
|
+
/** Apply transform on points in place. */
|
|
142
155
|
tryTransformInPlace(transform) {
|
|
143
156
|
transform.multiplyPoint3dArrayInPlace(this._points);
|
|
144
157
|
return true;
|
|
@@ -157,7 +170,7 @@ class PointString3d extends GeometryQuery_1.GeometryQuery {
|
|
|
157
170
|
isInPlane(plane) {
|
|
158
171
|
return PointHelpers_1.Point3dArray.isCloseToPlane(this._points, plane, Geometry_1.Geometry.smallMetricDistance);
|
|
159
172
|
}
|
|
160
|
-
/** Extend a range to include the points in this PointString3d. */
|
|
173
|
+
/** Extend a range to include the points in this PointString3d (optionally transformed). */
|
|
161
174
|
extendRange(rangeToExtend, transform) {
|
|
162
175
|
rangeToExtend.extendArray(this._points, transform);
|
|
163
176
|
}
|
|
@@ -168,8 +181,10 @@ class PointString3d extends GeometryQuery_1.GeometryQuery {
|
|
|
168
181
|
return PointHelpers_1.Point3dArray.isAlmostEqual(this._points, other._points);
|
|
169
182
|
}
|
|
170
183
|
/** Reduce to empty set of points. */
|
|
171
|
-
clear() {
|
|
172
|
-
|
|
184
|
+
clear() {
|
|
185
|
+
this._points.length = 0;
|
|
186
|
+
}
|
|
187
|
+
/** Second step of double dispatch: call `handler.handlePointString(this)` */
|
|
173
188
|
dispatchToGeometryHandler(handler) {
|
|
174
189
|
return handler.handlePointString3d(this);
|
|
175
190
|
}
|