@bitbybit-dev/manifold 1.1.0 → 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/inputs/base-inputs.js +0 -1
- package/lib/api/inputs/manifold-inputs.d.ts +63 -23
- package/lib/api/inputs/manifold-inputs.js +114 -1
- package/lib/api/manifold-service.d.ts +30 -2
- package/lib/api/manifold-service.js +43 -22
- package/lib/api/services/cross-section/cross-section-booleans.d.ts +78 -2
- package/lib/api/services/cross-section/cross-section-booleans.js +86 -10
- package/lib/api/services/cross-section/cross-section-evaluate.d.ts +45 -2
- package/lib/api/services/cross-section/cross-section-evaluate.js +45 -2
- package/lib/api/services/cross-section/cross-section-operations.d.ts +71 -0
- package/lib/api/services/cross-section/cross-section-operations.js +71 -2
- package/lib/api/services/cross-section/cross-section-shapes.d.ts +39 -0
- package/lib/api/services/cross-section/cross-section-shapes.js +39 -0
- package/lib/api/services/cross-section/cross-section-transforms.d.ts +72 -2
- package/lib/api/services/cross-section/cross-section-transforms.js +72 -2
- package/lib/api/services/cross-section/cross-section.d.ts +53 -1
- package/lib/api/services/cross-section/cross-section.js +53 -5
- package/lib/api/services/index.js +1 -0
- package/lib/api/services/manifold/manifold-booleans.d.ts +116 -6
- package/lib/api/services/manifold/manifold-booleans.js +159 -48
- package/lib/api/services/manifold/manifold-evaluate.d.ts +133 -3
- package/lib/api/services/manifold/manifold-evaluate.js +135 -5
- package/lib/api/services/manifold/manifold-operations.d.ts +202 -1
- package/lib/api/services/manifold/manifold-operations.js +204 -3
- package/lib/api/services/manifold/manifold-shapes.d.ts +59 -0
- package/lib/api/services/manifold/manifold-shapes.js +78 -20
- package/lib/api/services/manifold/manifold-transforms.d.ts +97 -3
- package/lib/api/services/manifold/manifold-transforms.js +102 -6
- package/lib/api/services/manifold/manifold.d.ts +20 -0
- package/lib/api/services/manifold/manifold.js +20 -1
- package/lib/api/services/mesh/mesh-evaluate.d.ts +81 -3
- package/lib/api/services/mesh/mesh-evaluate.js +84 -6
- package/lib/api/services/mesh/mesh-operations.d.ts +24 -2
- package/lib/api/services/mesh/mesh-operations.js +24 -2
- package/lib/api/services/mesh/mesh.d.ts +4 -0
- package/lib/api/services/mesh/mesh.js +4 -1
- package/package.json +6 -45
- package/babel.config.cjs +0 -17
- package/babel.config.d.cts +0 -6
|
@@ -1,24 +1,225 @@
|
|
|
1
1
|
import * as Inputs from "../../inputs";
|
|
2
2
|
import * as Manifold3D from "manifold-3d";
|
|
3
|
+
/**
|
|
4
|
+
* Contains various functions for Solid meshes from Manifold library https://github.com/elalish/manifold
|
|
5
|
+
* Thanks Manifold community for developing this kernel
|
|
6
|
+
*/
|
|
3
7
|
export declare class ManifoldOperations {
|
|
4
8
|
private manifold;
|
|
5
9
|
constructor(wasm: Manifold3D.ManifoldToplevel);
|
|
10
|
+
/**
|
|
11
|
+
* Computes convex hull of the manifold shape provided
|
|
12
|
+
* @param inputs two shapes
|
|
13
|
+
* @returns hulled manifold shape
|
|
14
|
+
* @group hulls
|
|
15
|
+
* @shortname convex hull
|
|
16
|
+
* @drawable true
|
|
17
|
+
*/
|
|
6
18
|
hull(inputs: Inputs.Manifold.ManifoldDto<Manifold3D.Manifold>): Manifold3D.Manifold;
|
|
19
|
+
/**
|
|
20
|
+
* Hull points or manifolds
|
|
21
|
+
* @param inputs manifold
|
|
22
|
+
* @returns manifold
|
|
23
|
+
* @group hulls
|
|
24
|
+
* @shortname hull points
|
|
25
|
+
* @drawable true
|
|
26
|
+
*/
|
|
7
27
|
hullPoints(inputs: Inputs.Manifold.HullPointsDto<(Inputs.Base.Point3 | Manifold3D.Manifold)[]>): Manifold3D.Manifold;
|
|
28
|
+
/**
|
|
29
|
+
* Returns the cross section of this object parallel to the X-Y plane at the
|
|
30
|
+
* specified height. Using a height equal to the bottom
|
|
31
|
+
* of the bounding box will return the bottom faces, while using a height
|
|
32
|
+
* equal to the top of the bounding box will return empty.
|
|
33
|
+
* @param inputs manifold and height
|
|
34
|
+
* @returns sliced cross section
|
|
35
|
+
* @group cross sections
|
|
36
|
+
* @shortname slice
|
|
37
|
+
* @drawable true
|
|
38
|
+
*/
|
|
8
39
|
slice(inputs: Inputs.Manifold.SliceDto<Manifold3D.Manifold>): Manifold3D.CrossSection;
|
|
40
|
+
/**
|
|
41
|
+
* Creates a projection on xy plane from the shape outline
|
|
42
|
+
* @param inputs manifold
|
|
43
|
+
* @returns projected cross section
|
|
44
|
+
* @group cross sections
|
|
45
|
+
* @shortname project
|
|
46
|
+
* @drawable true
|
|
47
|
+
*/
|
|
9
48
|
project(inputs: Inputs.Manifold.ManifoldDto<Manifold3D.Manifold>): Manifold3D.CrossSection;
|
|
49
|
+
/**
|
|
50
|
+
* Return a copy of the manifold with the set tolerance value.
|
|
51
|
+
* This performs mesh simplification when the tolerance value is increased.
|
|
52
|
+
* @param inputs manifold and tolerance
|
|
53
|
+
* @returns manifold with new tolerance
|
|
54
|
+
* @group basic
|
|
55
|
+
* @shortname set tolerance
|
|
56
|
+
* @drawable false
|
|
57
|
+
*/
|
|
10
58
|
setTolerance(inputs: Inputs.Manifold.ManifoldRefineToleranceDto<Manifold3D.Manifold>): Manifold3D.Manifold;
|
|
11
|
-
|
|
59
|
+
/**
|
|
60
|
+
* Returns the first of n sequential new unique mesh IDs for marking sets of triangles that can be looked up after further operations. Assign to Mesh.runOriginalID vector.
|
|
61
|
+
* @param inputs count
|
|
62
|
+
* @returns void
|
|
63
|
+
* @group basic
|
|
64
|
+
* @shortname reserve id
|
|
65
|
+
* @drawable false
|
|
66
|
+
*/
|
|
12
67
|
reserveIds(inputs: Inputs.Manifold.CountDto): number;
|
|
68
|
+
/**
|
|
69
|
+
* If you copy a manifold, but you want this new copy to have new properties
|
|
70
|
+
* (e.g. a different UV mapping), you can reset its IDs to a new original,
|
|
71
|
+
* meaning it will now be referenced by its descendants instead of the meshes
|
|
72
|
+
* it was built from, allowing you to differentiate the copies when applying
|
|
73
|
+
* your properties to the final result.
|
|
74
|
+
*
|
|
75
|
+
* This function also condenses all coplanar faces in the relation, and
|
|
76
|
+
* collapses those edges. If you want to have inconsistent properties across
|
|
77
|
+
* these faces, meaning you want to preserve some of these edges, you should
|
|
78
|
+
* instead call GetMesh(), calculate your properties and use these to
|
|
79
|
+
* construct a new manifold.
|
|
80
|
+
* @param inputs manifold
|
|
81
|
+
* @returns original manifold
|
|
82
|
+
* @group basic
|
|
83
|
+
* @shortname as original
|
|
84
|
+
* @drawable true
|
|
85
|
+
*/
|
|
86
|
+
asOriginal(inputs: Inputs.Manifold.ManifoldDto<Manifold3D.Manifold>): Manifold3D.Manifold;
|
|
87
|
+
/**
|
|
88
|
+
* Constructs a new manifold from a list of other manifolds. This is a purely
|
|
89
|
+
* topological operation, so care should be taken to avoid creating
|
|
90
|
+
* overlapping results. It is the inverse operation of Decompose().
|
|
91
|
+
* @param inputs manifold shapes
|
|
92
|
+
* @returns composed manifold
|
|
93
|
+
* @group composition
|
|
94
|
+
* @shortname compose
|
|
95
|
+
* @drawable true
|
|
96
|
+
*/
|
|
13
97
|
compose(inputs: Inputs.Manifold.ManifoldsDto<Manifold3D.Manifold>): Manifold3D.Manifold;
|
|
98
|
+
/**
|
|
99
|
+
* This operation returns a vector of Manifolds that are topologically
|
|
100
|
+
* disconnected. If everything is connected, the vector is length one,
|
|
101
|
+
* containing a copy of the original. It is the inverse operation of
|
|
102
|
+
* Compose().
|
|
103
|
+
* @param inputs manifold
|
|
104
|
+
* @returns decomposed manifold shapes
|
|
105
|
+
* @group composition
|
|
106
|
+
* @shortname decompose
|
|
107
|
+
* @drawable true
|
|
108
|
+
*/
|
|
14
109
|
decompose(inputs: Inputs.Manifold.ManifoldDto<Manifold3D.Manifold>): Manifold3D.Manifold[];
|
|
110
|
+
/**
|
|
111
|
+
* Fills in vertex properties for normal vectors, calculated from the mesh
|
|
112
|
+
* geometry. Flat faces composed of three or more triangles will remain flat.
|
|
113
|
+
* @param inputs manifold and normal index with minimum sharp angle
|
|
114
|
+
* @returns manifold with calculated normals
|
|
115
|
+
* @group adjustments
|
|
116
|
+
* @shortname calculate normals
|
|
117
|
+
* @drawable true
|
|
118
|
+
*/
|
|
15
119
|
calculateNormals(inputs: Inputs.Manifold.CalculateNormalsDto<Manifold3D.Manifold>): Manifold3D.Manifold;
|
|
120
|
+
/**
|
|
121
|
+
* Curvature is the inverse of the radius of curvature, and signed such that
|
|
122
|
+
* positive is convex and negative is concave. There are two orthogonal
|
|
123
|
+
* principal curvatures at any point on a manifold, with one maximum and the
|
|
124
|
+
* other minimum. Gaussian curvature is their product, while mean
|
|
125
|
+
* curvature is their sum. This approximates them for every vertex and assigns
|
|
126
|
+
* them as vertex properties on the given channels.
|
|
127
|
+
* @param inputs manifold and gaussian and mean index
|
|
128
|
+
* @returns manifold with calculated curvature
|
|
129
|
+
* @group adjustments
|
|
130
|
+
* @shortname calculate curvature
|
|
131
|
+
* @drawable true
|
|
132
|
+
*/
|
|
16
133
|
calculateCurvature(inputs: Inputs.Manifold.CalculateCurvatureDto<Manifold3D.Manifold>): Manifold3D.Manifold;
|
|
134
|
+
/**
|
|
135
|
+
* Increase the density of the mesh by splitting each edge into pieces such
|
|
136
|
+
* that any point on the resulting triangles is roughly within tolerance of
|
|
137
|
+
* the smoothly curved surface defined by the tangent vectors. This means
|
|
138
|
+
* tightly curving regions will be divided more finely than smoother regions.
|
|
139
|
+
* If halfedgeTangents are not present, the result will simply be a copy of
|
|
140
|
+
* the original. Quads will ignore their interior triangle bisector.
|
|
141
|
+
* @param inputs manifold and tolerance
|
|
142
|
+
* @returns refined manifold
|
|
143
|
+
* @group adjustments
|
|
144
|
+
* @shortname refine to tolerance
|
|
145
|
+
* @drawable true
|
|
146
|
+
*/
|
|
17
147
|
refineToTolerance(inputs: Inputs.Manifold.ManifoldRefineToleranceDto<Manifold3D.Manifold>): Manifold3D.Manifold;
|
|
148
|
+
/**
|
|
149
|
+
* Increase the density of the mesh by splitting each edge into pieces of
|
|
150
|
+
* roughly the input length. Interior verts are added to keep the rest of the
|
|
151
|
+
* triangulation edges also of roughly the same length. If halfedgeTangents
|
|
152
|
+
* are present (e.g. from the Smooth() constructor), the new vertices will be
|
|
153
|
+
* moved to the interpolated surface according to their barycentric
|
|
154
|
+
* coordinates.
|
|
155
|
+
* @param inputs manifold and length
|
|
156
|
+
* @returns refined manifold
|
|
157
|
+
* @group adjustments
|
|
158
|
+
* @shortname refine to length
|
|
159
|
+
* @drawable true
|
|
160
|
+
*/
|
|
18
161
|
refineToLength(inputs: Inputs.Manifold.ManifoldRefineLengthDto<Manifold3D.Manifold>): Manifold3D.Manifold;
|
|
162
|
+
/**
|
|
163
|
+
* Increase the density of the mesh by splitting every edge into n pieces. For
|
|
164
|
+
* instance, with n = 2, each triangle will be split into 4 triangles. These
|
|
165
|
+
* will all be coplanar (and will not be immediately collapsed) unless the
|
|
166
|
+
* Mesh/Manifold has halfedgeTangents specified (e.g. from the Smooth()
|
|
167
|
+
* constructor), in which case the new vertices will be moved to the
|
|
168
|
+
* interpolated surface according to their barycentric coordinates.
|
|
169
|
+
* @param inputs manifold and count
|
|
170
|
+
* @returns refined manifold
|
|
171
|
+
* @group adjustments
|
|
172
|
+
* @shortname refine
|
|
173
|
+
* @drawable true
|
|
174
|
+
*/
|
|
19
175
|
refine(inputs: Inputs.Manifold.ManifoldRefineDto<Manifold3D.Manifold>): Manifold3D.Manifold;
|
|
176
|
+
/**
|
|
177
|
+
* Smooths out the Manifold by filling in the halfedgeTangent vectors. The
|
|
178
|
+
* geometry will remain unchanged until Refine or RefineToLength is called to
|
|
179
|
+
* interpolate the surface. This version uses the geometry of the triangles
|
|
180
|
+
* and pseudo-normals to define the tangent vectors.
|
|
181
|
+
* @param inputs manifold and minimum sharp angle and minimum smoothness
|
|
182
|
+
* @returns smoothed manifold
|
|
183
|
+
* @group adjustments
|
|
184
|
+
* @shortname smooth out
|
|
185
|
+
* @drawable true
|
|
186
|
+
*/
|
|
20
187
|
smoothOut(inputs: Inputs.Manifold.ManifoldSmoothOutDto<Manifold3D.Manifold>): Manifold3D.Manifold;
|
|
188
|
+
/**
|
|
189
|
+
* Smooths out the Manifold by filling in the halfedgeTangent vectors. The
|
|
190
|
+
* geometry will remain unchanged until Refine or RefineToLength is called to
|
|
191
|
+
* interpolate the surface. This version uses the supplied vertex normal
|
|
192
|
+
* properties to define the tangent vectors.
|
|
193
|
+
* @param inputs manifold and normal index
|
|
194
|
+
* @returns smoothed manifold
|
|
195
|
+
* @group adjustments
|
|
196
|
+
* @shortname smooth by normals
|
|
197
|
+
* @drawable true
|
|
198
|
+
*/
|
|
21
199
|
smoothByNormals(inputs: Inputs.Manifold.ManifoldSmoothByNormalsDto<Manifold3D.Manifold>): Manifold3D.Manifold;
|
|
200
|
+
/**
|
|
201
|
+
* Return a copy of the manifold simplified to the given tolerance, but with
|
|
202
|
+
* its actual tolerance value unchanged. The result will contain a subset of
|
|
203
|
+
* the original verts and all surfaces will have moved by less than tolerance.
|
|
204
|
+
* @param inputs manifold and tolerance
|
|
205
|
+
* @returns simplified manifold
|
|
206
|
+
* @group adjustments
|
|
207
|
+
* @shortname simplify
|
|
208
|
+
* @drawable true
|
|
209
|
+
*/
|
|
22
210
|
simplify(inputs: Inputs.Manifold.ManifoldSimplifyDto<Manifold3D.Manifold>): Manifold3D.Manifold;
|
|
211
|
+
/**
|
|
212
|
+
* Create a new copy of this manifold with updated vertex properties by
|
|
213
|
+
* supplying a function that takes the existing position and properties as
|
|
214
|
+
* input. You may specify any number of output properties, allowing creation
|
|
215
|
+
* and removal of channels. Note: undefined behavior will result if you read
|
|
216
|
+
* past the number of input properties or write past the number of output
|
|
217
|
+
* properties.
|
|
218
|
+
* @param inputs manifold, numProp and property function
|
|
219
|
+
* @returns manifold with updated properties
|
|
220
|
+
* @group adjustments
|
|
221
|
+
* @shortname set properties
|
|
222
|
+
* @drawable true
|
|
223
|
+
*/
|
|
23
224
|
setProperties(inputs: Inputs.Manifold.ManifoldSetPropertiesDto<Manifold3D.Manifold>): Manifold3D.Manifold;
|
|
24
225
|
}
|
|
@@ -1,64 +1,265 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contains various functions for Solid meshes from Manifold library https://github.com/elalish/manifold
|
|
3
|
+
* Thanks Manifold community for developing this kernel
|
|
4
|
+
*/
|
|
1
5
|
export class ManifoldOperations {
|
|
2
6
|
constructor(wasm) {
|
|
3
7
|
this.manifold = wasm;
|
|
4
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Computes convex hull of the manifold shape provided
|
|
11
|
+
* @param inputs two shapes
|
|
12
|
+
* @returns hulled manifold shape
|
|
13
|
+
* @group hulls
|
|
14
|
+
* @shortname convex hull
|
|
15
|
+
* @drawable true
|
|
16
|
+
*/
|
|
5
17
|
hull(inputs) {
|
|
6
18
|
return inputs.manifold.hull();
|
|
7
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Hull points or manifolds
|
|
22
|
+
* @param inputs manifold
|
|
23
|
+
* @returns manifold
|
|
24
|
+
* @group hulls
|
|
25
|
+
* @shortname hull points
|
|
26
|
+
* @drawable true
|
|
27
|
+
*/
|
|
8
28
|
hullPoints(inputs) {
|
|
9
29
|
const { Manifold } = this.manifold;
|
|
10
30
|
const { hull } = Manifold;
|
|
11
31
|
return hull(inputs.points);
|
|
12
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Returns the cross section of this object parallel to the X-Y plane at the
|
|
35
|
+
* specified height. Using a height equal to the bottom
|
|
36
|
+
* of the bounding box will return the bottom faces, while using a height
|
|
37
|
+
* equal to the top of the bounding box will return empty.
|
|
38
|
+
* @param inputs manifold and height
|
|
39
|
+
* @returns sliced cross section
|
|
40
|
+
* @group cross sections
|
|
41
|
+
* @shortname slice
|
|
42
|
+
* @drawable true
|
|
43
|
+
*/
|
|
13
44
|
slice(inputs) {
|
|
14
45
|
return inputs.manifold.slice(inputs.height);
|
|
15
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Creates a projection on xy plane from the shape outline
|
|
49
|
+
* @param inputs manifold
|
|
50
|
+
* @returns projected cross section
|
|
51
|
+
* @group cross sections
|
|
52
|
+
* @shortname project
|
|
53
|
+
* @drawable true
|
|
54
|
+
*/
|
|
16
55
|
project(inputs) {
|
|
17
56
|
return inputs.manifold.project();
|
|
18
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Return a copy of the manifold with the set tolerance value.
|
|
60
|
+
* This performs mesh simplification when the tolerance value is increased.
|
|
61
|
+
* @param inputs manifold and tolerance
|
|
62
|
+
* @returns manifold with new tolerance
|
|
63
|
+
* @group basic
|
|
64
|
+
* @shortname set tolerance
|
|
65
|
+
* @drawable false
|
|
66
|
+
*/
|
|
19
67
|
setTolerance(inputs) {
|
|
20
68
|
return inputs.manifold.setTolerance(inputs.tolerance);
|
|
21
69
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
70
|
+
/**
|
|
71
|
+
* Returns the first of n sequential new unique mesh IDs for marking sets of triangles that can be looked up after further operations. Assign to Mesh.runOriginalID vector.
|
|
72
|
+
* @param inputs count
|
|
73
|
+
* @returns void
|
|
74
|
+
* @group basic
|
|
75
|
+
* @shortname reserve id
|
|
76
|
+
* @drawable false
|
|
77
|
+
*/
|
|
25
78
|
reserveIds(inputs) {
|
|
26
79
|
const { Manifold } = this.manifold;
|
|
27
80
|
const { reserveIDs } = Manifold;
|
|
28
81
|
return reserveIDs(inputs.count);
|
|
29
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* If you copy a manifold, but you want this new copy to have new properties
|
|
85
|
+
* (e.g. a different UV mapping), you can reset its IDs to a new original,
|
|
86
|
+
* meaning it will now be referenced by its descendants instead of the meshes
|
|
87
|
+
* it was built from, allowing you to differentiate the copies when applying
|
|
88
|
+
* your properties to the final result.
|
|
89
|
+
*
|
|
90
|
+
* This function also condenses all coplanar faces in the relation, and
|
|
91
|
+
* collapses those edges. If you want to have inconsistent properties across
|
|
92
|
+
* these faces, meaning you want to preserve some of these edges, you should
|
|
93
|
+
* instead call GetMesh(), calculate your properties and use these to
|
|
94
|
+
* construct a new manifold.
|
|
95
|
+
* @param inputs manifold
|
|
96
|
+
* @returns original manifold
|
|
97
|
+
* @group basic
|
|
98
|
+
* @shortname as original
|
|
99
|
+
* @drawable true
|
|
100
|
+
*/
|
|
101
|
+
asOriginal(inputs) {
|
|
102
|
+
return inputs.manifold.asOriginal();
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Constructs a new manifold from a list of other manifolds. This is a purely
|
|
106
|
+
* topological operation, so care should be taken to avoid creating
|
|
107
|
+
* overlapping results. It is the inverse operation of Decompose().
|
|
108
|
+
* @param inputs manifold shapes
|
|
109
|
+
* @returns composed manifold
|
|
110
|
+
* @group composition
|
|
111
|
+
* @shortname compose
|
|
112
|
+
* @drawable true
|
|
113
|
+
*/
|
|
30
114
|
compose(inputs) {
|
|
31
115
|
const { Manifold } = this.manifold;
|
|
32
116
|
const { compose } = Manifold;
|
|
33
117
|
return compose(inputs.manifolds);
|
|
34
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* This operation returns a vector of Manifolds that are topologically
|
|
121
|
+
* disconnected. If everything is connected, the vector is length one,
|
|
122
|
+
* containing a copy of the original. It is the inverse operation of
|
|
123
|
+
* Compose().
|
|
124
|
+
* @param inputs manifold
|
|
125
|
+
* @returns decomposed manifold shapes
|
|
126
|
+
* @group composition
|
|
127
|
+
* @shortname decompose
|
|
128
|
+
* @drawable true
|
|
129
|
+
*/
|
|
35
130
|
decompose(inputs) {
|
|
36
131
|
return inputs.manifold.decompose();
|
|
37
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* Fills in vertex properties for normal vectors, calculated from the mesh
|
|
135
|
+
* geometry. Flat faces composed of three or more triangles will remain flat.
|
|
136
|
+
* @param inputs manifold and normal index with minimum sharp angle
|
|
137
|
+
* @returns manifold with calculated normals
|
|
138
|
+
* @group adjustments
|
|
139
|
+
* @shortname calculate normals
|
|
140
|
+
* @drawable true
|
|
141
|
+
*/
|
|
38
142
|
calculateNormals(inputs) {
|
|
39
143
|
return inputs.manifold.calculateNormals(inputs.normalIdx, inputs.minSharpAngle);
|
|
40
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* Curvature is the inverse of the radius of curvature, and signed such that
|
|
147
|
+
* positive is convex and negative is concave. There are two orthogonal
|
|
148
|
+
* principal curvatures at any point on a manifold, with one maximum and the
|
|
149
|
+
* other minimum. Gaussian curvature is their product, while mean
|
|
150
|
+
* curvature is their sum. This approximates them for every vertex and assigns
|
|
151
|
+
* them as vertex properties on the given channels.
|
|
152
|
+
* @param inputs manifold and gaussian and mean index
|
|
153
|
+
* @returns manifold with calculated curvature
|
|
154
|
+
* @group adjustments
|
|
155
|
+
* @shortname calculate curvature
|
|
156
|
+
* @drawable true
|
|
157
|
+
*/
|
|
41
158
|
calculateCurvature(inputs) {
|
|
42
159
|
return inputs.manifold.calculateCurvature(inputs.gaussianIdx, inputs.meanIdx);
|
|
43
160
|
}
|
|
161
|
+
/**
|
|
162
|
+
* Increase the density of the mesh by splitting each edge into pieces such
|
|
163
|
+
* that any point on the resulting triangles is roughly within tolerance of
|
|
164
|
+
* the smoothly curved surface defined by the tangent vectors. This means
|
|
165
|
+
* tightly curving regions will be divided more finely than smoother regions.
|
|
166
|
+
* If halfedgeTangents are not present, the result will simply be a copy of
|
|
167
|
+
* the original. Quads will ignore their interior triangle bisector.
|
|
168
|
+
* @param inputs manifold and tolerance
|
|
169
|
+
* @returns refined manifold
|
|
170
|
+
* @group adjustments
|
|
171
|
+
* @shortname refine to tolerance
|
|
172
|
+
* @drawable true
|
|
173
|
+
*/
|
|
44
174
|
refineToTolerance(inputs) {
|
|
45
175
|
return inputs.manifold.refineToTolerance(inputs.tolerance);
|
|
46
176
|
}
|
|
177
|
+
/**
|
|
178
|
+
* Increase the density of the mesh by splitting each edge into pieces of
|
|
179
|
+
* roughly the input length. Interior verts are added to keep the rest of the
|
|
180
|
+
* triangulation edges also of roughly the same length. If halfedgeTangents
|
|
181
|
+
* are present (e.g. from the Smooth() constructor), the new vertices will be
|
|
182
|
+
* moved to the interpolated surface according to their barycentric
|
|
183
|
+
* coordinates.
|
|
184
|
+
* @param inputs manifold and length
|
|
185
|
+
* @returns refined manifold
|
|
186
|
+
* @group adjustments
|
|
187
|
+
* @shortname refine to length
|
|
188
|
+
* @drawable true
|
|
189
|
+
*/
|
|
47
190
|
refineToLength(inputs) {
|
|
48
191
|
return inputs.manifold.refineToLength(inputs.length);
|
|
49
192
|
}
|
|
193
|
+
/**
|
|
194
|
+
* Increase the density of the mesh by splitting every edge into n pieces. For
|
|
195
|
+
* instance, with n = 2, each triangle will be split into 4 triangles. These
|
|
196
|
+
* will all be coplanar (and will not be immediately collapsed) unless the
|
|
197
|
+
* Mesh/Manifold has halfedgeTangents specified (e.g. from the Smooth()
|
|
198
|
+
* constructor), in which case the new vertices will be moved to the
|
|
199
|
+
* interpolated surface according to their barycentric coordinates.
|
|
200
|
+
* @param inputs manifold and count
|
|
201
|
+
* @returns refined manifold
|
|
202
|
+
* @group adjustments
|
|
203
|
+
* @shortname refine
|
|
204
|
+
* @drawable true
|
|
205
|
+
*/
|
|
50
206
|
refine(inputs) {
|
|
51
207
|
return inputs.manifold.refine(inputs.number);
|
|
52
208
|
}
|
|
209
|
+
/**
|
|
210
|
+
* Smooths out the Manifold by filling in the halfedgeTangent vectors. The
|
|
211
|
+
* geometry will remain unchanged until Refine or RefineToLength is called to
|
|
212
|
+
* interpolate the surface. This version uses the geometry of the triangles
|
|
213
|
+
* and pseudo-normals to define the tangent vectors.
|
|
214
|
+
* @param inputs manifold and minimum sharp angle and minimum smoothness
|
|
215
|
+
* @returns smoothed manifold
|
|
216
|
+
* @group adjustments
|
|
217
|
+
* @shortname smooth out
|
|
218
|
+
* @drawable true
|
|
219
|
+
*/
|
|
53
220
|
smoothOut(inputs) {
|
|
54
221
|
return inputs.manifold.smoothOut(inputs.minSharpAngle, inputs.minSmoothness);
|
|
55
222
|
}
|
|
223
|
+
/**
|
|
224
|
+
* Smooths out the Manifold by filling in the halfedgeTangent vectors. The
|
|
225
|
+
* geometry will remain unchanged until Refine or RefineToLength is called to
|
|
226
|
+
* interpolate the surface. This version uses the supplied vertex normal
|
|
227
|
+
* properties to define the tangent vectors.
|
|
228
|
+
* @param inputs manifold and normal index
|
|
229
|
+
* @returns smoothed manifold
|
|
230
|
+
* @group adjustments
|
|
231
|
+
* @shortname smooth by normals
|
|
232
|
+
* @drawable true
|
|
233
|
+
*/
|
|
56
234
|
smoothByNormals(inputs) {
|
|
57
235
|
return inputs.manifold.smoothByNormals(inputs.normalIdx);
|
|
58
236
|
}
|
|
237
|
+
/**
|
|
238
|
+
* Return a copy of the manifold simplified to the given tolerance, but with
|
|
239
|
+
* its actual tolerance value unchanged. The result will contain a subset of
|
|
240
|
+
* the original verts and all surfaces will have moved by less than tolerance.
|
|
241
|
+
* @param inputs manifold and tolerance
|
|
242
|
+
* @returns simplified manifold
|
|
243
|
+
* @group adjustments
|
|
244
|
+
* @shortname simplify
|
|
245
|
+
* @drawable true
|
|
246
|
+
*/
|
|
59
247
|
simplify(inputs) {
|
|
60
248
|
return inputs.manifold.simplify(inputs.tolerance);
|
|
61
249
|
}
|
|
250
|
+
/**
|
|
251
|
+
* Create a new copy of this manifold with updated vertex properties by
|
|
252
|
+
* supplying a function that takes the existing position and properties as
|
|
253
|
+
* input. You may specify any number of output properties, allowing creation
|
|
254
|
+
* and removal of channels. Note: undefined behavior will result if you read
|
|
255
|
+
* past the number of input properties or write past the number of output
|
|
256
|
+
* properties.
|
|
257
|
+
* @param inputs manifold, numProp and property function
|
|
258
|
+
* @returns manifold with updated properties
|
|
259
|
+
* @group adjustments
|
|
260
|
+
* @shortname set properties
|
|
261
|
+
* @drawable true
|
|
262
|
+
*/
|
|
62
263
|
setProperties(inputs) {
|
|
63
264
|
return inputs.manifold.setProperties(inputs.numProp, inputs.propFunc);
|
|
64
265
|
}
|
|
@@ -1,12 +1,71 @@
|
|
|
1
1
|
import * as Inputs from "../../inputs/manifold-inputs";
|
|
2
2
|
import * as Manifold3D from "manifold-3d";
|
|
3
|
+
/**
|
|
4
|
+
* Contains various functions for Solid meshes from Manifold library https://github.com/elalish/manifold
|
|
5
|
+
* Thanks Manifold community for developing this kernel
|
|
6
|
+
*/
|
|
3
7
|
export declare class ManifoldShapes {
|
|
4
8
|
private manifold;
|
|
5
9
|
constructor(wasm: Manifold3D.ManifoldToplevel);
|
|
10
|
+
/**
|
|
11
|
+
* Convert a Mesh into a Manifold, retaining its properties and merging only
|
|
12
|
+
* the positions according to the merge vectors. Will throw an error if the
|
|
13
|
+
* result is not an oriented 2-manifold. Will collapse degenerate triangles
|
|
14
|
+
* and unnecessary vertices.
|
|
15
|
+
*
|
|
16
|
+
* All fields are read, making this structure suitable for a lossless
|
|
17
|
+
* round-trip of data from manifoldToMesh(). For multi-material input, use
|
|
18
|
+
* reserveIDs() to set a unique originalID for each material, and sort the
|
|
19
|
+
* materials into triangle runs.
|
|
20
|
+
* @param inputs mesh definition
|
|
21
|
+
* @returns manifold
|
|
22
|
+
* @group create
|
|
23
|
+
* @shortname manifold from mesh
|
|
24
|
+
* @drawable true
|
|
25
|
+
*/
|
|
6
26
|
manifoldFromMesh(inputs: Inputs.Manifold.CreateFromMeshDto): Manifold3D.Manifold;
|
|
27
|
+
/**
|
|
28
|
+
* Create a Manifold from a set of polygon points describing triangles.
|
|
29
|
+
* @param inputs Polygon points
|
|
30
|
+
* @returns Manifold
|
|
31
|
+
* @group create
|
|
32
|
+
* @shortname from polygon points
|
|
33
|
+
* @drawable true
|
|
34
|
+
*/
|
|
7
35
|
fromPolygonPoints(inputs: Inputs.Manifold.FromPolygonPointsDto): Manifold3D.Manifold;
|
|
36
|
+
/**
|
|
37
|
+
* Create a 3D cube shape
|
|
38
|
+
* @param inputs Cube parameters
|
|
39
|
+
* @returns Cube solid
|
|
40
|
+
* @group primitives
|
|
41
|
+
* @shortname cube
|
|
42
|
+
* @drawable true
|
|
43
|
+
*/
|
|
8
44
|
cube(inputs: Inputs.Manifold.CubeDto): Manifold3D.Manifold;
|
|
45
|
+
/**
|
|
46
|
+
* Create a 3D sphere shape
|
|
47
|
+
* @param inputs Sphere parameters
|
|
48
|
+
* @returns Sphere solid
|
|
49
|
+
* @group primitives
|
|
50
|
+
* @shortname sphere
|
|
51
|
+
* @drawable true
|
|
52
|
+
*/
|
|
9
53
|
sphere(inputs: Inputs.Manifold.SphereDto): Manifold3D.Manifold;
|
|
54
|
+
/**
|
|
55
|
+
* Create a 3D tetrahedron shape
|
|
56
|
+
* @returns Tetrahedron solid
|
|
57
|
+
* @group primitives
|
|
58
|
+
* @shortname tetrahedron
|
|
59
|
+
* @drawable true
|
|
60
|
+
*/
|
|
10
61
|
tetrahedron(): Manifold3D.Manifold;
|
|
62
|
+
/**
|
|
63
|
+
* Create a 3D cylinder shape
|
|
64
|
+
* @param inputs Cylinder parameters
|
|
65
|
+
* @returns Cylinder solid
|
|
66
|
+
* @group primitives
|
|
67
|
+
* @shortname cylinder
|
|
68
|
+
* @drawable true
|
|
69
|
+
*/
|
|
11
70
|
cylinder(inputs: Inputs.Manifold.CylinderDto): Manifold3D.Manifold;
|
|
12
71
|
}
|