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 implementationInitializes all components of the vector with the same value.
Default Implementation
Declaration
Swift
init(repeating value: ComponentType)Parameters
valueThe value to repeat for all components of the vector.
-
dot(vector:)Default implementationComputes the dot product of this vector with vector.
Default Implementation
Declaration
Swift
func dot(vector: Self) -> ComponentTypeParameters
vectorThe 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) -> SelfParameters
lhsThe vector to add on the left.
rhsThe vector to add on the right.
Return Value
The sum of
lhsandrhs. -
Subtracts two vectors.
Declaration
Swift
static func - (lhs: Self, rhs: Self) -> SelfParameters
lhsThe vector to subtract from.
rhsThe vector to subtrat by.
Return Value
The difference of
lhsandrhs. -
Multiplies two vectors component-wise.
Declaration
Swift
static func * (lhs: Self, rhs: Self) -> SelfParameters
lhsThe vector to multiply by on the left.
rhsThe vector to multiply by on the right.
Return Value
The product of
lhsandrhs. -
Assigns and adds two vectors.
Declaration
Swift
static func += (lhs: inout Self, rhs: Self)Parameters
lhsThe vector to add and assign to on the left.
rhsThe vector to add on the right.
-
Assigns and subtracts two vectors.
Declaration
Swift
static func -= (lhs: inout Self, rhs: Self)Parameters
lhsThe vector to subtract from and assign to.
rhsThe vector to subtract by.
-
Assigns and multiplies two vectors component-wise.
Declaration
Swift
static func *= (lhs: inout Self, rhs: Self)Parameters
lhsThe vector to multiply by and assign to on the left.
rhsThe vector to multiply by on the right.
-
Adds a vector and a scalar.
Declaration
Swift
static func + (lhs: Self, rhs: ComponentType) -> SelfParameters
lhsThe vector to add by on the left.
rhsThe scalar to add by on the right.
Return Value
The sum of
lhsandrhs. -
Adds a scalar and a vector.
Declaration
Swift
static func + (lhs: ComponentType, rhs: Self) -> SelfParameters
lhsThe scalar to add by on the left.
rhsThe vector to add by on the right.
Return Value
The sum of
lhsandrhs. -
Subtracts a vector and a scalar.
Declaration
Swift
static func - (lhs: Self, rhs: ComponentType) -> SelfParameters
lhsThe vector to subtract from.
rhsThe scalar to subtract by.
Return Value
The difference of
lhsandrhs. -
Subtracts a scalar and a vector.
Declaration
Swift
static func - (lhs: ComponentType, rhs: Self) -> SelfParameters
lhsThe scalar to subtract from.
rhsThe vector to subtract by.
Return Value
The difference of
lhsandrhs. -
Multiplies a vector and a scalar.
Declaration
Swift
static func * (lhs: Self, rhs: ComponentType) -> SelfParameters
lhsThe vector to multiply by on the left.
rhsThe scalar to multiply by on the right.
Return Value
The product of
lhsandrhs. -
Mutiplies a scalar and a vector.
Declaration
Swift
static func * (lhs: ComponentType, rhs: Self) -> SelfParameters
lhsThe scalar to multiply by on the left.
rhsThe vector to multiply by on the right.
Return Value
The product of
lhsandrhs. -
Assigns and adds a vector and a scalar.
Declaration
Swift
static func += (lhs: inout Self, rhs: ComponentType)Parameters
lhsThe vector to add and assign to on the left.
rhsThe 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
lhsThe vector to subtract from and assign to.
rhsThe scalar to subtract by.
-
Assigns and multiplies a vector and a scalar.
Declaration
Swift
static func *= (lhs: inout Self, rhs: ComponentType)Parameters
lhsThe vector to multiply by and assign to on the left.
rhsThe vector to multiply by on the right.
-
zeroExtension methodDeclaration
Swift
public static var zero: Self { get } -
init(components:)Extension methodDeclaration
Swift
public convenience init(components: [ComponentType])
ConstantSizeVector Protocol Reference