@itwin/core-geometry 4.1.0-dev.70 → 4.1.0-dev.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -1
- package/lib/cjs/clipping/AlternatingConvexClipTree.d.ts +15 -17
- package/lib/cjs/clipping/AlternatingConvexClipTree.d.ts.map +1 -1
- package/lib/cjs/clipping/AlternatingConvexClipTree.js +24 -20
- package/lib/cjs/clipping/AlternatingConvexClipTree.js.map +1 -1
- package/lib/cjs/clipping/BooleanClipFactory.d.ts +28 -28
- package/lib/cjs/clipping/BooleanClipFactory.d.ts.map +1 -1
- package/lib/cjs/clipping/BooleanClipFactory.js +28 -28
- package/lib/cjs/clipping/BooleanClipFactory.js.map +1 -1
- package/lib/cjs/clipping/BooleanClipNode.d.ts +11 -11
- package/lib/cjs/clipping/BooleanClipNode.d.ts.map +1 -1
- package/lib/cjs/clipping/BooleanClipNode.js +11 -11
- package/lib/cjs/clipping/BooleanClipNode.js.map +1 -1
- package/lib/cjs/clipping/ClipPlane.d.ts +73 -76
- package/lib/cjs/clipping/ClipPlane.d.ts.map +1 -1
- package/lib/cjs/clipping/ClipPlane.js +105 -86
- package/lib/cjs/clipping/ClipPlane.js.map +1 -1
- package/lib/cjs/clipping/ClipPrimitive.d.ts +78 -47
- package/lib/cjs/clipping/ClipPrimitive.d.ts.map +1 -1
- package/lib/cjs/clipping/ClipPrimitive.js +110 -54
- package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
- package/lib/cjs/clipping/ClipUtils.d.ts +54 -44
- package/lib/cjs/clipping/ClipUtils.d.ts.map +1 -1
- package/lib/cjs/clipping/ClipUtils.js +33 -29
- package/lib/cjs/clipping/ClipUtils.js.map +1 -1
- package/lib/cjs/clipping/ClipVector.d.ts +39 -25
- package/lib/cjs/clipping/ClipVector.d.ts.map +1 -1
- package/lib/cjs/clipping/ClipVector.js +35 -23
- package/lib/cjs/clipping/ClipVector.js.map +1 -1
- package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts +61 -38
- package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
- package/lib/cjs/clipping/ConvexClipPlaneSet.js +64 -41
- package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts +49 -30
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js +50 -30
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
- package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.d.ts +2 -2
- package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.d.ts.map +1 -1
- package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.js +2 -2
- package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.d.ts +4 -2
- package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
- package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineSegment3d.js.map +1 -1
- package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineString3d.js.map +1 -1
- package/lib/esm/clipping/AlternatingConvexClipTree.d.ts +15 -17
- package/lib/esm/clipping/AlternatingConvexClipTree.d.ts.map +1 -1
- package/lib/esm/clipping/AlternatingConvexClipTree.js +24 -20
- package/lib/esm/clipping/AlternatingConvexClipTree.js.map +1 -1
- package/lib/esm/clipping/BooleanClipFactory.d.ts +28 -28
- package/lib/esm/clipping/BooleanClipFactory.d.ts.map +1 -1
- package/lib/esm/clipping/BooleanClipFactory.js +28 -28
- package/lib/esm/clipping/BooleanClipFactory.js.map +1 -1
- package/lib/esm/clipping/BooleanClipNode.d.ts +11 -11
- package/lib/esm/clipping/BooleanClipNode.d.ts.map +1 -1
- package/lib/esm/clipping/BooleanClipNode.js +11 -11
- package/lib/esm/clipping/BooleanClipNode.js.map +1 -1
- package/lib/esm/clipping/ClipPlane.d.ts +73 -76
- package/lib/esm/clipping/ClipPlane.d.ts.map +1 -1
- package/lib/esm/clipping/ClipPlane.js +105 -86
- package/lib/esm/clipping/ClipPlane.js.map +1 -1
- package/lib/esm/clipping/ClipPrimitive.d.ts +78 -47
- package/lib/esm/clipping/ClipPrimitive.d.ts.map +1 -1
- package/lib/esm/clipping/ClipPrimitive.js +110 -54
- package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
- package/lib/esm/clipping/ClipUtils.d.ts +54 -44
- package/lib/esm/clipping/ClipUtils.d.ts.map +1 -1
- package/lib/esm/clipping/ClipUtils.js +33 -29
- package/lib/esm/clipping/ClipUtils.js.map +1 -1
- package/lib/esm/clipping/ClipVector.d.ts +39 -25
- package/lib/esm/clipping/ClipVector.d.ts.map +1 -1
- package/lib/esm/clipping/ClipVector.js +35 -23
- package/lib/esm/clipping/ClipVector.js.map +1 -1
- package/lib/esm/clipping/ConvexClipPlaneSet.d.ts +61 -38
- package/lib/esm/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
- package/lib/esm/clipping/ConvexClipPlaneSet.js +64 -41
- package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts +49 -30
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js +50 -30
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
- package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.d.ts +2 -2
- package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.d.ts.map +1 -1
- package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.js +2 -2
- package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
- package/lib/esm/curve/CurvePrimitive.d.ts +4 -2
- package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/esm/curve/CurvePrimitive.js.map +1 -1
- package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
- package/lib/esm/curve/LineSegment3d.js.map +1 -1
- package/lib/esm/curve/LineString3d.d.ts.map +1 -1
- package/lib/esm/curve/LineString3d.js.map +1 -1
- package/package.json +3 -3
|
@@ -32,7 +32,8 @@ export declare enum ClipMaskXYZRangePlanes {
|
|
|
32
32
|
/** all 6 planes */
|
|
33
33
|
All = 63
|
|
34
34
|
}
|
|
35
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Wire format describing a [[ClipPrimitive]] defined by a set of clip planes.
|
|
36
37
|
* @public
|
|
37
38
|
*/
|
|
38
39
|
export interface ClipPrimitivePlanesProps {
|
|
@@ -43,7 +44,8 @@ export interface ClipPrimitivePlanesProps {
|
|
|
43
44
|
invisible?: boolean;
|
|
44
45
|
};
|
|
45
46
|
}
|
|
46
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* Wire format describing a [[ClipShape]].
|
|
47
49
|
* @public
|
|
48
50
|
*/
|
|
49
51
|
export interface ClipPrimitiveShapeProps {
|
|
@@ -69,17 +71,18 @@ export interface ClipPrimitiveShapeProps {
|
|
|
69
71
|
export type ClipPrimitiveProps = ClipPrimitivePlanesProps | ClipPrimitiveShapeProps;
|
|
70
72
|
/**
|
|
71
73
|
* * ClipPrimitive is a base class for clipping implementations that use
|
|
72
|
-
* * A UnionOfConvexClipPlaneSets designated "clipPlanes"
|
|
73
|
-
* *
|
|
74
|
-
* * When constructed directly, objects of type ClipPrimitive (directly, not through a derived class) will have just planes
|
|
74
|
+
* * A UnionOfConvexClipPlaneSets designated "clipPlanes".
|
|
75
|
+
* * An "invisible" flag.
|
|
76
|
+
* * When constructed directly, objects of type ClipPrimitive (directly, not through a derived class) will have just planes.
|
|
75
77
|
* * Derived classes (e.g. ClipShape) carry additional data such as a swept shape.
|
|
76
78
|
* * ClipPrimitive can be constructed with no planes.
|
|
77
79
|
* * Derived class is responsible for filling the plane sets.
|
|
78
|
-
* * At discretion of derived classes, plane construction can be done at construction time or "on demand when" queries
|
|
80
|
+
* * At discretion of derived classes, plane construction can be done at construction time or "on demand when" queries
|
|
81
|
+
* call `ensurePlaneSets ()`
|
|
79
82
|
* * ClipPrimitive can be constructed directly with planes (and no derived class).
|
|
80
83
|
* * That the prevailing use is via a ClipShape derived class.
|
|
81
84
|
* * The ClipShape has an "isMask" property
|
|
82
|
-
* * isMask === false means the plane sets should cover the inside of its polygon
|
|
85
|
+
* * isMask === false means the plane sets should cover the inside of its polygon.
|
|
83
86
|
* * isMask === true means the plane sets should cover the outside of its polygon.
|
|
84
87
|
* * Note that the ClipShape's `isMask` property and the ClipPrimitive's `isInvisible` property are distinct controls.
|
|
85
88
|
* * In normal usage, callers get "outside" clip behavior using ONLY the ClipShape isMask property.
|
|
@@ -92,9 +95,10 @@ export declare class ClipPrimitive implements Clipper {
|
|
|
92
95
|
protected _clipPlanes?: UnionOfConvexClipPlaneSets;
|
|
93
96
|
/** If true, pointInside inverts the sense of the pointInside for the _clipPlanes */
|
|
94
97
|
protected _invisible: boolean;
|
|
95
|
-
/**
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
+
/**
|
|
99
|
+
* Get a reference to the `UnionOfConvexClipPlaneSets`.
|
|
100
|
+
* * It triggers construction of the sets by `this.ensurePlaneSets()`.
|
|
101
|
+
* * Derived class typically caches the set on the first such call.
|
|
98
102
|
*/
|
|
99
103
|
fetchClipPlanesRef(): UnionOfConvexClipPlaneSets | undefined;
|
|
100
104
|
/** Ask if this primitive is a hole. */
|
|
@@ -110,31 +114,38 @@ export declare class ClipPrimitive implements Clipper {
|
|
|
110
114
|
toJSON(): ClipPrimitiveProps;
|
|
111
115
|
/**
|
|
112
116
|
* Returns true if the planes are present.
|
|
113
|
-
* * This can be false (for instance) if a ClipShape is holding a polygon but has not yet been asked to construct
|
|
117
|
+
* * This can be false (for instance) if a ClipShape is holding a polygon but has not yet been asked to construct
|
|
118
|
+
* the planes.
|
|
114
119
|
*/
|
|
115
120
|
arePlanesDefined(): boolean;
|
|
116
|
-
/** Return a deep clone
|
|
121
|
+
/** Return a deep clone. */
|
|
117
122
|
clone(): ClipPrimitive;
|
|
118
123
|
/**
|
|
119
|
-
*
|
|
124
|
+
* Trigger (if needed) computation of plane sets (if applicable) in the derived class.
|
|
120
125
|
* * Base class is no op.
|
|
121
126
|
* * In derived class, on first call create planes sets from defining data (e.g. swept shape).
|
|
122
127
|
* * In derived class, if planes are present leave them alone.
|
|
123
128
|
*/
|
|
124
129
|
ensurePlaneSets(): void;
|
|
125
|
-
/**
|
|
126
|
-
*
|
|
130
|
+
/**
|
|
131
|
+
* Return true if the point lies inside/on this polygon (or not inside/on if this polygon is a mask). Otherwise,
|
|
132
|
+
* return false.
|
|
133
|
+
* * Note that a derived class may choose to (a) implement its own test using its defining data, or (b) accept
|
|
134
|
+
* this implementation using planes that it inserted in the base class.
|
|
127
135
|
*/
|
|
128
136
|
pointInside(point: Point3d, onTolerance?: number): boolean;
|
|
129
|
-
/**
|
|
137
|
+
/**
|
|
138
|
+
* Method from [[Clipper]] interface.
|
|
130
139
|
* * Implement as dispatch to clipPlaneSets as supplied by derived class.
|
|
131
140
|
*/
|
|
132
141
|
isPointOnOrInside(point: Point3d, onTolerance?: number): boolean;
|
|
133
|
-
/**
|
|
142
|
+
/**
|
|
143
|
+
* Method from [[Clipper]] interface.
|
|
134
144
|
* * Implement as dispatch to clipPlaneSets as supplied by derived class.
|
|
135
145
|
*/
|
|
136
146
|
announceClippedSegmentIntervals(f0: number, f1: number, pointA: Point3d, pointB: Point3d, announce?: AnnounceNumberNumber): boolean;
|
|
137
|
-
/**
|
|
147
|
+
/**
|
|
148
|
+
* Method from [[Clipper]] interface.
|
|
138
149
|
* * Implement as dispatch to clipPlaneSets as supplied by derived class.
|
|
139
150
|
*/
|
|
140
151
|
announceClippedArcIntervals(arc: Arc3d, announce?: AnnounceNumberNumberCurvePrimitive): boolean;
|
|
@@ -142,29 +153,33 @@ export declare class ClipPrimitive implements Clipper {
|
|
|
142
153
|
* Multiply all ClipPlanes DPoint4d by matrix.
|
|
143
154
|
* @param matrix matrix to apply.
|
|
144
155
|
* @param invert if true, use in verse of the matrix.
|
|
145
|
-
* @param transpose if true, use the transpose of the matrix (or inverse, per invert parameter)
|
|
146
|
-
*
|
|
156
|
+
* @param transpose if true, use the transpose of the matrix (or inverse, per invert parameter).
|
|
157
|
+
* @param matrix matrix to apply.
|
|
158
|
+
* * Note that if matrixA is applied to all of space, the matrix to send to this method to get a corresponding
|
|
159
|
+
* effect on the plane is the inverse transpose of matrixA.
|
|
147
160
|
* * Callers that will apply the same matrix to many planes should pre-invert the matrix for efficiency.
|
|
148
161
|
* * Both params default to true to get the full effect of transforming space.
|
|
149
|
-
* @param matrix matrix to apply
|
|
150
162
|
*/
|
|
151
163
|
multiplyPlanesByMatrix4d(matrix: Matrix4d, invert?: boolean, transpose?: boolean): boolean;
|
|
152
|
-
/** Apply a transform to the clipper (e.g. transform all planes) */
|
|
164
|
+
/** Apply a transform to the clipper (e.g. transform all planes). */
|
|
153
165
|
transformInPlace(transform: Transform): boolean;
|
|
154
166
|
/** Sets both the clip plane set and the mask set visibility */
|
|
155
167
|
setInvisible(invisible: boolean): void;
|
|
156
168
|
/**
|
|
157
|
-
* Return true if any plane of the primary clipPlanes has (a) non-zero z component in its normal vector and
|
|
169
|
+
* Return true if any plane of the primary clipPlanes has (a) non-zero z component in its normal vector and
|
|
170
|
+
* (b) finite distance from origin.
|
|
158
171
|
*/
|
|
159
172
|
containsZClip(): boolean;
|
|
160
173
|
/**
|
|
161
174
|
* Quick test of whether the given points fall completely inside or outside.
|
|
162
|
-
* @param points points to test
|
|
163
|
-
* @param ignoreInvisibleSetting if true, do the test with the clip planes and return that, ignoring the
|
|
175
|
+
* @param points points to test.
|
|
176
|
+
* @param ignoreInvisibleSetting if true, do the test with the clip planes and return that, ignoring the
|
|
177
|
+
* invisible setting.
|
|
164
178
|
*/
|
|
165
179
|
classifyPointContainment(points: Point3d[], ignoreInvisibleSetting: boolean): ClipPlaneContainment;
|
|
166
|
-
/**
|
|
167
|
-
*
|
|
180
|
+
/**
|
|
181
|
+
* Promote json object form to class instance.
|
|
182
|
+
* * First try to convert to a ClipShape.
|
|
168
183
|
* * then try as a standalone instance of the base class ClipPrimitive.
|
|
169
184
|
*/
|
|
170
185
|
static fromJSON(json: ClipPrimitiveProps | undefined): ClipPrimitive | undefined;
|
|
@@ -180,15 +195,15 @@ export declare class ClipPrimitive implements Clipper {
|
|
|
180
195
|
export declare class ClipShape extends ClipPrimitive {
|
|
181
196
|
/** Points of the polygon, in the xy plane of the local coordinate system. */
|
|
182
197
|
protected _polygon: Point3d[];
|
|
183
|
-
/** optional low z (in local coordinates) */
|
|
198
|
+
/** optional low z (in local coordinates). */
|
|
184
199
|
protected _zLow?: number;
|
|
185
|
-
/** optional high z (in local coordinates) */
|
|
200
|
+
/** optional high z (in local coordinates). */
|
|
186
201
|
protected _zHigh?: number;
|
|
187
|
-
/** true if this is considered a hole (keep geometry outside of the polygon.
|
|
202
|
+
/** true if this is considered a hole (keep geometry outside of the polygon). */
|
|
188
203
|
protected _isMask: boolean;
|
|
189
|
-
/** transform from local to world */
|
|
204
|
+
/** transform from local to world. */
|
|
190
205
|
protected _transformFromClip?: Transform;
|
|
191
|
-
/** Transform from world to local */
|
|
206
|
+
/** Transform from world to local. */
|
|
192
207
|
protected _transformToClip?: Transform;
|
|
193
208
|
protected constructor(polygon?: Point3d[], zLow?: number, zHigh?: number, transform?: Transform, isMask?: boolean, invisible?: boolean);
|
|
194
209
|
/** Returns true if this ClipShape is marked as invisible. */
|
|
@@ -216,18 +231,19 @@ export declare class ClipShape extends ClipPrimitive {
|
|
|
216
231
|
/** Sets the polygon points array of this ClipShape to the array given (by reference). */
|
|
217
232
|
setPolygon(polygon: Point3d[]): void;
|
|
218
233
|
/**
|
|
219
|
-
*
|
|
220
|
-
*
|
|
234
|
+
* If the ClipShape's associated `UnionOfConvexClipPlaneSets` is defined, do nothing.
|
|
235
|
+
* If the ClipShape's associated `UnionOfConvexClipPlaneSets` is undefined, generate it from the `ClipShape`
|
|
236
|
+
* and transform.
|
|
221
237
|
*/
|
|
222
238
|
ensurePlaneSets(): void;
|
|
223
239
|
/**
|
|
224
240
|
* Initialize the members of the ClipShape class that may at times be undefined.
|
|
225
|
-
* zLow and zHigh default to Number.MAX_VALUE, and the transform defaults to an identity transform
|
|
241
|
+
* zLow and zHigh default to Number.MAX_VALUE, and the transform defaults to an identity transform.
|
|
226
242
|
*/
|
|
227
243
|
initSecondaryProps(isMask: boolean, zLow?: number, zHigh?: number, transform?: Transform): void;
|
|
228
|
-
/**
|
|
244
|
+
/** Emit json object form */
|
|
229
245
|
toJSON(): ClipPrimitiveShapeProps;
|
|
230
|
-
/**
|
|
246
|
+
/** Parse `json` to a clip shape. */
|
|
231
247
|
static fromClipShapeJSON(json: ClipPrimitiveShapeProps | undefined, result?: ClipShape): ClipShape | undefined;
|
|
232
248
|
/** Returns a new ClipShape that is a deep copy of the ClipShape given */
|
|
233
249
|
static createFrom(other: ClipShape, result?: ClipShape): ClipShape;
|
|
@@ -242,33 +258,48 @@ export declare class ClipShape extends ClipPrimitive {
|
|
|
242
258
|
static createEmpty(isMask?: boolean, invisible?: boolean, transform?: Transform, result?: ClipShape): ClipShape;
|
|
243
259
|
/** Checks to ensure that the member polygon has an area, and that the polygon is closed. */
|
|
244
260
|
get isValidPolygon(): boolean;
|
|
245
|
-
/** Returns a deep copy of this instance of ClipShape, storing in an optional result */
|
|
261
|
+
/** Returns a deep copy of this instance of ClipShape, storing in an optional result. */
|
|
246
262
|
clone(result?: ClipShape): ClipShape;
|
|
247
|
-
/**
|
|
263
|
+
/**
|
|
264
|
+
* Given the current polygon data, parses clip planes that together form an object, storing the result in
|
|
265
|
+
* the set given, either clip planes or mask planes.
|
|
266
|
+
*/
|
|
248
267
|
private parseClipPlanes;
|
|
249
|
-
/**
|
|
268
|
+
/**
|
|
269
|
+
* Given a start and end point, populate the given UnionOfConvexClipPlaneSets with ConvexClipPlaneSets
|
|
270
|
+
* defining the bounded region of linear planes. Returns true if successful.
|
|
271
|
+
*/
|
|
250
272
|
private parseLinearPlanes;
|
|
251
|
-
/**
|
|
273
|
+
/**
|
|
274
|
+
* Given a convex polygon defined as an array of points, populate the given UnionOfConvexClipPlaneSets with
|
|
275
|
+
* ConvexClipPlaneSets defining the bounded region. Returns true if successful.
|
|
276
|
+
*/
|
|
252
277
|
private parseConvexPolygonPlanes;
|
|
253
|
-
/**
|
|
278
|
+
/**
|
|
279
|
+
* Given a (possibly non-convex) polygon defined as an array of points, populate the given UnionOfConvexClipPlaneSets
|
|
280
|
+
* with multiple ConvexClipPlaneSets defining the bounded region. Returns true if successful.
|
|
281
|
+
*/
|
|
254
282
|
private parsePolygonPlanes;
|
|
255
283
|
/**
|
|
256
284
|
* Multiply all ClipPlanes DPoint4d by matrix.
|
|
257
285
|
* @param matrix matrix to apply.
|
|
258
286
|
* @param invert if true, use in verse of the matrix.
|
|
259
|
-
* @param transpose if true, use the transpose of the matrix (or inverse, per invert parameter)
|
|
260
|
-
*
|
|
287
|
+
* @param transpose if true, use the transpose of the matrix (or inverse, per invert parameter).
|
|
288
|
+
* @param matrix matrix to apply.
|
|
289
|
+
* * Note that if matrixA is applied to all of space, the matrix to send to this method to get a corresponding effect
|
|
290
|
+
* on the plane is the inverse transpose of matrixA.
|
|
261
291
|
* * Callers that will apply the same matrix to many planes should pre-invert the matrix for efficiency.
|
|
262
292
|
* * Both params default to true to get the full effect of transforming space.
|
|
263
|
-
* @param matrix matrix to apply
|
|
264
293
|
*/
|
|
265
294
|
multiplyPlanesByMatrix4d(matrix: Matrix4d, invert?: boolean, transpose?: boolean): boolean;
|
|
266
|
-
/**
|
|
295
|
+
/**
|
|
296
|
+
* Apply `transform` to the local to world (`transformFromClip`) transform.
|
|
267
297
|
* * The world to local transform (`transformToClip` is recomputed from the (changed) `transformToClip`
|
|
268
298
|
* * the transform is passed to the base class to be applied to clip plane form of the clipper.
|
|
269
299
|
*/
|
|
270
300
|
transformInPlace(transform: Transform): boolean;
|
|
271
|
-
/**
|
|
301
|
+
/**
|
|
302
|
+
* Return true if
|
|
272
303
|
* * at least one point is defined
|
|
273
304
|
* * The local to world transform (transformFromClip) either
|
|
274
305
|
* * is undefined
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClipPrimitive.d.ts","sourceRoot":"","sources":["../../../src/clipping/ClipPrimitive.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,OAAO,EAAY,MAAM,+BAA+B,CAAC;AAElE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAIlD,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAE,+BAA+B,EAAE,MAAM,8BAA8B,CAAC;AAI3G,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,kCAAkC,EAAE,MAAM,yBAAyB,CAAC;AAGnG;;;GAGG;AACH,oBAAY,sBAAsB;IAChC,gBAAgB;IAChB,IAAI,IAAO;IACX,kBAAkB;IAClB,IAAI,IAAO;IACX,mBAAmB;IACnB,KAAK,IAAO;IACZ,kBAAkB;IAClB,IAAI,IAAO;IACX,mBAAmB;IACnB,KAAK,IAAO;IACZ,kBAAkB;IAClB,IAAI,KAAO;IACX,mBAAmB;IACnB,KAAK,KAAO;IACZ,0CA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E,SAAS,GAAG,OAAO;IAW/D;;;;;;OAMG;IACH,IAAW,WAAW,IAAI,OAAO,CAOhC;IACD,wFAAwF;IACjF,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAInD,0FAA0F;IACnF,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;CAItD"}
|
|
@@ -48,17 +48,18 @@ export var ClipMaskXYZRangePlanes;
|
|
|
48
48
|
})(ClipMaskXYZRangePlanes || (ClipMaskXYZRangePlanes = {}));
|
|
49
49
|
/**
|
|
50
50
|
* * ClipPrimitive is a base class for clipping implementations that use
|
|
51
|
-
* * A UnionOfConvexClipPlaneSets designated "clipPlanes"
|
|
52
|
-
* *
|
|
53
|
-
* * When constructed directly, objects of type ClipPrimitive (directly, not through a derived class) will have just planes
|
|
51
|
+
* * A UnionOfConvexClipPlaneSets designated "clipPlanes".
|
|
52
|
+
* * An "invisible" flag.
|
|
53
|
+
* * When constructed directly, objects of type ClipPrimitive (directly, not through a derived class) will have just planes.
|
|
54
54
|
* * Derived classes (e.g. ClipShape) carry additional data such as a swept shape.
|
|
55
55
|
* * ClipPrimitive can be constructed with no planes.
|
|
56
56
|
* * Derived class is responsible for filling the plane sets.
|
|
57
|
-
* * At discretion of derived classes, plane construction can be done at construction time or "on demand when" queries
|
|
57
|
+
* * At discretion of derived classes, plane construction can be done at construction time or "on demand when" queries
|
|
58
|
+
* call `ensurePlaneSets ()`
|
|
58
59
|
* * ClipPrimitive can be constructed directly with planes (and no derived class).
|
|
59
60
|
* * That the prevailing use is via a ClipShape derived class.
|
|
60
61
|
* * The ClipShape has an "isMask" property
|
|
61
|
-
* * isMask === false means the plane sets should cover the inside of its polygon
|
|
62
|
+
* * isMask === false means the plane sets should cover the inside of its polygon.
|
|
62
63
|
* * isMask === true means the plane sets should cover the outside of its polygon.
|
|
63
64
|
* * Note that the ClipShape's `isMask` property and the ClipPrimitive's `isInvisible` property are distinct controls.
|
|
64
65
|
* * In normal usage, callers get "outside" clip behavior using ONLY the ClipShape isMask property.
|
|
@@ -67,13 +68,19 @@ export var ClipMaskXYZRangePlanes;
|
|
|
67
68
|
* @public
|
|
68
69
|
*/
|
|
69
70
|
export class ClipPrimitive {
|
|
70
|
-
/**
|
|
71
|
-
*
|
|
72
|
-
*
|
|
71
|
+
/**
|
|
72
|
+
* Get a reference to the `UnionOfConvexClipPlaneSets`.
|
|
73
|
+
* * It triggers construction of the sets by `this.ensurePlaneSets()`.
|
|
74
|
+
* * Derived class typically caches the set on the first such call.
|
|
73
75
|
*/
|
|
74
|
-
fetchClipPlanesRef() {
|
|
76
|
+
fetchClipPlanesRef() {
|
|
77
|
+
this.ensurePlaneSets();
|
|
78
|
+
return this._clipPlanes;
|
|
79
|
+
}
|
|
75
80
|
/** Ask if this primitive is a hole. */
|
|
76
|
-
get invisible() {
|
|
81
|
+
get invisible() {
|
|
82
|
+
return this._invisible;
|
|
83
|
+
}
|
|
77
84
|
constructor(planeSet, isInvisible = false) {
|
|
78
85
|
this._clipPlanes = planeSet;
|
|
79
86
|
this._invisible = isInvisible;
|
|
@@ -102,26 +109,30 @@ export class ClipPrimitive {
|
|
|
102
109
|
}
|
|
103
110
|
/**
|
|
104
111
|
* Returns true if the planes are present.
|
|
105
|
-
* * This can be false (for instance) if a ClipShape is holding a polygon but has not yet been asked to construct
|
|
112
|
+
* * This can be false (for instance) if a ClipShape is holding a polygon but has not yet been asked to construct
|
|
113
|
+
* the planes.
|
|
106
114
|
*/
|
|
107
115
|
arePlanesDefined() {
|
|
108
116
|
return this._clipPlanes !== undefined;
|
|
109
117
|
}
|
|
110
|
-
/** Return a deep clone
|
|
118
|
+
/** Return a deep clone. */
|
|
111
119
|
clone() {
|
|
112
120
|
const newPlanes = this._clipPlanes ? this._clipPlanes.clone() : undefined;
|
|
113
121
|
const result = new ClipPrimitive(newPlanes, this._invisible);
|
|
114
122
|
return result;
|
|
115
123
|
}
|
|
116
124
|
/**
|
|
117
|
-
*
|
|
125
|
+
* Trigger (if needed) computation of plane sets (if applicable) in the derived class.
|
|
118
126
|
* * Base class is no op.
|
|
119
127
|
* * In derived class, on first call create planes sets from defining data (e.g. swept shape).
|
|
120
128
|
* * In derived class, if planes are present leave them alone.
|
|
121
129
|
*/
|
|
122
130
|
ensurePlaneSets() { }
|
|
123
|
-
/**
|
|
124
|
-
*
|
|
131
|
+
/**
|
|
132
|
+
* Return true if the point lies inside/on this polygon (or not inside/on if this polygon is a mask). Otherwise,
|
|
133
|
+
* return false.
|
|
134
|
+
* * Note that a derived class may choose to (a) implement its own test using its defining data, or (b) accept
|
|
135
|
+
* this implementation using planes that it inserted in the base class.
|
|
125
136
|
*/
|
|
126
137
|
pointInside(point, onTolerance = Geometry.smallMetricDistanceSquared) {
|
|
127
138
|
this.ensurePlaneSets();
|
|
@@ -130,7 +141,8 @@ export class ClipPrimitive {
|
|
|
130
141
|
inside = this._clipPlanes.isPointOnOrInside(point, onTolerance);
|
|
131
142
|
return inside;
|
|
132
143
|
}
|
|
133
|
-
/**
|
|
144
|
+
/**
|
|
145
|
+
* Method from [[Clipper]] interface.
|
|
134
146
|
* * Implement as dispatch to clipPlaneSets as supplied by derived class.
|
|
135
147
|
*/
|
|
136
148
|
isPointOnOrInside(point, onTolerance = Geometry.smallMetricDistanceSquared) {
|
|
@@ -140,7 +152,8 @@ export class ClipPrimitive {
|
|
|
140
152
|
inside = this._clipPlanes.isPointOnOrInside(point, onTolerance);
|
|
141
153
|
return inside;
|
|
142
154
|
}
|
|
143
|
-
/**
|
|
155
|
+
/**
|
|
156
|
+
* Method from [[Clipper]] interface.
|
|
144
157
|
* * Implement as dispatch to clipPlaneSets as supplied by derived class.
|
|
145
158
|
*/
|
|
146
159
|
announceClippedSegmentIntervals(f0, f1, pointA, pointB, announce) {
|
|
@@ -150,7 +163,8 @@ export class ClipPrimitive {
|
|
|
150
163
|
hasInsideParts = this._clipPlanes.announceClippedSegmentIntervals(f0, f1, pointA, pointB, announce);
|
|
151
164
|
return hasInsideParts;
|
|
152
165
|
}
|
|
153
|
-
/**
|
|
166
|
+
/**
|
|
167
|
+
* Method from [[Clipper]] interface.
|
|
154
168
|
* * Implement as dispatch to clipPlaneSets as supplied by derived class.
|
|
155
169
|
*/
|
|
156
170
|
announceClippedArcIntervals(arc, announce) {
|
|
@@ -164,11 +178,12 @@ export class ClipPrimitive {
|
|
|
164
178
|
* Multiply all ClipPlanes DPoint4d by matrix.
|
|
165
179
|
* @param matrix matrix to apply.
|
|
166
180
|
* @param invert if true, use in verse of the matrix.
|
|
167
|
-
* @param transpose if true, use the transpose of the matrix (or inverse, per invert parameter)
|
|
168
|
-
*
|
|
181
|
+
* @param transpose if true, use the transpose of the matrix (or inverse, per invert parameter).
|
|
182
|
+
* @param matrix matrix to apply.
|
|
183
|
+
* * Note that if matrixA is applied to all of space, the matrix to send to this method to get a corresponding
|
|
184
|
+
* effect on the plane is the inverse transpose of matrixA.
|
|
169
185
|
* * Callers that will apply the same matrix to many planes should pre-invert the matrix for efficiency.
|
|
170
186
|
* * Both params default to true to get the full effect of transforming space.
|
|
171
|
-
* @param matrix matrix to apply
|
|
172
187
|
*/
|
|
173
188
|
multiplyPlanesByMatrix4d(matrix, invert = true, transpose = true) {
|
|
174
189
|
if (invert) { // form inverse once here, reuse for all planes
|
|
@@ -181,7 +196,7 @@ export class ClipPrimitive {
|
|
|
181
196
|
this._clipPlanes.multiplyPlanesByMatrix4d(matrix);
|
|
182
197
|
return true;
|
|
183
198
|
}
|
|
184
|
-
/** Apply a transform to the clipper (e.g. transform all planes) */
|
|
199
|
+
/** Apply a transform to the clipper (e.g. transform all planes). */
|
|
185
200
|
transformInPlace(transform) {
|
|
186
201
|
if (this._clipPlanes)
|
|
187
202
|
this._clipPlanes.transformInPlace(transform);
|
|
@@ -192,7 +207,8 @@ export class ClipPrimitive {
|
|
|
192
207
|
this._invisible = invisible;
|
|
193
208
|
}
|
|
194
209
|
/**
|
|
195
|
-
* Return true if any plane of the primary clipPlanes has (a) non-zero z component in its normal vector and
|
|
210
|
+
* Return true if any plane of the primary clipPlanes has (a) non-zero z component in its normal vector and
|
|
211
|
+
* (b) finite distance from origin.
|
|
196
212
|
*/
|
|
197
213
|
containsZClip() {
|
|
198
214
|
if (this.fetchClipPlanesRef() !== undefined)
|
|
@@ -204,8 +220,9 @@ export class ClipPrimitive {
|
|
|
204
220
|
}
|
|
205
221
|
/**
|
|
206
222
|
* Quick test of whether the given points fall completely inside or outside.
|
|
207
|
-
* @param points points to test
|
|
208
|
-
* @param ignoreInvisibleSetting if true, do the test with the clip planes and return that, ignoring the
|
|
223
|
+
* @param points points to test.
|
|
224
|
+
* @param ignoreInvisibleSetting if true, do the test with the clip planes and return that, ignoring the
|
|
225
|
+
* invisible setting.
|
|
209
226
|
*/
|
|
210
227
|
classifyPointContainment(points, ignoreInvisibleSetting) {
|
|
211
228
|
this.ensurePlaneSets();
|
|
@@ -224,8 +241,9 @@ export class ClipPrimitive {
|
|
|
224
241
|
}
|
|
225
242
|
return inside;
|
|
226
243
|
}
|
|
227
|
-
/**
|
|
228
|
-
*
|
|
244
|
+
/**
|
|
245
|
+
* Promote json object form to class instance.
|
|
246
|
+
* * First try to convert to a ClipShape.
|
|
229
247
|
* * then try as a standalone instance of the base class ClipPrimitive.
|
|
230
248
|
*/
|
|
231
249
|
static fromJSON(json) {
|
|
@@ -281,27 +299,49 @@ export class ClipShape extends ClipPrimitive {
|
|
|
281
299
|
this.initSecondaryProps(isMask, zLow, zHigh, transform);
|
|
282
300
|
}
|
|
283
301
|
/** Returns true if this ClipShape is marked as invisible. */
|
|
284
|
-
get invisible() {
|
|
302
|
+
get invisible() {
|
|
303
|
+
return this._invisible;
|
|
304
|
+
}
|
|
285
305
|
/** Return this transformFromClip, which may be undefined. */
|
|
286
|
-
get transformFromClip() {
|
|
306
|
+
get transformFromClip() {
|
|
307
|
+
return this._transformFromClip;
|
|
308
|
+
}
|
|
287
309
|
/** Return this transformToClip, which may be undefined. */
|
|
288
|
-
get transformToClip() {
|
|
310
|
+
get transformToClip() {
|
|
311
|
+
return this._transformToClip;
|
|
312
|
+
}
|
|
289
313
|
/** Returns true if this ClipShape's transforms are currently set. */
|
|
290
|
-
get transformValid() {
|
|
314
|
+
get transformValid() {
|
|
315
|
+
return this.transformFromClip !== undefined;
|
|
316
|
+
}
|
|
291
317
|
/** Returns true if this ClipShape's lower z boundary is set. */
|
|
292
|
-
get zLowValid() {
|
|
318
|
+
get zLowValid() {
|
|
319
|
+
return this._zLow !== undefined;
|
|
320
|
+
}
|
|
293
321
|
/** Returns true if this ClipShape's upper z boundary is set. */
|
|
294
|
-
get zHighValid() {
|
|
322
|
+
get zHighValid() {
|
|
323
|
+
return this._zHigh !== undefined;
|
|
324
|
+
}
|
|
295
325
|
/** Return true if this ClipShape has a local to world transform */
|
|
296
|
-
get transformIsValid() {
|
|
326
|
+
get transformIsValid() {
|
|
327
|
+
return this._transformFromClip !== undefined;
|
|
328
|
+
}
|
|
297
329
|
/** Return this zLow, which may be undefined. */
|
|
298
|
-
get zLow() {
|
|
330
|
+
get zLow() {
|
|
331
|
+
return this._zLow;
|
|
332
|
+
}
|
|
299
333
|
/** Return this zHigh, which may be undefined. */
|
|
300
|
-
get zHigh() {
|
|
334
|
+
get zHigh() {
|
|
335
|
+
return this._zHigh;
|
|
336
|
+
}
|
|
301
337
|
/** Returns a reference to this ClipShape's polygon array. */
|
|
302
|
-
get polygon() {
|
|
338
|
+
get polygon() {
|
|
339
|
+
return this._polygon;
|
|
340
|
+
}
|
|
303
341
|
/** Returns true if this ClipShape is a masking set. */
|
|
304
|
-
get isMask() {
|
|
342
|
+
get isMask() {
|
|
343
|
+
return this._isMask;
|
|
344
|
+
}
|
|
305
345
|
/** Sets the polygon points array of this ClipShape to the array given (by reference). */
|
|
306
346
|
setPolygon(polygon) {
|
|
307
347
|
// Add closure point
|
|
@@ -310,8 +350,9 @@ export class ClipShape extends ClipPrimitive {
|
|
|
310
350
|
this._polygon = polygon;
|
|
311
351
|
}
|
|
312
352
|
/**
|
|
313
|
-
*
|
|
314
|
-
*
|
|
353
|
+
* If the ClipShape's associated `UnionOfConvexClipPlaneSets` is defined, do nothing.
|
|
354
|
+
* If the ClipShape's associated `UnionOfConvexClipPlaneSets` is undefined, generate it from the `ClipShape`
|
|
355
|
+
* and transform.
|
|
315
356
|
*/
|
|
316
357
|
ensurePlaneSets() {
|
|
317
358
|
if (this._clipPlanes !== undefined)
|
|
@@ -323,7 +364,7 @@ export class ClipShape extends ClipPrimitive {
|
|
|
323
364
|
}
|
|
324
365
|
/**
|
|
325
366
|
* Initialize the members of the ClipShape class that may at times be undefined.
|
|
326
|
-
* zLow and zHigh default to Number.MAX_VALUE, and the transform defaults to an identity transform
|
|
367
|
+
* zLow and zHigh default to Number.MAX_VALUE, and the transform defaults to an identity transform.
|
|
327
368
|
*/
|
|
328
369
|
initSecondaryProps(isMask, zLow, zHigh, transform) {
|
|
329
370
|
this._isMask = isMask;
|
|
@@ -338,7 +379,7 @@ export class ClipShape extends ClipPrimitive {
|
|
|
338
379
|
this._transformToClip = Transform.createIdentity();
|
|
339
380
|
}
|
|
340
381
|
}
|
|
341
|
-
/**
|
|
382
|
+
/** Emit json object form */
|
|
342
383
|
toJSON() {
|
|
343
384
|
const shape = {
|
|
344
385
|
points: this._polygon.map((pt) => pt.toJSON()),
|
|
@@ -355,7 +396,7 @@ export class ClipShape extends ClipPrimitive {
|
|
|
355
396
|
shape.zhigh = this.zHigh;
|
|
356
397
|
return { shape };
|
|
357
398
|
}
|
|
358
|
-
/**
|
|
399
|
+
/** Parse `json` to a clip shape. */
|
|
359
400
|
static fromClipShapeJSON(json, result) {
|
|
360
401
|
const shape = json?.shape;
|
|
361
402
|
if (!shape)
|
|
@@ -417,7 +458,7 @@ export class ClipShape extends ClipPrimitive {
|
|
|
417
458
|
blockPoints[1].x = blockPoints[2].x = high.x;
|
|
418
459
|
blockPoints[0].y = blockPoints[1].y = blockPoints[4].y = low.y;
|
|
419
460
|
blockPoints[2].y = blockPoints[3].y = high.y;
|
|
420
|
-
return ClipShape.createShape(blockPoints, (ClipMaskXYZRangePlanes.None !== (clipMask & ClipMaskXYZRangePlanes.ZLow)) ? low.z : undefined, ClipMaskXYZRangePlanes.None !== (clipMask & ClipMaskXYZRangePlanes.ZHigh) ? high.z : undefined, transform, isMask, invisible, result);
|
|
461
|
+
return ClipShape.createShape(blockPoints, (ClipMaskXYZRangePlanes.None !== (clipMask & ClipMaskXYZRangePlanes.ZLow)) ? low.z : undefined, (ClipMaskXYZRangePlanes.None !== (clipMask & ClipMaskXYZRangePlanes.ZHigh)) ? high.z : undefined, transform, isMask, invisible, result);
|
|
421
462
|
}
|
|
422
463
|
/** Creates a new ClipShape with undefined members and a polygon points array of zero length. */
|
|
423
464
|
static createEmpty(isMask = false, invisible = false, transform, result) {
|
|
@@ -438,11 +479,14 @@ export class ClipShape extends ClipPrimitive {
|
|
|
438
479
|
return false;
|
|
439
480
|
return true;
|
|
440
481
|
}
|
|
441
|
-
/** Returns a deep copy of this instance of ClipShape, storing in an optional result */
|
|
482
|
+
/** Returns a deep copy of this instance of ClipShape, storing in an optional result. */
|
|
442
483
|
clone(result) {
|
|
443
484
|
return ClipShape.createFrom(this, result);
|
|
444
485
|
}
|
|
445
|
-
/**
|
|
486
|
+
/**
|
|
487
|
+
* Given the current polygon data, parses clip planes that together form an object, storing the result in
|
|
488
|
+
* the set given, either clip planes or mask planes.
|
|
489
|
+
*/
|
|
446
490
|
parseClipPlanes(set) {
|
|
447
491
|
const points = this._polygon;
|
|
448
492
|
if (points.length === 3 && !this._isMask && points[0].isExactEqual(points[points.length - 1])) {
|
|
@@ -461,7 +505,10 @@ export class ClipShape extends ClipPrimitive {
|
|
|
461
505
|
this.parsePolygonPlanes(set, this._polygon, this.isMask);
|
|
462
506
|
return true;
|
|
463
507
|
}
|
|
464
|
-
/**
|
|
508
|
+
/**
|
|
509
|
+
* Given a start and end point, populate the given UnionOfConvexClipPlaneSets with ConvexClipPlaneSets
|
|
510
|
+
* defining the bounded region of linear planes. Returns true if successful.
|
|
511
|
+
*/
|
|
465
512
|
parseLinearPlanes(set, start, end, cameraFocalLength) {
|
|
466
513
|
// Handles the degenerate case of 2 distinct points (used by select by line).
|
|
467
514
|
const normal = start.vectorTo(end);
|
|
@@ -493,7 +540,10 @@ export class ClipShape extends ClipPrimitive {
|
|
|
493
540
|
set.addConvexSet(convexSet);
|
|
494
541
|
return true;
|
|
495
542
|
}
|
|
496
|
-
/**
|
|
543
|
+
/**
|
|
544
|
+
* Given a convex polygon defined as an array of points, populate the given UnionOfConvexClipPlaneSets with
|
|
545
|
+
* ConvexClipPlaneSets defining the bounded region. Returns true if successful.
|
|
546
|
+
*/
|
|
497
547
|
parseConvexPolygonPlanes(set, polygon, direction, buildExteriorClipper, cameraFocalLength) {
|
|
498
548
|
const samePointTolerance = 1.0e-8; // This could possibly be replaced with more widely used constants
|
|
499
549
|
const edges = [];
|
|
@@ -551,7 +601,10 @@ export class ClipShape extends ClipPrimitive {
|
|
|
551
601
|
}
|
|
552
602
|
return true;
|
|
553
603
|
}
|
|
554
|
-
/**
|
|
604
|
+
/**
|
|
605
|
+
* Given a (possibly non-convex) polygon defined as an array of points, populate the given UnionOfConvexClipPlaneSets
|
|
606
|
+
* with multiple ConvexClipPlaneSets defining the bounded region. Returns true if successful.
|
|
607
|
+
*/
|
|
555
608
|
parsePolygonPlanes(set, polygon, isMask, cameraFocalLength) {
|
|
556
609
|
const cleanPolygon = PolylineOps.compressDanglers(polygon, true);
|
|
557
610
|
const announceFace = (_graph, edge) => {
|
|
@@ -598,17 +651,19 @@ export class ClipShape extends ClipPrimitive {
|
|
|
598
651
|
* Multiply all ClipPlanes DPoint4d by matrix.
|
|
599
652
|
* @param matrix matrix to apply.
|
|
600
653
|
* @param invert if true, use in verse of the matrix.
|
|
601
|
-
* @param transpose if true, use the transpose of the matrix (or inverse, per invert parameter)
|
|
602
|
-
*
|
|
654
|
+
* @param transpose if true, use the transpose of the matrix (or inverse, per invert parameter).
|
|
655
|
+
* @param matrix matrix to apply.
|
|
656
|
+
* * Note that if matrixA is applied to all of space, the matrix to send to this method to get a corresponding effect
|
|
657
|
+
* on the plane is the inverse transpose of matrixA.
|
|
603
658
|
* * Callers that will apply the same matrix to many planes should pre-invert the matrix for efficiency.
|
|
604
659
|
* * Both params default to true to get the full effect of transforming space.
|
|
605
|
-
* @param matrix matrix to apply
|
|
606
660
|
*/
|
|
607
661
|
multiplyPlanesByMatrix4d(matrix, invert = true, transpose = true) {
|
|
608
662
|
this.ensurePlaneSets();
|
|
609
663
|
return super.multiplyPlanesByMatrix4d(matrix, invert, transpose);
|
|
610
664
|
}
|
|
611
|
-
/**
|
|
665
|
+
/**
|
|
666
|
+
* Apply `transform` to the local to world (`transformFromClip`) transform.
|
|
612
667
|
* * The world to local transform (`transformToClip` is recomputed from the (changed) `transformToClip`
|
|
613
668
|
* * the transform is passed to the base class to be applied to clip plane form of the clipper.
|
|
614
669
|
*/
|
|
@@ -623,7 +678,8 @@ export class ClipShape extends ClipPrimitive {
|
|
|
623
678
|
this._transformToClip = this._transformFromClip.inverse(); // could be undefined
|
|
624
679
|
return true;
|
|
625
680
|
}
|
|
626
|
-
/**
|
|
681
|
+
/**
|
|
682
|
+
* Return true if
|
|
627
683
|
* * at least one point is defined
|
|
628
684
|
* * The local to world transform (transformFromClip) either
|
|
629
685
|
* * is undefined
|