@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.
Files changed (41) hide show
  1. package/lib/cjs/curve/CoordinateXYZ.d.ts +10 -13
  2. package/lib/cjs/curve/CoordinateXYZ.d.ts.map +1 -1
  3. package/lib/cjs/curve/CoordinateXYZ.js +16 -15
  4. package/lib/cjs/curve/CoordinateXYZ.js.map +1 -1
  5. package/lib/cjs/curve/GeometryQuery.d.ts +17 -17
  6. package/lib/cjs/curve/GeometryQuery.d.ts.map +1 -1
  7. package/lib/cjs/curve/GeometryQuery.js +16 -15
  8. package/lib/cjs/curve/GeometryQuery.js.map +1 -1
  9. package/lib/cjs/curve/PointString3d.d.ts +17 -13
  10. package/lib/cjs/curve/PointString3d.d.ts.map +1 -1
  11. package/lib/cjs/curve/PointString3d.js +35 -20
  12. package/lib/cjs/curve/PointString3d.js.map +1 -1
  13. package/lib/cjs/polyface/Polyface.d.ts +155 -118
  14. package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
  15. package/lib/cjs/polyface/Polyface.js +244 -162
  16. package/lib/cjs/polyface/Polyface.js.map +1 -1
  17. package/lib/cjs/polyface/PolyfaceData.d.ts +12 -7
  18. package/lib/cjs/polyface/PolyfaceData.d.ts.map +1 -1
  19. package/lib/cjs/polyface/PolyfaceData.js +13 -6
  20. package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
  21. package/lib/esm/curve/CoordinateXYZ.d.ts +10 -13
  22. package/lib/esm/curve/CoordinateXYZ.d.ts.map +1 -1
  23. package/lib/esm/curve/CoordinateXYZ.js +16 -15
  24. package/lib/esm/curve/CoordinateXYZ.js.map +1 -1
  25. package/lib/esm/curve/GeometryQuery.d.ts +17 -17
  26. package/lib/esm/curve/GeometryQuery.d.ts.map +1 -1
  27. package/lib/esm/curve/GeometryQuery.js +16 -15
  28. package/lib/esm/curve/GeometryQuery.js.map +1 -1
  29. package/lib/esm/curve/PointString3d.d.ts +17 -13
  30. package/lib/esm/curve/PointString3d.d.ts.map +1 -1
  31. package/lib/esm/curve/PointString3d.js +35 -20
  32. package/lib/esm/curve/PointString3d.js.map +1 -1
  33. package/lib/esm/polyface/Polyface.d.ts +155 -118
  34. package/lib/esm/polyface/Polyface.d.ts.map +1 -1
  35. package/lib/esm/polyface/Polyface.js +244 -162
  36. package/lib/esm/polyface/Polyface.js.map +1 -1
  37. package/lib/esm/polyface/PolyfaceData.d.ts +12 -7
  38. package/lib/esm/polyface/PolyfaceData.d.ts.map +1 -1
  39. package/lib/esm/polyface/PolyfaceData.js +13 -6
  40. package/lib/esm/polyface/PolyfaceData.js.map +1 -1
  41. package/package.json +3 -3
@@ -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;;;GAGG;AACH,qBAAa,aAAc,SAAQ,aAAa;IAC9C,2CAA2C;IAC3C,SAAgB,gBAAgB,WAAW;IAE3C,OAAO,CAAC,IAAI,CAAU;IACtB,mDAAmD;IACnD,IAAW,KAAK,YAAwB;IACxC;;OAEG;IACH,OAAO;IAIP,6DAA6D;WAC/C,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa;IAGnD,iCAAiC;WACnB,SAAS,CAAC,CAAC,GAAE,MAAU,EAAE,CAAC,GAAE,MAAU,EAAE,CAAC,GAAE,MAAU,GAAG,aAAa;IAInF,oCAAoC;IACpB,KAAK,IAAI,OAAO;IAEhC,4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AqC;IACrB,KAAK,IAAI,OAAO;IAGhC,6EAA6E;IACtE,WAAW,CAAC,aAAa,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,SAAS,GAAG,IAAI;IAMvE,iDAAiD;IAC1C,mBAAmB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO;IAIzD,kCAAkC;IAC3B,gBAAgB,CAAC,SAAS,EAAE,SAAS,GAAG,aAAa,GAAG,SAAS;IAKxE,sBAAsB;IACf,KAAK,IAAI,aAAa,GAAG,SAAS;IAGzC,8CAA8C;IACvC,mBAAmB,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO;IAGzD;;;;;;OAMG;IACa,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO;IAG5D,+EAA+E;IACxE,yBAAyB,CAAC,OAAO,EAAE,eAAe,GAAG,GAAG;CAGhE"}
@@ -7,27 +7,32 @@ import { GeometryQuery } from "./GeometryQuery";
7
7
  */
8
8
  export class CoordinateXYZ extends GeometryQuery {
9
9
  /** Return a (REFERENCE TO) the coordinate data. */
10
- get point() { return this._xyz; }
10
+ get point() {
11
+ return this._xyz;
12
+ }
11
13
  /**
14
+ * Constructor
12
15
  * @param xyz point to be CAPTURED.
13
16
  */
14
17
  constructor(xyz) {
15
18
  super();
16
- /** String name for interface properties */
19
+ /** String name for interface properties. */
17
20
  this.geometryCategory = "point";
18
21
  this._xyz = xyz;
19
22
  }
20
- /** Create a new CoordinateXYZ containing a CLONE of point */
23
+ /** Create a new CoordinateXYZ containing a CLONE of point. */
21
24
  static create(point) {
22
25
  return new CoordinateXYZ(point.clone());
23
26
  }
24
- /** Create a new CoordinateXYZ */
27
+ /** Create a new CoordinateXYZ. */
25
28
  static createXYZ(x = 0, y = 0, z = 0) {
26
29
  return new CoordinateXYZ(Point3d.create(x, y, z));
27
30
  }
28
- /** Return the range of the point */
29
- range() { return Range3d.create(this._xyz); }
30
- /** Extend `rangeToExtend` to include this point (optionally transformed) */
31
+ /** Return the range of the point. */
32
+ range() {
33
+ return Range3d.create(this._xyz);
34
+ }
35
+ /** Extend `rangeToExtend` to include this point (optionally transformed). */
31
36
  extendRange(rangeToExtend, transform) {
32
37
  if (transform)
33
38
  rangeToExtend.extendTransformedXYZ(transform, this._xyz.x, this._xyz.y, this._xyz.z);
@@ -39,27 +44,23 @@ export class CoordinateXYZ extends GeometryQuery {
39
44
  transform.multiplyPoint3d(this._xyz, this._xyz);
40
45
  return true;
41
46
  }
42
- /** Return a transformed clone */
47
+ /** Return a transformed clone. */
43
48
  cloneTransformed(transform) {
44
49
  const result = new CoordinateXYZ(this._xyz.clone());
45
50
  result.tryTransformInPlace(transform);
46
51
  return result;
47
52
  }
48
- /** Return a clone */
53
+ /** Return a clone. */
49
54
  clone() {
50
55
  return new CoordinateXYZ(this._xyz.clone());
51
56
  }
52
- /**
53
- * Return GeometryQuery children for recursive queries.
54
- * * Leaf classes do not need to implement.
55
- */
56
57
  /** Test if (other instanceof Coordinate). */
57
58
  isSameGeometryClass(other) {
58
59
  return other instanceof CoordinateXYZ;
59
60
  }
60
61
  /**
61
62
  * Test for exact structure and nearly identical geometry.
62
- * * Leaf classes must implement !!!
63
+ * * Leaf classes must implement.
63
64
  * * Base class implementation recurses through children.
64
65
  * * Base implementation is complete for classes with children and no properties.
65
66
  * * Classes with both children and properties must implement for properties, call super for children.
@@ -67,7 +68,7 @@ export class CoordinateXYZ extends GeometryQuery {
67
68
  isAlmostEqual(other) {
68
69
  return (other instanceof CoordinateXYZ) && this._xyz.isAlmostEqual(other._xyz);
69
70
  }
70
- /** Second step of double dispatch: call `handler.handleCoordinateXYZ(this)` */
71
+ /** Second step of double dispatch: call `handler.handleCoordinateXYZ(this)` */
71
72
  dispatchToGeometryHandler(handler) {
72
73
  return handler.handleCoordinateXYZ(this);
73
74
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CoordinateXYZ.js","sourceRoot":"","sources":["../../../src/curve/CoordinateXYZ.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,OAAO,EA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AAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAChD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,iCAAiC;IAC1B,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,qBAAqB;IACd,KAAK;QACV,OAAO,IAAI,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IAC9C,CAAC;IACD;;;OAGG;IAEH,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,gFAAgF;IACzE,yBAAyB,CAAC,OAAwB;QACvD,OAAO,OAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAC3C,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 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\r\n private _xyz: Point3d;\r\n /** Return a (REFERENCE TO) the coordinate data. */\r\n public get point() { return this._xyz; }\r\n /**\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\r\n /** Return the range of the point */\r\n public override range(): Range3d { 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 /**\r\n * Return GeometryQuery children for recursive queries.\r\n * * Leaf classes do not need to implement.\r\n */\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"]}
1
+ {"version":3,"file":"CoordinateXYZ.js","sourceRoot":"","sources":["../../../src/curve/CoordinateXYZ.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;GAGG;AACH,MAAM,OAAO,aAAc,SAAQ,aAAa;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,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACpD,CAAC;IACD,qCAAqC;IACrB,KAAK;QACnB,OAAO,OAAO,CAAC,MAAM,CAAC,IAA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------------------------------------------------\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]] (which is an intermediate class shared by [[BSplineSurface3d]] and [[BSplineSurface3dH]])
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). REQUIRED IN ALL CONCRETE CLASSES */
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
- * * 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.
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
- * * both undefined returns true
85
- * * single defined returns false
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
- * * "double dispatch" call pattern.
90
- * * User code implements a `GeometryHandler` with specialized methods to handle `LineSegment3d`, `Arc3d` etc as
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,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,c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AC1B,kBAAyB,gBAAgB,EAAE,qBAAqB,CAAC;IACjE,yDAAyD;IAClD,KAAK,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO;IAO9D,0FAA0F;aAC1E,WAAW,CAAC,aAAa,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,SAAS,GAAG,IAAI;IAChF;;;;OAIG;aACa,mBAAmB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO;IAClE,4CAA4C;IACrC,mBAAmB,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,GAAE,MAAY,EAAE,EAAE,GAAE,MAAY,GAAG,OAAO;IAGnF,kCAAkC;aAClB,gBAAgB,CAAC,SAAS,EAAE,SAAS,GAAG,aAAa,GAAG,SAAS;IACjF,qBAAqB;aACL,KAAK,IAAI,aAAa,GAAG,SAAS;IAClD;;;OAGG;IACH,IAAW,QAAQ,IAAI,aAAa,EAAE,GAAG,SAAS,CAEjD;IACD,gFAAgF;aAChE,mBAAmB,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO;IAClE;;;;;;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"}
@@ -1,13 +1,13 @@
1
1
  import { Range3d } from "../geometry3d/Range";
2
2
  import { Transform } from "../geometry3d/Transform";
3
3
  /**
4
- * Queries to be supported by Curve, Surface, and Solid objects
4
+ * Queries to be supported by Curve, Surface, and Solid objects.
5
5
  * * `GeometryQuery` is an abstract base class with (abstract) methods for querying curve, solid primitive, mesh,
6
- * and bspline surfaces
6
+ * and bspline surfaces.
7
7
  * @public
8
8
  */
9
9
  export class GeometryQuery {
10
- /** Return the range of the entire GeometryQuery tree */
10
+ /** Return the range of the entire GeometryQuery tree. */
11
11
  range(transform, result) {
12
12
  if (result)
13
13
  result.setNull();
@@ -15,7 +15,7 @@ export class GeometryQuery {
15
15
  this.extendRange(range, transform);
16
16
  return range;
17
17
  }
18
- /** Try to move the geometry by dx,dy,dz */
18
+ /** Try to move the geometry by dx,dy,dz. */
19
19
  tryTranslateInPlace(dx, dy = 0.0, dz = 0.0) {
20
20
  return this.tryTransformInPlace(Transform.createTranslationXYZ(dx, dy, dz));
21
21
  }
@@ -23,13 +23,15 @@ export class GeometryQuery {
23
23
  * Return GeometryQuery children for recursive queries.
24
24
  * * leaf classes do not need to implement.
25
25
  */
26
- get children() { return undefined; }
26
+ get children() {
27
+ return undefined;
28
+ }
27
29
  /**
28
30
  * Test for exact structure and nearly identical geometry.
29
- * * Leaf classes must implement !!!
30
- * * base class implementation recurses through children.
31
- * * base implementation is complete for classes with children and no properties.
32
- * * classes with both children and properties must implement for properties, call super for children.
31
+ * * Leaf classes must implement.
32
+ * * Base class implementation recurses through children.
33
+ * * Base implementation is complete for classes with children and no properties.
34
+ * * Classes with both children and properties must implement for properties, call super for children.
33
35
  */
34
36
  isAlmostEqual(other) {
35
37
  if (this.isSameGeometryClass(other)) {
@@ -44,20 +46,19 @@ export class GeometryQuery {
44
46
  }
45
47
  return true;
46
48
  }
47
- else if (childrenA || childrenB) { // CurveCollections start with empty arrays for children. So these null pointer cases are never reached.
48
- return false; // plainly different .
49
+ else if (childrenA || childrenB) { // CurveCollections start with empty arrays for children so these null pointer cases are never reached.
50
+ return false; // plainly different
49
51
  }
50
52
  else {
51
- // both children null. call it equal? This class should probably have implemented.
52
- return true;
53
+ return true; // both children null; call it equal
53
54
  }
54
55
  }
55
56
  return false;
56
57
  }
57
58
  /**
58
59
  * Apply instance method [[isAlmostEqual]] if both are defined.
59
- * * both undefined returns true
60
- * * single defined returns false
60
+ * * Both undefined returns true.
61
+ * * Single defined returns false.
61
62
  */
62
63
  static areAlmostEqual(a, b) {
63
64
  if (a instanceof GeometryQuery && b instanceof GeometryQuery)
@@ -1 +1 @@
1
- {"version":3,"file":"GeometryQuery.js","sourceRoot":"","sources":["../../../src/curve/GeometryQuery.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAsCpD;;;;;GAKG;AACH,MAAM,OAAgB,aAAa;IAGjC,wDAAwD;IACjD,KAAK,CAAC,SAAqB,EAAE,MAAgB;QAClD,IAAI,MAAM;YAAE,MAAM,CAAC,OAAO,EAAE,CAAC;QAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QACrD,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QACnC,OAAO,KAAK,CAAC;IACf,CAAC;IASD,2CAA2C;IACpC,mBAAmB,CAAC,EAAU,EAAE,KAAa,GAAG,EAAE,KAAa,GAAG;QACvE,OAAO,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,oBAAoB,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IAC9E,CAAC;IAKD;;;OAGG;IACH,IAAW,QAAQ,KAAkC,OAAO,SAAS,CAAC,CAAC,CAAC;IAGxE;;;;;;OAMG;IACI,aAAa,CAAC,KAAoB;QACvC,IAAI,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,EAAE;YACnC,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC;YAChC,MAAM,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAC;YACjC,IAAI,SAAS,IAAI,SAAS,EAAE;gBAC1B,IAAI,SAAS,CAAC,MAAM,KAAK,SAAS,CAAC,MAAM;oBACvC,OAAO,KAAK,CAAC;gBACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;oBACzC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;wBAAE,OAAO,KAAK,CAAC;iBAC7D;gBACD,OAAO,IAAI,CAAC;aACb;iBAAM,IAAI,SAAS,IAAI,SAAS,EAAE,EAAG,yGAAyG;gBAC7I,OAAO,KAAK,CAAC,CAAG,sBAAsB;aACvC;iBAAM;gBACL,oFAAoF;gBACpF,OAAO,IAAI,CAAC;aACb;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","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) 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 { return undefined; }\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])) 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 // both children null. call it equal? This class should probably have implemented.\r\n return true;\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"]}
1
+ {"version":3,"file":"GeometryQuery.js","sourceRoot":"","sources":["../../../src/curve/GeometryQuery.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAsCpD;;;;;GAKG;AACH,MAAM,OAAgB,aAAa;IAGjC,yDAAyD;IAClD,KAAK,CAAC,SAAqB,EAAE,MAAgB;QAClD,IAAI,MAAM;YACR,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QACrD,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QACnC,OAAO,KAAK,CAAC;IACf,CAAC;IASD,4CAA4C;IACrC,mBAAmB,CAAC,EAAU,EAAE,KAAa,GAAG,EAAE,KAAa,GAAG;QACvE,OAAO,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,oBAAoB,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IAC9E,CAAC;IAKD;;;OAGG;IACH,IAAW,QAAQ;QACjB,OAAO,SAAS,CAAC;IACnB,CAAC;IAGD;;;;;;OAMG;IACI,aAAa,CAAC,KAAoB;QACvC,IAAI,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,EAAE;YACnC,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC;YAChC,MAAM,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAC;YACjC,IAAI,SAAS,IAAI,SAAS,EAAE;gBAC1B,IAAI,SAAS,CAAC,MAAM,KAAK,SAAS,CAAC,MAAM;oBACvC,OAAO,KAAK,CAAC;gBACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;oBACzC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;wBAC3C,OAAO,KAAK,CAAC;iBAChB;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","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
- /** return a clone of the points array. */
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,2,2]]` */
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 {*} [[x,y,z],...[x,y,z]]
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,2,2]]` */
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
- /** Return the number of points. */
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: call `handler.handlePointString(this)` */
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;IAErD,yCAAyC;IAClC,mBAAmB,CAAC,KAAK,EAAE,aAAa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B,KAAK;IAGZ,6EAA6E;IACtE,yBAAyB,CAAC,OAAO,EAAE,eAAe,GAAG,GAAG;CAGhE"}
@@ -18,9 +18,13 @@ import { GeometryQuery } from "./GeometryQuery";
18
18
  */
19
19
  export class PointString3d extends GeometryQuery {
20
20
  /** Test if `other` is a PointString3d */
21
- isSameGeometryClass(other) { return other instanceof PointString3d; }
22
- /** return a clone of the points array. */
23
- get points() { return this._points; }
21
+ isSameGeometryClass(other) {
22
+ return other instanceof PointString3d;
23
+ }
24
+ /** Return a clone of the points array. */
25
+ get points() {
26
+ return this._points;
27
+ }
24
28
  constructor() {
25
29
  super();
26
30
  /** String name for schema properties */
@@ -30,11 +34,18 @@ export class PointString3d extends GeometryQuery {
30
34
  /** Clone and apply a transform. */
31
35
  cloneTransformed(transform) {
32
36
  const c = this.clone();
33
- c.tryTransformInPlace(transform);
37
+ c.tryTransformInPlace(transform); // we know tryTransformInPlace succeeds
34
38
  return c;
35
39
  }
40
+ /**
41
+ * Turn any array (possibly nested) into a "flat" array of objects that are not arrays. This allows processing
42
+ * the objects without recursion into nested arrays.
43
+ */
36
44
  static flattenArray(arr) {
37
- return arr.reduce((flat, toFlatten) => {
45
+ return arr.reduce(
46
+ // a callback function to execute for each element in the array. Its return value becomes
47
+ // the value of the "flat" parameter on the next invocation of the callback function.
48
+ (flat, toFlatten) => {
38
49
  return flat.concat(Array.isArray(toFlatten) ? PointString3d.flattenArray(toFlatten) : toFlatten);
39
50
  }, []);
40
51
  }
@@ -44,7 +55,7 @@ export class PointString3d extends GeometryQuery {
44
55
  result.addPoints(points);
45
56
  return result;
46
57
  }
47
- /** Add multiple points to the PointString3d */
58
+ /** Add multiple points to the PointString3d. */
48
59
  addPoints(...points) {
49
60
  const toAdd = PointString3d.flattenArray(points);
50
61
  for (const p of toAdd) {
@@ -52,25 +63,25 @@ export class PointString3d extends GeometryQuery {
52
63
  this._points.push(p);
53
64
  }
54
65
  }
55
- /** Add a single point to the PointString3d */
66
+ /** Add a single point to the PointString3d. */
56
67
  addPoint(point) {
57
68
  this._points.push(point);
58
69
  }
59
- /** Remove the last point added to the PointString3d */
70
+ /** Remove the last point added to the PointString3d. */
60
71
  popPoint() {
61
72
  this._points.pop();
62
73
  }
63
- /** Replace this PointString3d's point array by a clone of the array in `other` */
74
+ /** Replace this PointString3d's point array by a clone of the array in `other`. */
64
75
  setFrom(other) {
65
76
  this._points = Point3dArray.clonePoint3dArray(other._points);
66
77
  }
67
- /** Create from an array of Point3d */
78
+ /** Create from an array of Point3d. */
68
79
  static createPoints(points) {
69
80
  const ps = new PointString3d();
70
81
  ps._points = Point3dArray.clonePoint3dArray(points);
71
82
  return ps;
72
83
  }
73
- /** Create a PointString3d from xyz coordinates packed in a Float64Array */
84
+ /** Create a PointString3d from xyz coordinates packed in a Float64Array. */
74
85
  static createFloat64Array(xyzData) {
75
86
  const ps = new PointString3d();
76
87
  for (let i = 0; i + 3 <= xyzData.length; i += 3)
@@ -83,7 +94,7 @@ export class PointString3d extends GeometryQuery {
83
94
  retVal.setFrom(this);
84
95
  return retVal;
85
96
  }
86
- /** Replace this instance's points by those from a json array, e.g. `[[1,2,3], [4,2,2]]` */
97
+ /** Replace this instance's points by those from a json array, e.g. `[[1,2,3], [4,5,6]]`. */
87
98
  setFromJSON(json) {
88
99
  this._points.length = 0;
89
100
  if (Array.isArray(json)) {
@@ -94,7 +105,7 @@ export class PointString3d extends GeometryQuery {
94
105
  }
95
106
  /**
96
107
  * Convert an PointString3d to a JSON object.
97
- * @return {*} [[x,y,z],...[x,y,z]]
108
+ * @return {*} e.g., `[[1,2,3], [4,5,6]]`.
98
109
  */
99
110
  toJSON() {
100
111
  const value = [];
@@ -102,7 +113,7 @@ export class PointString3d extends GeometryQuery {
102
113
  value.push(p.toJSON());
103
114
  return value;
104
115
  }
105
- /** Create a PointString3d from a json array, e.g. `[[1,2,3], [4,2,2]]` */
116
+ /** Create a PointString3d from a json array, e.g. `[[1,2,3], [4,5,6]]`. */
106
117
  static fromJSON(json) {
107
118
  const ps = new PointString3d();
108
119
  ps.setFromJSON(json);
@@ -120,14 +131,16 @@ export class PointString3d extends GeometryQuery {
120
131
  return undefined;
121
132
  }
122
133
  /** Return the number of points. */
123
- numPoints() { return this._points.length; }
134
+ numPoints() {
135
+ return this._points.length;
136
+ }
124
137
  /** Reverse the point order */
125
138
  reverseInPlace() {
126
139
  if (this._points.length >= 2) {
127
140
  let i0 = 0;
128
141
  let i1 = this._points.length - 1;
129
142
  while (i0 < i1) {
130
- const a = this._points[i0];
143
+ const a = this._points[i1];
131
144
  this._points[i1] = this._points[i0];
132
145
  this._points[i0] = a;
133
146
  i0++;
@@ -135,7 +148,7 @@ export class PointString3d extends GeometryQuery {
135
148
  }
136
149
  }
137
150
  }
138
- /** Return the number of points. */
151
+ /** Apply transform on points in place. */
139
152
  tryTransformInPlace(transform) {
140
153
  transform.multiplyPoint3dArrayInPlace(this._points);
141
154
  return true;
@@ -154,7 +167,7 @@ export class PointString3d extends GeometryQuery {
154
167
  isInPlane(plane) {
155
168
  return Point3dArray.isCloseToPlane(this._points, plane, Geometry.smallMetricDistance);
156
169
  }
157
- /** Extend a range to include the points in this PointString3d. */
170
+ /** Extend a range to include the points in this PointString3d (optionally transformed). */
158
171
  extendRange(rangeToExtend, transform) {
159
172
  rangeToExtend.extendArray(this._points, transform);
160
173
  }
@@ -165,8 +178,10 @@ export class PointString3d extends GeometryQuery {
165
178
  return Point3dArray.isAlmostEqual(this._points, other._points);
166
179
  }
167
180
  /** Reduce to empty set of points. */
168
- clear() { this._points.length = 0; }
169
- /** Second step of double dispatch: call `handler.handlePointString(this)` */
181
+ clear() {
182
+ this._points.length = 0;
183
+ }
184
+ /** Second step of double dispatch: call `handler.handlePointString(this)` */
170
185
  dispatchToGeometryHandler(handler) {
171
186
  return handler.handlePointString3d(this);
172
187
  }