You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The library uses protocols for vectors and matrices, so you can add conformance to your own types and send them in without conversion.
31
+
The library uses protocols for vectors and matrices. The `Manifold` and `CrossSection` types are generic over V, so you can plug in your own vector type.
32
32
33
-
```swift
34
-
importManifold3D
35
33
36
-
structV: Vector3 {
37
-
let x: Double
38
-
let y: Double
39
-
let z: Double
34
+
```swift
35
+
structMyVector: Vector3 {
36
+
let x, y, z:Double
40
37
}
41
38
42
-
let sphere = Manifold.sphere(radius: 10, segmentCount: 25)
43
-
let box = Manifold.cube(size: V(x: 12, y: 20, z: 20))
44
-
.rotate(V(x: 20, y: 25, z: 0))
45
-
let difference = sphere.boolean(.difference, with: box)
39
+
let box = Manifold.cube(size: MyVector(x: 12, y: 20, z: 20))
40
+
.rotate(MyVector(x: 20, y: 25, z: 0))
41
+
42
+
let difference = Manifold.sphere(radius: 10, segmentCount: 25)
43
+
.boolean(.difference, with: box)
46
44
47
45
let meshGL = difference.meshGL()
48
46
// Render or save meshGL.vertices, meshGL.triangles, etc.
0 commit comments