Skip to content

Commit b705343

Browse files
committed
Update Euclid to 0.5.30
1 parent b873052 commit b705343

File tree

6 files changed

+26
-11
lines changed

6 files changed

+26
-11
lines changed

Euclid/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [0.5.30](https://github.com/nicklockwood/Euclid/releases/tag/0.5.30) (2022-09-26)
2+
3+
- Fixed bug where applying negative scale to bounds made it empty
4+
15
## [0.5.29](https://github.com/nicklockwood/Euclid/releases/tag/0.5.29) (2022-09-03)
26

37
- Fixed bug where transforming an empty bounds led to nan coordinates

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.29",
3+
"version": "0.5.30",
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.29"
13+
"tag": "0.5.30"
1414
},
1515
"source_files": "Sources",
1616
"requires_arc": true,

Euclid/Euclid.xcodeproj/project.pbxproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@
634634
ONLY_ACTIVE_ARCH = YES;
635635
SDKROOT = macosx;
636636
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
637-
SWIFT_OPTIMIZATION_LEVEL = "-O";
637+
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
638638
SWIFT_VERSION = 4.2;
639639
VERSIONING_SYSTEM = "apple-generic";
640640
VERSION_INFO_PREFIX = "";
@@ -722,7 +722,7 @@
722722
"@executable_path/../Frameworks",
723723
"@loader_path/Frameworks",
724724
);
725-
MARKETING_VERSION = 0.5.29;
725+
MARKETING_VERSION = 0.5.30;
726726
OTHER_SWIFT_FLAGS = "-Xfrontend -warn-long-expression-type-checking=75";
727727
PRODUCT_BUNDLE_IDENTIFIER = com.charcoaldesign.Euclid;
728728
PRODUCT_MODULE_NAME = "$(PRODUCT_NAME:c99extidentifier)";
@@ -755,7 +755,7 @@
755755
"@executable_path/../Frameworks",
756756
"@loader_path/Frameworks",
757757
);
758-
MARKETING_VERSION = 0.5.29;
758+
MARKETING_VERSION = 0.5.30;
759759
OTHER_SWIFT_FLAGS = "-Xfrontend -warn-long-expression-type-checking=75";
760760
PRODUCT_BUNDLE_IDENTIFIER = com.charcoaldesign.Euclid;
761761
PRODUCT_MODULE_NAME = "$(PRODUCT_NAME:c99extidentifier)";

Euclid/Sources/Transforms.swift

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -715,17 +715,14 @@ public extension Bounds {
715715
/// - Parameter v: A scale vector to apply to the bounds.
716716
func scaled(by v: Vector) -> Bounds {
717717
let v = v.clamped()
718-
return isEmpty ? self : Bounds(
719-
min: min.scaled(by: v),
720-
max: max.scaled(by: v)
721-
)
718+
return isEmpty ? self : Bounds(min.scaled(by: v), max.scaled(by: v))
722719
}
723720

724721
/// Returns a scaled copy of the bounds.
725722
/// - Parameter f: A scale factor to apply to the bounds.
726723
func scaled(by f: Double) -> Bounds {
727724
let f = f.clamped()
728-
return isEmpty ? self : Bounds(min: min * f, max: max * f)
725+
return isEmpty ? self : Bounds(min * f, max * f)
729726
}
730727

731728
/// Returns a transformed copy of the bounds.

Euclid/Tests/TransformTests.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,4 +329,18 @@ class TransformTests: XCTestCase {
329329
)
330330
XCTAssertNotNil(mesh.transformed(by: transform).boundsIfSet)
331331
}
332+
333+
// MARK: Bounds transforms
334+
335+
func testBoundsInvertedScale() {
336+
let bounds = Bounds(min: -.one, max: .one)
337+
let transform = Transform(scale: -.one)
338+
XCTAssertEqual(bounds.transformed(by: transform), bounds)
339+
}
340+
341+
func testBoundsInvertedScale2() {
342+
let bounds = Bounds(min: -.one, max: .one)
343+
let transform = Transform(scale: -Vector(-1, 1, 1))
344+
XCTAssertEqual(bounds.transformed(by: transform), bounds)
345+
}
332346
}

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ let package = Package(
1414
dependencies: [
1515
.package(
1616
url: "https://github.com/nicklockwood/Euclid.git",
17-
.upToNextMinor(from: "0.5.29")
17+
.upToNextMinor(from: "0.5.30")
1818
),
1919
.package(
2020
url: "https://github.com/nicklockwood/LRUCache.git",

0 commit comments

Comments
 (0)