Vector4Base

public struct Vector4Base<VectorType> where VectorType : Addable

A 4-dimensional vector.

  • The number of components in a Vector4Base instance.

    Declaration

    Swift

    public static var numberOfComponents: Int { get }
  • The values of the vector.

    Declaration

    Swift

    public private(set) var components: [VectorType]
  • x

    The x coordinate of the vector (the first component).

    Declaration

    Swift

    public var x: VectorType { get set }
  • y

    The y coordinate of the vector (the second component).

    Declaration

    Swift

    public var y: VectorType { get set }
  • z

    The z coordinate of the vector (the third component).

    Declaration

    Swift

    public var z: VectorType { get set }
  • w

    The w coordinate of the vector (the fourth component).

    Declaration

    Swift

    public var w: VectorType { get set }
  • Initializse the zero vector.

    Declaration

    Swift

    public init()
  • Initializes a VectorBase with the given values.

    Declaration

    Swift

    public init(x: VectorType, y: VectorType, z: VectorType, w: VectorType)

    Parameters

    x

    The first component of the vector.

    y

    The second component of the vector.

    z

    The third component of the vector.

    w

    The fourth component of the vector.

  • Provides access to the underlying components of this instance.

    Declaration

    Swift

    public subscript(index: Int) -> VectorType { get set }

    Parameters

    index

    The index of the component to access.

    Return Value

    The component at the given index.

  • The color white.

    Declaration

    Swift

    public static var white: Vector4Base<Double> { get }
  • The color black.

    Declaration

    Swift

    public static var black: Vector4Base<Double> { get }
  • The color black with zero alpha.

    Declaration

    Swift

    public static var clear: Vector4Base<Double> { get }
  • red

    The color red.

    Declaration

    Swift

    public static var red: Vector4Base<Double> { get }
  • The color green.

    Declaration

    Swift

    public static var green: Vector4Base<Double> { get }
  • The color blue.

    Declaration

    Swift

    public static var blue: Vector4Base<Double> { get }
  • The color yellow.

    Declaration

    Swift

    public static var yellow: Vector4Base<Double> { get }
  • The color magenta.

    Declaration

    Swift

    public static var magenta: Vector4Base<Double> { get }
  • The color cyan.

    Declaration

    Swift

    public static var cyan: Vector4Base<Double> { get }
  • The color purple.

    Declaration

    Swift

    public static var purple: Vector4Base<Double> { get }
  • The color brown.

    Declaration

    Swift

    public static var brown: Vector4Base<Double> { get }
  • The color orange.

    Declaration

    Swift

    public static var orange: Vector4Base<Double> { get }
  • The color gray.

    Declaration

    Swift

    public static var gray: Vector4Base<Double> { get }
  • The color light gray.

    Declaration

    Swift

    public static var lightGray: Vector4Base<Double> { get }
  • The color dark gray.

    Declaration

    Swift

    public static var darkGray: Vector4Base<Double> { get }
  • The color dark red.

    Declaration

    Swift

    public static var darkRed: Vector4Base<Double> { get }
  • The color dark green.

    Declaration

    Swift

    public static var darkGreen: Vector4Base<Double> { get }
  • The color dark blue.

    Declaration

    Swift

    public static var darkBlue: Vector4Base<Double> { get }
  • r

    The red component of the vector (equivalent to x).

    Declaration

    Swift

    public var r: VectorType { get set }
  • g

    The green component of the vector (equivalent to y).

    Declaration

    Swift

    public var g: VectorType { get set }
  • b

    The blue component of the vector (equivalent to z).

    Declaration

    Swift

    public var b: VectorType { get set }
  • a

    The alpha component of the vector (equivalent to w).

    Declaration

    Swift

    public var a: VectorType { get set }
  • red

    The red component of the vector (equivalent to r).

    Declaration

    Swift

    public var red: VectorType { get set }
  • The green component of the vector (equivalent to g).

    Declaration

    Swift

    public var green: VectorType { get set }
  • The blue component of the vector (equivalent to b).

    Declaration

    Swift

    public var blue: VectorType { get set }
  • The blue component of the vector (equivalent to a).

    Declaration

    Swift

    public var alpha: VectorType { get set }
  • The unit vector in the x direction.

    Declaration

    Swift

    public static var unitX: Vector4Base<VectorType> { get }
  • The unit vector in the y direction.

    Declaration

    Swift

    public static var unitY: Vector4Base<VectorType> { get }
  • The unit vector in the z direction.

    Declaration

    Swift

    public static var unitZ: Vector4Base<VectorType> { get }
  • The unit vector in the w direction.

    Declaration

    Swift

    public static var unitW: Vector4Base<VectorType> { get }