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 }
-
Returns
true
ifself
andother
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.
-
Returns a value from 0.0 to 1.0, inclusive, indicating how far along a given angle is to
self.start
andself.stop
, where0.0
is exactly onstart
, and1.0
is exactly onstop
.Note
Angle sweeps that are greater than2π
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