@itwin/core-geometry 4.3.0-dev.14 → 4.3.0-dev.16
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 +16 -1
- package/lib/cjs/clipping/ClipUtils.d.ts +32 -5
- package/lib/cjs/clipping/ClipUtils.d.ts.map +1 -1
- package/lib/cjs/clipping/ClipUtils.js +92 -11
- package/lib/cjs/clipping/ClipUtils.js.map +1 -1
- package/lib/cjs/numerics/Newton.js +2 -1
- package/lib/cjs/numerics/Newton.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts +1 -0
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.js +1 -0
- package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/esm/clipping/ClipUtils.d.ts +32 -5
- package/lib/esm/clipping/ClipUtils.d.ts.map +1 -1
- package/lib/esm/clipping/ClipUtils.js +92 -11
- package/lib/esm/clipping/ClipUtils.js.map +1 -1
- package/lib/esm/numerics/Newton.js +2 -1
- package/lib/esm/numerics/Newton.js.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.d.ts +1 -0
- package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.js +1 -0
- package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
# Change Log - @itwin/core-geometry
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Tue, 24 Oct 2023 15:10:47 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 4.2.1
|
|
6
|
+
Tue, 24 Oct 2023 15:09:13 GMT
|
|
7
|
+
|
|
8
|
+
### Updates
|
|
9
|
+
|
|
10
|
+
- restore open bcurve json import
|
|
11
|
+
|
|
12
|
+
## 4.2.0
|
|
13
|
+
Tue, 17 Oct 2023 15:14:32 GMT
|
|
14
|
+
|
|
15
|
+
### Updates
|
|
16
|
+
|
|
17
|
+
- improvements to GrowableXYArray, Path, Loop
|
|
18
|
+
- PolyfaceClip.drapeRegion
|
|
4
19
|
|
|
5
20
|
## 4.1.9
|
|
6
21
|
Tue, 10 Oct 2023 18:48:12 GMT
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @module CartesianGeometry
|
|
3
3
|
*/
|
|
4
4
|
import { Arc3d } from "../curve/Arc3d";
|
|
5
|
-
import { AnyCurve, AnyRegion } from "../curve/CurveTypes";
|
|
6
5
|
import { AnnounceNumberNumber, AnnounceNumberNumberCurvePrimitive, CurvePrimitive } from "../curve/CurvePrimitive";
|
|
6
|
+
import { AnyCurve, AnyRegion } from "../curve/CurveTypes";
|
|
7
7
|
import { GeometryQuery } from "../curve/GeometryQuery";
|
|
8
8
|
import { GrowableFloat64Array } from "../geometry3d/GrowableFloat64Array";
|
|
9
9
|
import { GrowableXYZArray } from "../geometry3d/GrowableXYZArray";
|
|
@@ -238,17 +238,44 @@ export declare class ClipUtilities {
|
|
|
238
238
|
* @param ignoreInvisiblePlanes if true, do NOT compute a facet for convex set faces marked invisible.
|
|
239
239
|
*/
|
|
240
240
|
static doesConvexClipPlaneSetIntersectRange(convexSet: ConvexClipPlaneSet, range: Range3d, includeConvexSetFaces?: boolean, includeRangeFaces?: boolean, ignoreInvisiblePlanes?: boolean): boolean;
|
|
241
|
+
/**
|
|
242
|
+
* Create a clipper from the transformed range.
|
|
243
|
+
* @param range input range to create clipper from
|
|
244
|
+
* @param transform how to transform the range (NOTE: applied to the range faces without swelling the range volume)
|
|
245
|
+
* @param degeneratePoints optionally populated with the 1 or 2 points defining the transformed range if it is degenerate (all points colinear/coincident); otherwise untouched
|
|
246
|
+
* @returns newly constructed clipper. If no clip planes could be computed, fill `degeneratePoints` and return undefined.
|
|
247
|
+
*/
|
|
248
|
+
private static createClipperFromTransformedRange3d;
|
|
249
|
+
/**
|
|
250
|
+
* Handle pathological cases of range-range intersection, where one of the ranges defines no area or volume (is a line segment or single point).
|
|
251
|
+
* @param range local range to intersect with the point/segment
|
|
252
|
+
* @param points isolated local point, or local segment's start and end
|
|
253
|
+
* @param localToWorld optional transform for output range
|
|
254
|
+
* @param intersection optional range of the intersection, in world coordinates, or null range if no intersection.
|
|
255
|
+
* @returns whether the point/segment intersects the range
|
|
256
|
+
*/
|
|
257
|
+
private static rangeIntersectPointOrSegment;
|
|
241
258
|
/**
|
|
242
259
|
* Test for intersection of two ranges in different local coordinates.
|
|
243
260
|
* * Useful for clash detection of elements in iModels, using their stored (tight) local ranges and placement transforms.
|
|
244
|
-
* @param range0 range in local coordinates
|
|
245
|
-
* @param local0ToWorld placement transform for first
|
|
246
|
-
* @param range1 range in local coordinates
|
|
247
|
-
* @param local1ToWorld placement transform for second
|
|
261
|
+
* @param range0 first range in local coordinates
|
|
262
|
+
* @param local0ToWorld placement transform for first range
|
|
263
|
+
* @param range1 second range in local coordinates
|
|
264
|
+
* @param local1ToWorld placement transform for second range. Assumed to be invertible.
|
|
248
265
|
* @param range1Margin optional signed local distance to expand/contract the second range before intersection. Positive expands.
|
|
249
266
|
* @return whether the local ranges are adjacent or intersect. Also returns false if local1ToWorld is singular.
|
|
250
267
|
*/
|
|
251
268
|
static doLocalRangesIntersect(range0: Range3d, local0ToWorld: Transform, range1: Range3d, local1ToWorld: Transform, range1Margin?: number): boolean;
|
|
269
|
+
/**
|
|
270
|
+
* Compute the range of the intersection between two local (e.g., element-aligned) ranges.
|
|
271
|
+
* @param range0 first range in local coordinates
|
|
272
|
+
* @param local0ToWorld placement transform for first range
|
|
273
|
+
* @param range1 second range in local coordinates
|
|
274
|
+
* @param local1ToWorld placement transform for second range. Assumed to be invertible.
|
|
275
|
+
* @param result optional pre-allocated range to fill and return
|
|
276
|
+
* @return range of the intersection (aligned to world axes). Returns null range if local1ToWorld is singular.
|
|
277
|
+
*/
|
|
278
|
+
static rangeOfIntersectionOfLocalRanges(range0: Range3d, local0ToWorld: Transform, range1: Range3d, local1ToWorld: Transform, result?: Range3d): Range3d;
|
|
252
279
|
/**
|
|
253
280
|
* Test if `obj` is a `Clipper` object.
|
|
254
281
|
* * This is implemented by testing for each of the methods in the `Clipper` interface.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClipUtils.d.ts","sourceRoot":"","sources":["../../../src/clipping/ClipUtils.ts"],"names":[],"mappings":"AAIA;;GAEG;
|
|
1
|
+
{"version":3,"file":"ClipUtils.d.ts","sourceRoot":"","sources":["../../../src/clipping/ClipUtils.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGvC,OAAO,EAAE,oBAAoB,EAAE,kCAAkC,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACnH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AASvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAE1F,OAAO,EAAE,OAAO,EAAY,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAE/C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EA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AC1C,WAAW,EAAE,gBAAgB,EAAE,GAAG,SAAS,EAC3C,UAAU,EAAE,qBAAqB,GAAG,SAAS;IA6C/C;;;OAGG;WACW,wBAAwB,CAAC,OAAO,EAAE,kBAAkB,GAAG,0BAA0B;CA6BhG"}
|
|
@@ -8,9 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.ClipUtilities = exports.ClipStatus = exports.ClipStepAction = exports.ClipPlaneContainment = void 0;
|
|
11
|
+
const core_bentley_1 = require("@itwin/core-bentley");
|
|
11
12
|
const CurveCollection_1 = require("../curve/CurveCollection");
|
|
12
13
|
const CurveFactory_1 = require("../curve/CurveFactory");
|
|
13
14
|
const CurvePrimitive_1 = require("../curve/CurvePrimitive");
|
|
15
|
+
const LineSegment3d_1 = require("../curve/LineSegment3d");
|
|
14
16
|
const LineString3d_1 = require("../curve/LineString3d");
|
|
15
17
|
const Loop_1 = require("../curve/Loop");
|
|
16
18
|
const Path_1 = require("../curve/Path");
|
|
@@ -23,6 +25,7 @@ const Point3dArrayCarrier_1 = require("../geometry3d/Point3dArrayCarrier");
|
|
|
23
25
|
const Point3dVector3d_1 = require("../geometry3d/Point3dVector3d");
|
|
24
26
|
const Range_1 = require("../geometry3d/Range");
|
|
25
27
|
const ReusableObjectCache_1 = require("../geometry3d/ReusableObjectCache");
|
|
28
|
+
const Transform_1 = require("../geometry3d/Transform");
|
|
26
29
|
const PolyfaceBuilder_1 = require("../polyface/PolyfaceBuilder");
|
|
27
30
|
const ClipPlane_1 = require("./ClipPlane");
|
|
28
31
|
const ClipPrimitive_1 = require("./ClipPrimitive");
|
|
@@ -498,32 +501,110 @@ class ClipUtilities {
|
|
|
498
501
|
}
|
|
499
502
|
return false;
|
|
500
503
|
}
|
|
504
|
+
/**
|
|
505
|
+
* Create a clipper from the transformed range.
|
|
506
|
+
* @param range input range to create clipper from
|
|
507
|
+
* @param transform how to transform the range (NOTE: applied to the range faces without swelling the range volume)
|
|
508
|
+
* @param degeneratePoints optionally populated with the 1 or 2 points defining the transformed range if it is degenerate (all points colinear/coincident); otherwise untouched
|
|
509
|
+
* @returns newly constructed clipper. If no clip planes could be computed, fill `degeneratePoints` and return undefined.
|
|
510
|
+
*/
|
|
511
|
+
static createClipperFromTransformedRange3d(range, transform, degeneratePoints) {
|
|
512
|
+
if (!transform)
|
|
513
|
+
transform = Transform_1.Transform.createIdentity();
|
|
514
|
+
const builder = PolyfaceBuilder_1.PolyfaceBuilder.create();
|
|
515
|
+
builder.addTransformedRangeMesh(transform, range);
|
|
516
|
+
const mesh = builder.claimPolyface();
|
|
517
|
+
const clipper = this._workClipper = ConvexClipPlaneSet_1.ConvexClipPlaneSet.createConvexPolyface(mesh, this._workClipper).clipper;
|
|
518
|
+
if (clipper.planes.length > 0)
|
|
519
|
+
return clipper;
|
|
520
|
+
// no faces found in the compressed mesh
|
|
521
|
+
if (degeneratePoints) {
|
|
522
|
+
(0, core_bentley_1.assert)(mesh.data.point.length <= 2);
|
|
523
|
+
for (let i = 0; i < 2; ++i) {
|
|
524
|
+
const point = mesh.data.point.getPoint3dAtCheckedPointIndex(i);
|
|
525
|
+
if (point)
|
|
526
|
+
degeneratePoints.push(point);
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
return undefined;
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* Handle pathological cases of range-range intersection, where one of the ranges defines no area or volume (is a line segment or single point).
|
|
533
|
+
* @param range local range to intersect with the point/segment
|
|
534
|
+
* @param points isolated local point, or local segment's start and end
|
|
535
|
+
* @param localToWorld optional transform for output range
|
|
536
|
+
* @param intersection optional range of the intersection, in world coordinates, or null range if no intersection.
|
|
537
|
+
* @returns whether the point/segment intersects the range
|
|
538
|
+
*/
|
|
539
|
+
static rangeIntersectPointOrSegment(range, points, localToWorld, intersection) {
|
|
540
|
+
const announceInterval = intersection ?
|
|
541
|
+
(f0, f1, cp) => {
|
|
542
|
+
intersection.extendPoint(cp.fractionToPoint(f0), localToWorld);
|
|
543
|
+
intersection.extendPoint(cp.fractionToPoint(f1), localToWorld);
|
|
544
|
+
} : undefined;
|
|
545
|
+
let hasIntersection = false;
|
|
546
|
+
if (points.length > 1) {
|
|
547
|
+
const segment = LineSegment3d_1.LineSegment3d.createCapture(points[0], points[1]);
|
|
548
|
+
const clipper = ConvexClipPlaneSet_1.ConvexClipPlaneSet.createRange3dPlanes(range);
|
|
549
|
+
hasIntersection = segment.announceClipIntervals(clipper, announceInterval);
|
|
550
|
+
}
|
|
551
|
+
else if (points.length > 0) {
|
|
552
|
+
hasIntersection = range.containsPoint(points[0]);
|
|
553
|
+
if (hasIntersection && intersection)
|
|
554
|
+
intersection.extendPoint(points[0], localToWorld);
|
|
555
|
+
}
|
|
556
|
+
return hasIntersection;
|
|
557
|
+
}
|
|
501
558
|
/**
|
|
502
559
|
* Test for intersection of two ranges in different local coordinates.
|
|
503
560
|
* * Useful for clash detection of elements in iModels, using their stored (tight) local ranges and placement transforms.
|
|
504
|
-
* @param range0 range in local coordinates
|
|
505
|
-
* @param local0ToWorld placement transform for first
|
|
506
|
-
* @param range1 range in local coordinates
|
|
507
|
-
* @param local1ToWorld placement transform for second
|
|
561
|
+
* @param range0 first range in local coordinates
|
|
562
|
+
* @param local0ToWorld placement transform for first range
|
|
563
|
+
* @param range1 second range in local coordinates
|
|
564
|
+
* @param local1ToWorld placement transform for second range. Assumed to be invertible.
|
|
508
565
|
* @param range1Margin optional signed local distance to expand/contract the second range before intersection. Positive expands.
|
|
509
566
|
* @return whether the local ranges are adjacent or intersect. Also returns false if local1ToWorld is singular.
|
|
510
567
|
*/
|
|
511
568
|
static doLocalRangesIntersect(range0, local0ToWorld, range1, local1ToWorld, range1Margin) {
|
|
512
|
-
const worldToLocal1 =
|
|
569
|
+
const worldToLocal1 = this._workTransform = local1ToWorld.inverse(this._workTransform);
|
|
513
570
|
if (!worldToLocal1)
|
|
514
571
|
return false;
|
|
515
572
|
let myRange1 = range1;
|
|
516
573
|
if (range1Margin) {
|
|
517
|
-
myRange1 =
|
|
574
|
+
myRange1 = this._workRange = range1.clone(this._workRange);
|
|
518
575
|
myRange1.expandInPlace(range1Margin);
|
|
519
576
|
}
|
|
577
|
+
const degeneratePoints = [];
|
|
578
|
+
const local0ToLocal1 = worldToLocal1.multiplyTransformTransform(local0ToWorld, worldToLocal1);
|
|
520
579
|
// convert range0 into a clipper in local1 coordinates, then intersect with range1
|
|
580
|
+
const clipper = this.createClipperFromTransformedRange3d(range0, local0ToLocal1, degeneratePoints);
|
|
581
|
+
if (clipper)
|
|
582
|
+
return this.doesClipperIntersectRange(clipper, myRange1);
|
|
583
|
+
return this.rangeIntersectPointOrSegment(myRange1, degeneratePoints, local1ToWorld);
|
|
584
|
+
}
|
|
585
|
+
/**
|
|
586
|
+
* Compute the range of the intersection between two local (e.g., element-aligned) ranges.
|
|
587
|
+
* @param range0 first range in local coordinates
|
|
588
|
+
* @param local0ToWorld placement transform for first range
|
|
589
|
+
* @param range1 second range in local coordinates
|
|
590
|
+
* @param local1ToWorld placement transform for second range. Assumed to be invertible.
|
|
591
|
+
* @param result optional pre-allocated range to fill and return
|
|
592
|
+
* @return range of the intersection (aligned to world axes). Returns null range if local1ToWorld is singular.
|
|
593
|
+
*/
|
|
594
|
+
static rangeOfIntersectionOfLocalRanges(range0, local0ToWorld, range1, local1ToWorld, result) {
|
|
595
|
+
const myResult = Range_1.Range3d.createNull(result);
|
|
596
|
+
const worldToLocal1 = this._workTransform = local1ToWorld.inverse(this._workTransform);
|
|
597
|
+
if (!worldToLocal1)
|
|
598
|
+
return myResult;
|
|
599
|
+
const degeneratePoints = [];
|
|
521
600
|
const local0ToLocal1 = worldToLocal1.multiplyTransformTransform(local0ToWorld, worldToLocal1);
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
601
|
+
// convert range0 into a clipper in local1 coordinates, then intersect with range1
|
|
602
|
+
const clipper = this.createClipperFromTransformedRange3d(range0, local0ToLocal1, degeneratePoints);
|
|
603
|
+
if (clipper)
|
|
604
|
+
this.announceLoopsOfConvexClipPlaneSetIntersectRange(clipper, range1, (loopPoints) => { loopPoints.extendRange(myResult, local1ToWorld); });
|
|
605
|
+
else
|
|
606
|
+
this.rangeIntersectPointOrSegment(range1, degeneratePoints, local1ToWorld, myResult);
|
|
607
|
+
return myResult;
|
|
527
608
|
}
|
|
528
609
|
/**
|
|
529
610
|
* Test if `obj` is a `Clipper` object.
|