@bitbybit-dev/manifold 0.19.0-alpha.0 → 0.19.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.
|
@@ -1063,6 +1063,23 @@ export declare namespace Manifold {
|
|
|
1063
1063
|
*/
|
|
1064
1064
|
originOffset: number;
|
|
1065
1065
|
}
|
|
1066
|
+
class SplitByPlaneOnOffsetsDto<T> {
|
|
1067
|
+
constructor(manifold?: T, normal?: Base.Vector3, originOffsets?: number[]);
|
|
1068
|
+
/**
|
|
1069
|
+
* Manifold that will be split
|
|
1070
|
+
*/
|
|
1071
|
+
manifold: T;
|
|
1072
|
+
/**
|
|
1073
|
+
* The normal vector of the plane to be mirrored over
|
|
1074
|
+
* @default [1,0,0]
|
|
1075
|
+
*/
|
|
1076
|
+
normal: Base.Vector3;
|
|
1077
|
+
/**
|
|
1078
|
+
* The offsets from the origin
|
|
1079
|
+
* @default [0]
|
|
1080
|
+
*/
|
|
1081
|
+
originOffsets: number[];
|
|
1082
|
+
}
|
|
1066
1083
|
class ManifoldsDto<T> {
|
|
1067
1084
|
constructor(manifolds?: T[]);
|
|
1068
1085
|
/**
|
|
@@ -1199,6 +1199,30 @@ export var Manifold;
|
|
|
1199
1199
|
}
|
|
1200
1200
|
}
|
|
1201
1201
|
Manifold.SplitByPlaneDto = SplitByPlaneDto;
|
|
1202
|
+
class SplitByPlaneOnOffsetsDto {
|
|
1203
|
+
constructor(manifold, normal, originOffsets) {
|
|
1204
|
+
/**
|
|
1205
|
+
* The normal vector of the plane to be mirrored over
|
|
1206
|
+
* @default [1,0,0]
|
|
1207
|
+
*/
|
|
1208
|
+
this.normal = [1, 0, 0];
|
|
1209
|
+
/**
|
|
1210
|
+
* The offsets from the origin
|
|
1211
|
+
* @default [0]
|
|
1212
|
+
*/
|
|
1213
|
+
this.originOffsets = [0];
|
|
1214
|
+
if (manifold !== undefined) {
|
|
1215
|
+
this.manifold = manifold;
|
|
1216
|
+
}
|
|
1217
|
+
if (normal !== undefined) {
|
|
1218
|
+
this.normal = normal;
|
|
1219
|
+
}
|
|
1220
|
+
if (originOffsets !== undefined) {
|
|
1221
|
+
this.originOffsets = originOffsets;
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
Manifold.SplitByPlaneOnOffsetsDto = SplitByPlaneOnOffsetsDto;
|
|
1202
1226
|
class ManifoldsDto {
|
|
1203
1227
|
constructor(manifolds) {
|
|
1204
1228
|
if (manifolds !== undefined) {
|
|
@@ -5,6 +5,7 @@ export declare class ManifoldBooleans {
|
|
|
5
5
|
constructor(wasm: Manifold3D.ManifoldToplevel);
|
|
6
6
|
split(inputs: Inputs.Manifold.SplitManifoldsDto<Manifold3D.Manifold>): Manifold3D.Manifold[];
|
|
7
7
|
splitByPlane(inputs: Inputs.Manifold.SplitByPlaneDto<Manifold3D.Manifold>): Manifold3D.Manifold[];
|
|
8
|
+
splitByPlaneOnOffsets(inputs: Inputs.Manifold.SplitByPlaneOnOffsetsDto<Manifold3D.Manifold>): Manifold3D.Manifold[];
|
|
8
9
|
trimByPlane(inputs: Inputs.Manifold.TrimByPlaneDto<Manifold3D.Manifold>): Manifold3D.Manifold;
|
|
9
10
|
subtract(inputs: Inputs.Manifold.TwoManifoldsDto<Manifold3D.Manifold>): Manifold3D.Manifold;
|
|
10
11
|
add(inputs: Inputs.Manifold.TwoManifoldsDto<Manifold3D.Manifold>): Manifold3D.Manifold;
|
|
@@ -8,6 +8,20 @@ export class ManifoldBooleans {
|
|
|
8
8
|
splitByPlane(inputs) {
|
|
9
9
|
return inputs.manifold.splitByPlane(inputs.normal, inputs.originOffset);
|
|
10
10
|
}
|
|
11
|
+
splitByPlaneOnOffsets(inputs) {
|
|
12
|
+
const pieces = [];
|
|
13
|
+
const clone = inputs.manifold.asOriginal();
|
|
14
|
+
const remainders = [clone];
|
|
15
|
+
// original should not be deleted
|
|
16
|
+
inputs.originOffsets.forEach((s, i) => {
|
|
17
|
+
const halfs = remainders[i].splitByPlane(inputs.normal, s);
|
|
18
|
+
pieces.push(halfs[1]);
|
|
19
|
+
remainders.push(halfs[0]);
|
|
20
|
+
});
|
|
21
|
+
// release remainders
|
|
22
|
+
remainders.forEach(r => r.delete());
|
|
23
|
+
return pieces;
|
|
24
|
+
}
|
|
11
25
|
trimByPlane(inputs) {
|
|
12
26
|
return inputs.manifold.asOriginal().trimByPlane(inputs.normal, inputs.originOffset);
|
|
13
27
|
}
|