@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"}
|
|
@@ -51,17 +51,18 @@ var ClipMaskXYZRangePlanes;
|
|
|
51
51
|
})(ClipMaskXYZRangePlanes = exports.ClipMaskXYZRangePlanes || (exports.ClipMaskXYZRangePlanes = {}));
|
|
52
52
|
/**
|
|
53
53
|
* * ClipPrimitive is a base class for clipping implementations that use
|
|
54
|
-
* * A UnionOfConvexClipPlaneSets designated "clipPlanes"
|
|
55
|
-
* *
|
|
56
|
-
* * When constructed directly, objects of type ClipPrimitive (directly, not through a derived class) will have just planes
|
|
54
|
+
* * A UnionOfConvexClipPlaneSets designated "clipPlanes".
|
|
55
|
+
* * An "invisible" flag.
|
|
56
|
+
* * When constructed directly, objects of type ClipPrimitive (directly, not through a derived class) will have just planes.
|
|
57
57
|
* * Derived classes (e.g. ClipShape) carry additional data such as a swept shape.
|
|
58
58
|
* * ClipPrimitive can be constructed with no planes.
|
|
59
59
|
* * Derived class is responsible for filling the plane sets.
|
|
60
|
-
* * At discretion of derived classes, plane construction can be done at construction time or "on demand when" queries
|
|
60
|
+
* * At discretion of derived classes, plane construction can be done at construction time or "on demand when" queries
|
|
61
|
+
* call `ensurePlaneSets ()`
|
|
61
62
|
* * ClipPrimitive can be constructed directly with planes (and no derived class).
|
|
62
63
|
* * That the prevailing use is via a ClipShape derived class.
|
|
63
64
|
* * The ClipShape has an "isMask" property
|
|
64
|
-
* * isMask === false means the plane sets should cover the inside of its polygon
|
|
65
|
+
* * isMask === false means the plane sets should cover the inside of its polygon.
|
|
65
66
|
* * isMask === true means the plane sets should cover the outside of its polygon.
|
|
66
67
|
* * Note that the ClipShape's `isMask` property and the ClipPrimitive's `isInvisible` property are distinct controls.
|
|
67
68
|
* * In normal usage, callers get "outside" clip behavior using ONLY the ClipShape isMask property.
|
|
@@ -70,13 +71,19 @@ var ClipMaskXYZRangePlanes;
|
|
|
70
71
|
* @public
|
|
71
72
|
*/
|
|
72
73
|
class ClipPrimitive {
|
|
73
|
-
/**
|
|
74
|
-
*
|
|
75
|
-
*
|
|
74
|
+
/**
|
|
75
|
+
* Get a reference to the `UnionOfConvexClipPlaneSets`.
|
|
76
|
+
* * It triggers construction of the sets by `this.ensurePlaneSets()`.
|
|
77
|
+
* * Derived class typically caches the set on the first such call.
|
|
76
78
|
*/
|
|
77
|
-
fetchClipPlanesRef() {
|
|
79
|
+
fetchClipPlanesRef() {
|
|
80
|
+
this.ensurePlaneSets();
|
|
81
|
+
return this._clipPlanes;
|
|
82
|
+
}
|
|
78
83
|
/** Ask if this primitive is a hole. */
|
|
79
|
-
get invisible() {
|
|
84
|
+
get invisible() {
|
|
85
|
+
return this._invisible;
|
|
86
|
+
}
|
|
80
87
|
constructor(planeSet, isInvisible = false) {
|
|
81
88
|
this._clipPlanes = planeSet;
|
|
82
89
|
this._invisible = isInvisible;
|
|
@@ -105,26 +112,30 @@ class ClipPrimitive {
|
|
|
105
112
|
}
|
|
106
113
|
/**
|
|
107
114
|
* Returns true if the planes are present.
|
|
108
|
-
* * This can be false (for instance) if a ClipShape is holding a polygon but has not yet been asked to construct
|
|
115
|
+
* * This can be false (for instance) if a ClipShape is holding a polygon but has not yet been asked to construct
|
|
116
|
+
* the planes.
|
|
109
117
|
*/
|
|
110
118
|
arePlanesDefined() {
|
|
111
119
|
return this._clipPlanes !== undefined;
|
|
112
120
|
}
|
|
113
|
-
/** Return a deep clone
|
|
121
|
+
/** Return a deep clone. */
|
|
114
122
|
clone() {
|
|
115
123
|
const newPlanes = this._clipPlanes ? this._clipPlanes.clone() : undefined;
|
|
116
124
|
const result = new ClipPrimitive(newPlanes, this._invisible);
|
|
117
125
|
return result;
|
|
118
126
|
}
|
|
119
127
|
/**
|
|
120
|
-
*
|
|
128
|
+
* Trigger (if needed) computation of plane sets (if applicable) in the derived class.
|
|
121
129
|
* * Base class is no op.
|
|
122
130
|
* * In derived class, on first call create planes sets from defining data (e.g. swept shape).
|
|
123
131
|
* * In derived class, if planes are present leave them alone.
|
|
124
132
|
*/
|
|
125
133
|
ensurePlaneSets() { }
|
|
126
|
-
/**
|
|
127
|
-
*
|
|
134
|
+
/**
|
|
135
|
+
* Return true if the point lies inside/on this polygon (or not inside/on if this polygon is a mask). Otherwise,
|
|
136
|
+
* return false.
|
|
137
|
+
* * Note that a derived class may choose to (a) implement its own test using its defining data, or (b) accept
|
|
138
|
+
* this implementation using planes that it inserted in the base class.
|
|
128
139
|
*/
|
|
129
140
|
pointInside(point, onTolerance = Geometry_1.Geometry.smallMetricDistanceSquared) {
|
|
130
141
|
this.ensurePlaneSets();
|
|
@@ -133,7 +144,8 @@ class ClipPrimitive {
|
|
|
133
144
|
inside = this._clipPlanes.isPointOnOrInside(point, onTolerance);
|
|
134
145
|
return inside;
|
|
135
146
|
}
|
|
136
|
-
/**
|
|
147
|
+
/**
|
|
148
|
+
* Method from [[Clipper]] interface.
|
|
137
149
|
* * Implement as dispatch to clipPlaneSets as supplied by derived class.
|
|
138
150
|
*/
|
|
139
151
|
isPointOnOrInside(point, onTolerance = Geometry_1.Geometry.smallMetricDistanceSquared) {
|
|
@@ -143,7 +155,8 @@ class ClipPrimitive {
|
|
|
143
155
|
inside = this._clipPlanes.isPointOnOrInside(point, onTolerance);
|
|
144
156
|
return inside;
|
|
145
157
|
}
|
|
146
|
-
/**
|
|
158
|
+
/**
|
|
159
|
+
* Method from [[Clipper]] interface.
|
|
147
160
|
* * Implement as dispatch to clipPlaneSets as supplied by derived class.
|
|
148
161
|
*/
|
|
149
162
|
announceClippedSegmentIntervals(f0, f1, pointA, pointB, announce) {
|
|
@@ -153,7 +166,8 @@ class ClipPrimitive {
|
|
|
153
166
|
hasInsideParts = this._clipPlanes.announceClippedSegmentIntervals(f0, f1, pointA, pointB, announce);
|
|
154
167
|
return hasInsideParts;
|
|
155
168
|
}
|
|
156
|
-
/**
|
|
169
|
+
/**
|
|
170
|
+
* Method from [[Clipper]] interface.
|
|
157
171
|
* * Implement as dispatch to clipPlaneSets as supplied by derived class.
|
|
158
172
|
*/
|
|
159
173
|
announceClippedArcIntervals(arc, announce) {
|
|
@@ -167,11 +181,12 @@ class ClipPrimitive {
|
|
|
167
181
|
* Multiply all ClipPlanes DPoint4d by matrix.
|
|
168
182
|
* @param matrix matrix to apply.
|
|
169
183
|
* @param invert if true, use in verse of the matrix.
|
|
170
|
-
* @param transpose if true, use the transpose of the matrix (or inverse, per invert parameter)
|
|
171
|
-
*
|
|
184
|
+
* @param transpose if true, use the transpose of the matrix (or inverse, per invert parameter).
|
|
185
|
+
* @param matrix matrix to apply.
|
|
186
|
+
* * Note that if matrixA is applied to all of space, the matrix to send to this method to get a corresponding
|
|
187
|
+
* effect on the plane is the inverse transpose of matrixA.
|
|
172
188
|
* * Callers that will apply the same matrix to many planes should pre-invert the matrix for efficiency.
|
|
173
189
|
* * Both params default to true to get the full effect of transforming space.
|
|
174
|
-
* @param matrix matrix to apply
|
|
175
190
|
*/
|
|
176
191
|
multiplyPlanesByMatrix4d(matrix, invert = true, transpose = true) {
|
|
177
192
|
if (invert) { // form inverse once here, reuse for all planes
|
|
@@ -184,7 +199,7 @@ class ClipPrimitive {
|
|
|
184
199
|
this._clipPlanes.multiplyPlanesByMatrix4d(matrix);
|
|
185
200
|
return true;
|
|
186
201
|
}
|
|
187
|
-
/** Apply a transform to the clipper (e.g. transform all planes) */
|
|
202
|
+
/** Apply a transform to the clipper (e.g. transform all planes). */
|
|
188
203
|
transformInPlace(transform) {
|
|
189
204
|
if (this._clipPlanes)
|
|
190
205
|
this._clipPlanes.transformInPlace(transform);
|
|
@@ -195,7 +210,8 @@ class ClipPrimitive {
|
|
|
195
210
|
this._invisible = invisible;
|
|
196
211
|
}
|
|
197
212
|
/**
|
|
198
|
-
* Return true if any plane of the primary clipPlanes has (a) non-zero z component in its normal vector and
|
|
213
|
+
* Return true if any plane of the primary clipPlanes has (a) non-zero z component in its normal vector and
|
|
214
|
+
* (b) finite distance from origin.
|
|
199
215
|
*/
|
|
200
216
|
containsZClip() {
|
|
201
217
|
if (this.fetchClipPlanesRef() !== undefined)
|
|
@@ -207,8 +223,9 @@ class ClipPrimitive {
|
|
|
207
223
|
}
|
|
208
224
|
/**
|
|
209
225
|
* Quick test of whether the given points fall completely inside or outside.
|
|
210
|
-
* @param points points to test
|
|
211
|
-
* @param ignoreInvisibleSetting if true, do the test with the clip planes and return that, ignoring the
|
|
226
|
+
* @param points points to test.
|
|
227
|
+
* @param ignoreInvisibleSetting if true, do the test with the clip planes and return that, ignoring the
|
|
228
|
+
* invisible setting.
|
|
212
229
|
*/
|
|
213
230
|
classifyPointContainment(points, ignoreInvisibleSetting) {
|
|
214
231
|
this.ensurePlaneSets();
|
|
@@ -227,8 +244,9 @@ class ClipPrimitive {
|
|
|
227
244
|
}
|
|
228
245
|
return inside;
|
|
229
246
|
}
|
|
230
|
-
/**
|
|
231
|
-
*
|
|
247
|
+
/**
|
|
248
|
+
* Promote json object form to class instance.
|
|
249
|
+
* * First try to convert to a ClipShape.
|
|
232
250
|
* * then try as a standalone instance of the base class ClipPrimitive.
|
|
233
251
|
*/
|
|
234
252
|
static fromJSON(json) {
|
|
@@ -285,27 +303,49 @@ class ClipShape extends ClipPrimitive {
|
|
|
285
303
|
this.initSecondaryProps(isMask, zLow, zHigh, transform);
|
|
286
304
|
}
|
|
287
305
|
/** Returns true if this ClipShape is marked as invisible. */
|
|
288
|
-
get invisible() {
|
|
306
|
+
get invisible() {
|
|
307
|
+
return this._invisible;
|
|
308
|
+
}
|
|
289
309
|
/** Return this transformFromClip, which may be undefined. */
|
|
290
|
-
get transformFromClip() {
|
|
310
|
+
get transformFromClip() {
|
|
311
|
+
return this._transformFromClip;
|
|
312
|
+
}
|
|
291
313
|
/** Return this transformToClip, which may be undefined. */
|
|
292
|
-
get transformToClip() {
|
|
314
|
+
get transformToClip() {
|
|
315
|
+
return this._transformToClip;
|
|
316
|
+
}
|
|
293
317
|
/** Returns true if this ClipShape's transforms are currently set. */
|
|
294
|
-
get transformValid() {
|
|
318
|
+
get transformValid() {
|
|
319
|
+
return this.transformFromClip !== undefined;
|
|
320
|
+
}
|
|
295
321
|
/** Returns true if this ClipShape's lower z boundary is set. */
|
|
296
|
-
get zLowValid() {
|
|
322
|
+
get zLowValid() {
|
|
323
|
+
return this._zLow !== undefined;
|
|
324
|
+
}
|
|
297
325
|
/** Returns true if this ClipShape's upper z boundary is set. */
|
|
298
|
-
get zHighValid() {
|
|
326
|
+
get zHighValid() {
|
|
327
|
+
return this._zHigh !== undefined;
|
|
328
|
+
}
|
|
299
329
|
/** Return true if this ClipShape has a local to world transform */
|
|
300
|
-
get transformIsValid() {
|
|
330
|
+
get transformIsValid() {
|
|
331
|
+
return this._transformFromClip !== undefined;
|
|
332
|
+
}
|
|
301
333
|
/** Return this zLow, which may be undefined. */
|
|
302
|
-
get zLow() {
|
|
334
|
+
get zLow() {
|
|
335
|
+
return this._zLow;
|
|
336
|
+
}
|
|
303
337
|
/** Return this zHigh, which may be undefined. */
|
|
304
|
-
get zHigh() {
|
|
338
|
+
get zHigh() {
|
|
339
|
+
return this._zHigh;
|
|
340
|
+
}
|
|
305
341
|
/** Returns a reference to this ClipShape's polygon array. */
|
|
306
|
-
get polygon() {
|
|
342
|
+
get polygon() {
|
|
343
|
+
return this._polygon;
|
|
344
|
+
}
|
|
307
345
|
/** Returns true if this ClipShape is a masking set. */
|
|
308
|
-
get isMask() {
|
|
346
|
+
get isMask() {
|
|
347
|
+
return this._isMask;
|
|
348
|
+
}
|
|
309
349
|
/** Sets the polygon points array of this ClipShape to the array given (by reference). */
|
|
310
350
|
setPolygon(polygon) {
|
|
311
351
|
// Add closure point
|
|
@@ -314,8 +354,9 @@ class ClipShape extends ClipPrimitive {
|
|
|
314
354
|
this._polygon = polygon;
|
|
315
355
|
}
|
|
316
356
|
/**
|
|
317
|
-
*
|
|
318
|
-
*
|
|
357
|
+
* If the ClipShape's associated `UnionOfConvexClipPlaneSets` is defined, do nothing.
|
|
358
|
+
* If the ClipShape's associated `UnionOfConvexClipPlaneSets` is undefined, generate it from the `ClipShape`
|
|
359
|
+
* and transform.
|
|
319
360
|
*/
|
|
320
361
|
ensurePlaneSets() {
|
|
321
362
|
if (this._clipPlanes !== undefined)
|
|
@@ -327,7 +368,7 @@ class ClipShape extends ClipPrimitive {
|
|
|
327
368
|
}
|
|
328
369
|
/**
|
|
329
370
|
* Initialize the members of the ClipShape class that may at times be undefined.
|
|
330
|
-
* zLow and zHigh default to Number.MAX_VALUE, and the transform defaults to an identity transform
|
|
371
|
+
* zLow and zHigh default to Number.MAX_VALUE, and the transform defaults to an identity transform.
|
|
331
372
|
*/
|
|
332
373
|
initSecondaryProps(isMask, zLow, zHigh, transform) {
|
|
333
374
|
this._isMask = isMask;
|
|
@@ -342,7 +383,7 @@ class ClipShape extends ClipPrimitive {
|
|
|
342
383
|
this._transformToClip = Transform_1.Transform.createIdentity();
|
|
343
384
|
}
|
|
344
385
|
}
|
|
345
|
-
/**
|
|
386
|
+
/** Emit json object form */
|
|
346
387
|
toJSON() {
|
|
347
388
|
const shape = {
|
|
348
389
|
points: this._polygon.map((pt) => pt.toJSON()),
|
|
@@ -359,7 +400,7 @@ class ClipShape extends ClipPrimitive {
|
|
|
359
400
|
shape.zhigh = this.zHigh;
|
|
360
401
|
return { shape };
|
|
361
402
|
}
|
|
362
|
-
/**
|
|
403
|
+
/** Parse `json` to a clip shape. */
|
|
363
404
|
static fromClipShapeJSON(json, result) {
|
|
364
405
|
const shape = json?.shape;
|
|
365
406
|
if (!shape)
|
|
@@ -421,7 +462,7 @@ class ClipShape extends ClipPrimitive {
|
|
|
421
462
|
blockPoints[1].x = blockPoints[2].x = high.x;
|
|
422
463
|
blockPoints[0].y = blockPoints[1].y = blockPoints[4].y = low.y;
|
|
423
464
|
blockPoints[2].y = blockPoints[3].y = high.y;
|
|
424
|
-
return ClipShape.createShape(blockPoints, (ClipMaskXYZRangePlanes.None !== (clipMask & ClipMaskXYZRangePlanes.ZLow)) ? low.z : undefined, ClipMaskXYZRangePlanes.None !== (clipMask & ClipMaskXYZRangePlanes.ZHigh) ? high.z : undefined, transform, isMask, invisible, result);
|
|
465
|
+
return ClipShape.createShape(blockPoints, (ClipMaskXYZRangePlanes.None !== (clipMask & ClipMaskXYZRangePlanes.ZLow)) ? low.z : undefined, (ClipMaskXYZRangePlanes.None !== (clipMask & ClipMaskXYZRangePlanes.ZHigh)) ? high.z : undefined, transform, isMask, invisible, result);
|
|
425
466
|
}
|
|
426
467
|
/** Creates a new ClipShape with undefined members and a polygon points array of zero length. */
|
|
427
468
|
static createEmpty(isMask = false, invisible = false, transform, result) {
|
|
@@ -442,11 +483,14 @@ class ClipShape extends ClipPrimitive {
|
|
|
442
483
|
return false;
|
|
443
484
|
return true;
|
|
444
485
|
}
|
|
445
|
-
/** Returns a deep copy of this instance of ClipShape, storing in an optional result */
|
|
486
|
+
/** Returns a deep copy of this instance of ClipShape, storing in an optional result. */
|
|
446
487
|
clone(result) {
|
|
447
488
|
return ClipShape.createFrom(this, result);
|
|
448
489
|
}
|
|
449
|
-
/**
|
|
490
|
+
/**
|
|
491
|
+
* Given the current polygon data, parses clip planes that together form an object, storing the result in
|
|
492
|
+
* the set given, either clip planes or mask planes.
|
|
493
|
+
*/
|
|
450
494
|
parseClipPlanes(set) {
|
|
451
495
|
const points = this._polygon;
|
|
452
496
|
if (points.length === 3 && !this._isMask && points[0].isExactEqual(points[points.length - 1])) {
|
|
@@ -465,7 +509,10 @@ class ClipShape extends ClipPrimitive {
|
|
|
465
509
|
this.parsePolygonPlanes(set, this._polygon, this.isMask);
|
|
466
510
|
return true;
|
|
467
511
|
}
|
|
468
|
-
/**
|
|
512
|
+
/**
|
|
513
|
+
* Given a start and end point, populate the given UnionOfConvexClipPlaneSets with ConvexClipPlaneSets
|
|
514
|
+
* defining the bounded region of linear planes. Returns true if successful.
|
|
515
|
+
*/
|
|
469
516
|
parseLinearPlanes(set, start, end, cameraFocalLength) {
|
|
470
517
|
// Handles the degenerate case of 2 distinct points (used by select by line).
|
|
471
518
|
const normal = start.vectorTo(end);
|
|
@@ -497,7 +544,10 @@ class ClipShape extends ClipPrimitive {
|
|
|
497
544
|
set.addConvexSet(convexSet);
|
|
498
545
|
return true;
|
|
499
546
|
}
|
|
500
|
-
/**
|
|
547
|
+
/**
|
|
548
|
+
* Given a convex polygon defined as an array of points, populate the given UnionOfConvexClipPlaneSets with
|
|
549
|
+
* ConvexClipPlaneSets defining the bounded region. Returns true if successful.
|
|
550
|
+
*/
|
|
501
551
|
parseConvexPolygonPlanes(set, polygon, direction, buildExteriorClipper, cameraFocalLength) {
|
|
502
552
|
const samePointTolerance = 1.0e-8; // This could possibly be replaced with more widely used constants
|
|
503
553
|
const edges = [];
|
|
@@ -555,7 +605,10 @@ class ClipShape extends ClipPrimitive {
|
|
|
555
605
|
}
|
|
556
606
|
return true;
|
|
557
607
|
}
|
|
558
|
-
/**
|
|
608
|
+
/**
|
|
609
|
+
* Given a (possibly non-convex) polygon defined as an array of points, populate the given UnionOfConvexClipPlaneSets
|
|
610
|
+
* with multiple ConvexClipPlaneSets defining the bounded region. Returns true if successful.
|
|
611
|
+
*/
|
|
559
612
|
parsePolygonPlanes(set, polygon, isMask, cameraFocalLength) {
|
|
560
613
|
const cleanPolygon = PolylineOps_1.PolylineOps.compressDanglers(polygon, true);
|
|
561
614
|
const announceFace = (_graph, edge) => {
|
|
@@ -602,17 +655,19 @@ class ClipShape extends ClipPrimitive {
|
|
|
602
655
|
* Multiply all ClipPlanes DPoint4d by matrix.
|
|
603
656
|
* @param matrix matrix to apply.
|
|
604
657
|
* @param invert if true, use in verse of the matrix.
|
|
605
|
-
* @param transpose if true, use the transpose of the matrix (or inverse, per invert parameter)
|
|
606
|
-
*
|
|
658
|
+
* @param transpose if true, use the transpose of the matrix (or inverse, per invert parameter).
|
|
659
|
+
* @param matrix matrix to apply.
|
|
660
|
+
* * Note that if matrixA is applied to all of space, the matrix to send to this method to get a corresponding effect
|
|
661
|
+
* on the plane is the inverse transpose of matrixA.
|
|
607
662
|
* * Callers that will apply the same matrix to many planes should pre-invert the matrix for efficiency.
|
|
608
663
|
* * Both params default to true to get the full effect of transforming space.
|
|
609
|
-
* @param matrix matrix to apply
|
|
610
664
|
*/
|
|
611
665
|
multiplyPlanesByMatrix4d(matrix, invert = true, transpose = true) {
|
|
612
666
|
this.ensurePlaneSets();
|
|
613
667
|
return super.multiplyPlanesByMatrix4d(matrix, invert, transpose);
|
|
614
668
|
}
|
|
615
|
-
/**
|
|
669
|
+
/**
|
|
670
|
+
* Apply `transform` to the local to world (`transformFromClip`) transform.
|
|
616
671
|
* * The world to local transform (`transformToClip` is recomputed from the (changed) `transformToClip`
|
|
617
672
|
* * the transform is passed to the base class to be applied to clip plane form of the clipper.
|
|
618
673
|
*/
|
|
@@ -627,7 +682,8 @@ class ClipShape extends ClipPrimitive {
|
|
|
627
682
|
this._transformToClip = this._transformFromClip.inverse(); // could be undefined
|
|
628
683
|
return true;
|
|
629
684
|
}
|
|
630
|
-
/**
|
|
685
|
+
/**
|
|
686
|
+
* Return true if
|
|
631
687
|
* * at least one point is defined
|
|
632
688
|
* * The local to world transform (transformFromClip) either
|
|
633
689
|
* * is undefined
|