DirectionalRay2

  • Initializes a new Directional Ray with 2D vectors describing the start and secondary point the ray crosses before projecting towards infinity.

    The direction will be normalized before initializing.

    Precondition

    Vector(x: x2 - x1, y: y2 - y1).length > 0

    Declaration

    Swift

    public init(x1: Scalar, y1: Scalar, x2: Scalar, y2: Scalar)
  • Initializes a new Directional Ray with a 2D vector for its position and another describing the direction of the ray relative to the position.

    The direction will be normalized before initializing.

    Precondition

    Vector(x: dx, y: dy).length > 0

    Declaration

    Swift

    public init(x: Scalar, y: Scalar, dx: Scalar, dy: Scalar)

Available where Vector: Vector2Real

  • Returns the angle of this directional ray, in radians

    Declaration

    Swift

    public var angle: Vector.Scalar { get }