@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,371 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ /** @packageDocumentation
6
+ * @module Polyface
7
+ */
8
+ import { Point2d } from "../geometry3d/Point2dVector2d";
9
+ import { Vector3d } from "../geometry3d/Point3dVector3d";
10
+ import { TriangleLocationDetail } from "../geometry3d/BarycentricTriangle";
11
+ import { Geometry } from "../Geometry";
12
+ import { PolygonLocationDetail, PolygonOps } from "../geometry3d/PolygonOps";
13
+ import { NumberArray } from "../geometry3d/PointHelpers";
14
+ /** Options for computing and processing facet intersection methods.
15
+ * @see PolyfaceQuery.intersectRay3d
16
+ */
17
+ export class FacetIntersectOptions {
18
+ /** constructor with defaults */
19
+ constructor() {
20
+ this.distanceTolerance = Geometry.smallMetricDistance;
21
+ this.parameterTolerance = Geometry.smallFraction;
22
+ }
23
+ }
24
+ /**
25
+ * Implementation of `FacetLocationDetail` for a triangular facet.
26
+ * @public
27
+ */
28
+ export class TriangularFacetLocationDetail {
29
+ /** captures the detail if provided */
30
+ constructor(facetIndex = -1, detail) {
31
+ this._facetIndex = facetIndex;
32
+ this._detail = detail ? detail : TriangleLocationDetail.create();
33
+ }
34
+ /** Invalidate this detail. */
35
+ invalidate(deep = true) {
36
+ this._facetIndex = -1;
37
+ if (deep)
38
+ this._detail.invalidate();
39
+ this._normal = undefined;
40
+ this._param = undefined;
41
+ this._color = undefined;
42
+ }
43
+ /** Create a detail.
44
+ * @param result optional pre-allocated object to fill and return
45
+ */
46
+ static create(facetIndex, detail, result) {
47
+ if (undefined === result)
48
+ return new TriangularFacetLocationDetail(facetIndex, detail);
49
+ result.invalidate(false); // detail might be owned by result!
50
+ result._facetIndex = facetIndex;
51
+ if (undefined !== detail)
52
+ result._detail.copyContentsFrom(detail);
53
+ return result;
54
+ }
55
+ /** Get the facet index. */
56
+ get facetIndex() {
57
+ return this._facetIndex;
58
+ }
59
+ /** Get the edge count of this facet. */
60
+ get edgeCount() {
61
+ return 3;
62
+ }
63
+ /** Get the world coordinates of the point. */
64
+ get point() {
65
+ return this._detail.world;
66
+ }
67
+ /** Get the application-specific number. */
68
+ get a() {
69
+ return this._detail.a;
70
+ }
71
+ /** Get the projection of the point onto the closest facet edge. */
72
+ get closestEdge() {
73
+ return { startVertexIndex: this._detail.closestEdgeIndex, edgeParam: this._detail.closestEdgeParam };
74
+ }
75
+ /** Test validity of fields other than _detail. */
76
+ get _isValid() {
77
+ return this._facetIndex >= 0;
78
+ }
79
+ /** Whether this instance specifies a valid location. */
80
+ get isValid() {
81
+ return this._isValid && this._detail.isValid;
82
+ }
83
+ /** Whether the facet is convex. */
84
+ get isConvex() {
85
+ return true;
86
+ }
87
+ /** Whether the point is inside or on the polygon. */
88
+ get isInsideOrOn() {
89
+ return this._isValid && this._detail.isInsideOrOn;
90
+ }
91
+ /** Get the code that classifies the location of the point with respect to the facet. */
92
+ get classify() {
93
+ return this._detail.classify;
94
+ }
95
+ /** Clone the instance */
96
+ clone() {
97
+ const detail = new TriangularFacetLocationDetail();
98
+ detail.copyContentsFrom(this);
99
+ return detail;
100
+ }
101
+ /** Set the instance contents from the other detail.
102
+ * @param other detail to clone
103
+ */
104
+ copyContentsFrom(other) {
105
+ var _a, _b;
106
+ this._facetIndex = other._facetIndex;
107
+ this._detail.copyContentsFrom(other._detail);
108
+ this._normal = (_a = other._normal) === null || _a === void 0 ? void 0 : _a.clone();
109
+ this._param = (_b = other._param) === null || _b === void 0 ? void 0 : _b.clone();
110
+ this._color = other._color;
111
+ }
112
+ /** Get normal interpolated from facet data.
113
+ * @param facetNormals used to compute the normal cache
114
+ * @returns reference to cached normal
115
+ */
116
+ getNormal(facetNormals) {
117
+ if (this._detail.isValid && undefined === this._normal && undefined !== facetNormals) {
118
+ this._normal = Vector3d.create();
119
+ const scales = [this._detail.local.x, this._detail.local.y, this._detail.local.z];
120
+ facetNormals.linearCombination(scales, this._normal);
121
+ }
122
+ return this._normal;
123
+ }
124
+ /** Get uv parameter interpolated from facet data.
125
+ * @param facetParams used to compute the uv parameter cache
126
+ * @returns reference to cached uv parameter
127
+ */
128
+ getParam(facetParams) {
129
+ if (this._detail.isValid && undefined === this._param && undefined !== facetParams) {
130
+ this._param = Point2d.create();
131
+ const scales = [this._detail.local.x, this._detail.local.y, this._detail.local.z];
132
+ facetParams.linearCombination(scales, this._param);
133
+ }
134
+ return this._param;
135
+ }
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) {
142
+ if (this._detail.isValid && undefined === this._color && undefined !== facetColors) {
143
+ const scales = [this._detail.local.x, this._detail.local.y, this._detail.local.z];
144
+ this._color = NumberArray.linearCombinationOfColors(facetColors, scales);
145
+ }
146
+ return this._color;
147
+ }
148
+ /** Get the barycentric coordinates of this location.
149
+ * @returns cached barycentric coordinates
150
+ */
151
+ getBarycentricCoordinates() {
152
+ return [this._detail.local.x, this._detail.local.y, this._detail.local.z];
153
+ }
154
+ }
155
+ /**
156
+ * Implementation of `FacetLocationDetail` for a non-convex facet.
157
+ * * Facet vertex data interpolation is not available.
158
+ * @public
159
+ */
160
+ export class NonConvexFacetLocationDetail {
161
+ /** captures the detail if provided */
162
+ constructor(facetIndex = -1, edgeCount = 0, detail) {
163
+ this._facetIndex = facetIndex;
164
+ this._edgeCount = edgeCount;
165
+ this._detail = detail ? detail : PolygonLocationDetail.create();
166
+ }
167
+ /** Invalidate this detail. */
168
+ invalidate(deep = true) {
169
+ this._facetIndex = -1;
170
+ this._edgeCount = 0;
171
+ if (deep)
172
+ this._detail.invalidate();
173
+ }
174
+ /** Create a detail.
175
+ * @param result optional pre-allocated object to fill and return
176
+ */
177
+ static create(facetIndex, edgeCount, detail, result) {
178
+ if (undefined === result)
179
+ return new NonConvexFacetLocationDetail(facetIndex, edgeCount, detail);
180
+ result.invalidate(false); // detail might be owned by result!
181
+ result._facetIndex = facetIndex;
182
+ result._edgeCount = edgeCount;
183
+ if (undefined !== detail && result._detail !== detail)
184
+ result._detail.copyContentsFrom(detail);
185
+ return result;
186
+ }
187
+ /** Get the facet index. */
188
+ get facetIndex() {
189
+ return this._facetIndex;
190
+ }
191
+ /** Get the edge count of this facet. */
192
+ get edgeCount() {
193
+ return this._edgeCount;
194
+ }
195
+ /** Get the world coordinates of the point. */
196
+ get point() {
197
+ return this._detail.point;
198
+ }
199
+ /** Get the application-specific number. */
200
+ get a() {
201
+ return this._detail.a;
202
+ }
203
+ /** Get the projection of the point onto the closest facet edge. */
204
+ get closestEdge() {
205
+ return { startVertexIndex: this._detail.closestEdgeIndex, edgeParam: this._detail.closestEdgeParam };
206
+ }
207
+ /** Test validity of fields other than _detail. */
208
+ get _isValid() {
209
+ return this._facetIndex >= 0 && this._edgeCount >= 3;
210
+ }
211
+ /** Whether this instance specifies a valid location. */
212
+ get isValid() {
213
+ return this._isValid && this._detail.isValid;
214
+ }
215
+ /** Whether the facet is convex. */
216
+ get isConvex() {
217
+ return false;
218
+ }
219
+ /** Whether the point is inside or on the polygon. */
220
+ get isInsideOrOn() {
221
+ return this._isValid && this._detail.isInsideOrOn;
222
+ }
223
+ /** Get the code that classifies the location of the point with respect to the facet. */
224
+ get classify() {
225
+ return this._detail.code;
226
+ }
227
+ /** Clone the instance */
228
+ clone() {
229
+ const detail = new NonConvexFacetLocationDetail();
230
+ detail.copyContentsFrom(this);
231
+ return detail;
232
+ }
233
+ /** Set the instance contents from the other detail.
234
+ * @param other detail to clone
235
+ */
236
+ copyContentsFrom(other) {
237
+ this._facetIndex = other._facetIndex;
238
+ this._edgeCount = other._edgeCount;
239
+ this._detail.copyContentsFrom(other._detail);
240
+ }
241
+ /** Interpolated data is not defined for a non-convex facet.
242
+ * @returns undefined
243
+ */
244
+ getNormal() {
245
+ return undefined;
246
+ }
247
+ /** Interpolated data is not defined for a non-convex facet.
248
+ * @returns undefined
249
+ */
250
+ getParam() {
251
+ return undefined;
252
+ }
253
+ /** Interpolated data is not defined for a non-convex facet.
254
+ * @returns undefined
255
+ */
256
+ getColor() {
257
+ return undefined;
258
+ }
259
+ /** Barycentric coordinates are not defined for a non-convex facet.
260
+ * @returns undefined
261
+ */
262
+ getBarycentricCoordinates() {
263
+ return undefined;
264
+ }
265
+ }
266
+ /**
267
+ * Implementation of `FacetLocationDetail` for a convex facet.
268
+ * * If `edgeCount` is 3, `TriangularFacetLocationDetail` is more efficient.
269
+ * @public
270
+ */
271
+ export class ConvexFacetLocationDetail extends NonConvexFacetLocationDetail {
272
+ /** captures the detail if provided */
273
+ constructor(facetIndex = -1, edgeCount = 0, detail) {
274
+ super(facetIndex, edgeCount, detail);
275
+ }
276
+ /** Invalidate this detail. */
277
+ invalidate(deep = true) {
278
+ super.invalidate(deep);
279
+ this._normal = undefined;
280
+ this._param = undefined;
281
+ this._color = undefined;
282
+ this._barycentricCoordinates = undefined;
283
+ }
284
+ /** Create a detail.
285
+ * @param result optional pre-allocated object to fill and return
286
+ */
287
+ static create(facetIndex, edgeCount, detail, result) {
288
+ if (undefined === result)
289
+ return new ConvexFacetLocationDetail(facetIndex, edgeCount, detail);
290
+ return super.create(facetIndex, edgeCount, detail, result);
291
+ }
292
+ /** Whether the facet is convex. */
293
+ get isConvex() {
294
+ return true;
295
+ }
296
+ /** Clone the instance */
297
+ clone() {
298
+ const detail = new ConvexFacetLocationDetail();
299
+ detail.copyContentsFrom(this);
300
+ return detail;
301
+ }
302
+ /** Set the instance contents from the other detail.
303
+ * @param other detail to clone
304
+ */
305
+ copyContentsFrom(other) {
306
+ var _a, _b, _c;
307
+ super.copyContentsFrom(other);
308
+ this._normal = (_a = other._normal) === null || _a === void 0 ? void 0 : _a.clone();
309
+ this._param = (_b = other._param) === null || _b === void 0 ? void 0 : _b.clone();
310
+ this._color = other._color;
311
+ this._barycentricCoordinates = (_c = other._barycentricCoordinates) === null || _c === void 0 ? void 0 : _c.slice();
312
+ }
313
+ /** Get normal interpolated from facet data.
314
+ * @param facetNormals used to compute the normal cache
315
+ * @param facetVertices used to compute the barycentric coordinate cache
316
+ * @param distanceTolerance used to compute the barycentric coordinate cache
317
+ * @returns reference to cached normal
318
+ */
319
+ getNormal(facetNormals, facetVertices, distanceTolerance = Geometry.smallMetricDistance) {
320
+ if (this._detail.isValid && undefined === this._normal && undefined !== facetNormals) {
321
+ const scales = this.getBarycentricCoordinates(facetVertices, distanceTolerance);
322
+ if (undefined !== scales) {
323
+ this._normal = Vector3d.create();
324
+ facetNormals.linearCombination(scales, this._normal);
325
+ }
326
+ }
327
+ return this._normal;
328
+ }
329
+ /** Get uv parameter interpolated from facet data.
330
+ * @param facetParams used to compute the uv parameter cache
331
+ * @param facetVertices used to compute the barycentric coordinate cache
332
+ * @param distanceTolerance used to compute the barycentric coordinate cache
333
+ * @returns reference to cached uv parameter
334
+ */
335
+ getParam(facetParams, facetVertices, distanceTolerance = Geometry.smallMetricDistance) {
336
+ if (this._detail.isValid && undefined === this._param && undefined !== facetParams) {
337
+ const scales = this.getBarycentricCoordinates(facetVertices, distanceTolerance);
338
+ if (undefined !== scales) {
339
+ this._param = Point2d.create();
340
+ facetParams.linearCombination(scales, this._param);
341
+ }
342
+ }
343
+ return this._param;
344
+ }
345
+ /** Get color interpolated from facet data.
346
+ * @param facetColors used to compute the color cache
347
+ * @param facetVertices used to compute the barycentric coordinate cache
348
+ * @param distanceTolerance used to compute the barycentric coordinate cache
349
+ * @returns cached color
350
+ */
351
+ getColor(facetColors, facetVertices, distanceTolerance = Geometry.smallMetricDistance) {
352
+ if (this._detail.isValid && undefined === this._color && undefined !== facetColors) {
353
+ const scales = this.getBarycentricCoordinates(facetVertices, distanceTolerance);
354
+ if (undefined !== scales)
355
+ this._color = NumberArray.linearCombinationOfColors(facetColors, scales);
356
+ }
357
+ return this._color;
358
+ }
359
+ /** Get the barycentric coordinates of this location, if they have been computed.
360
+ * @param facetVertices used to compute the barycentric coordinate cache
361
+ * @param distanceTolerance used to compute the barycentric coordinate cache
362
+ * @returns cached barycentric coordinates
363
+ */
364
+ getBarycentricCoordinates(facetVertices, distanceTolerance = Geometry.smallMetricDistance) {
365
+ if (this._detail.isValid && undefined === this._barycentricCoordinates && undefined !== facetVertices) {
366
+ this._barycentricCoordinates = PolygonOps.convexBarycentricCoordinates(facetVertices, this._detail.point, distanceTolerance);
367
+ }
368
+ return this._barycentricCoordinates;
369
+ }
370
+ }
371
+ //# sourceMappingURL=FacetLocationDetail.js.map