@bitbybit-dev/manifold 1.1.1 → 1.2.0-rc.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.
Files changed (41) hide show
  1. package/README.md +14 -4
  2. package/index.js +0 -3
  3. package/lib/api/inputs/base-inputs.js +0 -1
  4. package/lib/api/inputs/manifold-inputs.d.ts +63 -23
  5. package/lib/api/inputs/manifold-inputs.js +114 -1
  6. package/lib/api/manifold-service.d.ts +30 -2
  7. package/lib/api/manifold-service.js +43 -22
  8. package/lib/api/services/cross-section/cross-section-booleans.d.ts +78 -2
  9. package/lib/api/services/cross-section/cross-section-booleans.js +86 -10
  10. package/lib/api/services/cross-section/cross-section-evaluate.d.ts +45 -2
  11. package/lib/api/services/cross-section/cross-section-evaluate.js +45 -2
  12. package/lib/api/services/cross-section/cross-section-operations.d.ts +71 -0
  13. package/lib/api/services/cross-section/cross-section-operations.js +71 -2
  14. package/lib/api/services/cross-section/cross-section-shapes.d.ts +39 -0
  15. package/lib/api/services/cross-section/cross-section-shapes.js +39 -0
  16. package/lib/api/services/cross-section/cross-section-transforms.d.ts +72 -2
  17. package/lib/api/services/cross-section/cross-section-transforms.js +72 -2
  18. package/lib/api/services/cross-section/cross-section.d.ts +53 -1
  19. package/lib/api/services/cross-section/cross-section.js +53 -5
  20. package/lib/api/services/index.js +1 -0
  21. package/lib/api/services/manifold/manifold-booleans.d.ts +116 -6
  22. package/lib/api/services/manifold/manifold-booleans.js +159 -48
  23. package/lib/api/services/manifold/manifold-evaluate.d.ts +133 -3
  24. package/lib/api/services/manifold/manifold-evaluate.js +135 -5
  25. package/lib/api/services/manifold/manifold-operations.d.ts +202 -1
  26. package/lib/api/services/manifold/manifold-operations.js +204 -3
  27. package/lib/api/services/manifold/manifold-shapes.d.ts +59 -0
  28. package/lib/api/services/manifold/manifold-shapes.js +78 -20
  29. package/lib/api/services/manifold/manifold-transforms.d.ts +97 -3
  30. package/lib/api/services/manifold/manifold-transforms.js +102 -6
  31. package/lib/api/services/manifold/manifold.d.ts +20 -0
  32. package/lib/api/services/manifold/manifold.js +20 -1
  33. package/lib/api/services/mesh/mesh-evaluate.d.ts +81 -3
  34. package/lib/api/services/mesh/mesh-evaluate.js +84 -6
  35. package/lib/api/services/mesh/mesh-operations.d.ts +24 -2
  36. package/lib/api/services/mesh/mesh-operations.js +24 -2
  37. package/lib/api/services/mesh/mesh.d.ts +4 -0
  38. package/lib/api/services/mesh/mesh.js +4 -1
  39. package/package.json +6 -45
  40. package/babel.config.cjs +0 -17
  41. package/babel.config.d.cts +0 -6
@@ -1,15 +1,91 @@
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 CrossSectionBooleans {
4
8
  private manifold;
5
9
  constructor(wasm: Manifold3D.ManifoldToplevel);
10
+ /**
11
+ * Subtract two cross sections
12
+ * @param inputs two cross sections
13
+ * @returns subtracted cross section
14
+ * @group a to b
15
+ * @shortname subtract
16
+ * @drawable true
17
+ */
6
18
  subtract(inputs: Inputs.Manifold.TwoCrossSectionsDto<Manifold3D.CrossSection>): Manifold3D.CrossSection;
19
+ /**
20
+ * Add two cross sections
21
+ * @param inputs two cross sections
22
+ * @returns unioned cross section
23
+ * @group a to b
24
+ * @shortname add
25
+ * @drawable true
26
+ */
7
27
  add(inputs: Inputs.Manifold.TwoCrossSectionsDto<Manifold3D.CrossSection>): Manifold3D.CrossSection;
28
+ /**
29
+ * Intersect two cross sections
30
+ * @param inputs two cross sections
31
+ * @returns intersected cross section
32
+ * @group a to b
33
+ * @shortname intersect
34
+ * @drawable true
35
+ */
8
36
  intersect(inputs: Inputs.Manifold.TwoCrossSectionsDto<Manifold3D.CrossSection>): Manifold3D.CrossSection;
37
+ /**
38
+ * Difference of two cross sections
39
+ * @param inputs two cross sections
40
+ * @returns difference of two cross sections
41
+ * @group 2 cross sections
42
+ * @shortname difference 2 cs
43
+ * @drawable true
44
+ */
9
45
  differenceTwo(inputs: Inputs.Manifold.TwoCrossSectionsDto<Manifold3D.CrossSection>): Manifold3D.CrossSection;
10
- difference(inputs: Inputs.Manifold.CrossSectionsDto<Manifold3D.CrossSection>): Manifold3D.CrossSection;
46
+ /**
47
+ * Union of two cross sections
48
+ * @param inputs two cross sections
49
+ * @returns union of two cross sections
50
+ * @group 2 cross sections
51
+ * @shortname union 2 cs
52
+ * @drawable true
53
+ */
11
54
  unionTwo(inputs: Inputs.Manifold.TwoCrossSectionsDto<Manifold3D.CrossSection>): Manifold3D.CrossSection;
12
- union(inputs: Inputs.Manifold.CrossSectionsDto<Manifold3D.CrossSection>): Manifold3D.CrossSection;
55
+ /**
56
+ * Intersection of two cross sections
57
+ * @param inputs two shapes
58
+ * @returns intersection of two cross sections
59
+ * @group 2 cross sections
60
+ * @shortname intersect 2 cs
61
+ * @drawable true
62
+ */
13
63
  intersectionTwo(inputs: Inputs.Manifold.TwoCrossSectionsDto<Manifold3D.CrossSection>): Manifold3D.CrossSection;
64
+ /**
65
+ * Difference of multiple cross sections
66
+ * @param inputs multiple cross sections
67
+ * @returns difference of cross sections
68
+ * @group multiple
69
+ * @shortname diff cross sections
70
+ * @drawable true
71
+ */
72
+ difference(inputs: Inputs.Manifold.CrossSectionsDto<Manifold3D.CrossSection>): Manifold3D.CrossSection;
73
+ /**
74
+ * Union of multiple cross sections
75
+ * @param inputs multiple cross sections
76
+ * @returns union of two cross sections
77
+ * @group multiple
78
+ * @shortname union cross sections
79
+ * @drawable true
80
+ */
81
+ union(inputs: Inputs.Manifold.CrossSectionsDto<Manifold3D.CrossSection>): Manifold3D.CrossSection;
82
+ /**
83
+ * Intersection of multiple cross sections
84
+ * @param inputs two cross sections
85
+ * @returns intersection of multiple cross sections
86
+ * @group multiple
87
+ * @shortname intersection cross sections
88
+ * @drawable true
89
+ */
14
90
  intersection(inputs: Inputs.Manifold.CrossSectionsDto<Manifold3D.CrossSection>): Manifold3D.CrossSection;
15
91
  }
@@ -1,41 +1,117 @@
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 CrossSectionBooleans {
2
6
  constructor(wasm) {
3
7
  this.manifold = wasm;
4
8
  }
9
+ /**
10
+ * Subtract two cross sections
11
+ * @param inputs two cross sections
12
+ * @returns subtracted cross section
13
+ * @group a to b
14
+ * @shortname subtract
15
+ * @drawable true
16
+ */
5
17
  subtract(inputs) {
6
18
  return inputs.crossSection1.subtract(inputs.crossSection2);
7
19
  }
20
+ /**
21
+ * Add two cross sections
22
+ * @param inputs two cross sections
23
+ * @returns unioned cross section
24
+ * @group a to b
25
+ * @shortname add
26
+ * @drawable true
27
+ */
8
28
  add(inputs) {
9
29
  return inputs.crossSection1.add(inputs.crossSection2);
10
30
  }
31
+ /**
32
+ * Intersect two cross sections
33
+ * @param inputs two cross sections
34
+ * @returns intersected cross section
35
+ * @group a to b
36
+ * @shortname intersect
37
+ * @drawable true
38
+ */
11
39
  intersect(inputs) {
12
40
  return inputs.crossSection1.intersect(inputs.crossSection2);
13
41
  }
42
+ /**
43
+ * Difference of two cross sections
44
+ * @param inputs two cross sections
45
+ * @returns difference of two cross sections
46
+ * @group 2 cross sections
47
+ * @shortname difference 2 cs
48
+ * @drawable true
49
+ */
14
50
  differenceTwo(inputs) {
15
51
  const { CrossSection } = this.manifold;
16
52
  const { difference } = CrossSection;
17
53
  return difference(inputs.crossSection1, inputs.crossSection2);
18
54
  }
19
- difference(inputs) {
20
- const { CrossSection } = this.manifold;
21
- const { difference } = CrossSection;
22
- return difference(inputs.crossSections);
23
- }
55
+ /**
56
+ * Union of two cross sections
57
+ * @param inputs two cross sections
58
+ * @returns union of two cross sections
59
+ * @group 2 cross sections
60
+ * @shortname union 2 cs
61
+ * @drawable true
62
+ */
24
63
  unionTwo(inputs) {
25
64
  const { CrossSection } = this.manifold;
26
65
  const { union } = CrossSection;
27
66
  return union(inputs.crossSection1, inputs.crossSection2);
28
67
  }
29
- union(inputs) {
30
- const { CrossSection } = this.manifold;
31
- const { union } = CrossSection;
32
- return union(inputs.crossSections);
33
- }
68
+ /**
69
+ * Intersection of two cross sections
70
+ * @param inputs two shapes
71
+ * @returns intersection of two cross sections
72
+ * @group 2 cross sections
73
+ * @shortname intersect 2 cs
74
+ * @drawable true
75
+ */
34
76
  intersectionTwo(inputs) {
35
77
  const { CrossSection } = this.manifold;
36
78
  const { intersection } = CrossSection;
37
79
  return intersection(inputs.crossSection1, inputs.crossSection2);
38
80
  }
81
+ /**
82
+ * Difference of multiple cross sections
83
+ * @param inputs multiple cross sections
84
+ * @returns difference of cross sections
85
+ * @group multiple
86
+ * @shortname diff cross sections
87
+ * @drawable true
88
+ */
89
+ difference(inputs) {
90
+ const { CrossSection } = this.manifold;
91
+ const { difference } = CrossSection;
92
+ return difference(inputs.crossSections);
93
+ }
94
+ /**
95
+ * Union of multiple cross sections
96
+ * @param inputs multiple cross sections
97
+ * @returns union of two cross sections
98
+ * @group multiple
99
+ * @shortname union cross sections
100
+ * @drawable true
101
+ */
102
+ union(inputs) {
103
+ const { CrossSection } = this.manifold;
104
+ const { union } = CrossSection;
105
+ return union(inputs.crossSections);
106
+ }
107
+ /**
108
+ * Intersection of multiple cross sections
109
+ * @param inputs two cross sections
110
+ * @returns intersection of multiple cross sections
111
+ * @group multiple
112
+ * @shortname intersection cross sections
113
+ * @drawable true
114
+ */
39
115
  intersection(inputs) {
40
116
  const { CrossSection } = this.manifold;
41
117
  const { intersection } = CrossSection;
@@ -1,11 +1,54 @@
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 CrossSectionEvaluate {
4
- private manifold;
5
- constructor(wasm: Manifold3D.ManifoldToplevel);
8
+ constructor(_wasm: Manifold3D.ManifoldToplevel);
9
+ /**
10
+ * Get area of cross section
11
+ * @param inputs cross section
12
+ * @returns area of cross section
13
+ * @group basic
14
+ * @shortname area
15
+ * @drawable false
16
+ */
6
17
  area(inputs: Inputs.Manifold.CrossSectionDto<Manifold3D.CrossSection>): number;
18
+ /**
19
+ * Check if cross section is empty
20
+ * @param inputs cross section
21
+ * @returns boolean indicating emptyness
22
+ * @group basic
23
+ * @shortname is empty
24
+ * @drawable false
25
+ */
7
26
  isEmpty(inputs: Inputs.Manifold.CrossSectionDto<Manifold3D.CrossSection>): boolean;
27
+ /**
28
+ * Get number of vertices in cross section
29
+ * @param inputs cross section
30
+ * @returns number of vertices of cross section
31
+ * @group basic
32
+ * @shortname num vert
33
+ * @drawable false
34
+ */
8
35
  numVert(inputs: Inputs.Manifold.CrossSectionDto<Manifold3D.CrossSection>): number;
36
+ /**
37
+ * Get number of contours in cross section
38
+ * @param inputs cross section
39
+ * @returns number of contour of cross section
40
+ * @group basic
41
+ * @shortname num contour
42
+ * @drawable false
43
+ */
9
44
  numContour(inputs: Inputs.Manifold.CrossSectionDto<Manifold3D.CrossSection>): number;
45
+ /**
46
+ * Get the bounds of the contour as a rectangle. Output is given in two vec2 points in the array. First array is the min point and second array is the max point.
47
+ * @param inputs cross section
48
+ * @returns bounds of cross section
49
+ * @group basic
50
+ * @shortname bounds
51
+ * @drawable false
52
+ */
10
53
  bounds(inputs: Inputs.Manifold.CrossSectionDto<Manifold3D.CrossSection>): Inputs.Base.Vector2[];
11
54
  }
@@ -1,19 +1,62 @@
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 CrossSectionEvaluate {
2
- constructor(wasm) {
3
- this.manifold = wasm;
6
+ constructor(_wasm) {
4
7
  }
8
+ /**
9
+ * Get area of cross section
10
+ * @param inputs cross section
11
+ * @returns area of cross section
12
+ * @group basic
13
+ * @shortname area
14
+ * @drawable false
15
+ */
5
16
  area(inputs) {
6
17
  return inputs.crossSection.area();
7
18
  }
19
+ /**
20
+ * Check if cross section is empty
21
+ * @param inputs cross section
22
+ * @returns boolean indicating emptyness
23
+ * @group basic
24
+ * @shortname is empty
25
+ * @drawable false
26
+ */
8
27
  isEmpty(inputs) {
9
28
  return inputs.crossSection.isEmpty();
10
29
  }
30
+ /**
31
+ * Get number of vertices in cross section
32
+ * @param inputs cross section
33
+ * @returns number of vertices of cross section
34
+ * @group basic
35
+ * @shortname num vert
36
+ * @drawable false
37
+ */
11
38
  numVert(inputs) {
12
39
  return inputs.crossSection.numVert();
13
40
  }
41
+ /**
42
+ * Get number of contours in cross section
43
+ * @param inputs cross section
44
+ * @returns number of contour of cross section
45
+ * @group basic
46
+ * @shortname num contour
47
+ * @drawable false
48
+ */
14
49
  numContour(inputs) {
15
50
  return inputs.crossSection.numContour();
16
51
  }
52
+ /**
53
+ * Get the bounds of the contour as a rectangle. Output is given in two vec2 points in the array. First array is the min point and second array is the max point.
54
+ * @param inputs cross section
55
+ * @returns bounds of cross section
56
+ * @group basic
57
+ * @shortname bounds
58
+ * @drawable false
59
+ */
17
60
  bounds(inputs) {
18
61
  const bounds = inputs.crossSection.bounds();
19
62
  return [bounds.min, bounds.max];
@@ -1,13 +1,84 @@
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 CrossSectionOperations {
4
8
  private manifold;
5
9
  constructor(wasm: Manifold3D.ManifoldToplevel);
10
+ /**
11
+ * Compute convex hull for the cross section
12
+ * @param inputs cross section
13
+ * @returns hulled cross section
14
+ * @group basic
15
+ * @shortname hull
16
+ * @drawable true
17
+ */
6
18
  hull(inputs: Inputs.Manifold.CrossSectionDto<Manifold3D.CrossSection>): Manifold3D.CrossSection;
19
+ /**
20
+ * Extrude the cross section to create a 3D shape
21
+ * @param inputs cross section and extrusion parameters
22
+ * @returns extruded manifold shape
23
+ * @group basic
24
+ * @shortname extrude
25
+ * @drawable true
26
+ */
7
27
  extrude(inputs: Inputs.Manifold.ExtrudeDto<Manifold3D.CrossSection>): Manifold3D.Manifold;
28
+ /**
29
+ * Revolve the cross section to create a 3D shape
30
+ * @param inputs cross section and extrusion parameters
31
+ * @returns extruded manifold shape
32
+ * @group basic
33
+ * @shortname revolve
34
+ * @drawable true
35
+ */
8
36
  revolve(inputs: Inputs.Manifold.RevolveDto<Manifold3D.CrossSection>): Manifold3D.Manifold;
37
+ /**
38
+ * Offsets the cross section to create a new cross section with a given delta (uses Clipper2 algorithm behind).
39
+ * @param inputs cross section and offset parameters
40
+ * @returns offset cross section
41
+ * @group basic
42
+ * @shortname offset
43
+ * @drawable true
44
+ */
9
45
  offset(inputs: Inputs.Manifold.OffsetDto<Manifold3D.CrossSection>): Manifold3D.CrossSection;
46
+ /**
47
+ * Remove vertices from the contours in this CrossSection that are less than
48
+ * the specified distance epsilon from an imaginary line that passes through
49
+ * its two adjacent vertices. Near duplicate vertices and collinear points
50
+ * will be removed at lower epsilons, with elimination of line segments
51
+ * becoming increasingly aggressive with larger epsilons.
52
+ *
53
+ * It is recommended to apply this function following Offset, in order to
54
+ * clean up any spurious tiny line segments introduced that do not improve
55
+ * quality in any meaningful way. This is particularly important if further
56
+ * offseting operations are to be performed, which would compound the issue.
57
+ * @param inputs cross section and epsilon parameters
58
+ * @returns simplified cross section
59
+ * @group basic
60
+ * @shortname simplify
61
+ * @drawable true
62
+ */
10
63
  simplify(inputs: Inputs.Manifold.SimplifyDto<Manifold3D.CrossSection>): Manifold3D.CrossSection;
64
+ /**
65
+ * Composes multiple cross sections or polygons into a single cross section
66
+ * @param inputs cross sections or polygons
67
+ * @returns composed cross section
68
+ * @group composition
69
+ * @shortname compose
70
+ * @drawable true
71
+ */
11
72
  compose(inputs: Inputs.Manifold.ComposeDto<(Manifold3D.CrossSection | Manifold3D.Polygons)[]>): Manifold3D.CrossSection;
73
+ /**
74
+ * Decompose cross sections that are topologically
75
+ * disconnected, each containing one outline contour with zero or more
76
+ * holes.
77
+ * @param inputs cross section
78
+ * @returns decomposed cross sections
79
+ * @group composition
80
+ * @shortname decompose
81
+ * @drawable true
82
+ */
12
83
  decompose(inputs: Inputs.Manifold.CrossSectionDto<Manifold3D.CrossSection>): Manifold3D.CrossSection[];
13
84
  }
@@ -1,35 +1,104 @@
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 CrossSectionOperations {
2
6
  constructor(wasm) {
3
7
  this.manifold = wasm;
4
8
  }
9
+ /**
10
+ * Compute convex hull for the cross section
11
+ * @param inputs cross section
12
+ * @returns hulled cross section
13
+ * @group basic
14
+ * @shortname hull
15
+ * @drawable true
16
+ */
5
17
  hull(inputs) {
6
18
  return inputs.crossSection.hull();
7
19
  }
20
+ /**
21
+ * Extrude the cross section to create a 3D shape
22
+ * @param inputs cross section and extrusion parameters
23
+ * @returns extruded manifold shape
24
+ * @group basic
25
+ * @shortname extrude
26
+ * @drawable true
27
+ */
8
28
  extrude(inputs) {
9
29
  return inputs.crossSection.extrude(inputs.height, inputs.nDivisions, inputs.twistDegrees, [inputs.scaleTopX, inputs.scaleTopY], inputs.center);
10
30
  }
31
+ /**
32
+ * Revolve the cross section to create a 3D shape
33
+ * @param inputs cross section and extrusion parameters
34
+ * @returns extruded manifold shape
35
+ * @group basic
36
+ * @shortname revolve
37
+ * @drawable true
38
+ */
11
39
  revolve(inputs) {
12
40
  const res = inputs.crossSection.revolve(inputs.circularSegments, inputs.revolveDegrees);
13
41
  if (inputs.matchProfile) {
14
- // Manifold revolves around Y-axis then sets it as Z-axis
15
- // We need to rotate -90 degrees around X to make Y point up correctly
16
42
  return res.rotate([-90, 0, 0]);
17
43
  }
18
44
  else {
19
45
  return res;
20
46
  }
21
47
  }
48
+ /**
49
+ * Offsets the cross section to create a new cross section with a given delta (uses Clipper2 algorithm behind).
50
+ * @param inputs cross section and offset parameters
51
+ * @returns offset cross section
52
+ * @group basic
53
+ * @shortname offset
54
+ * @drawable true
55
+ */
22
56
  offset(inputs) {
23
57
  return inputs.crossSection.offset(inputs.delta, inputs.joinType, inputs.miterLimit, inputs.circularSegments);
24
58
  }
59
+ /**
60
+ * Remove vertices from the contours in this CrossSection that are less than
61
+ * the specified distance epsilon from an imaginary line that passes through
62
+ * its two adjacent vertices. Near duplicate vertices and collinear points
63
+ * will be removed at lower epsilons, with elimination of line segments
64
+ * becoming increasingly aggressive with larger epsilons.
65
+ *
66
+ * It is recommended to apply this function following Offset, in order to
67
+ * clean up any spurious tiny line segments introduced that do not improve
68
+ * quality in any meaningful way. This is particularly important if further
69
+ * offseting operations are to be performed, which would compound the issue.
70
+ * @param inputs cross section and epsilon parameters
71
+ * @returns simplified cross section
72
+ * @group basic
73
+ * @shortname simplify
74
+ * @drawable true
75
+ */
25
76
  simplify(inputs) {
26
77
  return inputs.crossSection.simplify(inputs.epsilon);
27
78
  }
79
+ /**
80
+ * Composes multiple cross sections or polygons into a single cross section
81
+ * @param inputs cross sections or polygons
82
+ * @returns composed cross section
83
+ * @group composition
84
+ * @shortname compose
85
+ * @drawable true
86
+ */
28
87
  compose(inputs) {
29
88
  const { CrossSection } = this.manifold;
30
89
  const { compose } = CrossSection;
31
90
  return compose(inputs.polygons);
32
91
  }
92
+ /**
93
+ * Decompose cross sections that are topologically
94
+ * disconnected, each containing one outline contour with zero or more
95
+ * holes.
96
+ * @param inputs cross section
97
+ * @returns decomposed cross sections
98
+ * @group composition
99
+ * @shortname decompose
100
+ * @drawable true
101
+ */
33
102
  decompose(inputs) {
34
103
  return inputs.crossSection.decompose();
35
104
  }
@@ -1,10 +1,49 @@
1
1
  import * as Inputs from "../../inputs/manifold-inputs";
2
2
  import * as Manifold3D from "manifold-3d";
3
+ /**
4
+ * Contains various functions for making shapes Manifold library https://github.com/elalish/manifold
5
+ * Thanks Manifold community for developing this kernel
6
+ */
3
7
  export declare class CrossSectionShapes {
4
8
  private manifold;
5
9
  constructor(wasm: Manifold3D.ManifoldToplevel);
10
+ /**
11
+ * Create a 2d cross-section from a set of contours (complex polygons). A
12
+ * boolean union operation (with Positive filling rule by default) is
13
+ * performed to combine overlapping polygons and ensure the resulting
14
+ * CrossSection is free of intersections.
15
+ * @param inputs polygons and fill rule
16
+ * @returns cross section
17
+ * @group base
18
+ * @shortname create
19
+ * @drawable true
20
+ */
6
21
  create(inputs: Inputs.Manifold.CreateContourSectionDto): Manifold3D.CrossSection;
22
+ /**
23
+ * Create a 2D square cross section
24
+ * @param inputs Square parameters
25
+ * @returns square cross section
26
+ * @group primitives
27
+ * @shortname square
28
+ * @drawable true
29
+ */
7
30
  square(inputs: Inputs.Manifold.SquareDto): Manifold3D.CrossSection;
31
+ /**
32
+ * Create a 2D circle cross section
33
+ * @param inputs Circle parameters
34
+ * @returns circle cross section
35
+ * @group primitives
36
+ * @shortname circle
37
+ * @drawable true
38
+ */
8
39
  circle(inputs: Inputs.Manifold.CircleDto): Manifold3D.CrossSection;
40
+ /**
41
+ * Create a 2D rectangle cross section
42
+ * @param inputs Rectangle parameters
43
+ * @returns rectangle cross section
44
+ * @group primitives
45
+ * @shortname rectangle
46
+ * @drawable true
47
+ */
9
48
  rectangle(inputs: Inputs.Manifold.RectangleDto): Manifold3D.CrossSection;
10
49
  }
@@ -1,21 +1,60 @@
1
+ /**
2
+ * Contains various functions for making shapes Manifold library https://github.com/elalish/manifold
3
+ * Thanks Manifold community for developing this kernel
4
+ */
1
5
  export class CrossSectionShapes {
2
6
  constructor(wasm) {
3
7
  this.manifold = wasm;
4
8
  }
9
+ /**
10
+ * Create a 2d cross-section from a set of contours (complex polygons). A
11
+ * boolean union operation (with Positive filling rule by default) is
12
+ * performed to combine overlapping polygons and ensure the resulting
13
+ * CrossSection is free of intersections.
14
+ * @param inputs polygons and fill rule
15
+ * @returns cross section
16
+ * @group base
17
+ * @shortname create
18
+ * @drawable true
19
+ */
5
20
  create(inputs) {
6
21
  const { CrossSection } = this.manifold;
7
22
  return new CrossSection(inputs.polygons, inputs.fillRule);
8
23
  }
24
+ /**
25
+ * Create a 2D square cross section
26
+ * @param inputs Square parameters
27
+ * @returns square cross section
28
+ * @group primitives
29
+ * @shortname square
30
+ * @drawable true
31
+ */
9
32
  square(inputs) {
10
33
  const { CrossSection } = this.manifold;
11
34
  const { square } = CrossSection;
12
35
  return square(inputs.size, inputs.center);
13
36
  }
37
+ /**
38
+ * Create a 2D circle cross section
39
+ * @param inputs Circle parameters
40
+ * @returns circle cross section
41
+ * @group primitives
42
+ * @shortname circle
43
+ * @drawable true
44
+ */
14
45
  circle(inputs) {
15
46
  const { CrossSection } = this.manifold;
16
47
  const { circle } = CrossSection;
17
48
  return circle(inputs.radius, inputs.circularSegments);
18
49
  }
50
+ /**
51
+ * Create a 2D rectangle cross section
52
+ * @param inputs Rectangle parameters
53
+ * @returns rectangle cross section
54
+ * @group primitives
55
+ * @shortname rectangle
56
+ * @drawable true
57
+ */
19
58
  rectangle(inputs) {
20
59
  const { CrossSection } = this.manifold;
21
60
  const { square } = CrossSection;