AngleSweep

public struct AngleSweep<Scalar> : Hashable where Scalar : ElementaryFunctions, Scalar : FloatingPoint

A pair of angle + angle range values that can be used to test inclusivity of Angle<Scalar> values.

  • Declaration

    Swift

    public var start: Angle<Scalar>
  • Declaration

    Swift

    public var sweep: Angle<Scalar>
  • Returns start + sweep.

    Declaration

    Swift

    public var stop: Angle<Scalar> { get }
  • Declaration

    Swift

    public init(start startInRadians: Scalar, sweep sweepInRadians: Scalar)
  • Declaration

    Swift

    public init(start: Angle<Scalar>, sweep: Angle<Scalar>)
  • Returns true if self and other cover to the same angle sweep, after normalization.

    This method ignores the signs of the sweeps, and only compares the covered circular arc of both angle sweeps.

    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 true if this angle sweep intersects with another angle sweep.

    The result is true also for angle sweeps that overlap only on their end-points, i.e. the check is inclusive.

    Declaration

    Swift

    @_specialize(exported: true, kind: full, where Scalar == Double)
    @_specialize(exported: true, kind: full, where Scalar == Float)
    @inlinable
    public func intersects(_ other: `Self`) -> Bool
  • Returns true if this circular arc contains a given angle value within its start + sweep region.

    Declaration

    Swift

    @_specialize(exported: true, kind: full, where Scalar == Double)
    @_specialize(exported: true, kind: full, where Scalar == Float)
    @inlinable
    public func contains(_ angle: Angle<Scalar>) -> Bool
  • Returns the result of clamping a given angle so it is contained within this angle sweep.

    Declaration

    Swift

    @_specialize(exported: true, kind: full, where Scalar == Double)
    @_specialize(exported: true, kind: full, where Scalar == Float)
    @inlinable
    public func clamped(_ angle: Angle<Scalar>) -> Angle<Scalar>
  • Returns a value from 0.0 to 1.0, inclusive, indicating how far along a given angle is to self.start and self.stop, where 0.0 is exactly on start, and 1.0 is exactly on stop.

    Note

    Angle sweeps that are greater than will not properly map into a ratio due to the overlapping angle ranges.

    Declaration

    Swift

    @_specialize(exported: true, kind: full, where Scalar == Double)
    @_specialize(exported: true, kind: full, where Scalar == Float)
    @inlinable
    public func ratioOfAngle(_ angle: Angle<Scalar>) -> Scalar