@itwin/core-geometry 4.0.0-dev.22 → 4.0.0-dev.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/lib/cjs/Geometry.d.ts +23 -0
  2. package/lib/cjs/Geometry.d.ts.map +1 -1
  3. package/lib/cjs/Geometry.js +25 -1
  4. package/lib/cjs/Geometry.js.map +1 -1
  5. package/lib/cjs/geometry3d/BarycentricTriangle.d.ts +195 -8
  6. package/lib/cjs/geometry3d/BarycentricTriangle.d.ts.map +1 -1
  7. package/lib/cjs/geometry3d/BarycentricTriangle.js +459 -11
  8. package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
  9. package/lib/cjs/geometry3d/GrowableXYArray.d.ts +1 -1
  10. package/lib/cjs/geometry3d/GrowableXYArray.d.ts.map +1 -1
  11. package/lib/cjs/geometry3d/GrowableXYArray.js +1 -1
  12. package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
  13. package/lib/cjs/geometry3d/IndexedXYCollection.d.ts +22 -7
  14. package/lib/cjs/geometry3d/IndexedXYCollection.d.ts.map +1 -1
  15. package/lib/cjs/geometry3d/IndexedXYCollection.js +41 -5
  16. package/lib/cjs/geometry3d/IndexedXYCollection.js.map +1 -1
  17. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts +58 -4
  18. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  19. package/lib/cjs/geometry3d/IndexedXYZCollection.js +102 -4
  20. package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
  21. package/lib/cjs/geometry3d/Point2dArrayCarrier.d.ts +10 -0
  22. package/lib/cjs/geometry3d/Point2dArrayCarrier.d.ts.map +1 -1
  23. package/lib/cjs/geometry3d/Point2dArrayCarrier.js +14 -0
  24. package/lib/cjs/geometry3d/Point2dArrayCarrier.js.map +1 -1
  25. package/lib/cjs/geometry3d/Point3dArrayCarrier.d.ts +0 -6
  26. package/lib/cjs/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
  27. package/lib/cjs/geometry3d/Point3dArrayCarrier.js +0 -6
  28. package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
  29. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +1 -1
  30. package/lib/cjs/geometry3d/Point3dVector3d.js +2 -2
  31. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  32. package/lib/cjs/geometry3d/PointHelpers.d.ts +14 -1
  33. package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
  34. package/lib/cjs/geometry3d/PointHelpers.js +33 -1
  35. package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
  36. package/lib/cjs/geometry3d/PolygonOps.d.ts +120 -10
  37. package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
  38. package/lib/cjs/geometry3d/PolygonOps.js +412 -12
  39. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  40. package/lib/cjs/polyface/FacetLocationDetail.d.ts +264 -0
  41. package/lib/cjs/polyface/FacetLocationDetail.d.ts.map +1 -0
  42. package/lib/cjs/polyface/FacetLocationDetail.js +378 -0
  43. package/lib/cjs/polyface/FacetLocationDetail.js.map +1 -0
  44. package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts +2 -5
  45. package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
  46. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js +5 -2
  47. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  48. package/lib/cjs/polyface/PolyfaceBuilder.d.ts +20 -14
  49. package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
  50. package/lib/cjs/polyface/PolyfaceBuilder.js +21 -17
  51. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  52. package/lib/cjs/polyface/PolyfaceData.d.ts +1 -1
  53. package/lib/cjs/polyface/PolyfaceData.d.ts.map +1 -1
  54. package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
  55. package/lib/cjs/polyface/PolyfaceQuery.d.ts +22 -1
  56. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  57. package/lib/cjs/polyface/PolyfaceQuery.js +52 -2
  58. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  59. package/lib/cjs/solid/Sphere.d.ts +5 -5
  60. package/lib/cjs/solid/Sphere.js +5 -5
  61. package/lib/cjs/solid/Sphere.js.map +1 -1
  62. package/lib/esm/Geometry.d.ts +23 -0
  63. package/lib/esm/Geometry.d.ts.map +1 -1
  64. package/lib/esm/Geometry.js +24 -0
  65. package/lib/esm/Geometry.js.map +1 -1
  66. package/lib/esm/geometry3d/BarycentricTriangle.d.ts +195 -8
  67. package/lib/esm/geometry3d/BarycentricTriangle.d.ts.map +1 -1
  68. package/lib/esm/geometry3d/BarycentricTriangle.js +459 -12
  69. package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
  70. package/lib/esm/geometry3d/GrowableXYArray.d.ts +1 -1
  71. package/lib/esm/geometry3d/GrowableXYArray.d.ts.map +1 -1
  72. package/lib/esm/geometry3d/GrowableXYArray.js +1 -1
  73. package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
  74. package/lib/esm/geometry3d/IndexedXYCollection.d.ts +22 -7
  75. package/lib/esm/geometry3d/IndexedXYCollection.d.ts.map +1 -1
  76. package/lib/esm/geometry3d/IndexedXYCollection.js +41 -5
  77. package/lib/esm/geometry3d/IndexedXYCollection.js.map +1 -1
  78. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts +58 -4
  79. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  80. package/lib/esm/geometry3d/IndexedXYZCollection.js +103 -5
  81. package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
  82. package/lib/esm/geometry3d/Point2dArrayCarrier.d.ts +10 -0
  83. package/lib/esm/geometry3d/Point2dArrayCarrier.d.ts.map +1 -1
  84. package/lib/esm/geometry3d/Point2dArrayCarrier.js +14 -0
  85. package/lib/esm/geometry3d/Point2dArrayCarrier.js.map +1 -1
  86. package/lib/esm/geometry3d/Point3dArrayCarrier.d.ts +0 -6
  87. package/lib/esm/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
  88. package/lib/esm/geometry3d/Point3dArrayCarrier.js +0 -6
  89. package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
  90. package/lib/esm/geometry3d/Point3dVector3d.d.ts +1 -1
  91. package/lib/esm/geometry3d/Point3dVector3d.js +2 -2
  92. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  93. package/lib/esm/geometry3d/PointHelpers.d.ts +14 -1
  94. package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
  95. package/lib/esm/geometry3d/PointHelpers.js +33 -1
  96. package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
  97. package/lib/esm/geometry3d/PolygonOps.d.ts +120 -10
  98. package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
  99. package/lib/esm/geometry3d/PolygonOps.js +411 -12
  100. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  101. package/lib/esm/polyface/FacetLocationDetail.d.ts +264 -0
  102. package/lib/esm/polyface/FacetLocationDetail.d.ts.map +1 -0
  103. package/lib/esm/polyface/FacetLocationDetail.js +371 -0
  104. package/lib/esm/polyface/FacetLocationDetail.js.map +1 -0
  105. package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts +2 -5
  106. package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
  107. package/lib/esm/polyface/IndexedPolyfaceVisitor.js +5 -2
  108. package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  109. package/lib/esm/polyface/PolyfaceBuilder.d.ts +20 -14
  110. package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
  111. package/lib/esm/polyface/PolyfaceBuilder.js +21 -17
  112. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  113. package/lib/esm/polyface/PolyfaceData.d.ts +1 -1
  114. package/lib/esm/polyface/PolyfaceData.d.ts.map +1 -1
  115. package/lib/esm/polyface/PolyfaceData.js.map +1 -1
  116. package/lib/esm/polyface/PolyfaceQuery.d.ts +22 -1
  117. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  118. package/lib/esm/polyface/PolyfaceQuery.js +52 -2
  119. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  120. package/lib/esm/solid/Sphere.d.ts +5 -5
  121. package/lib/esm/solid/Sphere.js +5 -5
  122. package/lib/esm/solid/Sphere.js.map +1 -1
  123. package/package.json +4 -4
@@ -0,0 +1,264 @@
1
+ /** @packageDocumentation
2
+ * @module Polyface
3
+ */
4
+ import { Point2d } from "../geometry3d/Point2dVector2d";
5
+ import { Point3d, Vector3d } from "../geometry3d/Point3dVector3d";
6
+ import { TriangleLocationDetail } from "../geometry3d/BarycentricTriangle";
7
+ import { PolygonLocation } from "../Geometry";
8
+ import { PolyfaceVisitor } from "./Polyface";
9
+ import { PolygonLocationDetail } from "../geometry3d/PolygonOps";
10
+ import { IndexedXYZCollection } from "../geometry3d/IndexedXYZCollection";
11
+ import { IndexedXYCollection } from "../geometry3d/IndexedXYCollection";
12
+ /** Callback for processing the detail for an intersected facet.
13
+ * @param detail reference to the intersection data, with `detail.IsInsideOn === true`. Note that `detail` is owned by the caller; to persist, use `detail.clone`.
14
+ * @param visitor at currently intersected facet
15
+ * @returns true to accept this intersection and stop processing; false to continue to the next facet
16
+ */
17
+ export declare type FacetIntersectCallback = (detail: FacetLocationDetail, visitor: PolyfaceVisitor) => boolean;
18
+ /** Options for computing and processing facet intersection methods.
19
+ * @see PolyfaceQuery.intersectRay3d
20
+ */
21
+ export declare class FacetIntersectOptions {
22
+ /** distance tolerance for testing coincidence with facet boundary */
23
+ distanceTolerance: number;
24
+ /** fractional tolerance for snapping barycentric coordinates to a triangular facet edge */
25
+ parameterTolerance: number;
26
+ /** whether to compute the normal at the intersection point */
27
+ needNormal?: boolean;
28
+ /** whether to compute the uv parameter at the intersection point */
29
+ needParam?: boolean;
30
+ /** whether to compute the color at the intersection point */
31
+ needColor?: boolean;
32
+ /** whether to compute the barycentric coordinates of the point for a convex facet */
33
+ needBarycentricCoordinates?: boolean;
34
+ /** optional callback to accept an intersected facet */
35
+ acceptIntersection?: FacetIntersectCallback;
36
+ /** constructor with defaults */
37
+ constructor();
38
+ }
39
+ /**
40
+ * Carries data about a point in the plane of a facet of a mesh.
41
+ * @see PolyfaceQuery.intersectRay3d
42
+ * @public
43
+ */
44
+ export interface FacetLocationDetail {
45
+ /** Get the index of the referenced facet. */
46
+ get facetIndex(): number;
47
+ /** Get the number of edges of this facet. */
48
+ get edgeCount(): number;
49
+ /** Get the world coordinates of the point. */
50
+ get point(): Point3d;
51
+ /** Get the application-specific number. */
52
+ get a(): number;
53
+ /** Get the projection of the point onto the closest facet edge. */
54
+ get closestEdge(): {
55
+ startVertexIndex: number;
56
+ edgeParam: number;
57
+ };
58
+ /** Whether this instance specifies a valid location. */
59
+ get isValid(): boolean;
60
+ /** Whether the facet is convex. */
61
+ get isConvex(): boolean;
62
+ /** Whether the point is inside or on the facet. */
63
+ get isInsideOrOn(): boolean;
64
+ /** Get the code that classifies the location of the point with respect to the facet. */
65
+ get classify(): PolygonLocation;
66
+ /** Clone the instance */
67
+ clone(): FacetLocationDetail;
68
+ /** Set the instance contents from the other detail */
69
+ copyContentsFrom(other: FacetLocationDetail): void;
70
+ /** Get reference to cached normal interpolated from facet data. Inputs may be used to compute the cache. */
71
+ getNormal(facetNormals?: IndexedXYZCollection, facetVertices?: IndexedXYZCollection, distanceTolerance?: number): Vector3d | undefined;
72
+ /** Get reference to cached uv parameter interpolated from facet data. Inputs may be used to compute the cache. */
73
+ getParam(facetParams?: IndexedXYCollection, facetVertices?: IndexedXYZCollection, distanceTolerance?: number): Point2d | undefined;
74
+ /** Get cached color interpolated from facet data. Inputs may be used to compute the cache. */
75
+ getColor(facetColors?: number[], facetVertices?: IndexedXYZCollection, distanceTolerance?: number): number | undefined;
76
+ /** Get reference to cached barycentric coordinates of the point. Inputs may be used to compute the cache. */
77
+ getBarycentricCoordinates(facetVertices?: IndexedXYZCollection, distanceTolerance?: number): number[] | undefined;
78
+ }
79
+ /**
80
+ * Implementation of `FacetLocationDetail` for a triangular facet.
81
+ * @public
82
+ */
83
+ export declare class TriangularFacetLocationDetail implements FacetLocationDetail {
84
+ private _facetIndex;
85
+ private _detail;
86
+ private _normal?;
87
+ private _param?;
88
+ private _color?;
89
+ /** captures the detail if provided */
90
+ private constructor();
91
+ /** Invalidate this detail. */
92
+ invalidate(deep?: boolean): void;
93
+ /** Create a detail.
94
+ * @param result optional pre-allocated object to fill and return
95
+ */
96
+ static create(facetIndex: number, detail?: TriangleLocationDetail, result?: TriangularFacetLocationDetail): TriangularFacetLocationDetail;
97
+ /** Get the facet index. */
98
+ get facetIndex(): number;
99
+ /** Get the edge count of this facet. */
100
+ get edgeCount(): number;
101
+ /** Get the world coordinates of the point. */
102
+ get point(): Point3d;
103
+ /** Get the application-specific number. */
104
+ get a(): number;
105
+ /** Get the projection of the point onto the closest facet edge. */
106
+ get closestEdge(): {
107
+ startVertexIndex: number;
108
+ edgeParam: number;
109
+ };
110
+ /** Test validity of fields other than _detail. */
111
+ private get _isValid();
112
+ /** Whether this instance specifies a valid location. */
113
+ get isValid(): boolean;
114
+ /** Whether the facet is convex. */
115
+ get isConvex(): boolean;
116
+ /** Whether the point is inside or on the polygon. */
117
+ get isInsideOrOn(): boolean;
118
+ /** Get the code that classifies the location of the point with respect to the facet. */
119
+ get classify(): PolygonLocation;
120
+ /** Clone the instance */
121
+ clone(): TriangularFacetLocationDetail;
122
+ /** Set the instance contents from the other detail.
123
+ * @param other detail to clone
124
+ */
125
+ copyContentsFrom(other: TriangularFacetLocationDetail): void;
126
+ /** Get normal interpolated from facet data.
127
+ * @param facetNormals used to compute the normal cache
128
+ * @returns reference to cached normal
129
+ */
130
+ getNormal(facetNormals?: IndexedXYZCollection): Vector3d | undefined;
131
+ /** Get uv parameter interpolated from facet data.
132
+ * @param facetParams used to compute the uv parameter cache
133
+ * @returns reference to cached uv parameter
134
+ */
135
+ getParam(facetParams?: IndexedXYCollection): Point2d | undefined;
136
+ /** Get color interpolated from facet data.
137
+ * * Assumes barycentric coordinates are already computed in the TriangleLocationDetail member.
138
+ * @param facetColors used to compute the color cache
139
+ * @returns cached color
140
+ */
141
+ getColor(facetColors?: number[]): number | undefined;
142
+ /** Get the barycentric coordinates of this location.
143
+ * @returns cached barycentric coordinates
144
+ */
145
+ getBarycentricCoordinates(): number[];
146
+ }
147
+ /**
148
+ * Implementation of `FacetLocationDetail` for a non-convex facet.
149
+ * * Facet vertex data interpolation is not available.
150
+ * @public
151
+ */
152
+ export declare class NonConvexFacetLocationDetail implements FacetLocationDetail {
153
+ private _facetIndex;
154
+ private _edgeCount;
155
+ protected _detail: PolygonLocationDetail;
156
+ /** captures the detail if provided */
157
+ protected constructor(facetIndex?: number, edgeCount?: number, detail?: PolygonLocationDetail);
158
+ /** Invalidate this detail. */
159
+ invalidate(deep?: boolean): void;
160
+ /** Create a detail.
161
+ * @param result optional pre-allocated object to fill and return
162
+ */
163
+ static create(facetIndex: number, edgeCount: number, detail?: PolygonLocationDetail, result?: NonConvexFacetLocationDetail): NonConvexFacetLocationDetail;
164
+ /** Get the facet index. */
165
+ get facetIndex(): number;
166
+ /** Get the edge count of this facet. */
167
+ get edgeCount(): number;
168
+ /** Get the world coordinates of the point. */
169
+ get point(): Point3d;
170
+ /** Get the application-specific number. */
171
+ get a(): number;
172
+ /** Get the projection of the point onto the closest facet edge. */
173
+ get closestEdge(): {
174
+ startVertexIndex: number;
175
+ edgeParam: number;
176
+ };
177
+ /** Test validity of fields other than _detail. */
178
+ private get _isValid();
179
+ /** Whether this instance specifies a valid location. */
180
+ get isValid(): boolean;
181
+ /** Whether the facet is convex. */
182
+ get isConvex(): boolean;
183
+ /** Whether the point is inside or on the polygon. */
184
+ get isInsideOrOn(): boolean;
185
+ /** Get the code that classifies the location of the point with respect to the facet. */
186
+ get classify(): PolygonLocation;
187
+ /** Clone the instance */
188
+ clone(): NonConvexFacetLocationDetail;
189
+ /** Set the instance contents from the other detail.
190
+ * @param other detail to clone
191
+ */
192
+ copyContentsFrom(other: NonConvexFacetLocationDetail): void;
193
+ /** Interpolated data is not defined for a non-convex facet.
194
+ * @returns undefined
195
+ */
196
+ getNormal(): Vector3d | undefined;
197
+ /** Interpolated data is not defined for a non-convex facet.
198
+ * @returns undefined
199
+ */
200
+ getParam(): Point2d | undefined;
201
+ /** Interpolated data is not defined for a non-convex facet.
202
+ * @returns undefined
203
+ */
204
+ getColor(): number | undefined;
205
+ /** Barycentric coordinates are not defined for a non-convex facet.
206
+ * @returns undefined
207
+ */
208
+ getBarycentricCoordinates(): number[] | undefined;
209
+ }
210
+ /**
211
+ * Implementation of `FacetLocationDetail` for a convex facet.
212
+ * * If `edgeCount` is 3, `TriangularFacetLocationDetail` is more efficient.
213
+ * @public
214
+ */
215
+ export declare class ConvexFacetLocationDetail extends NonConvexFacetLocationDetail {
216
+ private _normal?;
217
+ private _param?;
218
+ private _color?;
219
+ private _barycentricCoordinates?;
220
+ /** captures the detail if provided */
221
+ private constructor();
222
+ /** Invalidate this detail. */
223
+ invalidate(deep?: boolean): void;
224
+ /** Create a detail.
225
+ * @param result optional pre-allocated object to fill and return
226
+ */
227
+ static create(facetIndex: number, edgeCount: number, detail?: PolygonLocationDetail, result?: ConvexFacetLocationDetail): ConvexFacetLocationDetail;
228
+ /** Whether the facet is convex. */
229
+ get isConvex(): boolean;
230
+ /** Clone the instance */
231
+ clone(): ConvexFacetLocationDetail;
232
+ /** Set the instance contents from the other detail.
233
+ * @param other detail to clone
234
+ */
235
+ copyContentsFrom(other: ConvexFacetLocationDetail): void;
236
+ /** Get normal interpolated from facet data.
237
+ * @param facetNormals used to compute the normal cache
238
+ * @param facetVertices used to compute the barycentric coordinate cache
239
+ * @param distanceTolerance used to compute the barycentric coordinate cache
240
+ * @returns reference to cached normal
241
+ */
242
+ getNormal(facetNormals?: IndexedXYZCollection, facetVertices?: IndexedXYZCollection, distanceTolerance?: number): Vector3d | undefined;
243
+ /** Get uv parameter interpolated from facet data.
244
+ * @param facetParams used to compute the uv parameter cache
245
+ * @param facetVertices used to compute the barycentric coordinate cache
246
+ * @param distanceTolerance used to compute the barycentric coordinate cache
247
+ * @returns reference to cached uv parameter
248
+ */
249
+ getParam(facetParams?: IndexedXYCollection, facetVertices?: IndexedXYZCollection, distanceTolerance?: number): Point2d | undefined;
250
+ /** Get color interpolated from facet data.
251
+ * @param facetColors used to compute the color cache
252
+ * @param facetVertices used to compute the barycentric coordinate cache
253
+ * @param distanceTolerance used to compute the barycentric coordinate cache
254
+ * @returns cached color
255
+ */
256
+ getColor(facetColors?: number[], facetVertices?: IndexedXYZCollection, distanceTolerance?: number): number | undefined;
257
+ /** Get the barycentric coordinates of this location, if they have been computed.
258
+ * @param facetVertices used to compute the barycentric coordinate cache
259
+ * @param distanceTolerance used to compute the barycentric coordinate cache
260
+ * @returns cached barycentric coordinates
261
+ */
262
+ getBarycentricCoordinates(facetVertices?: IndexedXYZCollection, distanceTolerance?: number): number[] | undefined;
263
+ }
264
+ //# sourceMappingURL=FacetLocationDetail.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FacetLocationDetail.d.ts","sourceRoot":"","sources":["../../../src/polyface/FacetLocationDetail.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAY,eAAe,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,qBAAqB,E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AAO;IAGP,8BAA8B;IACd,UAAU,CAAC,IAAI,GAAE,OAAc;IAO/C;;OAEG;WACoB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,qBAAqB,EAAE,MAAM,CAAC,EAAE,yBAAyB,GAAG,yBAAyB;IAKnK,mCAAmC;IACnC,IAAoB,QAAQ,IAAI,OAAO,CAEtC;IACD,yBAAyB;IACT,KAAK,IAAI,yBAAyB;IAKlD;;OAEG;IACa,gBAAgB,CAAC,KAAK,EAAE,yBAAyB;IAOjE;;;;;OAKG;IACa,SAAS,CAAC,YAAY,CAAC,EAAE,oBAAoB,EAAE,aAAa,CAAC,EAAE,oBAAoB,EAAE,iBAAiB,GAAE,MAAqC,GAAG,QAAQ,GAAG,SAAS;IAUpL;;;;;OAKG;IACa,QAAQ,CAAC,WAAW,CAAC,EAAE,mBAAmB,EAAE,aAAa,CAAC,EAAE,oBAAoB,EAAE,iBAAiB,GAAE,MAAqC,GAAG,OAAO,GAAG,SAAS;IAUhL;;;;;OAKG;IACa,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,EAAE,aAAa,CAAC,EAAE,oBAAoB,EAAE,iBAAiB,GAAE,MAAqC,GAAG,MAAM,GAAG,SAAS;IAQpK;;;;MAIE;IACc,yBAAyB,CAAC,aAAa,CAAC,EAAE,oBAAoB,EAAE,iBAAiB,GAAE,MAAqC,GAAG,MAAM,EAAE,GAAG,SAAS;CAMhK"}
@@ -0,0 +1,378 @@
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ /** @packageDocumentation
7
+ * @module Polyface
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.ConvexFacetLocationDetail = exports.NonConvexFacetLocationDetail = exports.TriangularFacetLocationDetail = exports.FacetIntersectOptions = void 0;
11
+ const Point2dVector2d_1 = require("../geometry3d/Point2dVector2d");
12
+ const Point3dVector3d_1 = require("../geometry3d/Point3dVector3d");
13
+ const BarycentricTriangle_1 = require("../geometry3d/BarycentricTriangle");
14
+ const Geometry_1 = require("../Geometry");
15
+ const PolygonOps_1 = require("../geometry3d/PolygonOps");
16
+ const PointHelpers_1 = require("../geometry3d/PointHelpers");
17
+ /** Options for computing and processing facet intersection methods.
18
+ * @see PolyfaceQuery.intersectRay3d
19
+ */
20
+ class FacetIntersectOptions {
21
+ /** constructor with defaults */
22
+ constructor() {
23
+ this.distanceTolerance = Geometry_1.Geometry.smallMetricDistance;
24
+ this.parameterTolerance = Geometry_1.Geometry.smallFraction;
25
+ }
26
+ }
27
+ exports.FacetIntersectOptions = FacetIntersectOptions;
28
+ /**
29
+ * Implementation of `FacetLocationDetail` for a triangular facet.
30
+ * @public
31
+ */
32
+ class TriangularFacetLocationDetail {
33
+ /** captures the detail if provided */
34
+ constructor(facetIndex = -1, detail) {
35
+ this._facetIndex = facetIndex;
36
+ this._detail = detail ? detail : BarycentricTriangle_1.TriangleLocationDetail.create();
37
+ }
38
+ /** Invalidate this detail. */
39
+ invalidate(deep = true) {
40
+ this._facetIndex = -1;
41
+ if (deep)
42
+ this._detail.invalidate();
43
+ this._normal = undefined;
44
+ this._param = undefined;
45
+ this._color = undefined;
46
+ }
47
+ /** Create a detail.
48
+ * @param result optional pre-allocated object to fill and return
49
+ */
50
+ static create(facetIndex, detail, result) {
51
+ if (undefined === result)
52
+ return new TriangularFacetLocationDetail(facetIndex, detail);
53
+ result.invalidate(false); // detail might be owned by result!
54
+ result._facetIndex = facetIndex;
55
+ if (undefined !== detail)
56
+ result._detail.copyContentsFrom(detail);
57
+ return result;
58
+ }
59
+ /** Get the facet index. */
60
+ get facetIndex() {
61
+ return this._facetIndex;
62
+ }
63
+ /** Get the edge count of this facet. */
64
+ get edgeCount() {
65
+ return 3;
66
+ }
67
+ /** Get the world coordinates of the point. */
68
+ get point() {
69
+ return this._detail.world;
70
+ }
71
+ /** Get the application-specific number. */
72
+ get a() {
73
+ return this._detail.a;
74
+ }
75
+ /** Get the projection of the point onto the closest facet edge. */
76
+ get closestEdge() {
77
+ return { startVertexIndex: this._detail.closestEdgeIndex, edgeParam: this._detail.closestEdgeParam };
78
+ }
79
+ /** Test validity of fields other than _detail. */
80
+ get _isValid() {
81
+ return this._facetIndex >= 0;
82
+ }
83
+ /** Whether this instance specifies a valid location. */
84
+ get isValid() {
85
+ return this._isValid && this._detail.isValid;
86
+ }
87
+ /** Whether the facet is convex. */
88
+ get isConvex() {
89
+ return true;
90
+ }
91
+ /** Whether the point is inside or on the polygon. */
92
+ get isInsideOrOn() {
93
+ return this._isValid && this._detail.isInsideOrOn;
94
+ }
95
+ /** Get the code that classifies the location of the point with respect to the facet. */
96
+ get classify() {
97
+ return this._detail.classify;
98
+ }
99
+ /** Clone the instance */
100
+ clone() {
101
+ const detail = new TriangularFacetLocationDetail();
102
+ detail.copyContentsFrom(this);
103
+ return detail;
104
+ }
105
+ /** Set the instance contents from the other detail.
106
+ * @param other detail to clone
107
+ */
108
+ copyContentsFrom(other) {
109
+ var _a, _b;
110
+ this._facetIndex = other._facetIndex;
111
+ this._detail.copyContentsFrom(other._detail);
112
+ this._normal = (_a = other._normal) === null || _a === void 0 ? void 0 : _a.clone();
113
+ this._param = (_b = other._param) === null || _b === void 0 ? void 0 : _b.clone();
114
+ this._color = other._color;
115
+ }
116
+ /** Get normal interpolated from facet data.
117
+ * @param facetNormals used to compute the normal cache
118
+ * @returns reference to cached normal
119
+ */
120
+ getNormal(facetNormals) {
121
+ if (this._detail.isValid && undefined === this._normal && undefined !== facetNormals) {
122
+ this._normal = Point3dVector3d_1.Vector3d.create();
123
+ const scales = [this._detail.local.x, this._detail.local.y, this._detail.local.z];
124
+ facetNormals.linearCombination(scales, this._normal);
125
+ }
126
+ return this._normal;
127
+ }
128
+ /** Get uv parameter interpolated from facet data.
129
+ * @param facetParams used to compute the uv parameter cache
130
+ * @returns reference to cached uv parameter
131
+ */
132
+ getParam(facetParams) {
133
+ if (this._detail.isValid && undefined === this._param && undefined !== facetParams) {
134
+ this._param = Point2dVector2d_1.Point2d.create();
135
+ const scales = [this._detail.local.x, this._detail.local.y, this._detail.local.z];
136
+ facetParams.linearCombination(scales, this._param);
137
+ }
138
+ return this._param;
139
+ }
140
+ /** Get color interpolated from facet data.
141
+ * * Assumes barycentric coordinates are already computed in the TriangleLocationDetail member.
142
+ * @param facetColors used to compute the color cache
143
+ * @returns cached color
144
+ */
145
+ getColor(facetColors) {
146
+ if (this._detail.isValid && undefined === this._color && undefined !== facetColors) {
147
+ const scales = [this._detail.local.x, this._detail.local.y, this._detail.local.z];
148
+ this._color = PointHelpers_1.NumberArray.linearCombinationOfColors(facetColors, scales);
149
+ }
150
+ return this._color;
151
+ }
152
+ /** Get the barycentric coordinates of this location.
153
+ * @returns cached barycentric coordinates
154
+ */
155
+ getBarycentricCoordinates() {
156
+ return [this._detail.local.x, this._detail.local.y, this._detail.local.z];
157
+ }
158
+ }
159
+ exports.TriangularFacetLocationDetail = TriangularFacetLocationDetail;
160
+ /**
161
+ * Implementation of `FacetLocationDetail` for a non-convex facet.
162
+ * * Facet vertex data interpolation is not available.
163
+ * @public
164
+ */
165
+ class NonConvexFacetLocationDetail {
166
+ /** captures the detail if provided */
167
+ constructor(facetIndex = -1, edgeCount = 0, detail) {
168
+ this._facetIndex = facetIndex;
169
+ this._edgeCount = edgeCount;
170
+ this._detail = detail ? detail : PolygonOps_1.PolygonLocationDetail.create();
171
+ }
172
+ /** Invalidate this detail. */
173
+ invalidate(deep = true) {
174
+ this._facetIndex = -1;
175
+ this._edgeCount = 0;
176
+ if (deep)
177
+ this._detail.invalidate();
178
+ }
179
+ /** Create a detail.
180
+ * @param result optional pre-allocated object to fill and return
181
+ */
182
+ static create(facetIndex, edgeCount, detail, result) {
183
+ if (undefined === result)
184
+ return new NonConvexFacetLocationDetail(facetIndex, edgeCount, detail);
185
+ result.invalidate(false); // detail might be owned by result!
186
+ result._facetIndex = facetIndex;
187
+ result._edgeCount = edgeCount;
188
+ if (undefined !== detail && result._detail !== detail)
189
+ result._detail.copyContentsFrom(detail);
190
+ return result;
191
+ }
192
+ /** Get the facet index. */
193
+ get facetIndex() {
194
+ return this._facetIndex;
195
+ }
196
+ /** Get the edge count of this facet. */
197
+ get edgeCount() {
198
+ return this._edgeCount;
199
+ }
200
+ /** Get the world coordinates of the point. */
201
+ get point() {
202
+ return this._detail.point;
203
+ }
204
+ /** Get the application-specific number. */
205
+ get a() {
206
+ return this._detail.a;
207
+ }
208
+ /** Get the projection of the point onto the closest facet edge. */
209
+ get closestEdge() {
210
+ return { startVertexIndex: this._detail.closestEdgeIndex, edgeParam: this._detail.closestEdgeParam };
211
+ }
212
+ /** Test validity of fields other than _detail. */
213
+ get _isValid() {
214
+ return this._facetIndex >= 0 && this._edgeCount >= 3;
215
+ }
216
+ /** Whether this instance specifies a valid location. */
217
+ get isValid() {
218
+ return this._isValid && this._detail.isValid;
219
+ }
220
+ /** Whether the facet is convex. */
221
+ get isConvex() {
222
+ return false;
223
+ }
224
+ /** Whether the point is inside or on the polygon. */
225
+ get isInsideOrOn() {
226
+ return this._isValid && this._detail.isInsideOrOn;
227
+ }
228
+ /** Get the code that classifies the location of the point with respect to the facet. */
229
+ get classify() {
230
+ return this._detail.code;
231
+ }
232
+ /** Clone the instance */
233
+ clone() {
234
+ const detail = new NonConvexFacetLocationDetail();
235
+ detail.copyContentsFrom(this);
236
+ return detail;
237
+ }
238
+ /** Set the instance contents from the other detail.
239
+ * @param other detail to clone
240
+ */
241
+ copyContentsFrom(other) {
242
+ this._facetIndex = other._facetIndex;
243
+ this._edgeCount = other._edgeCount;
244
+ this._detail.copyContentsFrom(other._detail);
245
+ }
246
+ /** Interpolated data is not defined for a non-convex facet.
247
+ * @returns undefined
248
+ */
249
+ getNormal() {
250
+ return undefined;
251
+ }
252
+ /** Interpolated data is not defined for a non-convex facet.
253
+ * @returns undefined
254
+ */
255
+ getParam() {
256
+ return undefined;
257
+ }
258
+ /** Interpolated data is not defined for a non-convex facet.
259
+ * @returns undefined
260
+ */
261
+ getColor() {
262
+ return undefined;
263
+ }
264
+ /** Barycentric coordinates are not defined for a non-convex facet.
265
+ * @returns undefined
266
+ */
267
+ getBarycentricCoordinates() {
268
+ return undefined;
269
+ }
270
+ }
271
+ exports.NonConvexFacetLocationDetail = NonConvexFacetLocationDetail;
272
+ /**
273
+ * Implementation of `FacetLocationDetail` for a convex facet.
274
+ * * If `edgeCount` is 3, `TriangularFacetLocationDetail` is more efficient.
275
+ * @public
276
+ */
277
+ class ConvexFacetLocationDetail extends NonConvexFacetLocationDetail {
278
+ /** captures the detail if provided */
279
+ constructor(facetIndex = -1, edgeCount = 0, detail) {
280
+ super(facetIndex, edgeCount, detail);
281
+ }
282
+ /** Invalidate this detail. */
283
+ invalidate(deep = true) {
284
+ super.invalidate(deep);
285
+ this._normal = undefined;
286
+ this._param = undefined;
287
+ this._color = undefined;
288
+ this._barycentricCoordinates = undefined;
289
+ }
290
+ /** Create a detail.
291
+ * @param result optional pre-allocated object to fill and return
292
+ */
293
+ static create(facetIndex, edgeCount, detail, result) {
294
+ if (undefined === result)
295
+ return new ConvexFacetLocationDetail(facetIndex, edgeCount, detail);
296
+ return super.create(facetIndex, edgeCount, detail, result);
297
+ }
298
+ /** Whether the facet is convex. */
299
+ get isConvex() {
300
+ return true;
301
+ }
302
+ /** Clone the instance */
303
+ clone() {
304
+ const detail = new ConvexFacetLocationDetail();
305
+ detail.copyContentsFrom(this);
306
+ return detail;
307
+ }
308
+ /** Set the instance contents from the other detail.
309
+ * @param other detail to clone
310
+ */
311
+ copyContentsFrom(other) {
312
+ var _a, _b, _c;
313
+ super.copyContentsFrom(other);
314
+ this._normal = (_a = other._normal) === null || _a === void 0 ? void 0 : _a.clone();
315
+ this._param = (_b = other._param) === null || _b === void 0 ? void 0 : _b.clone();
316
+ this._color = other._color;
317
+ this._barycentricCoordinates = (_c = other._barycentricCoordinates) === null || _c === void 0 ? void 0 : _c.slice();
318
+ }
319
+ /** Get normal interpolated from facet data.
320
+ * @param facetNormals used to compute the normal cache
321
+ * @param facetVertices used to compute the barycentric coordinate cache
322
+ * @param distanceTolerance used to compute the barycentric coordinate cache
323
+ * @returns reference to cached normal
324
+ */
325
+ getNormal(facetNormals, facetVertices, distanceTolerance = Geometry_1.Geometry.smallMetricDistance) {
326
+ if (this._detail.isValid && undefined === this._normal && undefined !== facetNormals) {
327
+ const scales = this.getBarycentricCoordinates(facetVertices, distanceTolerance);
328
+ if (undefined !== scales) {
329
+ this._normal = Point3dVector3d_1.Vector3d.create();
330
+ facetNormals.linearCombination(scales, this._normal);
331
+ }
332
+ }
333
+ return this._normal;
334
+ }
335
+ /** Get uv parameter interpolated from facet data.
336
+ * @param facetParams used to compute the uv parameter cache
337
+ * @param facetVertices used to compute the barycentric coordinate cache
338
+ * @param distanceTolerance used to compute the barycentric coordinate cache
339
+ * @returns reference to cached uv parameter
340
+ */
341
+ getParam(facetParams, facetVertices, distanceTolerance = Geometry_1.Geometry.smallMetricDistance) {
342
+ if (this._detail.isValid && undefined === this._param && undefined !== facetParams) {
343
+ const scales = this.getBarycentricCoordinates(facetVertices, distanceTolerance);
344
+ if (undefined !== scales) {
345
+ this._param = Point2dVector2d_1.Point2d.create();
346
+ facetParams.linearCombination(scales, this._param);
347
+ }
348
+ }
349
+ return this._param;
350
+ }
351
+ /** Get color interpolated from facet data.
352
+ * @param facetColors used to compute the color cache
353
+ * @param facetVertices used to compute the barycentric coordinate cache
354
+ * @param distanceTolerance used to compute the barycentric coordinate cache
355
+ * @returns cached color
356
+ */
357
+ getColor(facetColors, facetVertices, distanceTolerance = Geometry_1.Geometry.smallMetricDistance) {
358
+ if (this._detail.isValid && undefined === this._color && undefined !== facetColors) {
359
+ const scales = this.getBarycentricCoordinates(facetVertices, distanceTolerance);
360
+ if (undefined !== scales)
361
+ this._color = PointHelpers_1.NumberArray.linearCombinationOfColors(facetColors, scales);
362
+ }
363
+ return this._color;
364
+ }
365
+ /** Get the barycentric coordinates of this location, if they have been computed.
366
+ * @param facetVertices used to compute the barycentric coordinate cache
367
+ * @param distanceTolerance used to compute the barycentric coordinate cache
368
+ * @returns cached barycentric coordinates
369
+ */
370
+ getBarycentricCoordinates(facetVertices, distanceTolerance = Geometry_1.Geometry.smallMetricDistance) {
371
+ if (this._detail.isValid && undefined === this._barycentricCoordinates && undefined !== facetVertices) {
372
+ this._barycentricCoordinates = PolygonOps_1.PolygonOps.convexBarycentricCoordinates(facetVertices, this._detail.point, distanceTolerance);
373
+ }
374
+ return this._barycentricCoordinates;
375
+ }
376
+ }
377
+ exports.ConvexFacetLocationDetail = ConvexFacetLocationDetail;
378
+ //# sourceMappingURL=FacetLocationDetail.js.map