PointProjectableType

public protocol PointProjectableType : GeometricType

Protocol for geometric types that support vector projection operations.

Types conforming to this protocol expose a function that can project an arbitrary vector onto their surface.

  • The vector type associated with this PointProjectableType.

    Declaration

    Swift

    associatedtype Vector : VectorType
  • Returns a vector on the surface of this geometric type that is the closest to vector.

    Declaration

    Swift

    func project(_ vector: Vector) -> Vector
  • Returns the squared distance between the closest point in this geometric type’s surface to a given vector.

    Seealso

    distance(to:)

    Declaration

    Swift

    func distanceSquared(to vector: Vector) -> Vector.Scalar
  • Returns the distance between the closest point in this geometric type’s surface to a given vector.

    Equivalent to self.distanceSquared(to: vector).squareRoot().

    Declaration

    Swift

    func distance(to vector: Vector) -> Vector.Scalar

Available where Vector: VectorMultiplicative

  • distanceSquared(to:) Default implementation

    Default Implementation

    Returns the squared distance between the closest point in this geometric type’s surface to a given vector.

    Seealso

    distance(to:)

    Declaration

    Swift

    func distanceSquared(to vector: Vector) -> Vector.Scalar

Available where Vector: VectorFloatingPoint

  • distance(to:) Default implementation

    Default Implementation

    Returns the distance between the closest point in this geometric type’s surface to a given vector.

    Equivalent to self.distanceSquared(to: vector).squareRoot().

    Seealso

    distanceSquared(to:)

    Declaration

    Swift

    func distance(to vector: Vector) -> Vector.Scalar