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
Vector4
Declaration
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
Vector4
with 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
true
if all components oflhs
are greater thanrhs
.Performs
lhs.x > rhs.x && lhs.y > rhs.y && lhs.z > rhs.z && lhs.w > rhs.w
Declaration
Swift
public static func > (lhs: `Self`, rhs: `Self`) -> Bool
-
Compares two vectors and returns
true
if all components oflhs
are greater than or equal torhs
.Performs
lhs.x >= rhs.x && lhs.y >= rhs.y && lhs.z >= rhs.z && lhs.w >= rhs.w
Declaration
Swift
public static func >= (lhs: `Self`, rhs: `Self`) -> Bool
-
Compares two vectors and returns
true
if all components oflhs
are less thanrhs
.Performs
lhs.x < rhs.x && lhs.y < rhs.y && lhs.z < rhs.z && lhs.w < rhs.w
Declaration
Swift
public static func < (lhs: `Self`, rhs: `Self`) -> Bool
-
Compares two vectors and returns
true
if all components oflhs
are less than or equal torhs
.Performs
lhs.x <= rhs.x && lhs.y <= rhs.y && lhs.z <= rhs.z && lhs.w <= rhs.w
Declaration
Swift
public static func <= (lhs: `Self`, rhs: `Self`) -> Bool
-
A zero-value
Vector4
value 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
Vector4Type
value 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
Vector4Type
Declaration
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
Vector4
where 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
fma
function on each component.Declaration
Swift
public func addingProduct(_ a: `Self`, _ b: `Self`) -> Vector4<Scalar>
Parameters
lhs
One of the vectors to multiply before adding to this vector.
rhs
The other vector to multiply.
Return Value
The product of
lhs
andrhs
, 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
fma
function on each component.Declaration
Swift
public func addingProduct(_ a: Scalar, _ b: `Self`) -> Vector4<Scalar>
Parameters
lhs
A scalar to multiply before adding to this vector.
rhs
A vector to multiply.
Return Value
The product of
lhs
andrhs
, 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
fma
function on each component.Declaration
Swift
public func addingProduct(_ a: `Self`, _ b: Scalar) -> Vector4<Scalar>
Parameters
lhs
A vector to multiply before adding to this vector.
rhs
A scalar to multiply.
Return Value
The product of
lhs
andrhs
, added to this vector. -
Rounds the components of this
Vector3Type
using a givenFloatingPointRoundingRule
.Declaration
Swift
public func rounded(_ rule: FloatingPointRoundingRule) -> Vector4<Scalar>
-
Rounds the components of this
Vector3Type
using 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
Vector3Type
using 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
Vector3Type
using 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>