@bitbybit-dev/base 1.3.2 → 1.4.0-rc.0
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/README.md +1 -1
- package/lib/api/GlobalCDNProvider.js +1 -1
- package/lib/api/index.d.ts +2 -0
- package/lib/api/index.js +2 -0
- package/lib/api/inputs/base-inputs.d.ts +10 -4
- package/lib/api/inputs/color-inputs.d.ts +24 -23
- package/lib/api/inputs/color-inputs.js +1 -0
- package/lib/api/inputs/dates-inputs.d.ts +16 -16
- package/lib/api/inputs/frame-inputs.d.ts +515 -0
- package/lib/api/inputs/frame-inputs.js +617 -0
- package/lib/api/inputs/index.d.ts +1 -0
- package/lib/api/inputs/index.js +1 -0
- package/lib/api/inputs/io-inputs.d.ts +3 -3
- package/lib/api/inputs/io-inputs.js +1 -1
- package/lib/api/inputs/lists-inputs.d.ts +23 -23
- package/lib/api/inputs/logic-inputs.d.ts +11 -11
- package/lib/api/inputs/math-inputs.d.ts +49 -49
- package/lib/api/inputs/math-inputs.js +4 -4
- package/lib/api/inputs/mesh-inputs.d.ts +3 -3
- package/lib/api/inputs/mesh-inputs.js +3 -3
- package/lib/api/inputs/point-inputs.d.ts +39 -38
- package/lib/api/inputs/point-inputs.js +6 -5
- package/lib/api/inputs/polyline-inputs.d.ts +5 -4
- package/lib/api/inputs/polyline-inputs.js +3 -3
- package/lib/api/inputs/text-inputs.d.ts +34 -33
- package/lib/api/inputs/text-inputs.js +15 -12
- package/lib/api/inputs/transforms-inputs.d.ts +16 -16
- package/lib/api/inputs/vector-inputs.d.ts +26 -25
- package/lib/api/inputs/vector-inputs.js +2 -1
- package/lib/api/kernel-calls/call-by-path.d.ts +12 -0
- package/lib/api/kernel-calls/call-by-path.js +36 -0
- package/lib/api/kernel-calls/constraints.d.ts +53 -0
- package/lib/api/kernel-calls/constraints.js +21 -0
- package/lib/api/kernel-calls/describe-failure.d.ts +32 -0
- package/lib/api/kernel-calls/describe-failure.js +164 -0
- package/lib/api/kernel-calls/errors.d.ts +55 -0
- package/lib/api/kernel-calls/errors.js +42 -0
- package/lib/api/kernel-calls/failure-message.d.ts +18 -0
- package/lib/api/kernel-calls/failure-message.js +36 -0
- package/lib/api/kernel-calls/index.d.ts +10 -0
- package/lib/api/kernel-calls/index.js +10 -0
- package/lib/api/kernel-calls/input-rules.d.ts +67 -0
- package/lib/api/kernel-calls/input-rules.js +135 -0
- package/lib/api/kernel-calls/input-validation.d.ts +130 -0
- package/lib/api/kernel-calls/input-validation.js +221 -0
- package/lib/api/kernel-calls/rehydrate.d.ts +16 -0
- package/lib/api/kernel-calls/rehydrate.js +38 -0
- package/lib/api/kernel-calls/resolve-dto.d.ts +59 -0
- package/lib/api/kernel-calls/resolve-dto.js +61 -0
- package/lib/api/kernel-calls/with-defaults.d.ts +16 -0
- package/lib/api/kernel-calls/with-defaults.js +53 -0
- package/lib/api/resolved-inputs/index.d.ts +304 -0
- package/lib/api/resolved-inputs/index.js +1 -0
- package/lib/api/services/color.js +43 -26
- package/lib/api/services/dates.js +53 -33
- package/lib/api/services/frame.d.ts +670 -0
- package/lib/api/services/frame.js +1040 -0
- package/lib/api/services/helpers/dxf/dxf-generator.d.ts +2 -3
- package/lib/api/services/helpers/dxf/dxf-generator.js +27 -37
- package/lib/api/services/helpers/dxf/dxf.js +10 -4
- package/lib/api/services/helpers/frame-axes.d.ts +36 -0
- package/lib/api/services/helpers/frame-axes.js +57 -0
- package/lib/api/services/helpers/matrices.d.ts +17 -0
- package/lib/api/services/helpers/matrices.js +51 -0
- package/lib/api/services/index.d.ts +1 -0
- package/lib/api/services/index.js +1 -0
- package/lib/api/services/line.js +15 -12
- package/lib/api/services/lists.js +174 -136
- package/lib/api/services/logic.js +44 -34
- package/lib/api/services/math.js +127 -82
- package/lib/api/services/mesh.js +20 -13
- package/lib/api/services/point.js +62 -46
- package/lib/api/services/polyline.js +22 -18
- package/lib/api/services/text.js +81 -46
- package/lib/api/services/transforms.js +38 -25
- package/lib/api/services/vector.js +37 -22
- package/package.json +1 -1
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as Inputs from "../inputs";
|
|
2
|
+
import { resolveDto } from "../kernel-calls";
|
|
1
3
|
/**
|
|
2
4
|
* Points as plain number arrays. A point is `[x, y, z]` with Y pointing up, the same shape as a
|
|
3
5
|
* vector, so the two can be passed to each other's methods; a 2D point is `[x, y]`. Every method
|
|
@@ -141,8 +143,9 @@ export class Point {
|
|
|
141
143
|
* ```
|
|
142
144
|
*/
|
|
143
145
|
translateXYZPoints(inputs) {
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
+
const resolved = resolveDto(Inputs.Point.TranslateXYZPointsDto, inputs);
|
|
147
|
+
const translationTransform = this.transforms.translationXYZ({ translation: [resolved.x, resolved.y, resolved.z] });
|
|
148
|
+
return this.geometryHelper.transformControlPoints(translationTransform, resolved.points);
|
|
146
149
|
}
|
|
147
150
|
/**
|
|
148
151
|
* Scales points away from or toward a center, with its own factor per axis.
|
|
@@ -163,8 +166,9 @@ export class Point {
|
|
|
163
166
|
* ```
|
|
164
167
|
*/
|
|
165
168
|
scalePointsCenterXYZ(inputs) {
|
|
166
|
-
const
|
|
167
|
-
|
|
169
|
+
const resolved = resolveDto(Inputs.Point.ScalePointsCenterXYZDto, inputs);
|
|
170
|
+
const scaleTransforms = this.transforms.scaleCenterXYZ({ center: resolved.center, scaleXyz: resolved.scaleXyz });
|
|
171
|
+
return this.geometryHelper.transformControlPoints(scaleTransforms, resolved.points);
|
|
168
172
|
}
|
|
169
173
|
/**
|
|
170
174
|
* Stretches points along one direction, measured from a center; distances across that direction
|
|
@@ -187,8 +191,9 @@ export class Point {
|
|
|
187
191
|
* ```
|
|
188
192
|
*/
|
|
189
193
|
stretchPointsDirFromCenter(inputs) {
|
|
190
|
-
const
|
|
191
|
-
|
|
194
|
+
const resolved = resolveDto(Inputs.Point.StretchPointsDirFromCenterDto, inputs);
|
|
195
|
+
const stretchTransforms = this.transforms.stretchDirFromCenter({ center: resolved.center, scale: resolved.scale, direction: resolved.direction });
|
|
196
|
+
return this.geometryHelper.transformControlPoints(stretchTransforms, resolved.points);
|
|
192
197
|
}
|
|
193
198
|
/**
|
|
194
199
|
* Rotates points around an axis that passes through a center.
|
|
@@ -211,8 +216,9 @@ export class Point {
|
|
|
211
216
|
* ```
|
|
212
217
|
*/
|
|
213
218
|
rotatePointsCenterAxis(inputs) {
|
|
214
|
-
const
|
|
215
|
-
|
|
219
|
+
const resolved = resolveDto(Inputs.Point.RotatePointsCenterAxisDto, inputs);
|
|
220
|
+
const rotationTransforms = this.transforms.rotationCenterAxis({ center: resolved.center, axis: resolved.axis, angle: resolved.angle });
|
|
221
|
+
return this.geometryHelper.transformControlPoints(rotationTransforms, resolved.points);
|
|
216
222
|
}
|
|
217
223
|
/**
|
|
218
224
|
* Finds the smallest axis-aligned box that holds all the points.
|
|
@@ -452,7 +458,8 @@ export class Point {
|
|
|
452
458
|
* ```
|
|
453
459
|
*/
|
|
454
460
|
pointXYZ(inputs) {
|
|
455
|
-
|
|
461
|
+
const resolved = resolveDto(Inputs.Point.PointXYZDto, inputs);
|
|
462
|
+
return [resolved.x, resolved.y, resolved.z];
|
|
456
463
|
}
|
|
457
464
|
/**
|
|
458
465
|
* Builds a 2D point from its x and y values.
|
|
@@ -469,7 +476,8 @@ export class Point {
|
|
|
469
476
|
* ```
|
|
470
477
|
*/
|
|
471
478
|
pointXY(inputs) {
|
|
472
|
-
|
|
479
|
+
const resolved = resolveDto(Inputs.Point.PointXYDto, inputs);
|
|
480
|
+
return [resolved.x, resolved.y];
|
|
473
481
|
}
|
|
474
482
|
/**
|
|
475
483
|
* Lays out points along a logarithmic spiral in the XY plane, from the origin outward to
|
|
@@ -488,12 +496,13 @@ export class Point {
|
|
|
488
496
|
* ```
|
|
489
497
|
*/
|
|
490
498
|
spiral(inputs) {
|
|
491
|
-
const
|
|
492
|
-
const
|
|
499
|
+
const resolved = resolveDto(Inputs.Point.SpiralDto, inputs);
|
|
500
|
+
const phi = resolved.phi;
|
|
501
|
+
const b = Math.log(phi) / (Math.PI / resolved.widening);
|
|
493
502
|
const spiral = [];
|
|
494
|
-
const step =
|
|
495
|
-
for (let i = 0; i <
|
|
496
|
-
const th = Math.log(i /
|
|
503
|
+
const step = resolved.radius / resolved.numberPoints;
|
|
504
|
+
for (let i = 0; i < resolved.radius; i += step) {
|
|
505
|
+
const th = Math.log(i / resolved.factor) / b;
|
|
497
506
|
const x = i * Math.cos(th);
|
|
498
507
|
const y = i * Math.sin(th);
|
|
499
508
|
spiral.push([x ? x : 0, y ? y : 0, 0]);
|
|
@@ -517,24 +526,25 @@ export class Point {
|
|
|
517
526
|
* ```
|
|
518
527
|
*/
|
|
519
528
|
hexGrid(inputs) {
|
|
520
|
-
const
|
|
529
|
+
const resolved = resolveDto(Inputs.Point.HexGridCentersDto, inputs);
|
|
530
|
+
const xLength = Math.sqrt(Math.pow(resolved.radiusHexagon, 2) - Math.pow(resolved.radiusHexagon / 2, 2));
|
|
521
531
|
const points = [];
|
|
522
|
-
for (let ix = 0; ix <
|
|
532
|
+
for (let ix = 0; ix < resolved.nrHexagonsX; ix++) {
|
|
523
533
|
const coordX = ix * xLength * 2;
|
|
524
|
-
for (let iy = 0; iy <
|
|
525
|
-
const coordY = (
|
|
534
|
+
for (let iy = 0; iy < resolved.nrHexagonsY; iy++) {
|
|
535
|
+
const coordY = (resolved.radiusHexagon + resolved.radiusHexagon / 2) * iy;
|
|
526
536
|
const adjustX = coordX + (iy % 2 === 0 ? 0 : xLength);
|
|
527
537
|
points.push([adjustX, coordY, 0]);
|
|
528
538
|
}
|
|
529
539
|
}
|
|
530
|
-
if (
|
|
540
|
+
if (resolved.orientOnCenter) {
|
|
531
541
|
const compensateX = points[points.length - 1][0] / 2;
|
|
532
542
|
const compensateY = points[points.length - 1][1] / 2;
|
|
533
543
|
points.forEach((p, index) => {
|
|
534
544
|
points[index] = [p[0] - compensateX, p[1] - compensateY, 0];
|
|
535
545
|
});
|
|
536
546
|
}
|
|
537
|
-
if (
|
|
547
|
+
if (resolved.pointsOnGround) {
|
|
538
548
|
points.forEach((p, index) => {
|
|
539
549
|
points[index] = [p[0], 0, p[1]];
|
|
540
550
|
});
|
|
@@ -566,16 +576,16 @@ export class Point {
|
|
|
566
576
|
* ```
|
|
567
577
|
*/
|
|
568
578
|
hexGridScaledToFit(inputs) {
|
|
569
|
-
|
|
570
|
-
let width =
|
|
571
|
-
let height =
|
|
572
|
-
let nrHexagonsInHeight =
|
|
573
|
-
let nrHexagonsInWidth =
|
|
574
|
-
let extendTop =
|
|
575
|
-
let extendBottom =
|
|
576
|
-
let extendLeft =
|
|
577
|
-
let extendRight =
|
|
578
|
-
const { flatTop
|
|
579
|
+
const resolved = resolveDto(Inputs.Point.HexGridScaledToFitDto, inputs);
|
|
580
|
+
let width = resolved.width;
|
|
581
|
+
let height = resolved.height;
|
|
582
|
+
let nrHexagonsInHeight = resolved.nrHexagonsInHeight;
|
|
583
|
+
let nrHexagonsInWidth = resolved.nrHexagonsInWidth;
|
|
584
|
+
let extendTop = resolved.extendTop;
|
|
585
|
+
let extendBottom = resolved.extendBottom;
|
|
586
|
+
let extendLeft = resolved.extendLeft;
|
|
587
|
+
let extendRight = resolved.extendRight;
|
|
588
|
+
const { flatTop, centerGrid, pointsOnGround } = resolved;
|
|
579
589
|
if (flatTop) {
|
|
580
590
|
const oldWidth = width;
|
|
581
591
|
width = height;
|
|
@@ -801,7 +811,7 @@ export class Point {
|
|
|
801
811
|
if (flatTop) {
|
|
802
812
|
const grouped = this.lists.groupNth({
|
|
803
813
|
list: scaledHexagons.reverse(),
|
|
804
|
-
nrElements:
|
|
814
|
+
nrElements: resolved.nrHexagonsInWidth,
|
|
805
815
|
keepRemainder: true,
|
|
806
816
|
});
|
|
807
817
|
const res = this.lists.flipLists({
|
|
@@ -811,7 +821,7 @@ export class Point {
|
|
|
811
821
|
scaledHexagons = res.flat();
|
|
812
822
|
const groupedCenters = this.lists.groupNth({
|
|
813
823
|
list: scaledCenters.reverse(),
|
|
814
|
-
nrElements:
|
|
824
|
+
nrElements: resolved.nrHexagonsInWidth,
|
|
815
825
|
keepRemainder: true,
|
|
816
826
|
});
|
|
817
827
|
const resCenters = this.lists.flipLists({
|
|
@@ -846,7 +856,8 @@ export class Point {
|
|
|
846
856
|
* ```
|
|
847
857
|
*/
|
|
848
858
|
maxFilletRadius(inputs) {
|
|
849
|
-
const
|
|
859
|
+
const resolved = resolveDto(Inputs.Point.ThreePointsToleranceDto, inputs);
|
|
860
|
+
const { start: p1, center: p2, end: c, tolerance } = resolved;
|
|
850
861
|
const v1 = this.vector.sub({ first: p1, second: c });
|
|
851
862
|
const v2 = this.vector.sub({ first: p2, second: c });
|
|
852
863
|
const len1 = this.vector.length({ vector: v1 });
|
|
@@ -891,7 +902,8 @@ export class Point {
|
|
|
891
902
|
* ```
|
|
892
903
|
*/
|
|
893
904
|
maxFilletRadiusHalfLine(inputs) {
|
|
894
|
-
const
|
|
905
|
+
const resolved = resolveDto(Inputs.Point.ThreePointsToleranceDto, inputs);
|
|
906
|
+
const { start: p1, center: p2, end: c, tolerance } = resolved;
|
|
895
907
|
const v1 = this.vector.sub({ first: p1, second: c });
|
|
896
908
|
const v2 = this.vector.sub({ first: p2, second: c });
|
|
897
909
|
const len1 = this.vector.length({ vector: v1 });
|
|
@@ -937,7 +949,8 @@ export class Point {
|
|
|
937
949
|
* ```
|
|
938
950
|
*/
|
|
939
951
|
maxFilletsHalfLine(inputs) {
|
|
940
|
-
const
|
|
952
|
+
const resolved = resolveDto(Inputs.Point.PointsMaxFilletsHalfLineDto, inputs);
|
|
953
|
+
const { points, checkLastWithFirst, tolerance } = resolved;
|
|
941
954
|
const n = points.length;
|
|
942
955
|
const results = [];
|
|
943
956
|
if (n < 3) {
|
|
@@ -1000,7 +1013,8 @@ export class Point {
|
|
|
1000
1013
|
* ```
|
|
1001
1014
|
*/
|
|
1002
1015
|
safestPointsMaxFilletHalfLine(inputs) {
|
|
1003
|
-
const
|
|
1016
|
+
const resolved = resolveDto(Inputs.Point.PointsMaxFilletsHalfLineDto, inputs);
|
|
1017
|
+
const allMaxRadii = this.maxFilletsHalfLine(resolved);
|
|
1004
1018
|
if (allMaxRadii.length === 0) {
|
|
1005
1019
|
return 0;
|
|
1006
1020
|
}
|
|
@@ -1028,7 +1042,8 @@ export class Point {
|
|
|
1028
1042
|
* ```
|
|
1029
1043
|
*/
|
|
1030
1044
|
removeConsecutiveDuplicates(inputs) {
|
|
1031
|
-
|
|
1045
|
+
const resolved = resolveDto(Inputs.Point.RemoveConsecutiveDuplicatesDto, inputs);
|
|
1046
|
+
return this.geometryHelper.removeConsecutivePointDuplicates(resolved.points, resolved.checkFirstAndLast, resolved.tolerance);
|
|
1032
1047
|
}
|
|
1033
1048
|
/**
|
|
1034
1049
|
* Finds the direction at right angles to the plane through three points, with length 1.
|
|
@@ -1053,9 +1068,10 @@ export class Point {
|
|
|
1053
1068
|
* ```
|
|
1054
1069
|
*/
|
|
1055
1070
|
normalFromThreePoints(inputs) {
|
|
1056
|
-
const
|
|
1057
|
-
const
|
|
1058
|
-
const
|
|
1071
|
+
const resolved = resolveDto(Inputs.Point.ThreePointsNormalDto, inputs);
|
|
1072
|
+
const p1 = resolved.point1;
|
|
1073
|
+
const p2 = resolved.point2;
|
|
1074
|
+
const p3 = resolved.point3;
|
|
1059
1075
|
if (!p1 || !p2 || !p3 || p1.length !== 3 || p2.length !== 3 || p3.length !== 3) {
|
|
1060
1076
|
throw new Error("All points must be arrays of 3 numbers [x, y, z]");
|
|
1061
1077
|
}
|
|
@@ -1072,7 +1088,7 @@ export class Point {
|
|
|
1072
1088
|
console.warn("Points are collinear or coincident; cannot calculate a unique normal.");
|
|
1073
1089
|
return undefined;
|
|
1074
1090
|
}
|
|
1075
|
-
if (
|
|
1091
|
+
if (resolved.reverseNormal) {
|
|
1076
1092
|
nx = -nx;
|
|
1077
1093
|
ny = -ny;
|
|
1078
1094
|
nz = -nz;
|
|
@@ -1109,11 +1125,11 @@ export class Point {
|
|
|
1109
1125
|
* ```
|
|
1110
1126
|
*/
|
|
1111
1127
|
twoPointsAlmostEqual(inputs) {
|
|
1112
|
-
|
|
1113
|
-
const p1 =
|
|
1114
|
-
const p2 =
|
|
1128
|
+
const resolved = resolveDto(Inputs.Point.TwoPointsToleranceDto, inputs);
|
|
1129
|
+
const p1 = resolved.point1;
|
|
1130
|
+
const p2 = resolved.point2;
|
|
1115
1131
|
const dist = this.distance({ startPoint: p1, endPoint: p2 });
|
|
1116
|
-
return dist < (
|
|
1132
|
+
return dist < (resolved.tolerance);
|
|
1117
1133
|
}
|
|
1118
1134
|
/**
|
|
1119
1135
|
* Sorts points by X, then by Y for equal X, then by Z.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as Inputs from "../inputs";
|
|
2
|
+
import { resolveDto } from "../kernel-calls";
|
|
1
3
|
/**
|
|
2
4
|
* Polylines: chains of straight segments through a list of points, held as plain objects of the
|
|
3
5
|
* form `{ points, isClosed }`. A closed polyline joins its last point back to its first. The
|
|
@@ -118,10 +120,10 @@ export class Polyline {
|
|
|
118
120
|
* ```
|
|
119
121
|
*/
|
|
120
122
|
create(inputs) {
|
|
121
|
-
|
|
123
|
+
const resolved = resolveDto(Inputs.Polyline.PolylineCreateDto, inputs);
|
|
122
124
|
return {
|
|
123
|
-
points:
|
|
124
|
-
isClosed:
|
|
125
|
+
points: resolved.points,
|
|
126
|
+
isClosed: resolved.isClosed,
|
|
125
127
|
};
|
|
126
128
|
}
|
|
127
129
|
/**
|
|
@@ -201,14 +203,14 @@ export class Polyline {
|
|
|
201
203
|
* ```
|
|
202
204
|
*/
|
|
203
205
|
polylineSelfIntersection(inputs) {
|
|
204
|
-
const
|
|
206
|
+
const resolved = resolveDto(Inputs.Polyline.PolylineToleranceDto, inputs);
|
|
207
|
+
const { polyline, tolerance } = resolved;
|
|
205
208
|
const lines = this.polylineToLines({ polyline });
|
|
206
209
|
const numSegments = lines.length;
|
|
207
210
|
if (numSegments < 3) {
|
|
208
211
|
return [];
|
|
209
212
|
}
|
|
210
213
|
const selfIntersectionPoints = [];
|
|
211
|
-
const defaultTolerance = tolerance !== null && tolerance !== void 0 ? tolerance : 1e-6;
|
|
212
214
|
for (let i = 0; i < numSegments; i++) {
|
|
213
215
|
for (let j = i + 1; j < numSegments; j++) {
|
|
214
216
|
let areAdjacent = (j === i + 1);
|
|
@@ -222,7 +224,7 @@ export class Polyline {
|
|
|
222
224
|
line1: lines[i],
|
|
223
225
|
line2: lines[j],
|
|
224
226
|
checkSegmentsOnly: true,
|
|
225
|
-
tolerance
|
|
227
|
+
tolerance,
|
|
226
228
|
});
|
|
227
229
|
if (intersection) {
|
|
228
230
|
let foundClose = false;
|
|
@@ -230,7 +232,7 @@ export class Polyline {
|
|
|
230
232
|
if (this.point.twoPointsAlmostEqual({
|
|
231
233
|
point1: intersection,
|
|
232
234
|
point2: existingPoint,
|
|
233
|
-
tolerance
|
|
235
|
+
tolerance
|
|
234
236
|
})) {
|
|
235
237
|
foundClose = true;
|
|
236
238
|
break;
|
|
@@ -265,18 +267,18 @@ export class Polyline {
|
|
|
265
267
|
* ```
|
|
266
268
|
*/
|
|
267
269
|
twoPolylineIntersection(inputs) {
|
|
268
|
-
const
|
|
270
|
+
const resolved = resolveDto(Inputs.Polyline.TwoPolylinesToleranceDto, inputs);
|
|
271
|
+
const { polyline1, polyline2, tolerance } = resolved;
|
|
269
272
|
const lines1 = this.polylineToLines({ polyline: polyline1 });
|
|
270
273
|
const lines2 = this.polylineToLines({ polyline: polyline2 });
|
|
271
274
|
const intersectionPoints = [];
|
|
272
|
-
const defaultTolerance = tolerance !== null && tolerance !== void 0 ? tolerance : 1e-6;
|
|
273
275
|
for (const seg1 of lines1) {
|
|
274
276
|
for (const seg2 of lines2) {
|
|
275
277
|
const intersection = this.line.lineLineIntersection({
|
|
276
278
|
line1: seg1,
|
|
277
279
|
line2: seg2,
|
|
278
280
|
checkSegmentsOnly: true,
|
|
279
|
-
tolerance
|
|
281
|
+
tolerance,
|
|
280
282
|
});
|
|
281
283
|
if (intersection) {
|
|
282
284
|
let foundClose = false;
|
|
@@ -284,7 +286,7 @@ export class Polyline {
|
|
|
284
286
|
if (this.point.twoPointsAlmostEqual({
|
|
285
287
|
point1: intersection,
|
|
286
288
|
point2: existingPoint,
|
|
287
|
-
tolerance
|
|
289
|
+
tolerance
|
|
288
290
|
})) {
|
|
289
291
|
foundClose = true;
|
|
290
292
|
break;
|
|
@@ -318,9 +320,9 @@ export class Polyline {
|
|
|
318
320
|
* ```
|
|
319
321
|
*/
|
|
320
322
|
sortSegmentsIntoPolylines(inputs) {
|
|
321
|
-
|
|
322
|
-
const tolerance =
|
|
323
|
-
const segments =
|
|
323
|
+
const resolved = resolveDto(Inputs.Polyline.SegmentsToleranceDto, inputs);
|
|
324
|
+
const tolerance = resolved.tolerance;
|
|
325
|
+
const segments = resolved.segments;
|
|
324
326
|
if (!segments || segments.length === 0) {
|
|
325
327
|
return [];
|
|
326
328
|
}
|
|
@@ -472,10 +474,11 @@ export class Polyline {
|
|
|
472
474
|
* ```
|
|
473
475
|
*/
|
|
474
476
|
maxFilletsHalfLine(inputs) {
|
|
477
|
+
const resolved = resolveDto(Inputs.Polyline.PolylineToleranceDto, inputs);
|
|
475
478
|
return this.point.maxFilletsHalfLine({
|
|
476
|
-
points:
|
|
477
|
-
checkLastWithFirst:
|
|
478
|
-
tolerance:
|
|
479
|
+
points: resolved.polyline.points,
|
|
480
|
+
checkLastWithFirst: resolved.polyline.isClosed,
|
|
481
|
+
tolerance: resolved.tolerance,
|
|
479
482
|
});
|
|
480
483
|
}
|
|
481
484
|
/**
|
|
@@ -497,7 +500,8 @@ export class Polyline {
|
|
|
497
500
|
* ```
|
|
498
501
|
*/
|
|
499
502
|
safestFilletRadius(inputs) {
|
|
500
|
-
const
|
|
503
|
+
const resolved = resolveDto(Inputs.Polyline.PolylineToleranceDto, inputs);
|
|
504
|
+
const allMaxRadii = this.maxFilletsHalfLine(resolved);
|
|
501
505
|
if (allMaxRadii.length === 0) {
|
|
502
506
|
return 0;
|
|
503
507
|
}
|