Skip to content

Commit 48d01f7

Browse files
committed
Update Euclid to 0.5.26
1 parent d4e5d99 commit 48d01f7

30 files changed

+371
-188
lines changed

Euclid/CHANGELOG.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
## [0.5.26](https://github.com/nicklockwood/Euclid/releases/tag/0.5.26) (2022-07-24)
2+
3+
- SceneKit meshes are now more reliably sealed at import time
4+
- Improved triangulation/tessellation of complex convex polygons
5+
- Fixed case where `loft` could produce a mesh with redundant back-face polygons
6+
- You can now create `Path`s with a single point (useful when lofting)
7+
- Fixed crash when lofting zero-scale path
8+
- Fixed assertion failure when scaling path by zero vector
9+
- Reduced false negatives when comparing `Plane` equality
10+
- Improved performance of uniform `Plane` scaling
11+
- Added `Sendable` conformance to all applicable types when building with Xcode 14
12+
- Converted unintended static `var` values to `let`
13+
- Fixed warnings in Xcode 14 beta
14+
115
## [0.5.25](https://github.com/nicklockwood/Euclid/releases/tag/0.5.25) (2022-07-03)
216

317
- Added `Mesh.submeshes` property
@@ -9,7 +23,7 @@
923

1024
- Fixed crash when extruding along collinear points
1125
- Fixed bug when lofting intermediate open paths
12-
- Improved makeWatertight() implementation
26+
- Improved `makeWatertight()` implementation
1327
- Improved vertex merging logic to only merge vertices that cause holes
1428
- Fixed bugs in triangulation logic that could introduce holes
1529
- Fixed case where mesh was incorrectly assumed to be watertight
@@ -61,7 +75,7 @@
6175
- Renamed `Mesh(text:)` constructor to `Mesh.text()`
6276
- Replaced broken `SCNNode`/`URL` Mesh initializers
6377
- Deprecated `Vector.quantized()` method
64-
- Fixed warnings on Xcode 13.3
78+
- Fixed warnings in Xcode 13.3
6579

6680
## [0.5.17](https://github.com/nicklockwood/Euclid/releases/tag/0.5.17) (2022-02-23)
6781

Euclid/Euclid.podspec.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Euclid",
3-
"version": "0.5.25",
3+
"version": "0.5.26",
44
"license": {
55
"type": "MIT",
66
"file": "LICENSE.md"
@@ -10,7 +10,7 @@
1010
"authors": "Nick Lockwood",
1111
"source": {
1212
"git": "https://github.com/nicklockwood/Euclid.git",
13-
"tag": "0.5.25"
13+
"tag": "0.5.26"
1414
},
1515
"source_files": "Sources",
1616
"requires_arc": true,

Euclid/Euclid.xcodeproj/project.pbxproj

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 50;
6+
objectVersion = 54;
77
objects = {
88

99
/* Begin PBXBuildFile section */
@@ -364,7 +364,7 @@
364364
isa = PBXProject;
365365
attributes = {
366366
LastSwiftUpdateCheck = 1010;
367-
LastUpgradeCheck = 1340;
367+
LastUpgradeCheck = 1400;
368368
ORGANIZATIONNAME = "Nick Lockwood";
369369
TargetAttributes = {
370370
016FAB2821BFE78100AF60DC = {
@@ -431,6 +431,7 @@
431431
/* Begin PBXShellScriptBuildPhase section */
432432
01F2A9E9250177730081CDF5 /* Format Code */ = {
433433
isa = PBXShellScriptBuildPhase;
434+
alwaysOutOfDate = 1;
434435
buildActionMask = 2147483647;
435436
files = (
436437
);
@@ -449,6 +450,7 @@
449450
};
450451
0A24014C256AA09600C1535C /* Lint Code */ = {
451452
isa = PBXShellScriptBuildPhase;
453+
alwaysOutOfDate = 1;
452454
buildActionMask = 2147483647;
453455
files = (
454456
);
@@ -607,6 +609,7 @@
607609
CODE_SIGN_IDENTITY = "Mac Developer";
608610
COPY_PHASE_STRIP = NO;
609611
CURRENT_PROJECT_VERSION = 1;
612+
DEAD_CODE_STRIPPING = YES;
610613
DEBUG_INFORMATION_FORMAT = dwarf;
611614
ENABLE_STRICT_OBJC_MSGSEND = YES;
612615
ENABLE_TESTABILITY = YES;
@@ -674,6 +677,7 @@
674677
CODE_SIGN_IDENTITY = "Mac Developer";
675678
COPY_PHASE_STRIP = NO;
676679
CURRENT_PROJECT_VERSION = 1;
680+
DEAD_CODE_STRIPPING = YES;
677681
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
678682
ENABLE_NS_ASSERTIONS = NO;
679683
ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -705,6 +709,7 @@
705709
CODE_SIGN_IDENTITY = "";
706710
CODE_SIGN_STYLE = Automatic;
707711
COMBINE_HIDPI_IMAGES = YES;
712+
DEAD_CODE_STRIPPING = YES;
708713
DEFINES_MODULE = YES;
709714
DEVELOPMENT_TEAM = "";
710715
DYLIB_COMPATIBILITY_VERSION = 1;
@@ -718,7 +723,7 @@
718723
"@executable_path/../Frameworks",
719724
"@loader_path/Frameworks",
720725
);
721-
MARKETING_VERSION = 0.5.25;
726+
MARKETING_VERSION = 0.5.26;
722727
OTHER_SWIFT_FLAGS = "-Xfrontend -warn-long-expression-type-checking=75";
723728
PRODUCT_BUNDLE_IDENTIFIER = com.charcoaldesign.Euclid;
724729
PRODUCT_MODULE_NAME = "$(PRODUCT_NAME:c99extidentifier)";
@@ -737,6 +742,7 @@
737742
CODE_SIGN_IDENTITY = "";
738743
CODE_SIGN_STYLE = Automatic;
739744
COMBINE_HIDPI_IMAGES = YES;
745+
DEAD_CODE_STRIPPING = YES;
740746
DEFINES_MODULE = YES;
741747
DEVELOPMENT_TEAM = "";
742748
DYLIB_COMPATIBILITY_VERSION = 1;
@@ -750,7 +756,7 @@
750756
"@executable_path/../Frameworks",
751757
"@loader_path/Frameworks",
752758
);
753-
MARKETING_VERSION = 0.5.25;
759+
MARKETING_VERSION = 0.5.26;
754760
OTHER_SWIFT_FLAGS = "-Xfrontend -warn-long-expression-type-checking=75";
755761
PRODUCT_BUNDLE_IDENTIFIER = com.charcoaldesign.Euclid;
756762
PRODUCT_MODULE_NAME = "$(PRODUCT_NAME:c99extidentifier)";
@@ -769,6 +775,7 @@
769775
CODE_SIGN_IDENTITY = "-";
770776
CODE_SIGN_STYLE = Automatic;
771777
COMBINE_HIDPI_IMAGES = YES;
778+
DEAD_CODE_STRIPPING = YES;
772779
DEVELOPMENT_TEAM = "";
773780
INFOPLIST_FILE = Tests/Info.plist;
774781
LD_RUNPATH_SEARCH_PATHS = (
@@ -791,6 +798,7 @@
791798
CODE_SIGN_IDENTITY = "-";
792799
CODE_SIGN_STYLE = Automatic;
793800
COMBINE_HIDPI_IMAGES = YES;
801+
DEAD_CODE_STRIPPING = YES;
794802
DEVELOPMENT_TEAM = "";
795803
INFOPLIST_FILE = Tests/Info.plist;
796804
LD_RUNPATH_SEARCH_PATHS = (

Euclid/Euclid.xcodeproj/xcshareddata/xcschemes/Euclid.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1340"
3+
LastUpgradeVersion = "1400"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Euclid/Euclid.xcodeproj/xcshareddata/xcschemes/Example.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1340"
3+
LastUpgradeVersion = "1400"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Euclid/Example/SceneViewController.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class SceneViewController: UIViewController {
3030
let cube = Mesh.cube(size: 0.8, material: UIColor.red)
3131
let sphere = Mesh.sphere(slices: 120, material: UIColor.blue)
3232
let mesh = cube.subtract(sphere).makeWatertight()
33+
3334
print("Time:", CFAbsoluteTimeGetCurrent() - start)
3435
print("Polygons:", mesh.polygons.count)
3536
print("Triangles:", mesh.triangulate().polygons.count)

Euclid/Sources/Angle.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
import Foundation
3333

3434
/// An angle or 2D rotation.
35-
public struct Angle: Hashable, Comparable {
35+
public struct Angle: Hashable, Comparable, Sendable {
3636
/// The angle in radians.
3737
public var radians: Double
3838

@@ -92,13 +92,13 @@ public func tan(_ angle: Angle) -> Double {
9292

9393
public extension Angle {
9494
/// Angle representing a zero (identity) rotation.
95-
static var zero = Angle.radians(0)
95+
static let zero = Angle.radians(0)
9696
/// Angle representing a quarter rotation.
97-
static var halfPi = Angle.radians(.pi / 2)
97+
static let halfPi = Angle.radians(.pi / 2)
9898
/// Angle representing a half-rotation.
99-
static var pi = Angle.radians(.pi)
99+
static let pi = Angle.radians(.pi)
100100
/// Angle representing a full rotation.
101-
static var twoPi = Angle.radians(.pi * 2)
101+
static let twoPi = Angle.radians(.pi * 2)
102102

103103
/// The angle in degrees.
104104
var degrees: Double {

Euclid/Sources/Bounds.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
/// An axially-aligned bounding box in 3D space.
3333
///
3434
/// Used for efficient intersection elimination between more complex shapes.
35-
public struct Bounds: Hashable {
35+
public struct Bounds: Hashable, Sendable {
3636
/// The minimum coordinate of the bounds.
3737
public let min: Vector
3838
/// The maximum coordinate of the bounds.

Euclid/Sources/Color.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
/// A color in RGBA format.
3333
///
3434
/// Color can be used as a ``Polygon/material-swift.property`` or as a ``Vertex/color``.
35-
public struct Color: Hashable {
35+
public struct Color: Hashable, Sendable {
3636
/// The red component of the color.
3737
public var r: Double
3838
/// The green component of the color.
@@ -85,13 +85,13 @@ extension Color: Codable {
8585
}
8686

8787
public extension Color {
88-
static var clear = Color(0, 0)
89-
static var black = Color(0)
90-
static var white = Color(1)
88+
static let clear = Color(0, 0)
89+
static let black = Color(0)
90+
static let white = Color(1)
9191
static let gray = Color(0.5)
92-
static var red = Color(1, 0, 0)
93-
static var green = Color(0, 1, 0)
94-
static var blue = Color(0, 0, 1)
92+
static let red = Color(1, 0, 0)
93+
static let green = Color(0, 1, 0)
94+
static let blue = Color(0, 0, 1)
9595
static let yellow = Color(1, 1, 0)
9696
static let cyan = Color(0, 1, 1)
9797
static let magenta = Color(1, 0, 1)

Euclid/Sources/Euclid+SceneKit.swift

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -685,12 +685,10 @@ public extension Mesh {
685685
isWatertight = nil
686686
}
687687
let bounds = Bounds(scnGeometry.boundingBox)
688-
if isWatertight == true {
689-
let holeEdges = polygons.holeEdges
690-
let distance = holeEdges.separationDistance
691-
let endPoints = holeEdges.endPoints
692-
polygons = polygons.mergingVertices(endPoints, withPrecision: distance)
693-
}
688+
let holeEdges = polygons.holeEdges
689+
let maxLength = (holeEdges.map { $0.length }.min() ?? 0) / 2
690+
let distance = max(min(holeEdges.separationDistance, maxLength), 1e-6)
691+
polygons = polygons.mergingVertices(withPrecision: distance)
694692
self.init(
695693
unchecked: polygons,
696694
bounds: bounds,

Euclid/Sources/Line.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
//
3131

3232
/// An infinite line in 3D space.
33-
public struct Line: Hashable {
33+
public struct Line: Hashable, Sendable {
3434
// An arbitrary point on the line selected as the origin.
3535
public let origin: Vector
3636
// The normalized direction of the line.

Euclid/Sources/LineSegment.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
//
3131

3232
/// A finite line segment in 3D space.
33-
public struct LineSegment: Hashable {
33+
public struct LineSegment: Hashable, Sendable {
3434
// The starting point of the line segment.
3535
public let start: Vector
3636
// The end point of the line segment.

0 commit comments

Comments
 (0)