@bitbybit-dev/base 1.6.1 → 1.7.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/lib/api/GlobalCDNProvider.js +1 -1
- package/lib/api/inputs/base-inputs.d.ts +36 -7
- package/lib/api/inputs/base-inputs.js +10 -0
- package/lib/api/inputs/color-inputs.d.ts +54 -1
- package/lib/api/inputs/color-inputs.js +73 -1
- package/lib/api/inputs/frame-inputs.d.ts +2 -1
- package/lib/api/inputs/frame-inputs.js +2 -1
- package/lib/api/inputs/io-inputs.d.ts +527 -59
- package/lib/api/inputs/io-inputs.js +432 -40
- package/lib/api/inputs/line-inputs.d.ts +17 -0
- package/lib/api/inputs/line-inputs.js +15 -0
- package/lib/api/inputs/math-inputs.d.ts +62 -0
- package/lib/api/inputs/math-inputs.js +82 -0
- package/lib/api/inputs/mesh-inputs.d.ts +16 -0
- package/lib/api/inputs/mesh-inputs.js +14 -0
- package/lib/api/inputs/transforms-inputs.d.ts +76 -0
- package/lib/api/inputs/transforms-inputs.js +85 -0
- package/lib/api/kernel-calls/index.d.ts +1 -0
- package/lib/api/kernel-calls/index.js +1 -0
- package/lib/api/kernel-calls/settings.d.ts +82 -0
- package/lib/api/kernel-calls/settings.js +123 -0
- package/lib/api/recipes/surface-mesh.d.ts +2 -1
- package/lib/api/recipes/surface-mesh.js +5 -3
- package/lib/api/resolved-inputs/index.d.ts +32 -2
- package/lib/api/services/base-bitbybit.d.ts +12 -0
- package/lib/api/services/base-bitbybit.js +19 -3
- package/lib/api/services/color.d.ts +36 -2
- package/lib/api/services/color.js +60 -11
- package/lib/api/services/helpers/color/color-forms.constants.d.ts +10 -0
- package/lib/api/services/helpers/color/color-forms.constants.js +10 -0
- package/lib/api/services/helpers/color/color-forms.d.ts +3 -0
- package/lib/api/services/helpers/color/color-forms.js +27 -0
- package/lib/api/services/helpers/color/css-colors.constants.d.ts +9 -0
- package/lib/api/services/helpers/color/css-colors.constants.js +158 -0
- package/lib/api/services/helpers/color/css-colors.d.ts +1 -0
- package/lib/api/services/helpers/color/css-colors.js +61 -0
- package/lib/api/services/helpers/curves/bezier-pieces.constants.d.ts +5 -0
- package/lib/api/services/helpers/curves/bezier-pieces.constants.js +5 -0
- package/lib/api/services/helpers/curves/bezier-pieces.d.ts +24 -0
- package/lib/api/services/helpers/curves/bezier-pieces.js +149 -0
- package/lib/api/services/helpers/curves/conic-arcs.constants.d.ts +5 -0
- package/lib/api/services/helpers/curves/conic-arcs.constants.js +5 -0
- package/lib/api/services/helpers/curves/conic-arcs.d.ts +24 -0
- package/lib/api/services/helpers/curves/conic-arcs.js +85 -0
- package/lib/api/services/helpers/curves/nurbs-forms.d.ts +20 -0
- package/lib/api/services/helpers/curves/nurbs-forms.js +112 -0
- package/lib/api/services/helpers/curves/nurbs.d.ts +4 -0
- package/lib/api/services/helpers/curves/nurbs.js +10 -9
- package/lib/api/services/helpers/files/drawing/drawing-budget.d.ts +3 -0
- package/lib/api/services/helpers/files/drawing/drawing-budget.js +24 -0
- package/lib/api/services/helpers/files/drawing/drawing-geometry.d.ts +18 -0
- package/lib/api/services/helpers/files/drawing/drawing-geometry.js +84 -0
- package/lib/api/services/helpers/files/drawing/drawing-model.d.ts +5 -0
- package/lib/api/services/helpers/files/drawing/drawing-model.js +252 -0
- package/lib/api/services/helpers/files/drawing/drawing-types.d.ts +60 -0
- package/lib/api/services/helpers/files/drawing/drawing-types.js +1 -0
- package/lib/api/services/helpers/files/drawing/drawing.constants.d.ts +28 -0
- package/lib/api/services/helpers/files/drawing/drawing.constants.js +29 -0
- package/lib/api/services/helpers/files/dxf/dxf-colors.d.ts +5 -0
- package/lib/api/services/helpers/files/dxf/dxf-colors.js +45 -0
- package/lib/api/services/helpers/files/dxf/dxf-entities.d.ts +17 -0
- package/lib/api/services/helpers/files/dxf/dxf-entities.js +193 -0
- package/lib/api/services/helpers/files/dxf/dxf-file-text.d.ts +1 -0
- package/lib/api/services/helpers/files/dxf/dxf-file-text.js +50 -0
- package/lib/api/services/helpers/files/dxf/dxf-generator.d.ts +2 -36
- package/lib/api/services/helpers/files/dxf/dxf-generator.js +81 -523
- package/lib/api/services/helpers/files/dxf/dxf-reader-dtos.d.ts +6 -0
- package/lib/api/services/helpers/files/dxf/dxf-reader-dtos.js +81 -0
- package/lib/api/services/helpers/files/dxf/dxf-reader-geometry.d.ts +21 -0
- package/lib/api/services/helpers/files/dxf/dxf-reader-geometry.js +67 -0
- package/lib/api/services/helpers/files/dxf/dxf-reader-types.d.ts +69 -0
- package/lib/api/services/helpers/files/dxf/dxf-reader-types.js +1 -0
- package/lib/api/services/helpers/files/dxf/dxf-reader.constants.d.ts +71 -0
- package/lib/api/services/helpers/files/dxf/dxf-reader.constants.js +78 -0
- package/lib/api/services/helpers/files/dxf/dxf-reader.d.ts +2 -0
- package/lib/api/services/helpers/files/dxf/dxf-reader.js +556 -0
- package/lib/api/services/helpers/files/dxf/dxf-tables.d.ts +27 -0
- package/lib/api/services/helpers/files/dxf/dxf-tables.js +247 -0
- package/lib/api/services/helpers/files/dxf/dxf-text.d.ts +26 -0
- package/lib/api/services/helpers/files/dxf/dxf-text.js +97 -0
- package/lib/api/services/helpers/files/dxf/dxf-tokens.d.ts +9 -0
- package/lib/api/services/helpers/files/dxf/dxf-tokens.js +65 -0
- package/lib/api/services/helpers/files/dxf/dxf.constants.d.ts +32 -1
- package/lib/api/services/helpers/files/dxf/dxf.constants.js +34 -1
- package/lib/api/services/helpers/files/file-bytes.d.ts +1 -0
- package/lib/api/services/helpers/files/file-bytes.js +15 -0
- package/lib/api/services/helpers/files/ground-axes.d.ts +2 -0
- package/lib/api/services/helpers/files/ground-axes.js +4 -0
- package/lib/api/services/helpers/files/mesh-file-axes.d.ts +7 -0
- package/lib/api/services/helpers/files/mesh-file-axes.js +17 -0
- package/lib/api/services/helpers/files/stl-axes.d.ts +4 -0
- package/lib/api/services/helpers/files/stl-axes.js +22 -0
- package/lib/api/services/helpers/files/stl-types.d.ts +7 -0
- package/lib/api/services/helpers/files/stl-types.js +1 -0
- package/lib/api/services/helpers/files/stl.constants.d.ts +11 -0
- package/lib/api/services/helpers/files/stl.constants.js +11 -0
- package/lib/api/services/helpers/files/stl.d.ts +3 -0
- package/lib/api/services/helpers/files/stl.js +93 -0
- package/lib/api/services/helpers/files/svg/svg-css.d.ts +48 -0
- package/lib/api/services/helpers/files/svg/svg-css.js +444 -0
- package/lib/api/services/helpers/files/svg/svg-dash-patterns.d.ts +2 -0
- package/lib/api/services/helpers/files/svg/svg-dash-patterns.js +35 -0
- package/lib/api/services/helpers/files/svg/svg-document.d.ts +26 -0
- package/lib/api/services/helpers/files/svg/svg-document.js +89 -0
- package/lib/api/services/helpers/files/svg/svg-memo.d.ts +1 -0
- package/lib/api/services/helpers/files/svg/svg-memo.js +8 -0
- package/lib/api/services/helpers/files/svg/svg-normalizer.d.ts +6 -0
- package/lib/api/services/helpers/files/svg/svg-normalizer.js +433 -0
- package/lib/api/services/helpers/files/svg/svg-numbers.d.ts +15 -0
- package/lib/api/services/helpers/files/svg/svg-numbers.js +61 -0
- package/lib/api/services/helpers/files/svg/svg-path-data.constants.d.ts +8 -0
- package/lib/api/services/helpers/files/svg/svg-path-data.constants.js +10 -0
- package/lib/api/services/helpers/files/svg/svg-path-data.d.ts +9 -0
- package/lib/api/services/helpers/files/svg/svg-path-data.js +203 -0
- package/lib/api/services/helpers/files/svg/svg-path-types.d.ts +33 -0
- package/lib/api/services/helpers/files/svg/svg-path-types.js +1 -0
- package/lib/api/services/helpers/files/svg/svg-reader.constants.d.ts +35 -0
- package/lib/api/services/helpers/files/svg/svg-reader.constants.js +35 -0
- package/lib/api/services/helpers/files/svg/svg-reading.constants.d.ts +9 -0
- package/lib/api/services/helpers/files/svg/svg-reading.constants.js +9 -0
- package/lib/api/services/helpers/files/svg/svg-reading.d.ts +6 -0
- package/lib/api/services/helpers/files/svg/svg-reading.js +233 -0
- package/lib/api/services/helpers/files/svg/svg-scene-types.d.ts +54 -0
- package/lib/api/services/helpers/files/svg/svg-scene-types.js +1 -0
- package/lib/api/services/helpers/files/svg/svg-shapes.d.ts +6 -0
- package/lib/api/services/helpers/files/svg/svg-shapes.js +102 -0
- package/lib/api/services/helpers/files/svg/svg-strokes.d.ts +38 -0
- package/lib/api/services/helpers/files/svg/svg-strokes.js +108 -0
- package/lib/api/services/helpers/files/svg/svg-style.d.ts +26 -0
- package/lib/api/services/helpers/files/svg/svg-style.js +211 -0
- package/lib/api/services/helpers/files/svg/svg-transform.d.ts +10 -0
- package/lib/api/services/helpers/files/svg/svg-transform.js +76 -0
- package/lib/api/services/helpers/files/svg/svg-writer.d.ts +16 -0
- package/lib/api/services/helpers/files/svg/svg-writer.js +153 -0
- package/lib/api/services/helpers/files/svg/svg-xml.d.ts +11 -0
- package/lib/api/services/helpers/files/svg/svg-xml.js +322 -0
- package/lib/api/services/helpers/files/svg/svg.constants.d.ts +13 -0
- package/lib/api/services/helpers/files/svg/svg.constants.js +13 -0
- package/lib/api/services/helpers/files/work-budget.d.ts +11 -0
- package/lib/api/services/helpers/files/work-budget.js +26 -0
- package/lib/api/services/helpers/geometry/affine2.d.ts +8 -0
- package/lib/api/services/helpers/geometry/affine2.js +18 -0
- package/lib/api/services/helpers/geometry/ellipse-arcs.d.ts +14 -0
- package/lib/api/services/helpers/geometry/ellipse-arcs.js +96 -0
- package/lib/api/services/helpers/geometry/frame-axes.d.ts +3 -1
- package/lib/api/services/helpers/geometry/polygon-nesting.constants.d.ts +6 -0
- package/lib/api/services/helpers/geometry/polygon-nesting.constants.js +6 -0
- package/lib/api/services/helpers/geometry/polygon-nesting.d.ts +31 -0
- package/lib/api/services/helpers/geometry/polygon-nesting.js +251 -0
- package/lib/api/services/helpers/geometry/quaternions.constants.d.ts +3 -0
- package/lib/api/services/helpers/geometry/quaternions.constants.js +3 -0
- package/lib/api/services/helpers/geometry/quaternions.d.ts +14 -0
- package/lib/api/services/helpers/geometry/quaternions.js +71 -0
- package/lib/api/services/helpers/geometry/scalars.constants.d.ts +1 -0
- package/lib/api/services/helpers/geometry/scalars.constants.js +1 -0
- package/lib/api/services/helpers/geometry/scalars.d.ts +3 -0
- package/lib/api/services/helpers/geometry/scalars.js +29 -1
- package/lib/api/services/helpers/geometry/vectors.d.ts +1 -0
- package/lib/api/services/helpers/geometry/vectors.js +6 -0
- package/lib/api/services/helpers/mesh/mesh-proximity.constants.d.ts +1 -0
- package/lib/api/services/helpers/mesh/mesh-proximity.constants.js +1 -0
- package/lib/api/services/helpers/mesh/mesh-proximity.d.ts +1 -0
- package/lib/api/services/helpers/mesh/mesh-proximity.js +40 -40
- package/lib/api/services/io/drawing.d.ts +170 -0
- package/lib/api/services/io/drawing.js +212 -0
- package/lib/api/services/io/dxf.d.ts +134 -0
- package/lib/api/services/io/dxf.js +167 -0
- package/lib/api/services/io/index.d.ts +4 -0
- package/lib/api/services/io/index.js +4 -0
- package/lib/api/services/io/io.d.ts +14 -0
- package/lib/api/services/io/io.js +15 -0
- package/lib/api/services/io/svg.d.ts +64 -0
- package/lib/api/services/io/svg.js +102 -0
- package/lib/api/services/line.d.ts +17 -0
- package/lib/api/services/line.js +20 -1
- package/lib/api/services/math.d.ts +35 -0
- package/lib/api/services/math.js +56 -1
- package/lib/api/services/mesh.d.ts +17 -0
- package/lib/api/services/mesh.js +27 -1
- package/lib/api/services/point.d.ts +4 -1
- package/lib/api/services/point.js +9 -4
- package/lib/api/services/recipes.d.ts +3 -0
- package/lib/api/services/recipes.js +4 -1
- package/lib/api/services/text.d.ts +4 -1
- package/lib/api/services/text.js +8 -3
- package/lib/api/services/transforms.d.ts +119 -1
- package/lib/api/services/transforms.js +158 -30
- package/package.json +1 -1
- package/lib/api/services/helpers/files/dxf/dxf.d.ts +0 -87
- package/lib/api/services/helpers/files/dxf/dxf.js +0 -111
- package/lib/api/services/io.d.ts +0 -9
- package/lib/api/services/io.js +0 -10
|
@@ -2,6 +2,7 @@ import * as Inputs from "../inputs";
|
|
|
2
2
|
import { InputError, resolveDto } from "../kernel-calls";
|
|
3
3
|
import { arcThroughThreePoints, pointsOnArc } from "./helpers/geometry/arcs";
|
|
4
4
|
import { add3, length3, scale3, subtract3 } from "./helpers/geometry/vectors";
|
|
5
|
+
import { pointOnGround } from "./helpers/files/ground-axes";
|
|
5
6
|
/**
|
|
6
7
|
* Points as plain number arrays. A point is `[x, y, z]` with Y pointing up, the same shape as a
|
|
7
8
|
* vector, so the two can be passed to each other's methods; a 2D point is `[x, y]`. Every method
|
|
@@ -9,11 +10,15 @@ import { add3, length3, scale3, subtract3 } from "./helpers/geometry/vectors";
|
|
|
9
10
|
* model units.
|
|
10
11
|
*/
|
|
11
12
|
export class Point {
|
|
12
|
-
constructor(geometryHelper, transforms, vector, lists) {
|
|
13
|
+
constructor(geometryHelper, transforms, vector, lists, settings = () => ({})) {
|
|
13
14
|
this.geometryHelper = geometryHelper;
|
|
14
15
|
this.transforms = transforms;
|
|
15
16
|
this.vector = vector;
|
|
16
17
|
this.lists = lists;
|
|
18
|
+
this.settings = settings;
|
|
19
|
+
}
|
|
20
|
+
onGround(x, y) {
|
|
21
|
+
return pointOnGround(x, y, this.settings().coordinateSystem);
|
|
17
22
|
}
|
|
18
23
|
/**
|
|
19
24
|
* Applies a transformation matrix, or a list of them in order, to one point.
|
|
@@ -541,7 +546,7 @@ export class Point {
|
|
|
541
546
|
}
|
|
542
547
|
if (resolved.pointsOnGround) {
|
|
543
548
|
points.forEach((p, index) => {
|
|
544
|
-
points[index] =
|
|
549
|
+
points[index] = this.onGround(p[0], p[1]);
|
|
545
550
|
});
|
|
546
551
|
}
|
|
547
552
|
return points;
|
|
@@ -799,11 +804,11 @@ export class Point {
|
|
|
799
804
|
}
|
|
800
805
|
if (pointsOnGround) {
|
|
801
806
|
for (let i = 0; i < scaledCenters.length; i++) {
|
|
802
|
-
scaledCenters[i] =
|
|
807
|
+
scaledCenters[i] = this.onGround(scaledCenters[i][0], scaledCenters[i][1]);
|
|
803
808
|
}
|
|
804
809
|
for (let i = 0; i < scaledHexagons.length; i++) {
|
|
805
810
|
for (let j = 0; j < scaledHexagons[i].length; j++) {
|
|
806
|
-
scaledHexagons[i][j] =
|
|
811
|
+
scaledHexagons[i][j] = this.onGround(scaledHexagons[i][j][0], scaledHexagons[i][j][1]);
|
|
807
812
|
}
|
|
808
813
|
}
|
|
809
814
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as Inputs from "../inputs";
|
|
2
|
+
import type { BitbybitSettings } from "../kernel-calls/settings";
|
|
2
3
|
import type { RecipeIssue, RecipeSource, RecipeSurfaceMesh } from "../recipes/recipe-types";
|
|
3
4
|
/**
|
|
4
5
|
* Recipes with no CAD kernel needed: solids described as a list of steps that `occt.recipes` and
|
|
@@ -8,6 +9,8 @@ import type { RecipeIssue, RecipeSource, RecipeSurfaceMesh } from "../recipes/re
|
|
|
8
9
|
* @beta
|
|
9
10
|
*/
|
|
10
11
|
export declare class Recipes {
|
|
12
|
+
private readonly settings;
|
|
13
|
+
constructor(settings?: () => BitbybitSettings);
|
|
11
14
|
/**
|
|
12
15
|
* Checks a value against the recipe format and lists what is wrong with it: steps that refer
|
|
13
16
|
* forward or out of range, ranges outside their buffers, coordinates that are not finite or
|
|
@@ -13,6 +13,9 @@ import { isTransformMatrix } from "./helpers/geometry/matrices";
|
|
|
13
13
|
* @beta
|
|
14
14
|
*/
|
|
15
15
|
export class Recipes {
|
|
16
|
+
constructor(settings = () => ({})) {
|
|
17
|
+
this.settings = settings;
|
|
18
|
+
}
|
|
16
19
|
/**
|
|
17
20
|
* Checks a value against the recipe format and lists what is wrong with it: steps that refer
|
|
18
21
|
* forward or out of range, ranges outside their buffers, coordinates that are not finite or
|
|
@@ -71,7 +74,7 @@ export class Recipes {
|
|
|
71
74
|
*/
|
|
72
75
|
surfaceMeshes(inputs) {
|
|
73
76
|
const resolved = resolveDto(Inputs.Recipes.RecipeSurfaceMeshesDto, inputs);
|
|
74
|
-
return recipeSurfaceMeshes(resolved.recipe, resolved.roots, resolved.adjustZtoY);
|
|
77
|
+
return recipeSurfaceMeshes(resolved.recipe, resolved.roots, resolved.adjustZtoY, this.settings().coordinateSystem);
|
|
75
78
|
}
|
|
76
79
|
/**
|
|
77
80
|
* Follows a node through the transforms that only turn and move to the step it places, folding
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as Inputs from "../inputs";
|
|
2
2
|
import type * as Models from "../models";
|
|
3
3
|
import type { Point } from "./point";
|
|
4
|
+
import type { BitbybitSettings } from "../kernel-calls/settings";
|
|
4
5
|
/**
|
|
5
6
|
* Working with text: splitting, joining, searching, trimming, padding, changing case, regular
|
|
6
7
|
* expressions and formatting with placeholders. `vectorChar` and `vectorText` turn text into line
|
|
@@ -9,7 +10,8 @@ import type { Point } from "./point";
|
|
|
9
10
|
*/
|
|
10
11
|
export declare class TextBitByBit {
|
|
11
12
|
private readonly point;
|
|
12
|
-
|
|
13
|
+
private readonly settings;
|
|
14
|
+
constructor(point: Point, settings?: () => BitbybitSettings);
|
|
13
15
|
/**
|
|
14
16
|
* Passes a text through unchanged, so a value can be given a name and reused.
|
|
15
17
|
*
|
|
@@ -522,6 +524,7 @@ export declare class TextBitByBit {
|
|
|
522
524
|
* ```
|
|
523
525
|
*/
|
|
524
526
|
vectorText(inputs: Inputs.Text.VectorTextDto): Models.Text.VectorTextData[];
|
|
527
|
+
private onGround;
|
|
525
528
|
private vectorParamsChar;
|
|
526
529
|
private translateLine;
|
|
527
530
|
}
|
package/lib/api/services/text.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as Inputs from "../inputs";
|
|
2
2
|
import { defaultsVectorParams } from "../models/simplex";
|
|
3
3
|
import { resolveDto } from "../kernel-calls";
|
|
4
|
+
import { pointOnGround } from "./helpers/files/ground-axes";
|
|
4
5
|
/**
|
|
5
6
|
* Working with text: splitting, joining, searching, trimming, padding, changing case, regular
|
|
6
7
|
* expressions and formatting with placeholders. `vectorChar` and `vectorText` turn text into line
|
|
@@ -8,8 +9,9 @@ import { resolveDto } from "../kernel-calls";
|
|
|
8
9
|
* 0.
|
|
9
10
|
*/
|
|
10
11
|
export class TextBitByBit {
|
|
11
|
-
constructor(point) {
|
|
12
|
+
constructor(point, settings = () => ({})) {
|
|
12
13
|
this.point = point;
|
|
14
|
+
this.settings = settings;
|
|
13
15
|
}
|
|
14
16
|
/**
|
|
15
17
|
* Passes a text through unchanged, so a value can be given a name and reused.
|
|
@@ -630,7 +632,7 @@ export class TextBitByBit {
|
|
|
630
632
|
const gx = ratio * glyph[i] + xOffset;
|
|
631
633
|
const gy = ratio * glyph[i + 1] + yOffset + extrudeYOffset;
|
|
632
634
|
if (glyph[i] !== undefined) {
|
|
633
|
-
polyline.push(
|
|
635
|
+
polyline.push(this.onGround(gx, gy));
|
|
634
636
|
continue;
|
|
635
637
|
}
|
|
636
638
|
paths.push(polyline);
|
|
@@ -749,6 +751,9 @@ export class TextBitByBit {
|
|
|
749
751
|
}
|
|
750
752
|
return lines;
|
|
751
753
|
}
|
|
754
|
+
onGround(x, y) {
|
|
755
|
+
return pointOnGround(x, y, this.settings().coordinateSystem);
|
|
756
|
+
}
|
|
752
757
|
vectorParamsChar(inputs) {
|
|
753
758
|
const params = Object.assign({}, defaultsVectorParams, inputs);
|
|
754
759
|
params.input = inputs.char || params.char;
|
|
@@ -760,7 +765,7 @@ export class TextBitByBit {
|
|
|
760
765
|
vchar.paths = vchar.paths.map((path) => {
|
|
761
766
|
const pts = this.point.translatePoints({
|
|
762
767
|
points: path,
|
|
763
|
-
translation:
|
|
768
|
+
translation: this.onGround(x, y),
|
|
764
769
|
});
|
|
765
770
|
return pts;
|
|
766
771
|
});
|
|
@@ -301,6 +301,125 @@ export declare class Transforms {
|
|
|
301
301
|
* @drawable false
|
|
302
302
|
*/
|
|
303
303
|
identity(): Base.TransformMatrix;
|
|
304
|
+
/**
|
|
305
|
+
* Builds a quaternion that turns about an axis by an angle in degrees, positive
|
|
306
|
+
* counter-clockwise when the axis points toward you.
|
|
307
|
+
*
|
|
308
|
+
* A quaternion holds a rotation as four numbers with none of the gimbal lock of three angles;
|
|
309
|
+
* glTF and the renderers store rotations this way.
|
|
310
|
+
* Example: axis [0,0,1], angle 90 -> [0, 0, 0.7071, 0.7071]
|
|
311
|
+
* @param inputs - The axis and the angle in degrees
|
|
312
|
+
* @returns The rotation as [x, y, z, w]
|
|
313
|
+
* @group quaternion
|
|
314
|
+
* @shortname quaternion axis angle
|
|
315
|
+
* @drawable false
|
|
316
|
+
* @example
|
|
317
|
+
* ```typescript
|
|
318
|
+
* const quarter = bitbybit.transforms.quaternionFromAxisAngle({ axis: [0, 0, 1], angle: 90 });
|
|
319
|
+
* ```
|
|
320
|
+
*/
|
|
321
|
+
quaternionFromAxisAngle(inputs: Inputs.Transforms.AxisAngleDto): Base.Quaternion;
|
|
322
|
+
/**
|
|
323
|
+
* Builds a quaternion from three angles in degrees: a turn about the X axis, then about Y, then
|
|
324
|
+
* about Z, each about the fixed world axes, as `rotationCenterX`, `rotationCenterY` and
|
|
325
|
+
* `rotationCenterZ` applied in that order.
|
|
326
|
+
*
|
|
327
|
+
* Example: [0, 0, 90] -> [0, 0, 0.7071, 0.7071]
|
|
328
|
+
* @param inputs - The angles about X, Y and Z
|
|
329
|
+
* @returns The rotation as [x, y, z, w]
|
|
330
|
+
* @group quaternion
|
|
331
|
+
* @shortname quaternion from euler
|
|
332
|
+
* @drawable false
|
|
333
|
+
* @example
|
|
334
|
+
* ```typescript
|
|
335
|
+
* const turn = bitbybit.transforms.quaternionFromEuler({ angles: [30, 0, 90] });
|
|
336
|
+
* ```
|
|
337
|
+
*/
|
|
338
|
+
quaternionFromEuler(inputs: Inputs.Transforms.EulerAnglesDto): Base.Quaternion;
|
|
339
|
+
/**
|
|
340
|
+
* Reads a quaternion back as the three angles in degrees that `quaternionFromEuler` takes,
|
|
341
|
+
* about X, then Y, then Z.
|
|
342
|
+
*
|
|
343
|
+
* Y stays between -90 and 90. Within a ten-thousandth of a degree of either end, X and Z turn
|
|
344
|
+
* about one line, so X is 0 and Z takes the whole turn.
|
|
345
|
+
* Example: [0, 0, 0.7071, 0.7071] -> [0, 0, 90]
|
|
346
|
+
* @param inputs - The rotation
|
|
347
|
+
* @returns The angles about X, Y and Z
|
|
348
|
+
* @group quaternion
|
|
349
|
+
* @shortname quaternion to euler
|
|
350
|
+
* @drawable false
|
|
351
|
+
* @example
|
|
352
|
+
* ```typescript
|
|
353
|
+
* const angles = bitbybit.transforms.quaternionToEuler({ quaternion: [0, 0, 0.7071, 0.7071] });
|
|
354
|
+
* ```
|
|
355
|
+
*/
|
|
356
|
+
quaternionToEuler(inputs: Inputs.Transforms.QuaternionDto): Base.Vector3;
|
|
357
|
+
/**
|
|
358
|
+
* Combines two rotations into the one that turns by `first` and then by `second`.
|
|
359
|
+
*
|
|
360
|
+
* Order matters: turning about X then Z differs from turning about Z then X.
|
|
361
|
+
* Example: a quarter turn about X, then a quarter turn about Z -> one rotation doing both
|
|
362
|
+
* @param inputs - The rotation applied first and the one applied after it
|
|
363
|
+
* @returns The combined rotation as [x, y, z, w]
|
|
364
|
+
* @group quaternion
|
|
365
|
+
* @shortname quaternion combine
|
|
366
|
+
* @drawable false
|
|
367
|
+
* @example
|
|
368
|
+
* ```typescript
|
|
369
|
+
* const both = bitbybit.transforms.quaternionCombine({ first: [0.7071, 0, 0, 0.7071], second: [0, 0, 0.7071, 0.7071] });
|
|
370
|
+
* ```
|
|
371
|
+
*/
|
|
372
|
+
quaternionCombine(inputs: Inputs.Transforms.TwoQuaternionsDto): Base.Quaternion;
|
|
373
|
+
/**
|
|
374
|
+
* Turns a vector, or a point about the origin, by a rotation.
|
|
375
|
+
*
|
|
376
|
+
* Example: [1, 0, 0] turned by a quarter turn about Z -> [0, 1, 0]
|
|
377
|
+
* @param inputs - The rotation and the vector
|
|
378
|
+
* @returns The turned vector
|
|
379
|
+
* @group quaternion
|
|
380
|
+
* @shortname quaternion rotate vector
|
|
381
|
+
* @drawable false
|
|
382
|
+
* @example
|
|
383
|
+
* ```typescript
|
|
384
|
+
* const turned = bitbybit.transforms.quaternionRotateVector({ quaternion: [0, 0, 0.7071, 0.7071], vector: [1, 0, 0] });
|
|
385
|
+
* ```
|
|
386
|
+
*/
|
|
387
|
+
quaternionRotateVector(inputs: Inputs.Transforms.QuaternionVectorDto): Base.Vector3;
|
|
388
|
+
/**
|
|
389
|
+
* Gives the rotation that turns the world axes onto a frame's: X onto its direction and Z onto
|
|
390
|
+
* its normal. The origin is left out.
|
|
391
|
+
*
|
|
392
|
+
* The direction is squared to the normal first, so a rough direction is enough.
|
|
393
|
+
* Example: normal [0,0,1], direction [0,1,0] -> a quarter turn about Z
|
|
394
|
+
* @param inputs - The frame
|
|
395
|
+
* @returns The rotation as [x, y, z, w]
|
|
396
|
+
* @group quaternion
|
|
397
|
+
* @shortname quaternion from frame
|
|
398
|
+
* @drawable false
|
|
399
|
+
* @example
|
|
400
|
+
* ```typescript
|
|
401
|
+
* const turn = bitbybit.transforms.quaternionFromFrame({ frame: { origin: [0, 0, 0], normal: [0, 0, 1], direction: [0, 1, 0] } });
|
|
402
|
+
* ```
|
|
403
|
+
*/
|
|
404
|
+
quaternionFromFrame(inputs: Inputs.Frame.FrameDto): Base.Quaternion;
|
|
405
|
+
/**
|
|
406
|
+
* Writes a rotation as the transformation matrix the other methods here build, so it can be
|
|
407
|
+
* applied with `point.transformPoints` or combined with moves.
|
|
408
|
+
*
|
|
409
|
+
* Example: a quarter turn about Z -> the matrix that takes [1,0,0] to [0,1,0]
|
|
410
|
+
* @param inputs - The rotation
|
|
411
|
+
* @returns The matrix, 16 numbers in column-major order
|
|
412
|
+
* @group quaternion
|
|
413
|
+
* @shortname quaternion to matrix
|
|
414
|
+
* @drawable false
|
|
415
|
+
* @example
|
|
416
|
+
* ```typescript
|
|
417
|
+
* const matrix = bitbybit.transforms.quaternionToMatrix({ quaternion: [0, 0, 0.7071, 0.7071] });
|
|
418
|
+
* const points = bitbybit.point.transformPoints({ points: [[1, 0, 0]], transformation: [matrix] });
|
|
419
|
+
* ```
|
|
420
|
+
*/
|
|
421
|
+
quaternionToMatrix(inputs: Inputs.Transforms.QuaternionDto): Base.TransformMatrix;
|
|
422
|
+
private unitQuaternionOf;
|
|
304
423
|
private translation;
|
|
305
424
|
private scaling;
|
|
306
425
|
private rotationAxis;
|
|
@@ -308,7 +427,6 @@ export declare class Transforms {
|
|
|
308
427
|
private rotationY;
|
|
309
428
|
private rotationZ;
|
|
310
429
|
private rotationYawPitchRoll;
|
|
311
|
-
private rotationMatrixFromQuat;
|
|
312
430
|
private stretchDirection;
|
|
313
431
|
private matricesOf;
|
|
314
432
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as Inputs from "../inputs";
|
|
2
2
|
import { InputError, resolveDto } from "../kernel-calls";
|
|
3
3
|
import { composed, isRigidMatrix, isTransformMatrix, linearDeterminant, rigidInverse } from "./helpers/geometry/matrices";
|
|
4
|
+
import { degreesOfQuaternion, isQuaternion, quaternionAbout, quaternionMatrix, quaternionOfAxes, quaternionOfDegrees, quaternionProduct, quaternionTurned, unitQuaternion } from "./helpers/geometry/quaternions";
|
|
5
|
+
import { isTriple, squareFrame, unitOf } from "./helpers/geometry/frame-axes";
|
|
4
6
|
/**
|
|
5
7
|
* Builds transformation matrices for moving, rotating, scaling and stretching geometry. A
|
|
6
8
|
* transformation is a 4x4 matrix as 16 numbers in column-major order; most methods return a short
|
|
@@ -387,6 +389,161 @@ export class Transforms {
|
|
|
387
389
|
identity() {
|
|
388
390
|
return [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0];
|
|
389
391
|
}
|
|
392
|
+
/**
|
|
393
|
+
* Builds a quaternion that turns about an axis by an angle in degrees, positive
|
|
394
|
+
* counter-clockwise when the axis points toward you.
|
|
395
|
+
*
|
|
396
|
+
* A quaternion holds a rotation as four numbers with none of the gimbal lock of three angles;
|
|
397
|
+
* glTF and the renderers store rotations this way.
|
|
398
|
+
* Example: axis [0,0,1], angle 90 -> [0, 0, 0.7071, 0.7071]
|
|
399
|
+
* @param inputs - The axis and the angle in degrees
|
|
400
|
+
* @returns The rotation as [x, y, z, w]
|
|
401
|
+
* @group quaternion
|
|
402
|
+
* @shortname quaternion axis angle
|
|
403
|
+
* @drawable false
|
|
404
|
+
* @example
|
|
405
|
+
* ```typescript
|
|
406
|
+
* const quarter = bitbybit.transforms.quaternionFromAxisAngle({ axis: [0, 0, 1], angle: 90 });
|
|
407
|
+
* ```
|
|
408
|
+
*/
|
|
409
|
+
quaternionFromAxisAngle(inputs) {
|
|
410
|
+
const resolved = resolveDto(Inputs.Transforms.AxisAngleDto, inputs);
|
|
411
|
+
const axis = unitOf(resolved.axis);
|
|
412
|
+
if (axis === undefined || !Number.isFinite(resolved.angle)) {
|
|
413
|
+
throw new InputError("`axis` has to be three finite numbers not all 0, and `angle` a finite number.", axis === undefined ? "axis" : "angle");
|
|
414
|
+
}
|
|
415
|
+
return quaternionAbout(axis, resolved.angle);
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Builds a quaternion from three angles in degrees: a turn about the X axis, then about Y, then
|
|
419
|
+
* about Z, each about the fixed world axes, as `rotationCenterX`, `rotationCenterY` and
|
|
420
|
+
* `rotationCenterZ` applied in that order.
|
|
421
|
+
*
|
|
422
|
+
* Example: [0, 0, 90] -> [0, 0, 0.7071, 0.7071]
|
|
423
|
+
* @param inputs - The angles about X, Y and Z
|
|
424
|
+
* @returns The rotation as [x, y, z, w]
|
|
425
|
+
* @group quaternion
|
|
426
|
+
* @shortname quaternion from euler
|
|
427
|
+
* @drawable false
|
|
428
|
+
* @example
|
|
429
|
+
* ```typescript
|
|
430
|
+
* const turn = bitbybit.transforms.quaternionFromEuler({ angles: [30, 0, 90] });
|
|
431
|
+
* ```
|
|
432
|
+
*/
|
|
433
|
+
quaternionFromEuler(inputs) {
|
|
434
|
+
const resolved = resolveDto(Inputs.Transforms.EulerAnglesDto, inputs);
|
|
435
|
+
if (!isTriple(resolved.angles)) {
|
|
436
|
+
throw new InputError("`angles` has to be three finite numbers.", "angles");
|
|
437
|
+
}
|
|
438
|
+
return quaternionOfDegrees(resolved.angles);
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Reads a quaternion back as the three angles in degrees that `quaternionFromEuler` takes,
|
|
442
|
+
* about X, then Y, then Z.
|
|
443
|
+
*
|
|
444
|
+
* Y stays between -90 and 90. Within a ten-thousandth of a degree of either end, X and Z turn
|
|
445
|
+
* about one line, so X is 0 and Z takes the whole turn.
|
|
446
|
+
* Example: [0, 0, 0.7071, 0.7071] -> [0, 0, 90]
|
|
447
|
+
* @param inputs - The rotation
|
|
448
|
+
* @returns The angles about X, Y and Z
|
|
449
|
+
* @group quaternion
|
|
450
|
+
* @shortname quaternion to euler
|
|
451
|
+
* @drawable false
|
|
452
|
+
* @example
|
|
453
|
+
* ```typescript
|
|
454
|
+
* const angles = bitbybit.transforms.quaternionToEuler({ quaternion: [0, 0, 0.7071, 0.7071] });
|
|
455
|
+
* ```
|
|
456
|
+
*/
|
|
457
|
+
quaternionToEuler(inputs) {
|
|
458
|
+
return degreesOfQuaternion(this.unitQuaternionOf(inputs.quaternion, "quaternion"));
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Combines two rotations into the one that turns by `first` and then by `second`.
|
|
462
|
+
*
|
|
463
|
+
* Order matters: turning about X then Z differs from turning about Z then X.
|
|
464
|
+
* Example: a quarter turn about X, then a quarter turn about Z -> one rotation doing both
|
|
465
|
+
* @param inputs - The rotation applied first and the one applied after it
|
|
466
|
+
* @returns The combined rotation as [x, y, z, w]
|
|
467
|
+
* @group quaternion
|
|
468
|
+
* @shortname quaternion combine
|
|
469
|
+
* @drawable false
|
|
470
|
+
* @example
|
|
471
|
+
* ```typescript
|
|
472
|
+
* const both = bitbybit.transforms.quaternionCombine({ first: [0.7071, 0, 0, 0.7071], second: [0, 0, 0.7071, 0.7071] });
|
|
473
|
+
* ```
|
|
474
|
+
*/
|
|
475
|
+
quaternionCombine(inputs) {
|
|
476
|
+
return quaternionProduct(this.unitQuaternionOf(inputs.second, "second"), this.unitQuaternionOf(inputs.first, "first"));
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Turns a vector, or a point about the origin, by a rotation.
|
|
480
|
+
*
|
|
481
|
+
* Example: [1, 0, 0] turned by a quarter turn about Z -> [0, 1, 0]
|
|
482
|
+
* @param inputs - The rotation and the vector
|
|
483
|
+
* @returns The turned vector
|
|
484
|
+
* @group quaternion
|
|
485
|
+
* @shortname quaternion rotate vector
|
|
486
|
+
* @drawable false
|
|
487
|
+
* @example
|
|
488
|
+
* ```typescript
|
|
489
|
+
* const turned = bitbybit.transforms.quaternionRotateVector({ quaternion: [0, 0, 0.7071, 0.7071], vector: [1, 0, 0] });
|
|
490
|
+
* ```
|
|
491
|
+
*/
|
|
492
|
+
quaternionRotateVector(inputs) {
|
|
493
|
+
if (!isTriple(inputs.vector)) {
|
|
494
|
+
throw new InputError("`vector` has to be three finite numbers.", "vector");
|
|
495
|
+
}
|
|
496
|
+
return quaternionTurned(this.unitQuaternionOf(inputs.quaternion, "quaternion"), inputs.vector);
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Gives the rotation that turns the world axes onto a frame's: X onto its direction and Z onto
|
|
500
|
+
* its normal. The origin is left out.
|
|
501
|
+
*
|
|
502
|
+
* The direction is squared to the normal first, so a rough direction is enough.
|
|
503
|
+
* Example: normal [0,0,1], direction [0,1,0] -> a quarter turn about Z
|
|
504
|
+
* @param inputs - The frame
|
|
505
|
+
* @returns The rotation as [x, y, z, w]
|
|
506
|
+
* @group quaternion
|
|
507
|
+
* @shortname quaternion from frame
|
|
508
|
+
* @drawable false
|
|
509
|
+
* @example
|
|
510
|
+
* ```typescript
|
|
511
|
+
* const turn = bitbybit.transforms.quaternionFromFrame({ frame: { origin: [0, 0, 0], normal: [0, 0, 1], direction: [0, 1, 0] } });
|
|
512
|
+
* ```
|
|
513
|
+
*/
|
|
514
|
+
quaternionFromFrame(inputs) {
|
|
515
|
+
const axes = squareFrame(inputs.frame.origin, inputs.frame.normal, inputs.frame.direction);
|
|
516
|
+
if (typeof axes === "string") {
|
|
517
|
+
throw new InputError(`The frame's \`${axes}\` has no length, or its direction runs along its normal.`, "frame");
|
|
518
|
+
}
|
|
519
|
+
return quaternionOfAxes(axes);
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Writes a rotation as the transformation matrix the other methods here build, so it can be
|
|
523
|
+
* applied with `point.transformPoints` or combined with moves.
|
|
524
|
+
*
|
|
525
|
+
* Example: a quarter turn about Z -> the matrix that takes [1,0,0] to [0,1,0]
|
|
526
|
+
* @param inputs - The rotation
|
|
527
|
+
* @returns The matrix, 16 numbers in column-major order
|
|
528
|
+
* @group quaternion
|
|
529
|
+
* @shortname quaternion to matrix
|
|
530
|
+
* @drawable false
|
|
531
|
+
* @example
|
|
532
|
+
* ```typescript
|
|
533
|
+
* const matrix = bitbybit.transforms.quaternionToMatrix({ quaternion: [0, 0, 0.7071, 0.7071] });
|
|
534
|
+
* const points = bitbybit.point.transformPoints({ points: [[1, 0, 0]], transformation: [matrix] });
|
|
535
|
+
* ```
|
|
536
|
+
*/
|
|
537
|
+
quaternionToMatrix(inputs) {
|
|
538
|
+
return quaternionMatrix(this.unitQuaternionOf(inputs.quaternion, "quaternion"));
|
|
539
|
+
}
|
|
540
|
+
unitQuaternionOf(quaternion, name) {
|
|
541
|
+
const unit = isQuaternion(quaternion) ? unitQuaternion(quaternion) : undefined;
|
|
542
|
+
if (unit === undefined) {
|
|
543
|
+
throw new InputError(`\`${name}\` has to be four finite numbers, not all 0.`, name);
|
|
544
|
+
}
|
|
545
|
+
return unit;
|
|
546
|
+
}
|
|
390
547
|
translation(x, y, z) {
|
|
391
548
|
return [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, x, y, z, 1.0];
|
|
392
549
|
}
|
|
@@ -449,36 +606,7 @@ export class Transforms {
|
|
|
449
606
|
const y = sinYaw * cosPitch * cosRoll - cosYaw * sinPitch * sinRoll;
|
|
450
607
|
const z = cosYaw * cosPitch * sinRoll - sinYaw * sinPitch * cosRoll;
|
|
451
608
|
const w = cosYaw * cosPitch * cosRoll + sinYaw * sinPitch * sinRoll;
|
|
452
|
-
return
|
|
453
|
-
}
|
|
454
|
-
rotationMatrixFromQuat(x, y, z, w) {
|
|
455
|
-
const xx = x * x;
|
|
456
|
-
const yy = y * y;
|
|
457
|
-
const zz = z * z;
|
|
458
|
-
const xy = x * y;
|
|
459
|
-
const zw = z * w;
|
|
460
|
-
const zx = z * x;
|
|
461
|
-
const yw = y * w;
|
|
462
|
-
const yz = y * z;
|
|
463
|
-
const xw = x * w;
|
|
464
|
-
const m = this.identity();
|
|
465
|
-
m[0] = 1.0 - 2.0 * (yy + zz);
|
|
466
|
-
m[1] = 2.0 * (xy + zw);
|
|
467
|
-
m[2] = 2.0 * (zx - yw);
|
|
468
|
-
m[3] = 0.0;
|
|
469
|
-
m[4] = 2.0 * (xy - zw);
|
|
470
|
-
m[5] = 1.0 - 2.0 * (zz + xx);
|
|
471
|
-
m[6] = 2.0 * (yz + xw);
|
|
472
|
-
m[7] = 0.0;
|
|
473
|
-
m[8] = 2.0 * (zx + yw);
|
|
474
|
-
m[9] = 2.0 * (yz - xw);
|
|
475
|
-
m[10] = 1.0 - 2.0 * (yy + xx);
|
|
476
|
-
m[11] = 0.0;
|
|
477
|
-
m[12] = 0.0;
|
|
478
|
-
m[13] = 0.0;
|
|
479
|
-
m[14] = 0.0;
|
|
480
|
-
m[15] = 1.0;
|
|
481
|
-
return m;
|
|
609
|
+
return quaternionMatrix([x, y, z, w]);
|
|
482
610
|
}
|
|
483
611
|
stretchDirection(direction, scale) {
|
|
484
612
|
const d = this.vector.normalized({ vector: direction });
|
package/package.json
CHANGED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import * as Inputs from "../../../../inputs";
|
|
2
|
-
export declare class Dxf {
|
|
3
|
-
private dxfGenerator;
|
|
4
|
-
/**
|
|
5
|
-
* Creates a line segment definition for DXF export (pass-through for validation).
|
|
6
|
-
* Example: start=[0,0], end=[10,5] → DXF line segment from origin to [10,5]
|
|
7
|
-
* @param inputs Line segment definition
|
|
8
|
-
* @returns Line segment DTO
|
|
9
|
-
* @group dxf
|
|
10
|
-
* @shortname line segment
|
|
11
|
-
* @drawable false
|
|
12
|
-
*/
|
|
13
|
-
lineSegment(inputs: Inputs.IO.DxfLineSegmentDto): Inputs.IO.DxfLineSegmentDto;
|
|
14
|
-
/**
|
|
15
|
-
* Creates an arc segment definition for DXF export (curved path between two points).
|
|
16
|
-
* Example: center=[5,5], radius=5, startAngle=0°, endAngle=90° → quarter circle arc
|
|
17
|
-
* @param inputs Arc segment definition
|
|
18
|
-
* @returns Arc segment DTO
|
|
19
|
-
* @group dxf
|
|
20
|
-
* @shortname arc segment
|
|
21
|
-
* @drawable false
|
|
22
|
-
*/
|
|
23
|
-
arcSegment(inputs: Inputs.IO.DxfArcSegmentDto): Inputs.IO.DxfArcSegmentDto;
|
|
24
|
-
/**
|
|
25
|
-
* Creates a circle segment definition for DXF export (closed circular path).
|
|
26
|
-
* Example: center=[10,10], radius=5 → full circle with diameter 10 centered at [10,10]
|
|
27
|
-
* @param inputs Circle segment definition
|
|
28
|
-
* @returns Circle segment DTO
|
|
29
|
-
* @group dxf
|
|
30
|
-
* @shortname circle segment
|
|
31
|
-
* @drawable false
|
|
32
|
-
*/
|
|
33
|
-
circleSegment(inputs: Inputs.IO.DxfCircleSegmentDto): Inputs.IO.DxfCircleSegmentDto;
|
|
34
|
-
/**
|
|
35
|
-
* Creates a polyline segment definition for DXF export (connected line segments through points).
|
|
36
|
-
* Example: points=[[0,0], [5,0], [5,5], [0,5]] → rectangular polyline path
|
|
37
|
-
* @param inputs Polyline segment definition
|
|
38
|
-
* @returns Polyline segment DTO
|
|
39
|
-
* @group dxf
|
|
40
|
-
* @shortname polyline segment
|
|
41
|
-
* @drawable false
|
|
42
|
-
*/
|
|
43
|
-
polylineSegment(inputs: Inputs.IO.DxfPolylineSegmentDto): Inputs.IO.DxfPolylineSegmentDto;
|
|
44
|
-
/**
|
|
45
|
-
* Creates a spline segment definition for DXF export (smooth curve through control points).
|
|
46
|
-
* Example: controlPoints=[[0,0], [5,10], [10,0]] → smooth curved path through points
|
|
47
|
-
* @param inputs Spline segment definition
|
|
48
|
-
* @returns Spline segment DTO
|
|
49
|
-
* @group dxf
|
|
50
|
-
* @shortname spline segment
|
|
51
|
-
* @drawable false
|
|
52
|
-
*/
|
|
53
|
-
splineSegment(inputs: Inputs.IO.DxfSplineSegmentDto): Inputs.IO.DxfSplineSegmentDto;
|
|
54
|
-
/**
|
|
55
|
-
* Creates a path from multiple segments (combines lines, arcs, circles, polylines, splines).
|
|
56
|
-
* Similar to OCCT wires - segments are connected to form a continuous or multi-part path.
|
|
57
|
-
* Example: segments=[lineSegment, arcSegment, polylineSegment] → combined path entity
|
|
58
|
-
* @param inputs Path definition with segments
|
|
59
|
-
* @returns Path DTO
|
|
60
|
-
* @group dxf
|
|
61
|
-
* @shortname path
|
|
62
|
-
* @drawable false
|
|
63
|
-
*/
|
|
64
|
-
path(inputs: Inputs.IO.DxfPathDto): Inputs.IO.DxfPathDto;
|
|
65
|
-
/**
|
|
66
|
-
* Creates a paths part with layer and color assignment for DXF organization.
|
|
67
|
-
* Groups multiple paths into a single layer with consistent styling.
|
|
68
|
-
* Example: paths=[path1, path2], layer="Outlines", color=red → grouped geometry
|
|
69
|
-
* @param inputs Paths part definition
|
|
70
|
-
* @returns Paths part DTO
|
|
71
|
-
* @group dxf
|
|
72
|
-
* @shortname paths part
|
|
73
|
-
* @drawable false
|
|
74
|
-
*/
|
|
75
|
-
pathsPart(inputs: Inputs.IO.DxfPathsPartDto): Inputs.IO.DxfPathsPartDto;
|
|
76
|
-
/**
|
|
77
|
-
* Generates a complete DXF file from paths parts (exports 2D CAD drawing format).
|
|
78
|
-
* Supports lines, arcs, circles, polylines, and splines organized in layered paths.
|
|
79
|
-
* Example: model with 3 parts on different layers → valid DXF file string for CAD software
|
|
80
|
-
* @param inputs DXF model definition
|
|
81
|
-
* @returns DXF file content as string
|
|
82
|
-
* @group dxf
|
|
83
|
-
* @shortname dxf create
|
|
84
|
-
* @drawable false
|
|
85
|
-
*/
|
|
86
|
-
dxfCreate(inputs: Inputs.IO.DxfModelDto): string;
|
|
87
|
-
}
|