Vector3Type
public protocol Vector3Type : VectorTakeable where Self == Self.SubVector3, Self.TakeDimensions == Vector3TakeDimensions
Protocol for types that can represent 3D vectors.
-
Declaration
Swift
associatedtype SubVector3 = Self
-
The X coordinate of this 3D vector.
Declaration
Swift
var x: Scalar { get set }
-
The Y coordinate of this 3D vector.
Declaration
Swift
var y: Scalar { get set }
-
The Z coordinate of this 3D vector.
Declaration
Swift
var z: Scalar { get set }
-
Initializes this vector type with the given coordinates.
Declaration
Swift
init(x: Scalar, y: Scalar, z: Scalar)
-
init(_:
Default implementationz: ) Creates a new vector with the coordinates of a given
Vector2Type
, along with a new value for thez
axis.Default Implementation
Declaration
Swift
init<V>(_ vec: V, z: Scalar) where V : Vector2Type, Self.Scalar == V.Scalar
-
init(_:
Default implementation) Initializes a new instance of this
Vector3Type
type by copying the coordinates of anotherVector3Type
of matching scalar type.Default Implementation
Declaration
Swift
init<Vector>(_ vector: Vector) where Vector : Vector3Type, Self.Scalar == Vector.Scalar
-
scalarCount
Extension methodThe number of scalars in the vector.
For 3D vectors, this value is always 3.
Declaration
Swift
var scalarCount: Int { get }
-
subscript(_:
Extension method)
-
maximalComponentIndex
Extension methodReturns the index of the component of this vector that has the greatest value.
Vector3D(x: -3.0, y: 2.5, z: 0).maximalComponentIndex // Returns 1
Declaration
Swift
var maximalComponentIndex: Int { get }
-
minimalComponentIndex
Extension methodReturns the index of the component of this vector that has the least value.
Vector3D(x: -3.0, y: 2.5, z: 0).minimalComponentIndex // Returns 0
Declaration
Swift
var minimalComponentIndex: Int { get }
-
maximalComponent
Extension methodReturns the greatest scalar component between x, y, z in this vector
Vector3D(x: -3.0, y: 2.5, z: 0).maximalComponent // Returns 2.5
Declaration
Swift
var maximalComponent: Scalar { get }
-
minimalComponent
Extension methodReturns the least scalar component between x, y, z in this vector
Vector3D(x: -3.0, y: 2.5, z: 0).minimalComponent // Returns -3.0
Declaration
Swift
var minimalComponent: Scalar { get }