@bitbybit-dev/base 1.1.1 → 1.2.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 +14 -4
- package/index.js +0 -3
- package/lib/api/GlobalCDNProvider.js +1 -1
- package/lib/api/inputs/base-inputs.d.ts +114 -0
- package/lib/api/inputs/base-inputs.js +15 -0
- package/lib/api/inputs/color-inputs.d.ts +4 -0
- package/lib/api/inputs/color-inputs.js +4 -0
- package/lib/api/inputs/dates-inputs.d.ts +4 -0
- package/lib/api/inputs/dates-inputs.js +4 -0
- package/lib/api/inputs/io-inputs.d.ts +10 -6
- package/lib/api/inputs/io-inputs.js +4 -0
- package/lib/api/inputs/line-inputs.d.ts +36 -31
- package/lib/api/inputs/line-inputs.js +13 -0
- package/lib/api/inputs/lists-inputs.d.ts +28 -20
- package/lib/api/inputs/lists-inputs.js +16 -0
- package/lib/api/inputs/logic-inputs.d.ts +15 -4
- package/lib/api/inputs/logic-inputs.js +65 -0
- package/lib/api/inputs/math-inputs.d.ts +25 -0
- package/lib/api/inputs/math-inputs.js +40 -0
- package/lib/api/inputs/mesh-inputs.d.ts +16 -11
- package/lib/api/inputs/mesh-inputs.js +5 -0
- package/lib/api/inputs/point-inputs.d.ts +33 -27
- package/lib/api/inputs/point-inputs.js +14 -0
- package/lib/api/inputs/polyline-inputs.d.ts +33 -28
- package/lib/api/inputs/polyline-inputs.js +5 -0
- package/lib/api/inputs/text-inputs.d.ts +27 -14
- package/lib/api/inputs/text-inputs.js +13 -0
- package/lib/api/inputs/transforms-inputs.d.ts +9 -3
- package/lib/api/inputs/transforms-inputs.js +6 -0
- package/lib/api/inputs/vector-inputs.d.ts +5 -0
- package/lib/api/inputs/vector-inputs.js +69 -0
- package/lib/api/models/point/hex-grid-data.d.ts +8 -3
- package/lib/api/models/point/hex-grid-data.js +5 -0
- package/lib/api/models/simplex.d.ts +19 -250
- package/lib/api/models/simplex.js +7 -35
- package/lib/api/models/text/vector-char-data.d.ts +3 -3
- package/lib/api/models/text/vector-text-data.d.ts +3 -3
- package/lib/api/services/color.js +5 -4
- package/lib/api/services/geometry-helper.d.ts +5 -5
- package/lib/api/services/geometry-helper.js +101 -2
- package/lib/api/services/helpers/dxf/dxf-generator.js +20 -69
- package/lib/api/services/helpers/mesh-normals.d.ts +9 -0
- package/lib/api/services/helpers/mesh-normals.js +56 -0
- package/lib/api/services/io.d.ts +4 -0
- package/lib/api/services/io.js +4 -0
- package/lib/api/services/line.d.ts +2 -2
- package/lib/api/services/line.js +18 -51
- package/lib/api/services/lists.js +1 -6
- package/lib/api/services/mesh.d.ts +2 -1
- package/lib/api/services/mesh.js +14 -32
- package/lib/api/services/point.d.ts +3 -3
- package/lib/api/services/point.js +26 -82
- package/lib/api/services/polyline.d.ts +2 -2
- package/lib/api/services/polyline.js +13 -43
- package/lib/api/services/text.js +1 -9
- package/lib/api/services/transforms.js +10 -16
- package/lib/api/services/vector.d.ts +4 -4
- package/lib/api/services/vector.js +3 -3
- package/package.json +53 -91
- package/babel.config.cjs +0 -14
- package/babel.config.d.cts +0 -5
- package/lib/api/unit-test-helper.d.ts +0 -20
- package/lib/api/unit-test-helper.js +0 -130
package/README.md
CHANGED
|
@@ -43,7 +43,17 @@ This scaffolds a complete Vite + TypeScript project with all CAD kernels pre-con
|
|
|
43
43
|
| **Monorepo** | https://github.com/bitbybit-dev/bitbybit |
|
|
44
44
|
| **NPM** | https://www.npmjs.com/package/@bitbybit-dev/base |
|
|
45
45
|
| **Documentation** | https://learn.bitbybit.dev/learn/npm-packages/intro |
|
|
46
|
-
| **
|
|
46
|
+
| **API Reference** | https://docs.bitbybit.dev/modules/Bit |
|
|
47
|
+
| **Unit Test Coverage** | https://github.com/bitbybit-dev/bitbybit/actions/workflows/verify.yml |
|
|
48
|
+
|
|
49
|
+
### API reference
|
|
50
|
+
|
|
51
|
+
Every class, method and input type in this package is documented in the generated TypeScript API reference:
|
|
52
|
+
|
|
53
|
+
- [Vector](https://docs.bitbybit.dev/classes/Bit.Vector)
|
|
54
|
+
- [Math](https://docs.bitbybit.dev/classes/Bit.MathBitByBit)
|
|
55
|
+
- [Lists](https://docs.bitbybit.dev/classes/Bit.Lists)
|
|
56
|
+
- [Base input types](https://docs.bitbybit.dev/modules/Bit.Inputs.Base)
|
|
47
57
|
|
|
48
58
|
## Example Applications
|
|
49
59
|
|
|
@@ -60,10 +70,10 @@ This scaffolds a complete Vite + TypeScript project with all CAD kernels pre-con
|
|
|
60
70
|
npm run build-p
|
|
61
71
|
|
|
62
72
|
# Run unit tests with coverage
|
|
63
|
-
npm run test
|
|
73
|
+
npm run test:coverage
|
|
64
74
|
|
|
65
|
-
#
|
|
66
|
-
npm run test
|
|
75
|
+
# Re-run them as you edit
|
|
76
|
+
npm run test:watch
|
|
67
77
|
```
|
|
68
78
|
|
|
69
79
|
## Bitbybit Platform
|
package/index.js
CHANGED
|
@@ -3,45 +3,115 @@
|
|
|
3
3
|
* This is the single source of truth - other packages extend this via module augmentation.
|
|
4
4
|
*/
|
|
5
5
|
export declare namespace Base {
|
|
6
|
+
/**
|
|
7
|
+
* A colour as a CSS string - a hex value such as #ff8800, or any other form the browser
|
|
8
|
+
* accepts. This is the form every draw option and material takes; use the color API to convert
|
|
9
|
+
* to and from RGB and HSL.
|
|
10
|
+
*/
|
|
6
11
|
type Color = string;
|
|
12
|
+
/**
|
|
13
|
+
* A colour as separate red, green and blue channels, each 0-255. Use it when you need to compute
|
|
14
|
+
* with the channels; convert to a Color string before handing it to a draw call.
|
|
15
|
+
*/
|
|
7
16
|
type ColorRGB = {
|
|
8
17
|
r: number;
|
|
9
18
|
g: number;
|
|
10
19
|
b: number;
|
|
11
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* Red, green and blue channels plus an alpha channel for transparency. Alpha 0 is fully
|
|
23
|
+
* transparent, 1 fully opaque.
|
|
24
|
+
*/
|
|
12
25
|
type ColorRGBA = {
|
|
13
26
|
r: number;
|
|
14
27
|
g: number;
|
|
15
28
|
b: number;
|
|
16
29
|
a: number;
|
|
17
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* An engine material object, passed through untyped because its shape depends on which renderer
|
|
33
|
+
* is in use. Create one through the engine's material API rather than by hand.
|
|
34
|
+
*/
|
|
18
35
|
type Material = any;
|
|
36
|
+
/**
|
|
37
|
+
* A point in the plane as [x, y]. Points and vectors share the same array shape - the difference
|
|
38
|
+
* is meaning, not structure: a point is a position, a vector is a direction and a magnitude.
|
|
39
|
+
*/
|
|
19
40
|
type Point2 = [number, number];
|
|
41
|
+
/**
|
|
42
|
+
* A direction and magnitude in the plane as [x, y]. Structurally identical to Point2; use this
|
|
43
|
+
* name where the value means a direction rather than a position.
|
|
44
|
+
*/
|
|
20
45
|
type Vector2 = [number, number];
|
|
46
|
+
/**
|
|
47
|
+
* A point in space as [x, y, z], and the single most common type in the whole API. Y is up.
|
|
48
|
+
* A plain array, so it survives JSON, passes between kernels unchanged, and can be built by
|
|
49
|
+
* ordinary array code without a constructor.
|
|
50
|
+
*/
|
|
21
51
|
type Point3 = [number, number, number];
|
|
52
|
+
/**
|
|
53
|
+
* A direction and magnitude in space as [x, y, z]. Structurally identical to Point3; use this
|
|
54
|
+
* name where the value means a direction - a normal, an axis, an offset - rather than a position.
|
|
55
|
+
* Many operations expect it normalised, and say so on the parameter.
|
|
56
|
+
*/
|
|
22
57
|
type Vector3 = [number, number, number];
|
|
58
|
+
/**
|
|
59
|
+
* An axis in space: an origin point and a direction vector. Used wherever an operation needs both
|
|
60
|
+
* a position and an orientation - rotating about an arbitrary line, revolving a profile, mirroring
|
|
61
|
+
* across a line.
|
|
62
|
+
*/
|
|
23
63
|
type Axis3 = {
|
|
24
64
|
origin: Base.Point3;
|
|
25
65
|
direction: Base.Vector3;
|
|
26
66
|
};
|
|
67
|
+
/**
|
|
68
|
+
* An axis in the plane: an origin point and a direction vector.
|
|
69
|
+
*/
|
|
27
70
|
type Axis2 = {
|
|
28
71
|
origin: Base.Point2;
|
|
29
72
|
direction: Base.Vector2;
|
|
30
73
|
};
|
|
74
|
+
/**
|
|
75
|
+
* A finite straight segment in the plane as a pair of points, [start, end].
|
|
76
|
+
*/
|
|
31
77
|
type Segment2 = [Point2, Point2];
|
|
78
|
+
/**
|
|
79
|
+
* A finite straight segment in space as a pair of points, [start, end]. The array form, as opposed
|
|
80
|
+
* to Line3 which names its ends; both describe the same thing and different APIs prefer different
|
|
81
|
+
* shapes.
|
|
82
|
+
*/
|
|
32
83
|
type Segment3 = [Point3, Point3];
|
|
33
84
|
/** Triangle plane is efficient definition described by a normal vector and d value (N dot X = d) */
|
|
34
85
|
type TrianglePlane3 = {
|
|
35
86
|
normal: Vector3;
|
|
36
87
|
d: number;
|
|
37
88
|
};
|
|
89
|
+
/**
|
|
90
|
+
* A triangle as three points. The winding order decides which way the face points, so reversing it
|
|
91
|
+
* flips the normal.
|
|
92
|
+
*/
|
|
38
93
|
type Triangle3 = [Base.Point3, Base.Point3, Base.Point3];
|
|
94
|
+
/**
|
|
95
|
+
* A mesh as a flat list of triangles. The simplest possible mesh representation - no shared
|
|
96
|
+
* vertices and no index buffer - which makes it easy to build and to reason about, at the cost of
|
|
97
|
+
* repeating coordinates.
|
|
98
|
+
*/
|
|
39
99
|
type Mesh3 = Triangle3[];
|
|
100
|
+
/**
|
|
101
|
+
* An infinite plane: an origin point, a normal vector, and a direction vector that fixes the
|
|
102
|
+
* plane's rotation about its own normal. That third field is what lets an operation place 2D
|
|
103
|
+
* geometry on the plane with a predictable orientation rather than an arbitrary one.
|
|
104
|
+
*/
|
|
40
105
|
type Plane3 = {
|
|
41
106
|
origin: Base.Point3;
|
|
42
107
|
normal: Base.Vector3;
|
|
43
108
|
direction: Base.Vector3;
|
|
44
109
|
};
|
|
110
|
+
/**
|
|
111
|
+
* The axis-aligned box enclosing a shape, as a min and a max corner, with the centre and the
|
|
112
|
+
* width, height and length filled in as a convenience. Use it to size a camera to a model, to lay
|
|
113
|
+
* objects out without overlap, or to check a part fits a build volume.
|
|
114
|
+
*/
|
|
45
115
|
type BoundingBox = {
|
|
46
116
|
min: Base.Point3;
|
|
47
117
|
max: Base.Point3;
|
|
@@ -50,42 +120,86 @@ export declare namespace Base {
|
|
|
50
120
|
height?: number;
|
|
51
121
|
length?: number;
|
|
52
122
|
};
|
|
123
|
+
/**
|
|
124
|
+
* A finite straight line in the plane, named as start and end.
|
|
125
|
+
*/
|
|
53
126
|
type Line2 = {
|
|
54
127
|
start: Base.Point2;
|
|
55
128
|
end: Base.Point2;
|
|
56
129
|
};
|
|
130
|
+
/**
|
|
131
|
+
* A finite straight line in space, named as start and end. The named form, as opposed to Segment3
|
|
132
|
+
* which is a pair of points; different APIs prefer different shapes.
|
|
133
|
+
*/
|
|
57
134
|
type Line3 = {
|
|
58
135
|
start: Base.Point3;
|
|
59
136
|
end: Base.Point3;
|
|
60
137
|
};
|
|
138
|
+
/**
|
|
139
|
+
* A connected chain of points in space, optionally closed, with an optional colour. Closing it
|
|
140
|
+
* turns the chain into an outline that can become a face.
|
|
141
|
+
*/
|
|
61
142
|
type Polyline3 = {
|
|
62
143
|
points: Base.Point3[];
|
|
63
144
|
isClosed?: boolean;
|
|
64
145
|
color?: number[];
|
|
65
146
|
};
|
|
147
|
+
/**
|
|
148
|
+
* A connected chain of points in the plane, optionally closed, with an optional colour.
|
|
149
|
+
*/
|
|
66
150
|
type Polyline2 = {
|
|
67
151
|
points: Base.Point2[];
|
|
68
152
|
isClosed?: boolean;
|
|
69
153
|
color?: number[];
|
|
70
154
|
};
|
|
155
|
+
/**
|
|
156
|
+
* A 3x3 transformation matrix as 9 numbers, for transforms in the plane.
|
|
157
|
+
*/
|
|
71
158
|
type TransformMatrix3x3 = [number, number, number, number, number, number, number, number, number];
|
|
159
|
+
/**
|
|
160
|
+
* A list of 3x3 transformation matrices, for producing patterned layouts in the plane.
|
|
161
|
+
*/
|
|
72
162
|
type TransformMatrixes3x3 = TransformMatrix3x3[];
|
|
163
|
+
/**
|
|
164
|
+
* A 4x4 transformation matrix as 16 numbers in row-major order. Translation, rotation and scale
|
|
165
|
+
* combined into one value that any geometry API will accept, so the same transform applies
|
|
166
|
+
* equally to points, curves and solids.
|
|
167
|
+
*/
|
|
73
168
|
type TransformMatrix = [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number];
|
|
169
|
+
/**
|
|
170
|
+
* A list of 4x4 transformation matrices. Applying a list transforms a shape once per matrix,
|
|
171
|
+
* which is how patterned arrays and instanced layouts are produced in a single call.
|
|
172
|
+
*/
|
|
74
173
|
type TransformMatrixes = TransformMatrix[];
|
|
174
|
+
/**
|
|
175
|
+
* Horizontal alignment of content against its anchor: left, center or right.
|
|
176
|
+
*/
|
|
75
177
|
enum horizontalAlignEnum {
|
|
76
178
|
left = "left",
|
|
77
179
|
center = "center",
|
|
78
180
|
right = "right"
|
|
79
181
|
}
|
|
182
|
+
/**
|
|
183
|
+
* Vertical alignment of content against its anchor: top, middle or bottom.
|
|
184
|
+
*/
|
|
80
185
|
enum verticalAlignmentEnum {
|
|
81
186
|
top = "top",
|
|
82
187
|
middle = "middle",
|
|
83
188
|
bottom = "bottom"
|
|
84
189
|
}
|
|
190
|
+
/**
|
|
191
|
+
* Which of the two ends of something to act on - the top or the bottom. Used where an operation
|
|
192
|
+
* can cap, extend or trim one end of a shape.
|
|
193
|
+
*/
|
|
85
194
|
enum topBottomEnum {
|
|
86
195
|
top = "top",
|
|
87
196
|
bottom = "bottom"
|
|
88
197
|
}
|
|
198
|
+
/**
|
|
199
|
+
* Alignment against a nine-cell grid, combining a horizontal and a vertical position into one
|
|
200
|
+
* value - topLeft through bottomRight. Used to place text and 2D content without needing two
|
|
201
|
+
* separate alignment settings.
|
|
202
|
+
*/
|
|
89
203
|
enum basicAlignmentEnum {
|
|
90
204
|
topLeft = "topLeft",
|
|
91
205
|
topMid = "topMid",
|
|
@@ -8,23 +8,38 @@ export var Base;
|
|
|
8
8
|
// ============================================================================
|
|
9
9
|
// Alignment Enums
|
|
10
10
|
// ============================================================================
|
|
11
|
+
/**
|
|
12
|
+
* Horizontal alignment of content against its anchor: left, center or right.
|
|
13
|
+
*/
|
|
11
14
|
let horizontalAlignEnum;
|
|
12
15
|
(function (horizontalAlignEnum) {
|
|
13
16
|
horizontalAlignEnum["left"] = "left";
|
|
14
17
|
horizontalAlignEnum["center"] = "center";
|
|
15
18
|
horizontalAlignEnum["right"] = "right";
|
|
16
19
|
})(horizontalAlignEnum = Base.horizontalAlignEnum || (Base.horizontalAlignEnum = {}));
|
|
20
|
+
/**
|
|
21
|
+
* Vertical alignment of content against its anchor: top, middle or bottom.
|
|
22
|
+
*/
|
|
17
23
|
let verticalAlignmentEnum;
|
|
18
24
|
(function (verticalAlignmentEnum) {
|
|
19
25
|
verticalAlignmentEnum["top"] = "top";
|
|
20
26
|
verticalAlignmentEnum["middle"] = "middle";
|
|
21
27
|
verticalAlignmentEnum["bottom"] = "bottom";
|
|
22
28
|
})(verticalAlignmentEnum = Base.verticalAlignmentEnum || (Base.verticalAlignmentEnum = {}));
|
|
29
|
+
/**
|
|
30
|
+
* Which of the two ends of something to act on - the top or the bottom. Used where an operation
|
|
31
|
+
* can cap, extend or trim one end of a shape.
|
|
32
|
+
*/
|
|
23
33
|
let topBottomEnum;
|
|
24
34
|
(function (topBottomEnum) {
|
|
25
35
|
topBottomEnum["top"] = "top";
|
|
26
36
|
topBottomEnum["bottom"] = "bottom";
|
|
27
37
|
})(topBottomEnum = Base.topBottomEnum || (Base.topBottomEnum = {}));
|
|
38
|
+
/**
|
|
39
|
+
* Alignment against a nine-cell grid, combining a horizontal and a vertical position into one
|
|
40
|
+
* value - topLeft through bottomRight. Used to place text and 2D content without needing two
|
|
41
|
+
* separate alignment settings.
|
|
42
|
+
*/
|
|
28
43
|
let basicAlignmentEnum;
|
|
29
44
|
(function (basicAlignmentEnum) {
|
|
30
45
|
basicAlignmentEnum["topLeft"] = "topLeft";
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { Base } from "./base-inputs";
|
|
2
|
+
/**
|
|
3
|
+
* Parameters for colour handling: hex, RGB and HSL values, the components to combine or extract, and
|
|
4
|
+
* the settings for blending, inverting and generating ranges of colours.
|
|
5
|
+
*/
|
|
2
6
|
export declare namespace Color {
|
|
3
7
|
class HexDto {
|
|
4
8
|
constructor(color?: Base.Color);
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
// tslint:disable-next-line: no-namespace
|
|
2
|
+
/**
|
|
3
|
+
* Parameters for colour handling: hex, RGB and HSL values, the components to combine or extract, and
|
|
4
|
+
* the settings for blending, inverting and generating ranges of colours.
|
|
5
|
+
*/
|
|
2
6
|
export var Color;
|
|
3
7
|
(function (Color) {
|
|
4
8
|
class HexDto {
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-namespace */
|
|
2
2
|
// tslint:disable-next-line: no-namespace
|
|
3
|
+
/**
|
|
4
|
+
* Parameters for date and time values: the date to act on, the unit and amount for arithmetic, and the
|
|
5
|
+
* format and locale used when parsing or printing one.
|
|
6
|
+
*/
|
|
3
7
|
export var Dates;
|
|
4
8
|
(function (Dates) {
|
|
5
9
|
class DateDto {
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { Base } from "./base-inputs";
|
|
2
|
+
/**
|
|
3
|
+
* Parameters for reading and writing files: the data or shape to export, the target format and its
|
|
4
|
+
* options, the file name, and the settings that control how imported content is interpreted.
|
|
5
|
+
*/
|
|
2
6
|
export declare namespace IO {
|
|
3
7
|
/**
|
|
4
8
|
* Line segment defined by start and end points
|
|
@@ -73,7 +77,7 @@ export declare namespace IO {
|
|
|
73
77
|
* Whether the polyline is closed
|
|
74
78
|
* @default false
|
|
75
79
|
*/
|
|
76
|
-
closed?: boolean;
|
|
80
|
+
closed?: boolean | undefined;
|
|
77
81
|
/**
|
|
78
82
|
* Bulge values for each vertex (optional)
|
|
79
83
|
* Bulge = tan(angle/4) where angle is the arc angle in radians
|
|
@@ -82,7 +86,7 @@ export declare namespace IO {
|
|
|
82
86
|
* Array length should match points length (or be undefined for all straight segments)
|
|
83
87
|
* @default undefined
|
|
84
88
|
*/
|
|
85
|
-
bulges?: number[];
|
|
89
|
+
bulges?: number[] | undefined;
|
|
86
90
|
}
|
|
87
91
|
/**
|
|
88
92
|
* Spline/B-spline segment defined by control points and degree
|
|
@@ -98,12 +102,12 @@ export declare namespace IO {
|
|
|
98
102
|
* Degree of the spline (typically 2 or 3)
|
|
99
103
|
* @default 3
|
|
100
104
|
*/
|
|
101
|
-
degree?: number;
|
|
105
|
+
degree?: number | undefined;
|
|
102
106
|
/**
|
|
103
107
|
* Whether the spline is closed
|
|
104
108
|
* @default false
|
|
105
109
|
*/
|
|
106
|
-
closed?: boolean;
|
|
110
|
+
closed?: boolean | undefined;
|
|
107
111
|
}
|
|
108
112
|
/**
|
|
109
113
|
* A path can contain multiple segments of different types (lines, arcs, polylines, circles, splines)
|
|
@@ -155,13 +159,13 @@ export declare namespace IO {
|
|
|
155
159
|
* - "truecolor": 24-bit RGB true color - Full color spectrum, requires newer CAD software
|
|
156
160
|
* @default aci
|
|
157
161
|
*/
|
|
158
|
-
colorFormat?: "aci" | "truecolor";
|
|
162
|
+
colorFormat?: "aci" | "truecolor" | undefined;
|
|
159
163
|
/**
|
|
160
164
|
* AutoCAD version format for DXF file
|
|
161
165
|
* - "AC1009": AutoCAD R12/R11 - Maximum compatibility with older CAD software (e.g., Design CAD 3D Max)
|
|
162
166
|
* - "AC1015": AutoCAD 2000 - Modern format with extended features
|
|
163
167
|
* @default AC1009
|
|
164
168
|
*/
|
|
165
|
-
acadVersion?: "AC1009" | "AC1015";
|
|
169
|
+
acadVersion?: "AC1009" | "AC1015" | undefined;
|
|
166
170
|
}
|
|
167
171
|
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-namespace */
|
|
2
|
+
/**
|
|
3
|
+
* Parameters for reading and writing files: the data or shape to export, the target format and its
|
|
4
|
+
* options, the file name, and the settings that control how imported content is interpreted.
|
|
5
|
+
*/
|
|
2
6
|
export var IO;
|
|
3
7
|
(function (IO) {
|
|
4
8
|
/**
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { Base } from "./base-inputs";
|
|
2
|
+
/**
|
|
3
|
+
* Parameters for straight line segments: the start and end points that define one, the options for
|
|
4
|
+
* creating many at once from point lists, and the settings for measuring, reversing, transforming and
|
|
5
|
+
* converting them into polylines or kernel edges.
|
|
6
|
+
*/
|
|
2
7
|
export declare namespace Line {
|
|
3
8
|
class LinePointsDto {
|
|
4
9
|
/**
|
|
@@ -9,12 +14,12 @@ export declare namespace Line {
|
|
|
9
14
|
* Start point
|
|
10
15
|
* @default undefined
|
|
11
16
|
*/
|
|
12
|
-
start
|
|
17
|
+
start: Base.Point3;
|
|
13
18
|
/**
|
|
14
19
|
* End point
|
|
15
20
|
* @default undefined
|
|
16
21
|
*/
|
|
17
|
-
end
|
|
22
|
+
end: Base.Point3;
|
|
18
23
|
}
|
|
19
24
|
class LineStartEndPointsDto {
|
|
20
25
|
/**
|
|
@@ -41,7 +46,7 @@ export declare namespace Line {
|
|
|
41
46
|
* Line
|
|
42
47
|
* @default undefined
|
|
43
48
|
*/
|
|
44
|
-
line
|
|
49
|
+
line: LinePointsDto;
|
|
45
50
|
/**
|
|
46
51
|
* Value between 0 and 1
|
|
47
52
|
* @default 1
|
|
@@ -49,12 +54,12 @@ export declare namespace Line {
|
|
|
49
54
|
* @maximum 1
|
|
50
55
|
* @step 0.1
|
|
51
56
|
*/
|
|
52
|
-
opacity?: number;
|
|
57
|
+
opacity?: number | undefined;
|
|
53
58
|
/**
|
|
54
59
|
* Hex colour string
|
|
55
60
|
* @default #444444
|
|
56
61
|
*/
|
|
57
|
-
colours?: string | string[];
|
|
62
|
+
colours?: string | string[] | undefined;
|
|
58
63
|
/**
|
|
59
64
|
* Width of the line
|
|
60
65
|
* @default 3
|
|
@@ -62,17 +67,17 @@ export declare namespace Line {
|
|
|
62
67
|
* @maximum Infinity
|
|
63
68
|
* @step 0.1
|
|
64
69
|
*/
|
|
65
|
-
size?: number;
|
|
70
|
+
size?: number | undefined;
|
|
66
71
|
/**
|
|
67
72
|
* Indicates wether the position of this line will change in time
|
|
68
73
|
* @default false
|
|
69
74
|
*/
|
|
70
|
-
updatable?: boolean;
|
|
75
|
+
updatable?: boolean | undefined;
|
|
71
76
|
/**
|
|
72
77
|
* Line mesh variable in case it already exists and needs updating
|
|
73
78
|
* @default undefined
|
|
74
79
|
*/
|
|
75
|
-
lineMesh?: T;
|
|
80
|
+
lineMesh?: T | undefined;
|
|
76
81
|
}
|
|
77
82
|
class DrawLinesDto<T> {
|
|
78
83
|
/**
|
|
@@ -83,7 +88,7 @@ export declare namespace Line {
|
|
|
83
88
|
* Lines
|
|
84
89
|
* @default undefined
|
|
85
90
|
*/
|
|
86
|
-
lines
|
|
91
|
+
lines: LinePointsDto[];
|
|
87
92
|
/**
|
|
88
93
|
* Value between 0 and 1
|
|
89
94
|
* @default 1
|
|
@@ -91,12 +96,12 @@ export declare namespace Line {
|
|
|
91
96
|
* @maximum 1
|
|
92
97
|
* @step 0.1
|
|
93
98
|
*/
|
|
94
|
-
opacity?: number;
|
|
99
|
+
opacity?: number | undefined;
|
|
95
100
|
/**
|
|
96
101
|
* Hex colour string
|
|
97
102
|
* @default #444444
|
|
98
103
|
*/
|
|
99
|
-
colours?: string | string[];
|
|
104
|
+
colours?: string | string[] | undefined;
|
|
100
105
|
/**
|
|
101
106
|
* Width of the line
|
|
102
107
|
* @default 3
|
|
@@ -104,17 +109,17 @@ export declare namespace Line {
|
|
|
104
109
|
* @maximum Infinity
|
|
105
110
|
* @step 0.1
|
|
106
111
|
*/
|
|
107
|
-
size?: number;
|
|
112
|
+
size?: number | undefined;
|
|
108
113
|
/**
|
|
109
114
|
* Indicates wether the position of these lines will change in time
|
|
110
115
|
* @default false
|
|
111
116
|
*/
|
|
112
|
-
updatable?: boolean;
|
|
117
|
+
updatable?: boolean | undefined;
|
|
113
118
|
/**
|
|
114
119
|
* Line mesh variable in case it already exists and needs updating
|
|
115
120
|
* @default undefined
|
|
116
121
|
*/
|
|
117
|
-
linesMesh?: T;
|
|
122
|
+
linesMesh?: T | undefined;
|
|
118
123
|
}
|
|
119
124
|
class PointsLinesDto {
|
|
120
125
|
constructor(points?: Base.Point3[]);
|
|
@@ -122,7 +127,7 @@ export declare namespace Line {
|
|
|
122
127
|
* Points
|
|
123
128
|
* @default undefined
|
|
124
129
|
*/
|
|
125
|
-
points
|
|
130
|
+
points: Base.Point3[];
|
|
126
131
|
}
|
|
127
132
|
class LineDto {
|
|
128
133
|
constructor(line?: LinePointsDto);
|
|
@@ -130,7 +135,7 @@ export declare namespace Line {
|
|
|
130
135
|
* Line to convert
|
|
131
136
|
* @default undefined
|
|
132
137
|
*/
|
|
133
|
-
line
|
|
138
|
+
line: LinePointsDto;
|
|
134
139
|
}
|
|
135
140
|
class SegmentDto {
|
|
136
141
|
constructor(segment?: Base.Segment3);
|
|
@@ -138,7 +143,7 @@ export declare namespace Line {
|
|
|
138
143
|
* Segment
|
|
139
144
|
* @default undefined
|
|
140
145
|
*/
|
|
141
|
-
segment
|
|
146
|
+
segment: Base.Segment3;
|
|
142
147
|
}
|
|
143
148
|
class SegmentsDto {
|
|
144
149
|
constructor(segments?: Base.Segment3[]);
|
|
@@ -146,7 +151,7 @@ export declare namespace Line {
|
|
|
146
151
|
* Segments
|
|
147
152
|
* @default undefined
|
|
148
153
|
*/
|
|
149
|
-
segments
|
|
154
|
+
segments: Base.Segment3[];
|
|
150
155
|
}
|
|
151
156
|
class LinesDto {
|
|
152
157
|
constructor(lines?: LinePointsDto[]);
|
|
@@ -154,7 +159,7 @@ export declare namespace Line {
|
|
|
154
159
|
* Lines to convert
|
|
155
160
|
* @default undefined
|
|
156
161
|
*/
|
|
157
|
-
lines
|
|
162
|
+
lines: LinePointsDto[];
|
|
158
163
|
}
|
|
159
164
|
class LineLineIntersectionDto {
|
|
160
165
|
constructor(line1?: LinePointsDto, line2?: LinePointsDto, tolerance?: number);
|
|
@@ -162,17 +167,17 @@ export declare namespace Line {
|
|
|
162
167
|
* First line
|
|
163
168
|
* @default undefined
|
|
164
169
|
*/
|
|
165
|
-
line1
|
|
170
|
+
line1: LinePointsDto;
|
|
166
171
|
/**
|
|
167
172
|
* Second line
|
|
168
173
|
* @default undefined
|
|
169
174
|
*/
|
|
170
|
-
line2
|
|
175
|
+
line2: LinePointsDto;
|
|
171
176
|
/**
|
|
172
177
|
* Set to false if you want to check for infinite lines
|
|
173
178
|
* @default true
|
|
174
179
|
*/
|
|
175
|
-
checkSegmentsOnly?: boolean;
|
|
180
|
+
checkSegmentsOnly?: boolean | undefined;
|
|
176
181
|
/**
|
|
177
182
|
* Tolerance for intersection
|
|
178
183
|
* @default 0.01
|
|
@@ -180,7 +185,7 @@ export declare namespace Line {
|
|
|
180
185
|
* @maximum Infinity
|
|
181
186
|
* @step 0.1
|
|
182
187
|
*/
|
|
183
|
-
tolerance?: number;
|
|
188
|
+
tolerance?: number | undefined;
|
|
184
189
|
}
|
|
185
190
|
class PointOnLineDto {
|
|
186
191
|
constructor(line?: LinePointsDto, param?: number);
|
|
@@ -188,7 +193,7 @@ export declare namespace Line {
|
|
|
188
193
|
* Line to get point on
|
|
189
194
|
* @default undefined
|
|
190
195
|
*/
|
|
191
|
-
line
|
|
196
|
+
line: LinePointsDto;
|
|
192
197
|
/**
|
|
193
198
|
* Param to use for point on line
|
|
194
199
|
* @default 0.5
|
|
@@ -196,7 +201,7 @@ export declare namespace Line {
|
|
|
196
201
|
* @maximum Infinity
|
|
197
202
|
* @step 0.1
|
|
198
203
|
*/
|
|
199
|
-
param?: number;
|
|
204
|
+
param?: number | undefined;
|
|
200
205
|
}
|
|
201
206
|
class TransformLineDto {
|
|
202
207
|
constructor(line?: LinePointsDto, transformation?: Base.TransformMatrixes);
|
|
@@ -204,12 +209,12 @@ export declare namespace Line {
|
|
|
204
209
|
* Line to transform
|
|
205
210
|
* @default undefined
|
|
206
211
|
*/
|
|
207
|
-
line
|
|
212
|
+
line: LinePointsDto;
|
|
208
213
|
/**
|
|
209
214
|
* Transformation matrix or a list of transformation matrixes
|
|
210
215
|
* @default undefined
|
|
211
216
|
*/
|
|
212
|
-
transformation
|
|
217
|
+
transformation: Base.TransformMatrixes;
|
|
213
218
|
}
|
|
214
219
|
class TransformsLinesDto {
|
|
215
220
|
constructor(lines?: LinePointsDto[], transformation?: Base.TransformMatrixes[]);
|
|
@@ -217,12 +222,12 @@ export declare namespace Line {
|
|
|
217
222
|
* Lines to transform
|
|
218
223
|
* @default undefined
|
|
219
224
|
*/
|
|
220
|
-
lines
|
|
225
|
+
lines: LinePointsDto[];
|
|
221
226
|
/**
|
|
222
227
|
* Transformations matrix or a list of transformations matrixes
|
|
223
228
|
* @default undefined
|
|
224
229
|
*/
|
|
225
|
-
transformation
|
|
230
|
+
transformation: Base.TransformMatrixes[];
|
|
226
231
|
}
|
|
227
232
|
class TransformLinesDto {
|
|
228
233
|
constructor(lines?: LinePointsDto[], transformation?: Base.TransformMatrixes);
|
|
@@ -230,11 +235,11 @@ export declare namespace Line {
|
|
|
230
235
|
* Lines to transform
|
|
231
236
|
* @default undefined
|
|
232
237
|
*/
|
|
233
|
-
lines
|
|
238
|
+
lines: LinePointsDto[];
|
|
234
239
|
/**
|
|
235
240
|
* Transformation matrix or a list of transformation matrixes
|
|
236
241
|
* @default undefined
|
|
237
242
|
*/
|
|
238
|
-
transformation
|
|
243
|
+
transformation: Base.TransformMatrixes;
|
|
239
244
|
}
|
|
240
245
|
}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-namespace */
|
|
2
|
+
/**
|
|
3
|
+
* Parameters for straight line segments: the start and end points that define one, the options for
|
|
4
|
+
* creating many at once from point lists, and the settings for measuring, reversing, transforming and
|
|
5
|
+
* converting them into polylines or kernel edges.
|
|
6
|
+
*/
|
|
2
7
|
export var Line;
|
|
3
8
|
(function (Line) {
|
|
4
9
|
class LinePointsDto {
|
|
@@ -180,6 +185,14 @@ export var Line;
|
|
|
180
185
|
* @default true
|
|
181
186
|
*/
|
|
182
187
|
this.checkSegmentsOnly = true;
|
|
188
|
+
/**
|
|
189
|
+
* Tolerance for intersection
|
|
190
|
+
* @default 0.01
|
|
191
|
+
* @minimum 0
|
|
192
|
+
* @maximum Infinity
|
|
193
|
+
* @step 0.1
|
|
194
|
+
*/
|
|
195
|
+
this.tolerance = 0.01;
|
|
183
196
|
if (line1 !== undefined) {
|
|
184
197
|
this.line1 = line1;
|
|
185
198
|
}
|