Skip to content

Commit

Permalink
Update for 0.6.7 release
Browse files Browse the repository at this point in the history
  • Loading branch information
nicklockwood committed Jan 1, 2023
1 parent 9ba6f6c commit db28fca
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 28 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# Change Log

## [0.6.7](https://github.com/nicklockwood/Euclid/releases/tag/0.6.7) (2023-01-01)

- Fixed use of duplicate cross-sections to create sharp junctions in `loft` shapes
- Fixed `Path(polygon:)` initializer to create closed path and preserve colors
- Added convenience initializers to convert between `Vertex` and `PathPoint`
- Added `Path.with(color:)` and `PathPoint.with(color:)` helpers
- Added `Mesh(submeshes:)` convenience initializer
- Added convenience initializers for `Transform`
- Removed obsolete backwards compatibility code

## [0.6.6](https://github.com/nicklockwood/Euclid/releases/tag/0.6.6) (2022-12-17)

- Reduced compilation time for some complex expressions to fix Linux build
Expand Down
10 changes: 5 additions & 5 deletions Euclid.podspec.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Euclid",
"version": "0.6.6",
"version": "0.6.7",
"license": {
"type": "MIT",
"file": "LICENSE.md"
Expand All @@ -10,13 +10,13 @@
"authors": "Nick Lockwood",
"source": {
"git": "https://github.com/nicklockwood/Euclid.git",
"tag": "0.6.6"
"tag": "0.6.7"
},
"source_files": "Sources",
"requires_arc": true,
"platforms": {
"ios": "10.0",
"osx": "10.12",
"tvos": "10.0"
"ios": "11.0",
"osx": "10.13",
"tvos": "11.0"
}
}
4 changes: 2 additions & 2 deletions Euclid.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@
"@executable_path/../Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 0.6.6;
MARKETING_VERSION = 0.6.7;
OTHER_SWIFT_FLAGS = "-Xfrontend -warn-long-expression-type-checking=75";
PRODUCT_BUNDLE_IDENTIFIER = com.charcoaldesign.Euclid;
PRODUCT_MODULE_NAME = "$(PRODUCT_NAME:c99extidentifier)";
Expand Down Expand Up @@ -779,7 +779,7 @@
"@executable_path/../Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 0.6.6;
MARKETING_VERSION = 0.6.7;
OTHER_SWIFT_FLAGS = "-Xfrontend -warn-long-expression-type-checking=75";
PRODUCT_BUNDLE_IDENTIFIER = com.charcoaldesign.Euclid;
PRODUCT_MODULE_NAME = "$(PRODUCT_NAME:c99extidentifier)";
Expand Down
2 changes: 1 addition & 1 deletion Sources/Euclid+CoreGraphics.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public extension Path {
self.init(subpaths: cgPath.paths(detail: detail, color: color))
}

@available(*, renamed: "init(_:detail:color:)")
@available(*, deprecated, message: "Use `init(_:detail:color:)` instead")
init(cgPath: CGPath, detail: Int = 4, color: Color? = nil) {
self.init(subpaths: cgPath.paths(detail: detail, color: color))
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/Euclid+RealityKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public extension RealityKit.Transform {
}

@available(macOS 12.0, iOS 15.0, *)
private func defaultMaterialLookup(_ material: Polygon.Material?) -> Material? {
private func defaultMaterialLookup(_ material: Polygon.Material?) -> RealityKit.Material? {
switch material {
case let material as RealityKit.Material:
return material
Expand Down Expand Up @@ -161,7 +161,7 @@ public extension ModelEntity {
/// A closure that maps a Euclid material to a RealityKit material.
/// - Parameter m: A Euclid material to convert, or `nil` for the default material.
/// - Returns: A `Material` used by RealityKit.
typealias MaterialProvider = (_ m: Polygon.Material?) -> Material?
typealias MaterialProvider = (_ m: Polygon.Material?) -> RealityKit.Material?

/// Creates a model entity from a ``Mesh`` using the default tessellation method.
/// - Parameters:
Expand Down
4 changes: 2 additions & 2 deletions Sources/Euclid+SceneKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ public extension SCNGeometry {
)
}

@available(*, renamed: "init(_:)")
@available(*, deprecated, message: "Use `init(_:)` instead")
convenience init(bounds: Bounds) {
self.init(bounds)
}
Expand Down Expand Up @@ -728,7 +728,7 @@ public extension Mesh {
self.init(scnGeometry) { _ in material }
}

@available(*, renamed: "init(_:material:)")
@available(*, deprecated, message: "Use `init(_:material:)` instead")
init?(scnGeometry: SCNGeometry, materialLookup: MaterialProvider? = nil) {
self.init(scnGeometry, materialLookup: materialLookup)
}
Expand Down
9 changes: 2 additions & 7 deletions Sources/Mesh.swift
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,9 @@ public extension Mesh {
allBoundsSet = allBoundsSet && mesh.boundsIfSet != nil
polygons += mesh.polygons
}
var boundsIfSet: Bounds?
if allBoundsSet {
boundsIfSet = meshes.reduce(into: Bounds.empty) {
$0.formUnion($1.bounds)
}
}
return Mesh(
unchecked: polygons,
bounds: boundsIfSet,
bounds: allBoundsSet ? Bounds(bounds: meshes.map { $0.bounds }) : nil,
isConvex: false,
isWatertight: nil,
submeshes: nil // TODO: can we preserve this?
Expand Down Expand Up @@ -425,6 +419,7 @@ internal extension Mesh {
var boundsIfSet: Bounds? { storage.boundsIfSet }
var watertightIfSet: Bool? { storage.watertightIfSet }
var isKnownConvex: Bool { storage.isConvex }
// Note: we don't expose submeshesIfSet because it's unsafe to reuse
var submeshesIfEmpty: [Mesh]? {
storage.submeshesIfSet.flatMap { $0.isEmpty ? [] : nil }
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Path.swift
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public extension Path {
/// - Parameter subpaths: An array of paths.
init(subpaths: [Path]) {
guard subpaths.count > 1 else {
self = subpaths.first ?? Path([])
self = subpaths.first ?? .empty
return
}
let points = subpaths.flatMap { $0.points }
Expand Down
8 changes: 8 additions & 0 deletions Sources/Stretchable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,18 @@

/// Protocol for stretchable types.
protocol Stretchable {
/// Returns a stretched copy of the value.
/// - Parameters
/// - scaleFactor: A scale factor to apply to the value.
/// - along: The axis along which to apply the scale factor.
func stretched(by scaleFactor: Double, along: Line) -> Self
}

extension Stretchable {
/// Stretch the value in place.
/// - Parameters
/// - scaleFactor: A scale factor to apply to the value.
/// - along: The axis along which to apply the scale factor.
mutating func stretch(by scaleFactor: Double, along: Line) {
self = stretched(by: scaleFactor, along: along)
}
Expand Down
9 changes: 3 additions & 6 deletions Sources/Transforms.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public protocol Transformable {
func translated(by offset: Vector) -> Self

/// Returns a scaled copy of the value.
/// - Parameter scale: A scale vector to apply to the value.
/// - Parameter scale: A vector scale factor to apply to the value.
func scaled(by scale: Vector) -> Self

/// Returns a scaled copy of the value.
Expand Down Expand Up @@ -74,7 +74,7 @@ public extension Transformable {
}

/// Scale the value in place.
/// - Parameter scale: A scale vector to apply to the value.
/// - Parameter scale: A vector scale factor to apply to the value.
mutating func scale(by scale: Vector) {
self = scaled(by: scale)
}
Expand Down Expand Up @@ -241,8 +241,7 @@ public extension Transform {
rotation.isIdentity && offset.isEqual(to: .zero) && scale.isEqual(to: .one)
}

/// Does the transform apply a mirror operation (negative scale).
/// - Parameter v: An offset vector to apply to the transform.
/// Does the transform apply a mirror operation (negative scale)?
var isFlipped: Bool {
isFlippedScale(scale)
}
Expand Down Expand Up @@ -564,8 +563,6 @@ extension Bounds: Transformable {
return isEmpty ? self : Bounds(min.scaled(by: v), max.scaled(by: v))
}

/// Returns a scaled copy of the bounds.
/// - Parameter f: A scale factor to apply to the bounds.
public func scaled(by f: Double) -> Bounds {
let f = f.clamped()
return isEmpty ? self : Bounds(min * f, max * f)
Expand Down
4 changes: 2 additions & 2 deletions Tests/MeshShapeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ class MeshShapeTests: XCTestCase {

func testLoftEmptyPathToPath() {
let shapes = [
Path([]),
Path.empty,
Path.square(),
]

Expand All @@ -288,7 +288,7 @@ class MeshShapeTests: XCTestCase {
func testLoftPathToEmptyPath() {
let shapes = [
Path.square(),
Path([]),
Path.empty,
]

let loft = Mesh.loft(shapes)
Expand Down

0 comments on commit db28fca

Please sign in to comment.