Angle

public struct Angle<Scalar> : Hashable, CustomStringConvertible where Scalar : ElementaryFunctions, Scalar : FloatingPoint
extension Angle: AdditiveArithmetic
extension Angle: Numeric
extension Angle: Encodable where Scalar: Encodable
extension Angle: Decodable where Scalar: Decodable

A standardized representation of an angle.

  • pi

    Gets the angle value for the mathematical constant π.

    Declaration

    Swift

    @inlinable
    public static var pi: `Self` { get }
  • Gets the radian value associated with this angle.

    Declaration

    Swift

    public let radians: Scalar
  • Declaration

    Swift

    public var description: String { get }
  • Initializes this angle with a given radians angle value.

    Declaration

    Swift

    public init(radians: Scalar)
  • Returns true if self and other refer to the same angle, after normalization.

    Declaration

    Swift

    @_specialize(exported: true, kind: full, where Scalar == Double)
    @_specialize(exported: true, kind: full, where Scalar == Float)
    @inlinable
    public func isEquivalent(to other: `Self`) -> Bool
  • Returns this angle’s normalized representation, starting from a given offset, such that the angle is confined to [lowerBound, lowerBound + π)

    Declaration

    Swift

    @_specialize(exported: true, kind: full, where Scalar == Double)
    @_specialize(exported: true, kind: full, where Scalar == Float)
    @inlinable
    public func normalized(from lowerBound: Scalar) -> Scalar
  • Returns the relative sweep angles to go from self to other.

    In the results, shortest contains the smallest angle change to go from self to other, and longest is the largest angle change.

    If self and other point to the same angle, shortest will be .zero and longest will be Angle(radians: .pi + .pi)

    Declaration

    Swift

    @_specialize(exported: true, kind: full, where Scalar == Double)
    @_specialize(exported: true, kind: full, where Scalar == Float)
    @inlinable
    public func relativeAngles(to other: `Self`) -> (shortest: `Self`, longest: `Self`)
  • cos

    Returns the cosine of this angle.

    Declaration

    Swift

    @inlinable
    var cos: Scalar { get }
  • sin

    Returns the sine of this angle.

    Declaration

    Swift

    @inlinable
    var sin: Scalar { get }
  • tan

    Returns the tangent of this angle.

    Declaration

    Swift

    @inlinable
    var tan: Scalar { get }
  • Returns the arccosine of this angle

    Declaration

    Swift

    @inlinable
    var acos: Scalar { get }
  • Returns the arcsine of this angle.

    Declaration

    Swift

    @inlinable
    var asin: Scalar { get }
  • Returns the arctangent of this angle.

    Declaration

    Swift

    @inlinable
    var atan: Scalar { get }
  • Returns the [hyperbolic cosine][https://en.wikipedia.org/wiki/Hyperbolic_function] of this angle.

    Declaration

    Swift

    @inlinable
    var cosh: Scalar { get }
  • Returns the [hyperbolic sine][https://en.wikipedia.org/wiki/Hyperbolic_function] of this angle.

    Declaration

    Swift

    @inlinable
    var sinh: Scalar { get }
  • Returns the [hyperbolic tangent][https://en.wikipedia.org/wiki/Hyperbolic_function] of this angle.

    Declaration

    Swift

    @inlinable
    var tanh: Scalar { get }
  • Returns the [inverse hyperbolic cosine][https://en.wikipedia.org/wiki/Inverse_hyperbolic_function] of this angle.

    Declaration

    Swift

    @inlinable
    var acosh: Scalar { get }
  • Returns the [inverse hyperbolic sine][https://en.wikipedia.org/wiki/Inverse_hyperbolic_function] of this angle.

    Declaration

    Swift

    @inlinable
    var asinh: Scalar { get }
  • Returns the [inverse hyperbolic tangent][https://en.wikipedia.org/wiki/Inverse_hyperbolic_function] of this angle.

    Declaration

    Swift

    @inlinable
    var atanh: Scalar { get }
  • Gets the zero radian angle.

    Declaration

    Swift

    @inlinable
    public static var zero: Angle { get }
  • Flips the sign of the angle while maintaining its absolute magnitude.

    Declaration

    Swift

    @inlinable
    public prefix static func - (value: Angle) -> Angle
  • Adds two angles by summing their radians representation.

    Declaration

    Swift

    @inlinable
    public static func + (lhs: Angle, rhs: Angle) -> Angle
  • Subtracts two angles by subtracting their radians representation.

    Declaration

    Swift

    @inlinable
    public static func - (lhs: Angle, rhs: Angle) -> Angle
  • Adds a scalar and an angle, producing an angle value.

    Declaration

    Swift

    @inlinable
    public static func + (lhs: Angle, rhs: Scalar) -> Angle
  • Subtracts a scalar from an angle, producing an angle value

    Declaration

    Swift

    @inlinable
    public static func - (lhs: Angle, rhs: Scalar) -> Angle
  • Declaration

    Swift

    @inlinable
    public var magnitude: Scalar { get }
  • Declaration

    Swift

    @inlinable
    public init(integerLiteral value: Scalar.IntegerLiteralType)
  • Declaration

    Swift

    @inlinable
    public init?<T>(exactly source: T) where T : BinaryInteger
  • Declaration

    Swift

    @inlinable
    public static func * (lhs: Angle, rhs: Angle) -> Angle
  • Declaration

    Swift

    @inlinable
    public static func / (lhs: Angle, rhs: Angle) -> Angle
  • Declaration

    Swift

    @inlinable
    public static func * (lhs: Angle, rhs: Scalar) -> Angle
  • Declaration

    Swift

    @inlinable
    public static func / (lhs: Angle, rhs: Scalar) -> Angle
  • Declaration

    Swift

    @inlinable
    public static func *= (lhs: inout Angle, rhs: Angle)
  • Declaration

    Swift

    @inlinable
    public static func /= (lhs: inout Angle, rhs: Angle)
  • Declaration

    Swift

    @inlinable
    public static func *= (lhs: inout Angle, rhs: Scalar)
  • Declaration

    Swift

    @inlinable
    public static func /= (lhs: inout Angle, rhs: Scalar)