VectorType

public protocol VectorType : GeometricType

Protocol for N-dimensional vector types.

  • The scalar type associated with this VectorType.

    Declaration

    Swift

    associatedtype Scalar
  • The number of scalars in the vector.

    Declaration

    Swift

    var scalarCount: Int { get }
  • Accesses the scalar at the specified position.

    Precondition

    index >= 0 && index < scalarCount

    Declaration

    Swift

    subscript(index: Int) -> Scalar { get set }
  • Creates a new VectorType with the given scalar on all coordinates.

    Declaration

    Swift

    init(repeating scalar: Scalar)