@cadit-app/manifold-fillet 1.0.0 → 1.0.1
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/dist/example.js +4 -5
- package/dist/fillet.d.ts +4 -3
- package/dist/fillet.js +8 -8
- package/dist/index.d.ts +36 -18
- package/dist/index.js +26 -20
- package/dist/pipeAlongPath.d.ts +6 -5
- package/dist/pipeAlongPath.js +8 -8
- package/dist/wedgeBuilder.d.ts +4 -3
- package/dist/wedgeBuilder.js +3 -3
- package/package.json +1 -1
package/dist/example.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Example usage of the fillet library
|
|
2
|
+
* Example usage of the fillet library.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* the initialized Manifold WASM module.
|
|
4
|
+
* Works on both manifoldcad.org and CADit.
|
|
6
5
|
*/
|
|
7
6
|
import { Manifold } from 'manifold-3d/manifoldCAD';
|
|
8
7
|
import { createFillet } from './index';
|
|
9
|
-
// Create fillet API bound to the
|
|
10
|
-
const { fillet } = createFillet(
|
|
8
|
+
// Create fillet API bound to the Manifold class
|
|
9
|
+
const { fillet } = createFillet(Manifold);
|
|
11
10
|
const box = Manifold.cube([20, 20, 20], true);
|
|
12
11
|
// Fillet the edge at position (10, 10, 0)
|
|
13
12
|
const rounded = fillet(box, {
|
package/dist/fillet.d.ts
CHANGED
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
* 3. Subtract tube from wedge → cutting tool (just the corner tip)
|
|
11
11
|
* 4. Subtract cutting tool from original → rounded edge
|
|
12
12
|
*/
|
|
13
|
-
import type { Manifold
|
|
13
|
+
import type { Manifold } from 'manifold-3d';
|
|
14
|
+
import type { ManifoldStatic } from './index';
|
|
14
15
|
import { EdgeSelection } from './edgeSelection';
|
|
15
16
|
export interface FilletOptions {
|
|
16
17
|
/** Fillet radius */
|
|
@@ -23,10 +24,10 @@ export interface FilletOptions {
|
|
|
23
24
|
/**
|
|
24
25
|
* Apply fillet/round to selected edges of a Manifold.
|
|
25
26
|
*
|
|
26
|
-
* @param
|
|
27
|
+
* @param Manifold - The Manifold class with static constructors
|
|
27
28
|
* @param mf - The Manifold shape to fillet
|
|
28
29
|
* @param options - Fillet options (radius, selection, segments)
|
|
29
30
|
* @returns A new Manifold with filleted edges
|
|
30
31
|
*/
|
|
31
|
-
export declare function filletWithManifold(
|
|
32
|
+
export declare function filletWithManifold(Manifold: ManifoldStatic, mf: Manifold, options: FilletOptions): Manifold;
|
|
32
33
|
export type { EdgeSelection, PointEdgeSelection, AngleEdgeSelection } from './edgeSelection';
|
package/dist/fillet.js
CHANGED
|
@@ -14,12 +14,12 @@ import { extractEdges, selectEdges } from './edgeSelection';
|
|
|
14
14
|
/**
|
|
15
15
|
* Apply fillet/round to selected edges of a Manifold.
|
|
16
16
|
*
|
|
17
|
-
* @param
|
|
17
|
+
* @param Manifold - The Manifold class with static constructors
|
|
18
18
|
* @param mf - The Manifold shape to fillet
|
|
19
19
|
* @param options - Fillet options (radius, selection, segments)
|
|
20
20
|
* @returns A new Manifold with filleted edges
|
|
21
21
|
*/
|
|
22
|
-
export function filletWithManifold(
|
|
22
|
+
export function filletWithManifold(Manifold, mf, options) {
|
|
23
23
|
const { radius, selection, segments = 16 } = options;
|
|
24
24
|
if (radius <= 0) {
|
|
25
25
|
throw new Error('Fillet radius must be positive');
|
|
@@ -45,7 +45,7 @@ export function filletWithManifold(manifold, mf, options) {
|
|
|
45
45
|
// Only handling convex edges (standard fillets)
|
|
46
46
|
// Filter out flat edges (dihedral angle approx 0) which are just triangulation artifacts
|
|
47
47
|
if (edge.dihedralAngle > 5 && edge.dihedralAngle < 175) {
|
|
48
|
-
const tool = createFilletCuttingTool(
|
|
48
|
+
const tool = createFilletCuttingTool(Manifold, edge, radius, segments);
|
|
49
49
|
if (tool && tool.volume() > 1e-9) {
|
|
50
50
|
cuttingTools.push(tool);
|
|
51
51
|
}
|
|
@@ -64,7 +64,7 @@ export function filletWithManifold(manifold, mf, options) {
|
|
|
64
64
|
/**
|
|
65
65
|
* Create a fillet cutting tool using the wedge-minus-tube approach.
|
|
66
66
|
*/
|
|
67
|
-
function createFilletCuttingTool(
|
|
67
|
+
function createFilletCuttingTool(Manifold, edge, radius, segments) {
|
|
68
68
|
// Edge endpoints
|
|
69
69
|
const [x0, y0, z0] = edge.p0;
|
|
70
70
|
const [x1, y1, z1] = edge.p1;
|
|
@@ -90,9 +90,9 @@ function createFilletCuttingTool(manifold, edge, radius, segments) {
|
|
|
90
90
|
y1 - n0y * radius - n1y * radius + edgeDir[1] * ext,
|
|
91
91
|
z1 - n0z * radius - n1z * radius + edgeDir[2] * ext
|
|
92
92
|
];
|
|
93
|
-
const sphere0 =
|
|
94
|
-
const sphere1 =
|
|
95
|
-
const tube =
|
|
93
|
+
const sphere0 = Manifold.sphere(radius, segments).translate(tubeStart);
|
|
94
|
+
const sphere1 = Manifold.sphere(radius, segments).translate(tubeEnd);
|
|
95
|
+
const tube = Manifold.hull([sphere0, sphere1]);
|
|
96
96
|
// 2. WEDGE: Triangular prism extending INWARD
|
|
97
97
|
// CRITICAL: The wedge depth must be limited so it is completely contained
|
|
98
98
|
// within the tube on the "back" side. If deeper than the tube, subtracting
|
|
@@ -110,7 +110,7 @@ function createFilletCuttingTool(manifold, edge, radius, segments) {
|
|
|
110
110
|
wedgePoints.push([eX, eY, eZ]); // Edge
|
|
111
111
|
wedgePoints.push([eX - n0x * wedgeDepth, eY - n0y * wedgeDepth, eZ - n0z * wedgeDepth]);
|
|
112
112
|
wedgePoints.push([eX - n1x * wedgeDepth, eY - n1y * wedgeDepth, eZ - n1z * wedgeDepth]);
|
|
113
|
-
const wedge =
|
|
113
|
+
const wedge = Manifold.hull(wedgePoints);
|
|
114
114
|
// 3. CUTTING TOOL: Wedge - Tube
|
|
115
115
|
// Since wedge is small, wedge - tube leaves only the corner tip.
|
|
116
116
|
return wedge.subtract(tube);
|
package/dist/index.d.ts
CHANGED
|
@@ -3,22 +3,38 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Usage:
|
|
5
5
|
* ```typescript
|
|
6
|
+
* // Option 1: With full Manifold module
|
|
6
7
|
* import ManifoldModule from 'manifold-3d';
|
|
7
8
|
* import { createFillet } from '@cadit-app/brute-force-fillet';
|
|
8
9
|
*
|
|
9
|
-
* const
|
|
10
|
-
* const { fillet } = createFillet(
|
|
10
|
+
* const wasm = await ManifoldModule();
|
|
11
|
+
* const { fillet } = createFillet(wasm.Manifold);
|
|
11
12
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
13
|
+
* // Option 2: With Manifold class directly (e.g., manifoldcad.org)
|
|
14
|
+
* import { Manifold } from 'manifold-3d/manifoldCAD';
|
|
15
|
+
* import { createFillet } from '@cadit-app/brute-force-fillet';
|
|
16
|
+
*
|
|
17
|
+
* const { fillet } = createFillet(Manifold);
|
|
14
18
|
* ```
|
|
15
19
|
*/
|
|
16
|
-
import type { Manifold
|
|
20
|
+
import type { Manifold } from 'manifold-3d';
|
|
17
21
|
import { FilletOptions } from './fillet';
|
|
18
22
|
import { extractEdges, selectEdges, edgeDirection, edgeInwardDirection, sampleEdge, MeshEdge } from './edgeSelection';
|
|
19
|
-
export type { ManifoldToplevel } from './context';
|
|
20
23
|
export type { FilletOptions } from './fillet';
|
|
21
24
|
export type { MeshEdge, EdgeSelection, PointEdgeSelection, AngleEdgeSelection } from './edgeSelection';
|
|
25
|
+
/**
|
|
26
|
+
* The Manifold class type with static constructors.
|
|
27
|
+
* This is what you get from `manifold.Manifold` or `import { Manifold } from 'manifold-3d/manifoldCAD'`.
|
|
28
|
+
*/
|
|
29
|
+
export interface ManifoldStatic {
|
|
30
|
+
cube: (size: [number, number, number] | number, center?: boolean) => Manifold;
|
|
31
|
+
sphere: (radius: number, circularSegments?: number) => Manifold;
|
|
32
|
+
cylinder: (height: number, radiusLow: number, radiusHigh?: number, circularSegments?: number, center?: boolean) => Manifold;
|
|
33
|
+
hull: (manifolds: Manifold[] | [number, number, number][]) => Manifold;
|
|
34
|
+
union: (manifolds: Manifold[]) => Manifold;
|
|
35
|
+
intersection: (manifolds: Manifold[]) => Manifold;
|
|
36
|
+
difference: (manifolds: Manifold[]) => Manifold;
|
|
37
|
+
}
|
|
22
38
|
/**
|
|
23
39
|
* The fillet API returned by createFillet.
|
|
24
40
|
*/
|
|
@@ -65,28 +81,30 @@ export interface FilletAPI {
|
|
|
65
81
|
sampleEdge: typeof sampleEdge;
|
|
66
82
|
}
|
|
67
83
|
/**
|
|
68
|
-
* Creates a fillet API bound to a specific Manifold
|
|
84
|
+
* Creates a fillet API bound to a specific Manifold class.
|
|
69
85
|
*
|
|
70
|
-
* @param
|
|
71
|
-
* @returns An object containing all fillet functions bound to the
|
|
86
|
+
* @param Manifold - The Manifold class with static constructors (cube, sphere, hull, etc.)
|
|
87
|
+
* @returns An object containing all fillet functions bound to the Manifold class
|
|
72
88
|
*
|
|
73
89
|
* @example
|
|
74
90
|
* ```typescript
|
|
75
|
-
*
|
|
91
|
+
* // On manifoldcad.org:
|
|
92
|
+
* import { Manifold } from 'manifold-3d/manifoldCAD';
|
|
76
93
|
* import { createFillet } from '@cadit-app/brute-force-fillet';
|
|
77
94
|
*
|
|
78
|
-
* const
|
|
79
|
-
* const
|
|
95
|
+
* const { fillet } = createFillet(Manifold);
|
|
96
|
+
* const box = Manifold.cube([10, 10, 10], true);
|
|
97
|
+
* const rounded = fillet(box, { radius: 1, selection: { type: 'angle', minAngle: 80 } });
|
|
80
98
|
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* });
|
|
99
|
+
* // In Node.js:
|
|
100
|
+
* import ManifoldModule from 'manifold-3d';
|
|
101
|
+
* const wasm = await ManifoldModule();
|
|
102
|
+
* const { fillet } = createFillet(wasm.Manifold);
|
|
86
103
|
* ```
|
|
87
104
|
*/
|
|
88
|
-
export declare function createFillet(
|
|
105
|
+
export declare function createFillet(Manifold: ManifoldStatic): FilletAPI;
|
|
89
106
|
export { extractEdges, selectEdges, edgeDirection, edgeInwardDirection, sampleEdge };
|
|
90
107
|
export { filletWithManifold } from './fillet';
|
|
91
108
|
export { pipeAlongPath, pipeAlongPathExtended } from './pipeAlongPath';
|
|
92
109
|
export { buildWedge } from './wedgeBuilder';
|
|
110
|
+
export { default } from './example';
|
package/dist/index.js
CHANGED
|
@@ -3,14 +3,18 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Usage:
|
|
5
5
|
* ```typescript
|
|
6
|
+
* // Option 1: With full Manifold module
|
|
6
7
|
* import ManifoldModule from 'manifold-3d';
|
|
7
8
|
* import { createFillet } from '@cadit-app/brute-force-fillet';
|
|
8
9
|
*
|
|
9
|
-
* const
|
|
10
|
-
* const { fillet } = createFillet(
|
|
10
|
+
* const wasm = await ManifoldModule();
|
|
11
|
+
* const { fillet } = createFillet(wasm.Manifold);
|
|
11
12
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
13
|
+
* // Option 2: With Manifold class directly (e.g., manifoldcad.org)
|
|
14
|
+
* import { Manifold } from 'manifold-3d/manifoldCAD';
|
|
15
|
+
* import { createFillet } from '@cadit-app/brute-force-fillet';
|
|
16
|
+
*
|
|
17
|
+
* const { fillet } = createFillet(Manifold);
|
|
14
18
|
* ```
|
|
15
19
|
*/
|
|
16
20
|
import { filletWithManifold } from './fillet';
|
|
@@ -18,32 +22,33 @@ import { pipeAlongPath, pipeAlongPathExtended } from './pipeAlongPath';
|
|
|
18
22
|
import { buildWedge } from './wedgeBuilder';
|
|
19
23
|
import { extractEdges, selectEdges, edgeDirection, edgeInwardDirection, sampleEdge } from './edgeSelection';
|
|
20
24
|
/**
|
|
21
|
-
* Creates a fillet API bound to a specific Manifold
|
|
25
|
+
* Creates a fillet API bound to a specific Manifold class.
|
|
22
26
|
*
|
|
23
|
-
* @param
|
|
24
|
-
* @returns An object containing all fillet functions bound to the
|
|
27
|
+
* @param Manifold - The Manifold class with static constructors (cube, sphere, hull, etc.)
|
|
28
|
+
* @returns An object containing all fillet functions bound to the Manifold class
|
|
25
29
|
*
|
|
26
30
|
* @example
|
|
27
31
|
* ```typescript
|
|
28
|
-
*
|
|
32
|
+
* // On manifoldcad.org:
|
|
33
|
+
* import { Manifold } from 'manifold-3d/manifoldCAD';
|
|
29
34
|
* import { createFillet } from '@cadit-app/brute-force-fillet';
|
|
30
35
|
*
|
|
31
|
-
* const
|
|
32
|
-
* const
|
|
36
|
+
* const { fillet } = createFillet(Manifold);
|
|
37
|
+
* const box = Manifold.cube([10, 10, 10], true);
|
|
38
|
+
* const rounded = fillet(box, { radius: 1, selection: { type: 'angle', minAngle: 80 } });
|
|
33
39
|
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* });
|
|
40
|
+
* // In Node.js:
|
|
41
|
+
* import ManifoldModule from 'manifold-3d';
|
|
42
|
+
* const wasm = await ManifoldModule();
|
|
43
|
+
* const { fillet } = createFillet(wasm.Manifold);
|
|
39
44
|
* ```
|
|
40
45
|
*/
|
|
41
|
-
export function createFillet(
|
|
46
|
+
export function createFillet(Manifold) {
|
|
42
47
|
return {
|
|
43
|
-
fillet: (mf, options) => filletWithManifold(
|
|
44
|
-
pipeAlongPath: (path, radius, segments) => pipeAlongPath(
|
|
45
|
-
pipeAlongPathExtended: (path, radius, extensionFactor, segments) => pipeAlongPathExtended(
|
|
46
|
-
buildWedge: (edge, distance, inflate) => buildWedge(
|
|
48
|
+
fillet: (mf, options) => filletWithManifold(Manifold, mf, options),
|
|
49
|
+
pipeAlongPath: (path, radius, segments) => pipeAlongPath(Manifold, path, radius, segments),
|
|
50
|
+
pipeAlongPathExtended: (path, radius, extensionFactor, segments) => pipeAlongPathExtended(Manifold, path, radius, extensionFactor, segments),
|
|
51
|
+
buildWedge: (edge, distance, inflate) => buildWedge(Manifold, edge, distance, inflate),
|
|
47
52
|
// These don't need manifold instance
|
|
48
53
|
extractEdges,
|
|
49
54
|
selectEdges,
|
|
@@ -58,3 +63,4 @@ export { extractEdges, selectEdges, edgeDirection, edgeInwardDirection, sampleEd
|
|
|
58
63
|
export { filletWithManifold } from './fillet';
|
|
59
64
|
export { pipeAlongPath, pipeAlongPathExtended } from './pipeAlongPath';
|
|
60
65
|
export { buildWedge } from './wedgeBuilder';
|
|
66
|
+
export { default } from './example';
|
package/dist/pipeAlongPath.d.ts
CHANGED
|
@@ -3,25 +3,26 @@
|
|
|
3
3
|
* This approach is reliable for curved paths and produces
|
|
4
4
|
* smooth results with proper manifold topology.
|
|
5
5
|
*/
|
|
6
|
-
import type { Manifold
|
|
6
|
+
import type { Manifold } from 'manifold-3d';
|
|
7
|
+
import type { ManifoldStatic } from './index';
|
|
7
8
|
/**
|
|
8
9
|
* Creates a tube along a polyline path using convex hulls of spheres.
|
|
9
10
|
*
|
|
10
|
-
* @param
|
|
11
|
+
* @param Manifold - The Manifold class with static constructors
|
|
11
12
|
* @param path Array of 3D points defining the path
|
|
12
13
|
* @param radius Radius of the tube
|
|
13
14
|
* @param segments Optional circular segments for sphere quality
|
|
14
15
|
* @returns Manifold representing the tube
|
|
15
16
|
*/
|
|
16
|
-
export declare function pipeAlongPath(
|
|
17
|
+
export declare function pipeAlongPath(Manifold: ManifoldStatic, path: [number, number, number][], radius: number, segments?: number): Manifold;
|
|
17
18
|
/**
|
|
18
19
|
* Creates a tube along an edge path that extends slightly beyond
|
|
19
20
|
* the endpoints to ensure proper boolean overlap.
|
|
20
21
|
*
|
|
21
|
-
* @param
|
|
22
|
+
* @param Manifold - The Manifold class with static constructors
|
|
22
23
|
* @param path Path points
|
|
23
24
|
* @param radius Tube radius
|
|
24
25
|
* @param extensionFactor How much to extend beyond endpoints (as fraction of radius)
|
|
25
26
|
* @param segments Circular segments
|
|
26
27
|
*/
|
|
27
|
-
export declare function pipeAlongPathExtended(
|
|
28
|
+
export declare function pipeAlongPathExtended(Manifold: ManifoldStatic, path: [number, number, number][], radius: number, extensionFactor?: number, segments?: number): Manifold;
|
package/dist/pipeAlongPath.js
CHANGED
|
@@ -6,20 +6,20 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* Creates a tube along a polyline path using convex hulls of spheres.
|
|
8
8
|
*
|
|
9
|
-
* @param
|
|
9
|
+
* @param Manifold - The Manifold class with static constructors
|
|
10
10
|
* @param path Array of 3D points defining the path
|
|
11
11
|
* @param radius Radius of the tube
|
|
12
12
|
* @param segments Optional circular segments for sphere quality
|
|
13
13
|
* @returns Manifold representing the tube
|
|
14
14
|
*/
|
|
15
|
-
export function pipeAlongPath(
|
|
15
|
+
export function pipeAlongPath(Manifold, path, radius, segments) {
|
|
16
16
|
if (path.length < 2) {
|
|
17
17
|
throw new Error('Path must have at least 2 points');
|
|
18
18
|
}
|
|
19
19
|
// Create spheres at each path point
|
|
20
20
|
const spheres = [];
|
|
21
21
|
for (const [x, y, z] of path) {
|
|
22
|
-
const sphere =
|
|
22
|
+
const sphere = Manifold.sphere(radius, segments)
|
|
23
23
|
.translate([x, y, z]);
|
|
24
24
|
spheres.push(sphere);
|
|
25
25
|
}
|
|
@@ -27,26 +27,26 @@ export function pipeAlongPath(manifold, path, radius, segments) {
|
|
|
27
27
|
const segments_ = [];
|
|
28
28
|
for (let i = 0; i < path.length - 1; i++) {
|
|
29
29
|
// Hull two adjacent spheres to form a tube segment
|
|
30
|
-
const segment =
|
|
30
|
+
const segment = Manifold.hull([spheres[i], spheres[i + 1]]);
|
|
31
31
|
segments_.push(segment);
|
|
32
32
|
}
|
|
33
33
|
// Union all segments
|
|
34
34
|
if (segments_.length === 1) {
|
|
35
35
|
return segments_[0];
|
|
36
36
|
}
|
|
37
|
-
return
|
|
37
|
+
return Manifold.union(segments_);
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
40
|
* Creates a tube along an edge path that extends slightly beyond
|
|
41
41
|
* the endpoints to ensure proper boolean overlap.
|
|
42
42
|
*
|
|
43
|
-
* @param
|
|
43
|
+
* @param Manifold - The Manifold class with static constructors
|
|
44
44
|
* @param path Path points
|
|
45
45
|
* @param radius Tube radius
|
|
46
46
|
* @param extensionFactor How much to extend beyond endpoints (as fraction of radius)
|
|
47
47
|
* @param segments Circular segments
|
|
48
48
|
*/
|
|
49
|
-
export function pipeAlongPathExtended(
|
|
49
|
+
export function pipeAlongPathExtended(Manifold, path, radius, extensionFactor = 0.1, segments) {
|
|
50
50
|
if (path.length < 2) {
|
|
51
51
|
throw new Error('Path must have at least 2 points');
|
|
52
52
|
}
|
|
@@ -72,7 +72,7 @@ export function pipeAlongPathExtended(manifold, path, radius, extensionFactor =
|
|
|
72
72
|
...path,
|
|
73
73
|
[end[0] + endDir[0] * ext, end[1] + endDir[1] * ext, end[2] + endDir[2] * ext]
|
|
74
74
|
];
|
|
75
|
-
return pipeAlongPath(
|
|
75
|
+
return pipeAlongPath(Manifold, extendedPath, radius, segments);
|
|
76
76
|
}
|
|
77
77
|
function normalize(v) {
|
|
78
78
|
const len = Math.sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
|
package/dist/wedgeBuilder.d.ts
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* adjacent face normals. This creates a triangular prism that,
|
|
6
6
|
* when the tube is subtracted, leaves the fillet surface.
|
|
7
7
|
*/
|
|
8
|
-
import type { Manifold
|
|
8
|
+
import type { Manifold } from 'manifold-3d';
|
|
9
|
+
import type { ManifoldStatic } from './index';
|
|
9
10
|
import { MeshEdge } from './edgeSelection';
|
|
10
11
|
/**
|
|
11
12
|
* Creates a wedge solid along an edge.
|
|
@@ -14,10 +15,10 @@ import { MeshEdge } from './edgeSelection';
|
|
|
14
15
|
* - Along the edge direction (with small extension)
|
|
15
16
|
* - From the edge outward along both face normals
|
|
16
17
|
*
|
|
17
|
-
* @param
|
|
18
|
+
* @param Manifold - The Manifold class with static constructors
|
|
18
19
|
* @param edge The edge to build wedge for
|
|
19
20
|
* @param distance How far to offset along face normals
|
|
20
21
|
* @param inflate Extra inflation for boolean overlap (typically 2× precision)
|
|
21
22
|
* @returns Manifold representing the wedge
|
|
22
23
|
*/
|
|
23
|
-
export declare function buildWedge(
|
|
24
|
+
export declare function buildWedge(Manifold: ManifoldStatic, edge: MeshEdge, distance: number, inflate?: number): Manifold;
|
package/dist/wedgeBuilder.js
CHANGED
|
@@ -13,13 +13,13 @@ import { edgeDirection } from './edgeSelection';
|
|
|
13
13
|
* - Along the edge direction (with small extension)
|
|
14
14
|
* - From the edge outward along both face normals
|
|
15
15
|
*
|
|
16
|
-
* @param
|
|
16
|
+
* @param Manifold - The Manifold class with static constructors
|
|
17
17
|
* @param edge The edge to build wedge for
|
|
18
18
|
* @param distance How far to offset along face normals
|
|
19
19
|
* @param inflate Extra inflation for boolean overlap (typically 2× precision)
|
|
20
20
|
* @returns Manifold representing the wedge
|
|
21
21
|
*/
|
|
22
|
-
export function buildWedge(
|
|
22
|
+
export function buildWedge(Manifold, edge, distance, inflate = 0.001) {
|
|
23
23
|
// Edge vector and direction
|
|
24
24
|
const edgeVec = [
|
|
25
25
|
edge.p1[0] - edge.p0[0],
|
|
@@ -84,7 +84,7 @@ export function buildWedge(manifold, edge, distance, inflate = 0.001) {
|
|
|
84
84
|
// Build the wedge as a convex hull of these 6 points
|
|
85
85
|
// This guarantees a valid manifold
|
|
86
86
|
const points = [s0, sA, sB, e0, eA, eB];
|
|
87
|
-
return
|
|
87
|
+
return Manifold.hull(points);
|
|
88
88
|
}
|
|
89
89
|
/**
|
|
90
90
|
* Cross product of two vectors, normalized.
|