Skip to content

Commit

Permalink
Add support for arcminutes and arcseconds in Angle init
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasf committed Mar 7, 2024
1 parent 892cacf commit 7e90664
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Sources/SwiftSCAD/Values/Angle/Angle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ public struct Angle {
self.radians = radians
}

/// Create an angle from degrees
public init(degrees: Double) {
self.init(radians: degrees * .pi / 180.0)
/// Create an angle from degrees, and optionally, arcminutes and arcseconds
public init(degrees: Double, arcmins: Double = 0, arcsecs: Double = 0) {
let totalDegrees = degrees + arcmins / 60.0 + arcsecs / 3600.0
self.init(radians: totalDegrees * .pi / 180.0)
}

/// The angle expressed in degrees
Expand Down

0 comments on commit 7e90664

Please sign in to comment.