Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for partial lathes (and by extension partial cylinders) #126

Draft
wants to merge 23 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change Log

## [0.7.5](https://github.com/nicklockwood/Euclid/releases/tag/0.7.5) (2024-01-29)

- Added I/O functions
- Fixed transform not being applied to meshes created from a RealityKit `ModelEntity`
- Materials are now preserved for meshes created from RealityKit models
- Deprecated the `Quaternion` type in favor of `Rotation`

## [0.7.4](https://github.com/nicklockwood/Euclid/releases/tag/0.7.4) (2024-01-19)

- Removed stray `print()` statement from RealityKit exporter
Expand Down
4 changes: 2 additions & 2 deletions Euclid.docc/Extensions/Color.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

### Creating a Color

- ``Color/init(r:g:b:a:)``
- ``Color/init(_:_:_:_:)``
- ``Color/init(_:_:)``
- ``Color/init(_:)-25eby``
- ``Color/init(_:)-53lhy``
- ``Color/init(_:)-7d8un``
- ``Color/init(_:)-9bvpm``

### Default Colors

Expand Down
8 changes: 3 additions & 5 deletions Euclid.docc/Extensions/Vector.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@

### Creating Vectors

- ``Vector/init(_:)-228p6``
- ``Vector/init(_:)-4eop9``
- ``Vector/init(_:)-5n3j``
- ``Vector/init(_:)-63ct7``
- ``Vector/init(_:)-6nlm``
- ``Vector/init(x:y:z:)``
- ``Vector/init(_:_:_:)``
- ``Vector/init(size:)-8b34m``
- ``Vector/init(size:)-nkyk``
- ``Vector/init(_:)-63ct7``
- ``Vector/init(_:)-602vn``

### Default Vectors

Expand Down
4 changes: 2 additions & 2 deletions Euclid.podspec.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Euclid",
"version": "0.7.4",
"version": "0.7.5",
"license": {
"type": "MIT",
"file": "LICENSE.md"
Expand All @@ -10,7 +10,7 @@
"authors": "Nick Lockwood",
"source": {
"git": "https://github.com/nicklockwood/Euclid.git",
"tag": "0.7.4"
"tag": "0.7.5"
},
"source_files": "Sources",
"requires_arc": true,
Expand Down
36 changes: 28 additions & 8 deletions Euclid.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
0112D5C928EE29BB00A1C085 /* Euclid+RealityKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0112D5C828EE29BB00A1C085 /* Euclid+RealityKit.swift */; };
0125478027AFD53900C442C3 /* MeshShapeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0125477F27AFD53900C442C3 /* MeshShapeTests.swift */; };
0128EEBB2ABA607A00E60976 /* EuclidMesh.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0128EEBA2ABA607A00E60976 /* EuclidMesh.swift */; };
0131216A2A9E61B500BC8683 /* Path+CSG.swift in Sources */ = {isa = PBXBuildFile; fileRef = 013121692A9E61B500BC8683 /* Path+CSG.swift */; };
0131216D2AA2987500BC8683 /* PolygonCSGTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0131216B2AA2979900BC8683 /* PolygonCSGTests.swift */; };
013312DD21CA532A00626F1B /* PlaneTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 013312DC21CA532A00626F1B /* PlaneTests.swift */; };
013499932902FB5900CED6BE /* Euclid+SIMD.swift in Sources */ = {isa = PBXBuildFile; fileRef = 013499922902FB5900CED6BE /* Euclid+SIMD.swift */; };
0134999729043ACC00CED6BE /* RealityKitViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0134999629043ACC00CED6BE /* RealityKitViewController.swift */; };
Expand All @@ -23,6 +25,8 @@
014AC60E2505963800F54349 /* SceneKitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 014AC60D2505963800F54349 /* SceneKitTests.swift */; };
0157FEC42B63B1BE009033D1 /* Mesh+IO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0157FEC32B63B1BE009033D1 /* Mesh+IO.swift */; };
0162A09623795E260078AE84 /* Euclid.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 016FAB2921BFE78100AF60DC /* Euclid.framework */; platformFilters = (ios, maccatalyst, ); };
01593CCB297C39180058A35C /* Direction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01593CCA297C39180058A35C /* Direction.swift */; };
01593CCD297CB5AF0058A35C /* Position.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01593CCC297CB5AF0058A35C /* Position.swift */; };
0162A09923795EB30078AE84 /* Euclid.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 016FAB2921BFE78100AF60DC /* Euclid.framework */; };
016A77F82B2F7C7800B7AB73 /* MeshImportTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 016A77F72B2F7C7800B7AB73 /* MeshImportTests.swift */; };
016A77FA2B32184A00B7AB73 /* RealityKitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 016A77F92B32184A00B7AB73 /* RealityKitTests.swift */; };
Expand Down Expand Up @@ -70,12 +74,13 @@
01E5F54923D59BF100717D58 /* BSP.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01E5F54823D59BF100717D58 /* BSP.swift */; };
01F2382023BF4160005EC9DB /* LineSegment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01F2381F23BF4160005EC9DB /* LineSegment.swift */; };
01F2465428FD4A020071AE64 /* QuaternionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01F2465228FD499F0071AE64 /* QuaternionTests.swift */; };
01FAE7BD29744E08008DB288 /* PolygonCSGTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01FAE7BB29744C22008DB288 /* PolygonCSGTests.swift */; };
01FAE7BD29744E08008DB288 /* PathCSGTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01FAE7BB29744C22008DB288 /* PathCSGTests.swift */; };
0A240137256A64FB00C1535C /* AngleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A240136256A64FB00C1535C /* AngleTests.swift */; };
0A24013F256A671600C1535C /* Angle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A24013E256A671600C1535C /* Angle.swift */; };
52A3852E238D6E5700BE8407 /* LineTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52A3852D238D6E5700BE8407 /* LineTests.swift */; };
52A663A123857D5300FACF9D /* Line.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52A663A023857D5300FACF9D /* Line.swift */; };
52C844E223854CDF009C0A73 /* VectorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52C844E023854C87009C0A73 /* VectorTests.swift */; };
EA3A382D29700A4400A6185A /* Edge.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3A382C29700A4400A6185A /* Edge.swift */; };
EA6F2219296C5A9000B530BE /* Polygon+CSG.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA6F2218296C5A9000B530BE /* Polygon+CSG.swift */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -117,6 +122,8 @@
0112D5C828EE29BB00A1C085 /* Euclid+RealityKit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Euclid+RealityKit.swift"; sourceTree = "<group>"; };
0125477F27AFD53900C442C3 /* MeshShapeTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeshShapeTests.swift; sourceTree = "<group>"; };
0128EEBA2ABA607A00E60976 /* EuclidMesh.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EuclidMesh.swift; sourceTree = "<group>"; };
013121692A9E61B500BC8683 /* Path+CSG.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Path+CSG.swift"; sourceTree = "<group>"; };
0131216B2AA2979900BC8683 /* PolygonCSGTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PolygonCSGTests.swift; sourceTree = "<group>"; };
013312DC21CA532A00626F1B /* PlaneTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaneTests.swift; sourceTree = "<group>"; };
013499922902FB5900CED6BE /* Euclid+SIMD.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Euclid+SIMD.swift"; sourceTree = "<group>"; };
0134999629043ACC00CED6BE /* RealityKitViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RealityKitViewController.swift; sourceTree = "<group>"; };
Expand All @@ -129,6 +136,8 @@
0157FEC32B63B1BE009033D1 /* Mesh+IO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Mesh+IO.swift"; sourceTree = "<group>"; };
016A77F72B2F7C7800B7AB73 /* MeshImportTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeshImportTests.swift; sourceTree = "<group>"; };
016A77F92B32184A00B7AB73 /* RealityKitTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RealityKitTests.swift; sourceTree = "<group>"; };
01593CCA297C39180058A35C /* Direction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Direction.swift; sourceTree = "<group>"; };
01593CCC297CB5AF0058A35C /* Position.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Position.swift; sourceTree = "<group>"; };
016FAB2921BFE78100AF60DC /* Euclid.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Euclid.framework; sourceTree = BUILT_PRODUCTS_DIR; };
016FAB2C21BFE78100AF60DC /* Euclid.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Euclid.h; sourceTree = "<group>"; };
016FAB2D21BFE78100AF60DC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
Expand Down Expand Up @@ -177,12 +186,13 @@
01E5F54823D59BF100717D58 /* BSP.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BSP.swift; sourceTree = "<group>"; };
01F2381F23BF4160005EC9DB /* LineSegment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LineSegment.swift; sourceTree = "<group>"; };
01F2465228FD499F0071AE64 /* QuaternionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuaternionTests.swift; sourceTree = "<group>"; };
01FAE7BB29744C22008DB288 /* PolygonCSGTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PolygonCSGTests.swift; sourceTree = "<group>"; };
01FAE7BB29744C22008DB288 /* PathCSGTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PathCSGTests.swift; sourceTree = "<group>"; };
0A240136256A64FB00C1535C /* AngleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AngleTests.swift; sourceTree = "<group>"; };
0A24013E256A671600C1535C /* Angle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Angle.swift; sourceTree = "<group>"; };
52A3852D238D6E5700BE8407 /* LineTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LineTests.swift; sourceTree = "<group>"; };
52A663A023857D5300FACF9D /* Line.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Line.swift; sourceTree = "<group>"; };
52C844E023854C87009C0A73 /* VectorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VectorTests.swift; sourceTree = "<group>"; };
EA3A382C29700A4400A6185A /* Edge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Edge.swift; sourceTree = "<group>"; };
EA6F2218296C5A9000B530BE /* Polygon+CSG.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Polygon+CSG.swift"; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -251,11 +261,13 @@
0188525726D951490079C602 /* Color.swift */,
016FAB4521BFE7C100AF60DC /* Utilities.swift */,
016FAB4321BFE7C100AF60DC /* Vector.swift */,
01593CCC297CB5AF0058A35C /* Position.swift */,
01593CCA297C39180058A35C /* Direction.swift */,
016FAB4621BFE7C100AF60DC /* Vertex.swift */,
EA3A382C29700A4400A6185A /* Edge.swift */,
016FAB4C21BFE7C200AF60DC /* Polygon.swift */,
EA6F2218296C5A9000B530BE /* Polygon+CSG.swift */,
01E5F54823D59BF100717D58 /* BSP.swift */,
016FAB4921BFE7C200AF60DC /* Path.swift */,
016FAB4821BFE7C200AF60DC /* Mesh.swift */,
016FAB4421BFE7C100AF60DC /* Mesh+CSG.swift */,
016FAB4E21BFE7C200AF60DC /* Mesh+Shapes.swift */,
Expand All @@ -264,7 +276,9 @@
010A63382A951165000E3306 /* Mesh+OBJ.swift */,
0157FEC32B63B1BE009033D1 /* Mesh+IO.swift */,
016FAB4D21BFE7C200AF60DC /* Plane.swift */,
016FAB4921BFE7C200AF60DC /* Path.swift */,
0148ECA52783796A00B3F836 /* PathPoint.swift */,
013121692A9E61B500BC8683 /* Path+CSG.swift */,
0148ECA3278378D100B3F836 /* Path+Shapes.swift */,
52A663A023857D5300FACF9D /* Line.swift */,
01F2381F23BF4160005EC9DB /* LineSegment.swift */,
Expand All @@ -291,9 +305,9 @@
0A240136256A64FB00C1535C /* AngleTests.swift */,
01D96AB423D8E36A00D0D267 /* BoundsTests.swift */,
01BA29792235E34C0088D36B /* CGPathTests.swift */,
0101BAF425687A450096B1E7 /* CodingTests.swift */,
0188E98226ACA0040029C253 /* LineSegmentTests.swift */,
52A3852D238D6E5700BE8407 /* LineTests.swift */,
0101BAF425687A450096B1E7 /* CodingTests.swift */,
01CBE2672775E3EE00B7ED45 /* MeshTests.swift */,
016FAB5F21BFE7CE00AF60DC /* MeshCSGTests.swift */,
010A633A2A955BE9000E3306 /* MeshExportTests.swift */,
Expand All @@ -302,8 +316,9 @@
013B5BE426923087000860DC /* MetadataTests.swift */,
016FAB5C21BFE7CD00AF60DC /* PathTests.swift */,
016FAB6021BFE7CE00AF60DC /* PathShapeTests.swift */,
01FAE7BB29744C22008DB288 /* PathCSGTests.swift */,
016FAB5E21BFE7CE00AF60DC /* PolygonTests.swift */,
01FAE7BB29744C22008DB288 /* PolygonCSGTests.swift */,
0131216B2AA2979900BC8683 /* PolygonCSGTests.swift */,
013312DC21CA532A00626F1B /* PlaneTests.swift */,
014AC60D2505963800F54349 /* SceneKitTests.swift */,
016A77F92B32184A00B7AB73 /* RealityKitTests.swift */,
Expand Down Expand Up @@ -530,13 +545,15 @@
016FAB5421BFE7C200AF60DC /* Mesh.swift in Sources */,
01CF789326EBE0C70097907A /* Quaternion.swift in Sources */,
0112D5C928EE29BB00A1C085 /* Euclid+RealityKit.swift in Sources */,
01593CCD297CB5AF0058A35C /* Position.swift in Sources */,
EA6F2219296C5A9000B530BE /* Polygon+CSG.swift in Sources */,
016FAB5721BFE7C200AF60DC /* Transforms.swift in Sources */,
016FAB5121BFE7C200AF60DC /* Utilities.swift in Sources */,
016FAB5321BFE7C200AF60DC /* Bounds.swift in Sources */,
01BA297C2235E3590088D36B /* Euclid+CoreGraphics.swift in Sources */,
0148ECA62783796A00B3F836 /* PathPoint.swift in Sources */,
013499932902FB5900CED6BE /* Euclid+SIMD.swift in Sources */,
EA3A382D29700A4400A6185A /* Edge.swift in Sources */,
0188525A26D952890079C602 /* Euclid+AppKit.swift in Sources */,
01A3D52129F32D360085D6BE /* Mesh+STL.swift in Sources */,
01B9F60E292BCE57002CC3EB /* Stretchable.swift in Sources */,
Expand All @@ -550,11 +567,13 @@
0148ECA4278378D100B3F836 /* Path+Shapes.swift in Sources */,
52A663A123857D5300FACF9D /* Line.swift in Sources */,
01D2F9F82AADBB1400C201D9 /* Mesh+Texcoords.swift in Sources */,
01593CCB297C39180058A35C /* Direction.swift in Sources */,
016FAB4F21BFE7C200AF60DC /* Vector.swift in Sources */,
016FAB5021BFE7C200AF60DC /* Mesh+CSG.swift in Sources */,
016FAB5621BFE7C200AF60DC /* Euclid+SceneKit.swift in Sources */,
0A24013F256A671600C1535C /* Angle.swift in Sources */,
016FAB5921BFE7C200AF60DC /* Plane.swift in Sources */,
0131216A2A9E61B500BC8683 /* Path+CSG.swift in Sources */,
016FAB5A21BFE7C200AF60DC /* Mesh+Shapes.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -563,12 +582,13 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
01FAE7BD29744E08008DB288 /* PolygonCSGTests.swift in Sources */,
01FAE7BD29744E08008DB288 /* PathCSGTests.swift in Sources */,
01F2465428FD4A020071AE64 /* QuaternionTests.swift in Sources */,
01A429FA2237A85C00C251A6 /* TextTests.swift in Sources */,
0188E98326ACA0040029C253 /* LineSegmentTests.swift in Sources */,
0A240137256A64FB00C1535C /* AngleTests.swift in Sources */,
016A77F82B2F7C7800B7AB73 /* MeshImportTests.swift in Sources */,
0131216D2AA2987500BC8683 /* PolygonCSGTests.swift in Sources */,
52A3852E238D6E5700BE8407 /* LineTests.swift in Sources */,
016FAB6621BFE7CE00AF60DC /* PathShapeTests.swift in Sources */,
016FAB6321BFE7CE00AF60DC /* UtilityTests.swift in Sources */,
Expand Down Expand Up @@ -796,7 +816,7 @@
"@executable_path/../Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 0.7.4;
MARKETING_VERSION = 0.7.5;
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++14";
OTHER_SWIFT_FLAGS = "-Xfrontend -warn-long-expression-type-checking=75";
Expand Down Expand Up @@ -835,7 +855,7 @@
"@executable_path/../Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 0.7.4;
MARKETING_VERSION = 0.7.5;
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++14";
OTHER_SWIFT_FLAGS = "-Xfrontend -warn-long-expression-type-checking=75";
Expand Down
2 changes: 1 addition & 1 deletion Euclid.xcodeproj/xcshareddata/xcschemes/Euclid.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Release"
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
Expand Down
25 changes: 23 additions & 2 deletions Example/SceneKitViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,36 @@ class SceneKitViewController: UIViewController {
// place the camera
cameraNode.position = SCNVector3(x: 0, y: 0, z: 2)

// create some geometry using Euclid
let start = CFAbsoluteTimeGetCurrent()
// let cube = Mesh.cube(size: 0.8, material: UIColor.red)
// let sphere = Mesh.sphere(slices: 120, material: UIColor.blue)
// let mesh = cube.subtracting(sphere).makeWatertight()

// let cube = Mesh.cube().inverted()
// let cube2 = Mesh.cube().inverted().translated(by: Vector(0.5, 0.5, 0.5))
// let mesh = cube.union(cube2).inverted()

// print("Time:", CFAbsoluteTimeGetCurrent() - start)
// print("Polygons:", mesh.polygons.count)
// print("Triangles:", mesh.triangulate().polygons.count)
// print("Watertight:", mesh.isWatertight)

let polygon1 = Path.square(color: .red)
let polygon2 = Path.square(color: .green).translated(by: Vector(0.5, 0.5, 0)) // .rotated(by: .yaw(.pi / 5))
let polygon3 = Path.square(color: .blue).translated(by: Vector(0.25, -0.25, 0)) // .rotated(by: .yaw(.pi / 5))
let result = Path.difference([polygon1, polygon2, polygon3])
let mesh = Mesh.fill(result)

// create SCNNode
let geometry = SCNGeometry(euclidMesh)
let geometry = SCNGeometry(mesh)
let node = SCNNode(geometry: geometry)
scene.rootNode.addChildNode(node)

// configure the SCNView
let scnView = view as! SCNView
scnView.scene = scene
scnView.autoenablesDefaultLighting = true
// scnView.autoenablesDefaultLighting = true
scnView.allowsCameraControl = true
scnView.backgroundColor = .white
}
Expand Down
14 changes: 10 additions & 4 deletions Sources/Angle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,13 @@ public func tan(_ angle: Angle) -> Double {

public extension Angle {
/// Angle representing a zero (identity) rotation.
static let zero = Angle.radians(0)
static let zero: Angle = .radians(0)
/// Angle representing a quarter rotation.
static let halfPi = Angle.radians(.pi / 2)
static let halfPi: Angle = .radians(.pi / 2)
/// Angle representing a half-rotation.
static let pi = Angle.radians(.pi)
static let pi: Angle = .radians(.pi)
/// Angle representing a full rotation.
static let twoPi = Angle.radians(.pi * 2)
static let twoPi: Angle = .radians(.pi * 2)

/// The angle in degrees.
var degrees: Double {
Expand Down Expand Up @@ -206,6 +206,12 @@ public extension Angle {
}
}

public extension Angle {
func lerp(_ other: Angle, _ t: Double) -> Angle {
return self + (other - self) * t
}
}

extension Angle {
/// Approximate equality
func isEqual(to other: Angle, withPrecision p: Double = epsilon) -> Bool {
Expand Down
Loading
Loading