Ray
public struct Ray<Vector> : GeometricType where Vector : VectorType
extension Ray: LineType
extension Ray: Equatable where Vector: Equatable, Scalar: Equatable
extension Ray: Hashable where Vector: Hashable, Scalar: Hashable
extension Ray: Encodable where Vector: Encodable, Scalar: Encodable
extension Ray: Decodable where Vector: Decodable, Scalar: Decodable
extension Ray: LineAdditive where Vector: VectorAdditive
extension Ray: LineMultiplicative where Vector: VectorMultiplicative
extension Ray: LineDivisible where Vector: VectorDivisible
extension Ray: LineSigned where Vector: VectorSigned
extension Ray: LineFloatingPoint & PointProjectableType & SignedDistanceMeasurableType where Vector: VectorFloatingPoint
extension Ray: LineReal where Vector: VectorReal
Represents an N-dimensional geometric ray line which has a starting point and crosses a secondary point before projecting to infinity.
-
Convenience for
Vector.Scalar
Declaration
Swift
public typealias Scalar = Vector.Scalar
-
The starting position of this ray
Declaration
Swift
public var start: Vector
-
A secondary point a line tracing from
start
passes through before being projected to infinity in a straight line.Declaration
Swift
public var b: Vector
-
Declaration
Swift
@inlinable public var category: LineCategory { get }
-
Declaration
Swift
public init(start: Vector, b: Vector)
-
Declaration
Swift
public var a: Vector { get }
-
Declaration
Swift
public func offsetBy(_ vector: Vector) -> Ray<Vector>
-
Declaration
Swift
public func withPointsScaledBy(_ factor: Vector) -> Ray<Vector>
-
Declaration
Swift
public func withPointsScaledBy(_ factor: Vector, around center: Vector) -> Ray<Vector>
-
Returns a
DirectionalRay
representation of this ray, whereray.start
matchesself.start
andray.direction
matches(self.b - self.start).normalized()
.Precondition
(self.b - self.start).length > 0
Declaration
Swift
public var asDirectionalRay: DirectionalRay<Vector> { get }
-
Returns
true
for all positive projected scalars (ray)Declaration
Swift
public func containsProjectedNormalizedMagnitude( _ scalar: Vector.Scalar ) -> Bool
-
Returns the squared distance between this line and a given vector.
Declaration
Swift
@inlinable public func distanceSquared(to vector: Vector) -> Scalar