@bitbybit-dev/manifold 1.2.0-rc.2 → 1.3.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/lib/api/inputs/manifold-inputs.d.ts +521 -224
- package/lib/api/inputs/manifold-inputs.js +380 -135
- package/lib/api/manifold-service.d.ts +37 -11
- package/lib/api/manifold-service.js +37 -11
- package/lib/api/services/cross-section/cross-section-booleans.d.ts +66 -29
- package/lib/api/services/cross-section/cross-section-booleans.js +66 -29
- package/lib/api/services/cross-section/cross-section-evaluate.d.ts +38 -17
- package/lib/api/services/cross-section/cross-section-evaluate.js +38 -17
- package/lib/api/services/cross-section/cross-section-operations.d.ts +73 -33
- package/lib/api/services/cross-section/cross-section-operations.js +73 -33
- package/lib/api/services/cross-section/cross-section-shapes.d.ts +38 -17
- package/lib/api/services/cross-section/cross-section-shapes.js +38 -17
- package/lib/api/services/cross-section/cross-section-transforms.d.ts +64 -29
- package/lib/api/services/cross-section/cross-section-transforms.js +64 -29
- package/lib/api/services/cross-section/cross-section.d.ts +81 -20
- package/lib/api/services/cross-section/cross-section.js +81 -20
- package/lib/api/services/manifold/manifold-booleans.d.ts +139 -43
- package/lib/api/services/manifold/manifold-booleans.js +143 -43
- package/lib/api/services/manifold/manifold-evaluate.d.ts +134 -59
- package/lib/api/services/manifold/manifold-evaluate.js +141 -59
- package/lib/api/services/manifold/manifold-operations.d.ts +195 -108
- package/lib/api/services/manifold/manifold-operations.js +197 -110
- package/lib/api/services/manifold/manifold-shapes.d.ts +64 -26
- package/lib/api/services/manifold/manifold-shapes.js +66 -28
- package/lib/api/services/manifold/manifold-transforms.d.ts +100 -38
- package/lib/api/services/manifold/manifold-transforms.js +100 -38
- package/lib/api/services/manifold/manifold.d.ts +25 -8
- package/lib/api/services/manifold/manifold.js +25 -8
- package/lib/api/services/mesh/mesh-evaluate.d.ts +103 -32
- package/lib/api/services/mesh/mesh-evaluate.js +108 -33
- package/lib/api/services/mesh/mesh-operations.d.ts +12 -15
- package/lib/api/services/mesh/mesh-operations.js +12 -15
- package/lib/api/services/mesh/mesh.d.ts +4 -2
- package/lib/api/services/mesh/mesh.js +4 -2
- package/package.json +3 -3
|
@@ -6,8 +6,11 @@ import { ManifoldTransforms } from "./manifold-transforms";
|
|
|
6
6
|
import { ManifoldEvaluate } from "./manifold-evaluate";
|
|
7
7
|
import * as Inputs from "../../inputs";
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* Solids in the Manifold kernel: `shapes` builds cubes, spheres, cylinders and solids from meshes,
|
|
10
|
+
* `booleans` fuses, cuts and splits them, `operations` hulls, slices, refines and smooths them,
|
|
11
|
+
* `transforms` moves them and `evaluate` measures them. A solid here is a closed triangle mesh;
|
|
12
|
+
* every operation returns a new solid and the inputs stay as they are. The methods on this class
|
|
13
|
+
* turn solids into plain mesh data.
|
|
11
14
|
*/
|
|
12
15
|
export declare class Manifold {
|
|
13
16
|
plugins: any;
|
|
@@ -18,21 +21,35 @@ export declare class Manifold {
|
|
|
18
21
|
evaluate: ManifoldEvaluate;
|
|
19
22
|
constructor(wasm: Manifold3D.ManifoldToplevel);
|
|
20
23
|
/**
|
|
21
|
-
* Turns
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
+
* Turns a solid into plain mesh data: vertex properties, triangle indexes and the runs that
|
|
25
|
+
* group triangles by their original shape.
|
|
26
|
+
*
|
|
27
|
+
* `normalIdx` names the vertex property channel that holds normals, when the solid carries
|
|
28
|
+
* them.
|
|
29
|
+
* @param inputs - The solid and the optional normal channel
|
|
30
|
+
* @returns The mesh data
|
|
24
31
|
* @group meshing
|
|
25
32
|
* @shortname manifold to mesh
|
|
26
33
|
* @drawable false
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* const mesh = await bitbybit.manifold.manifold.manifoldToMesh({ manifold: cube });
|
|
37
|
+
* ```
|
|
27
38
|
*/
|
|
28
39
|
manifoldToMesh(inputs: Inputs.Manifold.ManifoldToMeshDto<Manifold3D.Manifold>): Manifold3D.Mesh;
|
|
29
40
|
/**
|
|
30
|
-
* Turns
|
|
31
|
-
*
|
|
32
|
-
*
|
|
41
|
+
* Turns several solids into plain mesh data, as `manifoldToMesh` does for one.
|
|
42
|
+
*
|
|
43
|
+
* `normalIdx` gives one normal channel per solid.
|
|
44
|
+
* @param inputs - The solids and the optional normal channels
|
|
45
|
+
* @returns One mesh per solid, in the same order
|
|
33
46
|
* @group meshing
|
|
34
47
|
* @shortname manifolds to meshes
|
|
35
48
|
* @drawable false
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* const meshes = await bitbybit.manifold.manifold.manifoldsToMeshes({ manifolds: [cube, sphere] });
|
|
52
|
+
* ```
|
|
36
53
|
*/
|
|
37
54
|
manifoldsToMeshes(inputs: Inputs.Manifold.ManifoldsToMeshesDto<Manifold3D.Manifold>): (Manifold3D.Mesh)[];
|
|
38
55
|
}
|
|
@@ -4,8 +4,11 @@ import { ManifoldOperations } from "./manifold-operations";
|
|
|
4
4
|
import { ManifoldTransforms } from "./manifold-transforms";
|
|
5
5
|
import { ManifoldEvaluate } from "./manifold-evaluate";
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* Solids in the Manifold kernel: `shapes` builds cubes, spheres, cylinders and solids from meshes,
|
|
8
|
+
* `booleans` fuses, cuts and splits them, `operations` hulls, slices, refines and smooths them,
|
|
9
|
+
* `transforms` moves them and `evaluate` measures them. A solid here is a closed triangle mesh;
|
|
10
|
+
* every operation returns a new solid and the inputs stay as they are. The methods on this class
|
|
11
|
+
* turn solids into plain mesh data.
|
|
9
12
|
*/
|
|
10
13
|
export class Manifold {
|
|
11
14
|
constructor(wasm) {
|
|
@@ -16,23 +19,37 @@ export class Manifold {
|
|
|
16
19
|
this.evaluate = new ManifoldEvaluate(wasm);
|
|
17
20
|
}
|
|
18
21
|
/**
|
|
19
|
-
* Turns
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
+
* Turns a solid into plain mesh data: vertex properties, triangle indexes and the runs that
|
|
23
|
+
* group triangles by their original shape.
|
|
24
|
+
*
|
|
25
|
+
* `normalIdx` names the vertex property channel that holds normals, when the solid carries
|
|
26
|
+
* them.
|
|
27
|
+
* @param inputs - The solid and the optional normal channel
|
|
28
|
+
* @returns The mesh data
|
|
22
29
|
* @group meshing
|
|
23
30
|
* @shortname manifold to mesh
|
|
24
31
|
* @drawable false
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* const mesh = await bitbybit.manifold.manifold.manifoldToMesh({ manifold: cube });
|
|
35
|
+
* ```
|
|
25
36
|
*/
|
|
26
37
|
manifoldToMesh(inputs) {
|
|
27
38
|
return inputs.manifold.getMesh(inputs.normalIdx);
|
|
28
39
|
}
|
|
29
40
|
/**
|
|
30
|
-
* Turns
|
|
31
|
-
*
|
|
32
|
-
*
|
|
41
|
+
* Turns several solids into plain mesh data, as `manifoldToMesh` does for one.
|
|
42
|
+
*
|
|
43
|
+
* `normalIdx` gives one normal channel per solid.
|
|
44
|
+
* @param inputs - The solids and the optional normal channels
|
|
45
|
+
* @returns One mesh per solid, in the same order
|
|
33
46
|
* @group meshing
|
|
34
47
|
* @shortname manifolds to meshes
|
|
35
48
|
* @drawable false
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* const meshes = await bitbybit.manifold.manifold.manifoldsToMeshes({ manifolds: [cube, sphere] });
|
|
52
|
+
* ```
|
|
36
53
|
*/
|
|
37
54
|
manifoldsToMeshes(inputs) {
|
|
38
55
|
return inputs.manifolds.map((manifold, index) => {
|
|
@@ -1,93 +1,164 @@
|
|
|
1
1
|
import * as Inputs from "../../inputs";
|
|
2
2
|
import * as Manifold3D from "manifold-3d";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Reading Manifold mesh data: the position and extra properties of a vertex, the vertices of a
|
|
5
|
+
* triangle, the tangent of a half-edge, the transform of a triangle run, and the counts of
|
|
6
|
+
* properties, vertices, triangles and runs. Indexes count from 0.
|
|
6
7
|
*/
|
|
7
8
|
export declare class MeshEvaluate {
|
|
8
9
|
constructor(_wasm: Manifold3D.ManifoldToplevel);
|
|
9
10
|
/**
|
|
10
|
-
*
|
|
11
|
-
* @param inputs mesh
|
|
12
|
-
* @returns
|
|
11
|
+
* Reads the position of one vertex of a mesh.
|
|
12
|
+
* @param inputs - The mesh and the vertex index
|
|
13
|
+
* @returns The vertex position
|
|
13
14
|
* @group basic
|
|
14
15
|
* @shortname position
|
|
15
16
|
* @drawable true
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const point = await bitbybit.manifold.mesh.evaluate.position({ mesh, vertexIndex: 0 });
|
|
20
|
+
* ```
|
|
16
21
|
*/
|
|
17
22
|
position(inputs: Inputs.Manifold.MeshVertexIndexDto<Manifold3D.Mesh>): Inputs.Base.Point3;
|
|
18
23
|
/**
|
|
19
|
-
*
|
|
20
|
-
* @param inputs mesh
|
|
21
|
-
* @returns
|
|
24
|
+
* Reads the three vertex indexes of one triangle of a mesh, in counterclockwise order.
|
|
25
|
+
* @param inputs - The mesh and the triangle index
|
|
26
|
+
* @returns The three vertex indexes
|
|
22
27
|
* @group basic
|
|
23
28
|
* @shortname verts
|
|
24
29
|
* @drawable false
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const corners = await bitbybit.manifold.mesh.evaluate.verts({ mesh, triangleIndex: 0 });
|
|
33
|
+
* ```
|
|
25
34
|
*/
|
|
26
35
|
verts(inputs: Inputs.Manifold.MeshTriangleIndexDto<Manifold3D.Mesh>): number[];
|
|
27
36
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
37
|
+
* Reads the tangent of one half-edge of a smoothed mesh: the direction the surface leaves the
|
|
38
|
+
* edge's start vertex in, as three numbers plus a weight.
|
|
39
|
+
*
|
|
40
|
+
* Half-edge three times the triangle index plus `j` is the edge of triangle `t` that starts at
|
|
41
|
+
* its `j`-th vertex; a mesh without smoothing tangents has none.
|
|
42
|
+
* @param inputs - The mesh and the half-edge index
|
|
43
|
+
* @returns The tangent as `[x, y, z, weight]`
|
|
32
44
|
* @group basic
|
|
33
45
|
* @shortname tangent
|
|
34
46
|
* @drawable true
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* const tangent = await bitbybit.manifold.mesh.evaluate.tangent({ mesh: smoothedMesh, halfEdgeIndex: 0 });
|
|
50
|
+
* ```
|
|
35
51
|
*/
|
|
36
52
|
tangent(inputs: Inputs.Manifold.MeshHalfEdgeIndexDto<Manifold3D.Mesh>): number[];
|
|
37
53
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* @
|
|
54
|
+
* Reads the properties of one vertex beyond its position, such as normals or colors stored in
|
|
55
|
+
* extra channels.
|
|
56
|
+
* @param inputs - The mesh and the vertex index
|
|
57
|
+
* @returns The extra property values, in channel order
|
|
41
58
|
* @group basic
|
|
42
59
|
* @shortname extras
|
|
43
60
|
* @drawable false
|
|
61
|
+
* @example
|
|
62
|
+
* ```typescript
|
|
63
|
+
* const props = await bitbybit.manifold.mesh.evaluate.extras({ mesh, vertexIndex: 0 });
|
|
64
|
+
* ```
|
|
44
65
|
*/
|
|
45
66
|
extras(inputs: Inputs.Manifold.MeshVertexIndexDto<Manifold3D.Mesh>): number[];
|
|
46
67
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* @param inputs mesh
|
|
50
|
-
* @returns
|
|
68
|
+
* Reads the column-major 4x4 matrix that carries the original mesh onto one run of triangles,
|
|
69
|
+
* the placement of that instance.
|
|
70
|
+
* @param inputs - The mesh and the run index
|
|
71
|
+
* @returns The 16 numbers of the matrix
|
|
51
72
|
* @group basic
|
|
52
73
|
* @shortname transform 4x4 matrix
|
|
53
74
|
* @drawable false
|
|
75
|
+
* @example
|
|
76
|
+
* ```typescript
|
|
77
|
+
* const placement = await bitbybit.manifold.mesh.evaluate.transform({ mesh, triangleRunIndex: 0 });
|
|
78
|
+
* ```
|
|
54
79
|
*/
|
|
55
80
|
transform(inputs: Inputs.Manifold.MeshTriangleRunIndexDto<Manifold3D.Mesh>): number[];
|
|
56
81
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
82
|
+
* Tells whether one run of triangles faces the other way than the original mesh it came from,
|
|
83
|
+
* as the inner surface left by a subtraction does. Informational: the normals a mesh hands out
|
|
84
|
+
* are already oriented for the result.
|
|
85
|
+
* @param inputs - The mesh and the run index
|
|
86
|
+
* @returns True when the run is a backside
|
|
87
|
+
* @group basic
|
|
88
|
+
* @shortname is backside
|
|
89
|
+
* @drawable false
|
|
90
|
+
* @example
|
|
91
|
+
* ```typescript
|
|
92
|
+
* const flipped = await bitbybit.manifold.mesh.evaluate.backside({ mesh, triangleRunIndex: 0 });
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
backside(inputs: Inputs.Manifold.MeshTriangleRunIndexDto<Manifold3D.Mesh>): boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Tells whether the first three extra property channels of one run of triangles hold vertex
|
|
98
|
+
* normals, which `manifold.operations.calculateNormals` writes there.
|
|
99
|
+
* @param inputs - The mesh and the run index
|
|
100
|
+
* @returns True when the run carries normals in its properties
|
|
101
|
+
* @group basic
|
|
102
|
+
* @shortname has normals
|
|
103
|
+
* @drawable false
|
|
104
|
+
* @example
|
|
105
|
+
* ```typescript
|
|
106
|
+
* const lit = await bitbybit.manifold.mesh.evaluate.hasNormals({ mesh, triangleRunIndex: 0 });
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
hasNormals(inputs: Inputs.Manifold.MeshTriangleRunIndexDto<Manifold3D.Mesh>): boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Counts the property channels each vertex of a mesh carries; the position alone takes three.
|
|
112
|
+
* @param inputs - The mesh
|
|
113
|
+
* @returns The number of properties per vertex
|
|
60
114
|
* @group basic
|
|
61
115
|
* @shortname number props
|
|
62
116
|
* @drawable false
|
|
117
|
+
* @example
|
|
118
|
+
* ```typescript
|
|
119
|
+
* const channels = await bitbybit.manifold.mesh.evaluate.numProp({ mesh });
|
|
120
|
+
* ```
|
|
63
121
|
*/
|
|
64
122
|
numProp(inputs: Inputs.Manifold.MeshDto<Manifold3D.Mesh>): number;
|
|
65
123
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
* @
|
|
124
|
+
* Counts the property vertices of a mesh, which can exceed the geometric vertices where
|
|
125
|
+
* neighboring triangles carry different properties.
|
|
126
|
+
* @param inputs - The mesh
|
|
127
|
+
* @returns The number of vertices
|
|
69
128
|
* @group basic
|
|
70
129
|
* @shortname number vertices
|
|
71
130
|
* @drawable false
|
|
131
|
+
* @example
|
|
132
|
+
* ```typescript
|
|
133
|
+
* const vertices = await bitbybit.manifold.mesh.evaluate.numVert({ mesh });
|
|
134
|
+
* ```
|
|
72
135
|
*/
|
|
73
136
|
numVert(inputs: Inputs.Manifold.MeshDto<Manifold3D.Mesh>): number;
|
|
74
137
|
/**
|
|
75
|
-
*
|
|
76
|
-
* @param inputs mesh
|
|
77
|
-
* @returns number of triangles
|
|
138
|
+
* Counts the triangles of a mesh, which together make its whole surface.
|
|
139
|
+
* @param inputs - The mesh
|
|
140
|
+
* @returns The number of triangles
|
|
78
141
|
* @group basic
|
|
79
142
|
* @shortname number triangles
|
|
80
143
|
* @drawable false
|
|
144
|
+
* @example
|
|
145
|
+
* ```typescript
|
|
146
|
+
* const triangles = await bitbybit.manifold.mesh.evaluate.numTri({ mesh });
|
|
147
|
+
* ```
|
|
81
148
|
*/
|
|
82
149
|
numTri(inputs: Inputs.Manifold.MeshDto<Manifold3D.Mesh>): number;
|
|
83
150
|
/**
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
* @param inputs mesh
|
|
87
|
-
* @returns number of runs
|
|
151
|
+
* Counts the triangle runs of a mesh: each run is a stretch of consecutive triangles that came
|
|
152
|
+
* from the same instance of the same input shape.
|
|
153
|
+
* @param inputs - The mesh
|
|
154
|
+
* @returns The number of runs
|
|
88
155
|
* @group basic
|
|
89
156
|
* @shortname number runs
|
|
90
157
|
* @drawable false
|
|
158
|
+
* @example
|
|
159
|
+
* ```typescript
|
|
160
|
+
* const runs = await bitbybit.manifold.mesh.evaluate.numRun({ mesh });
|
|
161
|
+
* ```
|
|
91
162
|
*/
|
|
92
163
|
numRun(inputs: Inputs.Manifold.MeshDto<Manifold3D.Mesh>): number;
|
|
93
164
|
}
|
|
@@ -1,113 +1,188 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Reading Manifold mesh data: the position and extra properties of a vertex, the vertices of a
|
|
3
|
+
* triangle, the tangent of a half-edge, the transform of a triangle run, and the counts of
|
|
4
|
+
* properties, vertices, triangles and runs. Indexes count from 0.
|
|
4
5
|
*/
|
|
5
6
|
export class MeshEvaluate {
|
|
6
7
|
constructor(_wasm) {
|
|
7
8
|
}
|
|
8
9
|
/**
|
|
9
|
-
*
|
|
10
|
-
* @param inputs mesh
|
|
11
|
-
* @returns
|
|
10
|
+
* Reads the position of one vertex of a mesh.
|
|
11
|
+
* @param inputs - The mesh and the vertex index
|
|
12
|
+
* @returns The vertex position
|
|
12
13
|
* @group basic
|
|
13
14
|
* @shortname position
|
|
14
15
|
* @drawable true
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const point = await bitbybit.manifold.mesh.evaluate.position({ mesh, vertexIndex: 0 });
|
|
19
|
+
* ```
|
|
15
20
|
*/
|
|
16
21
|
position(inputs) {
|
|
17
22
|
const res = inputs.mesh.position(inputs.vertexIndex);
|
|
18
23
|
return [res[0], res[1], res[2]];
|
|
19
24
|
}
|
|
20
25
|
/**
|
|
21
|
-
*
|
|
22
|
-
* @param inputs mesh
|
|
23
|
-
* @returns
|
|
26
|
+
* Reads the three vertex indexes of one triangle of a mesh, in counterclockwise order.
|
|
27
|
+
* @param inputs - The mesh and the triangle index
|
|
28
|
+
* @returns The three vertex indexes
|
|
24
29
|
* @group basic
|
|
25
30
|
* @shortname verts
|
|
26
31
|
* @drawable false
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* const corners = await bitbybit.manifold.mesh.evaluate.verts({ mesh, triangleIndex: 0 });
|
|
35
|
+
* ```
|
|
27
36
|
*/
|
|
28
37
|
verts(inputs) {
|
|
29
38
|
const res = inputs.mesh.verts(inputs.triangleIndex);
|
|
30
39
|
return [res[0], res[1], res[2]];
|
|
31
40
|
}
|
|
32
41
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
42
|
+
* Reads the tangent of one half-edge of a smoothed mesh: the direction the surface leaves the
|
|
43
|
+
* edge's start vertex in, as three numbers plus a weight.
|
|
44
|
+
*
|
|
45
|
+
* Half-edge three times the triangle index plus `j` is the edge of triangle `t` that starts at
|
|
46
|
+
* its `j`-th vertex; a mesh without smoothing tangents has none.
|
|
47
|
+
* @param inputs - The mesh and the half-edge index
|
|
48
|
+
* @returns The tangent as `[x, y, z, weight]`
|
|
37
49
|
* @group basic
|
|
38
50
|
* @shortname tangent
|
|
39
51
|
* @drawable true
|
|
52
|
+
* @example
|
|
53
|
+
* ```typescript
|
|
54
|
+
* const tangent = await bitbybit.manifold.mesh.evaluate.tangent({ mesh: smoothedMesh, halfEdgeIndex: 0 });
|
|
55
|
+
* ```
|
|
40
56
|
*/
|
|
41
57
|
tangent(inputs) {
|
|
42
58
|
const res = inputs.mesh.tangent(inputs.halfEdgeIndex);
|
|
43
|
-
return [res[0], res[1], res[2], res[
|
|
59
|
+
return [res[0], res[1], res[2], res[3]];
|
|
44
60
|
}
|
|
45
61
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* @
|
|
62
|
+
* Reads the properties of one vertex beyond its position, such as normals or colors stored in
|
|
63
|
+
* extra channels.
|
|
64
|
+
* @param inputs - The mesh and the vertex index
|
|
65
|
+
* @returns The extra property values, in channel order
|
|
49
66
|
* @group basic
|
|
50
67
|
* @shortname extras
|
|
51
68
|
* @drawable false
|
|
69
|
+
* @example
|
|
70
|
+
* ```typescript
|
|
71
|
+
* const props = await bitbybit.manifold.mesh.evaluate.extras({ mesh, vertexIndex: 0 });
|
|
72
|
+
* ```
|
|
52
73
|
*/
|
|
53
74
|
extras(inputs) {
|
|
54
75
|
const res = inputs.mesh.extras(inputs.vertexIndex);
|
|
55
76
|
return [...res];
|
|
56
77
|
}
|
|
57
78
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* @param inputs mesh
|
|
61
|
-
* @returns
|
|
79
|
+
* Reads the column-major 4x4 matrix that carries the original mesh onto one run of triangles,
|
|
80
|
+
* the placement of that instance.
|
|
81
|
+
* @param inputs - The mesh and the run index
|
|
82
|
+
* @returns The 16 numbers of the matrix
|
|
62
83
|
* @group basic
|
|
63
84
|
* @shortname transform 4x4 matrix
|
|
64
85
|
* @drawable false
|
|
86
|
+
* @example
|
|
87
|
+
* ```typescript
|
|
88
|
+
* const placement = await bitbybit.manifold.mesh.evaluate.transform({ mesh, triangleRunIndex: 0 });
|
|
89
|
+
* ```
|
|
65
90
|
*/
|
|
66
91
|
transform(inputs) {
|
|
67
92
|
const res = inputs.mesh.transform(inputs.triangleRunIndex);
|
|
68
93
|
return [...res];
|
|
69
94
|
}
|
|
70
95
|
/**
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
96
|
+
* Tells whether one run of triangles faces the other way than the original mesh it came from,
|
|
97
|
+
* as the inner surface left by a subtraction does. Informational: the normals a mesh hands out
|
|
98
|
+
* are already oriented for the result.
|
|
99
|
+
* @param inputs - The mesh and the run index
|
|
100
|
+
* @returns True when the run is a backside
|
|
101
|
+
* @group basic
|
|
102
|
+
* @shortname is backside
|
|
103
|
+
* @drawable false
|
|
104
|
+
* @example
|
|
105
|
+
* ```typescript
|
|
106
|
+
* const flipped = await bitbybit.manifold.mesh.evaluate.backside({ mesh, triangleRunIndex: 0 });
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
backside(inputs) {
|
|
110
|
+
return inputs.mesh.backside(inputs.triangleRunIndex);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Tells whether the first three extra property channels of one run of triangles hold vertex
|
|
114
|
+
* normals, which `manifold.operations.calculateNormals` writes there.
|
|
115
|
+
* @param inputs - The mesh and the run index
|
|
116
|
+
* @returns True when the run carries normals in its properties
|
|
117
|
+
* @group basic
|
|
118
|
+
* @shortname has normals
|
|
119
|
+
* @drawable false
|
|
120
|
+
* @example
|
|
121
|
+
* ```typescript
|
|
122
|
+
* const lit = await bitbybit.manifold.mesh.evaluate.hasNormals({ mesh, triangleRunIndex: 0 });
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
hasNormals(inputs) {
|
|
126
|
+
return inputs.mesh.hasNormals(inputs.triangleRunIndex);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Counts the property channels each vertex of a mesh carries; the position alone takes three.
|
|
130
|
+
* @param inputs - The mesh
|
|
131
|
+
* @returns The number of properties per vertex
|
|
74
132
|
* @group basic
|
|
75
133
|
* @shortname number props
|
|
76
134
|
* @drawable false
|
|
135
|
+
* @example
|
|
136
|
+
* ```typescript
|
|
137
|
+
* const channels = await bitbybit.manifold.mesh.evaluate.numProp({ mesh });
|
|
138
|
+
* ```
|
|
77
139
|
*/
|
|
78
140
|
numProp(inputs) {
|
|
79
141
|
return inputs.mesh.numProp;
|
|
80
142
|
}
|
|
81
143
|
/**
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
* @
|
|
144
|
+
* Counts the property vertices of a mesh, which can exceed the geometric vertices where
|
|
145
|
+
* neighboring triangles carry different properties.
|
|
146
|
+
* @param inputs - The mesh
|
|
147
|
+
* @returns The number of vertices
|
|
85
148
|
* @group basic
|
|
86
149
|
* @shortname number vertices
|
|
87
150
|
* @drawable false
|
|
151
|
+
* @example
|
|
152
|
+
* ```typescript
|
|
153
|
+
* const vertices = await bitbybit.manifold.mesh.evaluate.numVert({ mesh });
|
|
154
|
+
* ```
|
|
88
155
|
*/
|
|
89
156
|
numVert(inputs) {
|
|
90
157
|
return inputs.mesh.numVert;
|
|
91
158
|
}
|
|
92
159
|
/**
|
|
93
|
-
*
|
|
94
|
-
* @param inputs mesh
|
|
95
|
-
* @returns number of triangles
|
|
160
|
+
* Counts the triangles of a mesh, which together make its whole surface.
|
|
161
|
+
* @param inputs - The mesh
|
|
162
|
+
* @returns The number of triangles
|
|
96
163
|
* @group basic
|
|
97
164
|
* @shortname number triangles
|
|
98
165
|
* @drawable false
|
|
166
|
+
* @example
|
|
167
|
+
* ```typescript
|
|
168
|
+
* const triangles = await bitbybit.manifold.mesh.evaluate.numTri({ mesh });
|
|
169
|
+
* ```
|
|
99
170
|
*/
|
|
100
171
|
numTri(inputs) {
|
|
101
172
|
return inputs.mesh.numTri;
|
|
102
173
|
}
|
|
103
174
|
/**
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
* @param inputs mesh
|
|
107
|
-
* @returns number of runs
|
|
175
|
+
* Counts the triangle runs of a mesh: each run is a stretch of consecutive triangles that came
|
|
176
|
+
* from the same instance of the same input shape.
|
|
177
|
+
* @param inputs - The mesh
|
|
178
|
+
* @returns The number of runs
|
|
108
179
|
* @group basic
|
|
109
180
|
* @shortname number runs
|
|
110
181
|
* @drawable false
|
|
182
|
+
* @example
|
|
183
|
+
* ```typescript
|
|
184
|
+
* const runs = await bitbybit.manifold.mesh.evaluate.numRun({ mesh });
|
|
185
|
+
* ```
|
|
111
186
|
*/
|
|
112
187
|
numRun(inputs) {
|
|
113
188
|
return inputs.mesh.numRun;
|
|
@@ -1,29 +1,26 @@
|
|
|
1
1
|
import * as Inputs from "../../inputs";
|
|
2
2
|
import * as Manifold3D from "manifold-3d";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Repairs on Manifold mesh data before it is turned back into a solid; today that is `merge`, which
|
|
5
|
+
* restores the merge information a file round trip loses.
|
|
6
6
|
*/
|
|
7
7
|
export declare class MeshOperations {
|
|
8
8
|
constructor(_wasm: Manifold3D.ManifoldToplevel);
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* the function will return false. Otherwise, this will merge verts along open
|
|
13
|
-
* edges within tolerance (the maximum of the MeshGL tolerance and the
|
|
14
|
-
* baseline bounding-box tolerance), keeping any from the existing merge
|
|
15
|
-
* vectors.
|
|
10
|
+
* Fills in the mesh's merge information so it can become a solid again: vertices on open edges
|
|
11
|
+
* within the tolerance are merged, keeping existing entries.
|
|
16
12
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* will report a Status if it is not manifold.
|
|
22
|
-
* @param inputs mesh
|
|
23
|
-
* @returns merged mesh
|
|
13
|
+
* A mesh that is already closed is left alone and false comes back. Meant for a mesh whose
|
|
14
|
+
* merge data was lost in a file; the rebuilt solid reports a status if still open.
|
|
15
|
+
* @param inputs - The mesh to repair
|
|
16
|
+
* @returns True when the mesh was changed, false when it was already closed
|
|
24
17
|
* @group base
|
|
25
18
|
* @shortname merge
|
|
26
19
|
* @drawable true
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const changed = await bitbybit.manifold.mesh.operations.merge({ mesh });
|
|
23
|
+
* ```
|
|
27
24
|
*/
|
|
28
25
|
merge(inputs: Inputs.Manifold.MeshDto<Manifold3D.Mesh>): boolean;
|
|
29
26
|
}
|
|
@@ -1,28 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Repairs on Manifold mesh data before it is turned back into a solid; today that is `merge`, which
|
|
3
|
+
* restores the merge information a file round trip loses.
|
|
4
4
|
*/
|
|
5
5
|
export class MeshOperations {
|
|
6
6
|
constructor(_wasm) {
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* the function will return false. Otherwise, this will merge verts along open
|
|
12
|
-
* edges within tolerance (the maximum of the MeshGL tolerance and the
|
|
13
|
-
* baseline bounding-box tolerance), keeping any from the existing merge
|
|
14
|
-
* vectors.
|
|
9
|
+
* Fills in the mesh's merge information so it can become a solid again: vertices on open edges
|
|
10
|
+
* within the tolerance are merged, keeping existing entries.
|
|
15
11
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* will report a Status if it is not manifold.
|
|
21
|
-
* @param inputs mesh
|
|
22
|
-
* @returns merged mesh
|
|
12
|
+
* A mesh that is already closed is left alone and false comes back. Meant for a mesh whose
|
|
13
|
+
* merge data was lost in a file; the rebuilt solid reports a status if still open.
|
|
14
|
+
* @param inputs - The mesh to repair
|
|
15
|
+
* @returns True when the mesh was changed, false when it was already closed
|
|
23
16
|
* @group base
|
|
24
17
|
* @shortname merge
|
|
25
18
|
* @drawable true
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const changed = await bitbybit.manifold.mesh.operations.merge({ mesh });
|
|
22
|
+
* ```
|
|
26
23
|
*/
|
|
27
24
|
merge(inputs) {
|
|
28
25
|
return inputs.mesh.merge();
|
|
@@ -2,8 +2,10 @@ import * as Manifold3D from "manifold-3d";
|
|
|
2
2
|
import { MeshEvaluate } from "./mesh-evaluate";
|
|
3
3
|
import { MeshOperations } from "./mesh-operations";
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* The plain triangle data of a Manifold solid, as `manifold.manifoldToMesh` hands it out:
|
|
6
|
+
* `evaluate` reads vertices, triangles, tangents and the runs that group triangles by their
|
|
7
|
+
* original shape, and `operations` repairs merge information. A mesh is what crosses from the
|
|
8
|
+
* kernel to a renderer or a file.
|
|
7
9
|
*/
|
|
8
10
|
export declare class Mesh {
|
|
9
11
|
plugins: any;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { MeshEvaluate } from "./mesh-evaluate";
|
|
2
2
|
import { MeshOperations } from "./mesh-operations";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* The plain triangle data of a Manifold solid, as `manifold.manifoldToMesh` hands it out:
|
|
5
|
+
* `evaluate` reads vertices, triangles, tangents and the runs that group triangles by their
|
|
6
|
+
* original shape, and `operations` repairs merge information. A mesh is what crosses from the
|
|
7
|
+
* kernel to a renderer or a file.
|
|
6
8
|
*/
|
|
7
9
|
export class Mesh {
|
|
8
10
|
constructor(wasm) {
|