VectorType
public protocol VectorType: Equatable, Interpolatable, VectorMathCapable
Conforming types can be operated on as vectors composed of Scalar
components.
-
Creates a vector for which all components are equal to the given scalar.
Declaration
Swift
init(scalar: Scalar)
-
The number of scalar components in this vector type.
Declaration
Swift
static var length: Int
-
The empty vector (all scalar components are equal to
0.0
).Declaration
Swift
static var zero: Self
-
Subscripting for vector components.
Declaration
Swift
subscript(index: Int) -> Scalar { get set }
-
clamped(min:max:)
Default implementationReturns a vector where each component is clamped by the corresponding components in
min
andmax
.Default Implementation
Returns a vector where each component is clamped by the corresponding components in
min
andmax
.Declaration
Swift
func clamped(min: Self, max: Self) -> Self
Parameters
x
The vector to be clamped.
min
Each component in the output vector will
>=
the corresponding component in this vector.max
Each component in the output vector will be
<=
the corresponding component in this vector. -
clamp(min:max:)
Default implementationClamps in place.
Default Implementation
Clamps in place.
Declaration
Swift
mutating func clamp(min: Self, max: Self)