ConstantSizeVector

public protocol ConstantSizeVector : Addable, VectorBase

A Vector whose number of components is determined at compile time.

  • The number of components in a vector. Must be greater than 0. The instance property numberOfComponents must return this value.

    Declaration

    Swift

    static var numberOfComponents: Int { get }
  • init(repeating:) Default implementation

    Initializes all components of the vector with the same value.

    Default Implementation

    Declaration

    Swift

    init(repeating value: ComponentType)

    Parameters

    value

    The value to repeat for all components of the vector.

  • dot(vector:) Default implementation

    Computes the dot product of this vector with vector.

    Default Implementation

    Declaration

    Swift

    func dot(vector: Self) -> ComponentType

    Parameters

    vector

    The vector with which to calculate the dot product.

    Return Value

    The dot product of this instance and vector.

  • Adds two vectors.

    Declaration

    Swift

    static func + (lhs: Self, rhs: Self) -> Self

    Parameters

    lhs

    The vector to add on the left.

    rhs

    The vector to add on the right.

    Return Value

    The sum of lhs and rhs.

  • Subtracts two vectors.

    Declaration

    Swift

    static func - (lhs: Self, rhs: Self) -> Self

    Parameters

    lhs

    The vector to subtract from.

    rhs

    The vector to subtrat by.

    Return Value

    The difference of lhs and rhs.

  • Multiplies two vectors component-wise.

    Declaration

    Swift

    static func * (lhs: Self, rhs: Self) -> Self

    Parameters

    lhs

    The vector to multiply by on the left.

    rhs

    The vector to multiply by on the right.

    Return Value

    The product of lhs and rhs.

  • Assigns and adds two vectors.

    Declaration

    Swift

    static func += (lhs: inout Self, rhs: Self)

    Parameters

    lhs

    The vector to add and assign to on the left.

    rhs

    The vector to add on the right.

  • Assigns and subtracts two vectors.

    Declaration

    Swift

    static func -= (lhs: inout Self, rhs: Self)

    Parameters

    lhs

    The vector to subtract from and assign to.

    rhs

    The vector to subtract by.

  • Assigns and multiplies two vectors component-wise.

    Declaration

    Swift

    static func *= (lhs: inout Self, rhs: Self)

    Parameters

    lhs

    The vector to multiply by and assign to on the left.

    rhs

    The vector to multiply by on the right.

  • Adds a vector and a scalar.

    Declaration

    Swift

    static func + (lhs: Self, rhs: ComponentType) -> Self

    Parameters

    lhs

    The vector to add by on the left.

    rhs

    The scalar to add by on the right.

    Return Value

    The sum of lhs and rhs.

  • Adds a scalar and a vector.

    Declaration

    Swift

    static func + (lhs: ComponentType, rhs: Self) -> Self

    Parameters

    lhs

    The scalar to add by on the left.

    rhs

    The vector to add by on the right.

    Return Value

    The sum of lhs and rhs.

  • Subtracts a vector and a scalar.

    Declaration

    Swift

    static func - (lhs: Self, rhs: ComponentType) -> Self

    Parameters

    lhs

    The vector to subtract from.

    rhs

    The scalar to subtract by.

    Return Value

    The difference of lhs and rhs.

  • Subtracts a scalar and a vector.

    Declaration

    Swift

    static func - (lhs: ComponentType, rhs: Self) -> Self

    Parameters

    lhs

    The scalar to subtract from.

    rhs

    The vector to subtract by.

    Return Value

    The difference of lhs and rhs.

  • Multiplies a vector and a scalar.

    Declaration

    Swift

    static func * (lhs: Self, rhs: ComponentType) -> Self

    Parameters

    lhs

    The vector to multiply by on the left.

    rhs

    The scalar to multiply by on the right.

    Return Value

    The product of lhs and rhs.

  • Mutiplies a scalar and a vector.

    Declaration

    Swift

    static func * (lhs: ComponentType, rhs: Self) -> Self

    Parameters

    lhs

    The scalar to multiply by on the left.

    rhs

    The vector to multiply by on the right.

    Return Value

    The product of lhs and rhs.

  • Assigns and adds a vector and a scalar.

    Declaration

    Swift

    static func += (lhs: inout Self, rhs: ComponentType)

    Parameters

    lhs

    The vector to add and assign to on the left.

    rhs

    The scalar to add to on the right.

  • Assigns and subtracts a vector and a scalar.

    Declaration

    Swift

    static func -= (lhs: inout Self, rhs: ComponentType)

    Parameters

    lhs

    The vector to subtract from and assign to.

    rhs

    The scalar to subtract by.

  • Assigns and multiplies a vector and a scalar.

    Declaration

    Swift

    static func *= (lhs: inout Self, rhs: ComponentType)

    Parameters

    lhs

    The vector to multiply by and assign to on the left.

    rhs

    The vector to multiply by on the right.

  • zero Extension method

    Declaration

    Swift

    public static var zero: Self { get }
  • init(components:) Extension method

    Declaration

    Swift

    public convenience init(components: [ComponentType])