Vector4
public struct Vector4<Scalar> : Vector4Type
extension Vector4: Equatable where Scalar: Equatable
extension Vector4: Hashable where Scalar: Hashable
extension Vector4: Encodable where Scalar: Encodable
extension Vector4: Decodable where Scalar: Decodable
extension Vector4: VectorComparable where Scalar: Comparable
extension Vector4: AdditiveArithmetic where Scalar: AdditiveArithmetic
extension Vector4: VectorAdditive where Scalar: AdditiveArithmetic
extension Vector4: VectorMultiplicative where Scalar: Numeric
extension Vector4: Vector4Additive where Scalar: AdditiveArithmetic
extension Vector4: VectorSigned where Scalar: SignedNumeric & Comparable
extension Vector4: VectorDivisible where Scalar: DivisibleArithmetic
extension Vector4: VectorFloatingPoint where Scalar: DivisibleArithmetic & FloatingPoint
extension Vector4: SignedDistanceMeasurableType where Scalar: DivisibleArithmetic & FloatingPoint
extension Vector4: Vector4FloatingPoint where Scalar: DivisibleArithmetic & FloatingPoint
extension Vector4: VectorReal where Scalar: DivisibleArithmetic & Real
A four-component vector type
-
X coordinate of this vector
Declaration
Swift
public var x: Scalar -
Y coordinate of this vector
Declaration
Swift
public var y: Scalar -
Z coordinate of this vector
Declaration
Swift
public var z: Scalar -
w coordinate of this vector
Declaration
Swift
public var w: Scalar -
Textual representation of this
Vector4Declaration
Swift
public var description: String { get } -
Declaration
Swift
public init(x: Scalar, y: Scalar, z: Scalar, w: Scalar) -
Declaration
Swift
public init(repeating scalar: Scalar) -
Initializes this
Vector4with the values from a given tuple.Declaration
Swift
public init(_ tuple: (Scalar, Scalar, Scalar, Scalar))
-
Returns the pointwise minimal Vector where each component is the minimal scalar value at each index for both vectors.
Declaration
Swift
public static func pointwiseMin(_ lhs: `Self`, _ rhs: `Self`) -> Vector4<Scalar> -
Returns the pointwise maximal Vector where each component is the maximal scalar value at each index for both vectors.
Declaration
Swift
public static func pointwiseMax(_ lhs: `Self`, _ rhs: `Self`) -> Vector4<Scalar> -
Compares two vectors and returns
trueif all components oflhsare greater thanrhs.Performs
lhs.x > rhs.x && lhs.y > rhs.y && lhs.z > rhs.z && lhs.w > rhs.wDeclaration
Swift
public static func > (lhs: `Self`, rhs: `Self`) -> Bool -
Compares two vectors and returns
trueif all components oflhsare greater than or equal torhs.Performs
lhs.x >= rhs.x && lhs.y >= rhs.y && lhs.z >= rhs.z && lhs.w >= rhs.wDeclaration
Swift
public static func >= (lhs: `Self`, rhs: `Self`) -> Bool -
Compares two vectors and returns
trueif all components oflhsare less thanrhs.Performs
lhs.x < rhs.x && lhs.y < rhs.y && lhs.z < rhs.z && lhs.w < rhs.wDeclaration
Swift
public static func < (lhs: `Self`, rhs: `Self`) -> Bool -
Compares two vectors and returns
trueif all components oflhsare less than or equal torhs.Performs
lhs.x <= rhs.x && lhs.y <= rhs.y && lhs.z <= rhs.z && lhs.w <= rhs.wDeclaration
Swift
public static func <= (lhs: `Self`, rhs: `Self`) -> Bool
-
A zero-value
Vector4value where each component corresponds to its representation of0.Declaration
Swift
public static var zero: `Self` { get } -
Declaration
Swift
@inlinable public var nonZeroScalarCount: Int { get } -
Declaration
Swift
public static func + (lhs: `Self`, rhs: `Self`) -> Vector4<Scalar> -
Declaration
Swift
public static func - (lhs: `Self`, rhs: `Self`) -> Vector4<Scalar> -
Declaration
Swift
public static func + (lhs: `Self`, rhs: Scalar) -> Vector4<Scalar> -
Declaration
Swift
public static func - (lhs: `Self`, rhs: Scalar) -> Vector4<Scalar>
-
A unit-value
Vector4Typevalue where each component corresponds to its representation of4.Declaration
Swift
public static var one: `Self` { get } -
Calculates the dot product between this and another provided
Vector4TypeDeclaration
Swift
public func dot(_ other: `Self`) -> Scalar -
Declaration
Swift
public static func * (lhs: `Self`, rhs: `Self`) -> Vector4<Scalar> -
Declaration
Swift
public static func * (lhs: `Self`, rhs: Scalar) -> Vector4<Scalar> -
Declaration
Swift
public static func * (lhs: Scalar, rhs: `Self`) -> Vector4<Scalar>
-
Returns a
Vector4where each component is the absolute value of the components of thisVector4.Declaration
Swift
public var absolute: `Self` { get } -
Declaration
Swift
public var sign: `Self` { get } -
Negates this Vector
Declaration
Swift
public prefix static func - (lhs: `Self`) -> Vector4<Scalar>
-
Declaration
Swift
public static func / (lhs: `Self`, rhs: `Self`) -> Vector4<Scalar> -
Declaration
Swift
public static func / (lhs: `Self`, rhs: Scalar) -> Vector4<Scalar> -
Declaration
Swift
public static func / (lhs: Scalar, rhs: `Self`) -> Vector4<Scalar>
-
Returns the result of adding the product of the two given vectors to this vector, computed without intermediate rounding.
This method is equivalent to calling C
fmafunction on each component.Declaration
Swift
public func addingProduct(_ a: `Self`, _ b: `Self`) -> Vector4<Scalar>Parameters
lhsOne of the vectors to multiply before adding to this vector.
rhsThe other vector to multiply.
Return Value
The product of
lhsandrhs, added to this vector. -
Returns the result of adding the product of the given scalar and vector to this vector, computed without intermediate rounding.
This method is equivalent to calling C
fmafunction on each component.Declaration
Swift
public func addingProduct(_ a: Scalar, _ b: `Self`) -> Vector4<Scalar>Parameters
lhsA scalar to multiply before adding to this vector.
rhsA vector to multiply.
Return Value
The product of
lhsandrhs, added to this vector. -
Returns the result of adding the product of the given vector and scalar to this vector, computed without intermediate rounding.
This method is equivalent to calling C
fmafunction on each component.Declaration
Swift
public func addingProduct(_ a: `Self`, _ b: Scalar) -> Vector4<Scalar>Parameters
lhsA vector to multiply before adding to this vector.
rhsA scalar to multiply.
Return Value
The product of
lhsandrhs, added to this vector. -
Rounds the components of this
Vector3Typeusing a givenFloatingPointRoundingRule.Declaration
Swift
public func rounded(_ rule: FloatingPointRoundingRule) -> Vector4<Scalar> -
Rounds the components of this
Vector3Typeusing a givenFloatingPointRoundingRule.toNearestOrAwayFromZero.Equivalent to calling C’s round() function on each component.
Declaration
Swift
public func rounded() -> Vector4<Scalar> -
Rounds the components of this
Vector3Typeusing a givenFloatingPointRoundingRule.up.Equivalent to calling C’s ceil() function on each component.
Declaration
Swift
public func ceil() -> Vector4<Scalar> -
Rounds the components of this
Vector3Typeusing a givenFloatingPointRoundingRule.down.Equivalent to calling C’s floor() function on each component.
Declaration
Swift
public func floor() -> Vector4<Scalar> -
Declaration
Swift
public static func % (lhs: `Self`, rhs: `Self`) -> Vector4<Scalar> -
Declaration
Swift
public static func % (lhs: `Self`, rhs: Scalar) -> Vector4<Scalar> -
Declaration
Swift
public func signedDistance(to other: `Self`) -> Scalar -
Declaration
Swift
public init<V>(_ vec: V) where V : Vector4Type, V.Scalar : BinaryInteger
-
Declaration
Swift
public static func pow(_ vec: `Self`, _ exponent: Int) -> Vector4<Scalar> -
Declaration
Swift
public static func pow(_ vec: `Self`, _ exponent: `Self`) -> Vector4<Scalar>