Vector2

public struct Vector2

A vector with 2 components.

  • x

    Component at index 0

    Declaration

    Swift

    public var x: Scalar
  • y

    Component at index 1

    Declaration

    Swift

    public var y: Scalar
  • Creates a new Vector2 instance.

    Declaration

    Swift

    public init(x: Scalar, y: Scalar)
  • Creates a vector for which all components are equal to the given scalar.

    Declaration

    Swift

    public init(scalar: Scalar)
  • The number of scalar components in this vector type.

    Declaration

    Swift

    public static var length: Int { get }
  • The empty vector (all scalar components are equal to 0.0).

    Declaration

    Swift

    public static var zero: Vector2 { get }
  • Declaration

    Swift

    public subscript(index: Int) -> Scalar { get set }
  • Declaration

    Swift

    public func clamped(min: Vector2, max: Vector2) -> Vector2
  • Interpolate between the given values.

    Declaration

    Swift

    public func interpolated(to otherValue: Vector2, alpha: Scalar) -> Vector2
  • Interpolate between the given values.

    Declaration

    Swift

    public mutating func interpolate(to otherValue: Vector2, alpha: Scalar)
  • Equatable.

    Declaration

    Swift

    public static func == (lhs: Vector2, rhs: Vector2) -> Bool
  • Product.

    Declaration

    Swift

    public static func * (lhs: Vector2, rhs: Vector2) -> Vector2
  • Product (in place).

    Declaration

    Swift

    public static func *= (lhs: inout Vector2, rhs: Vector2)
  • Quotient.

    Declaration

    Swift

    public static func / (lhs: Vector2, rhs: Vector2) -> Vector2
  • Quotient (in place).

    Declaration

    Swift

    public static func /= (lhs: inout Vector2, rhs: Vector2)
  • Sum.

    Declaration

    Swift

    public static func + (lhs: Vector2, rhs: Vector2) -> Vector2
  • Sum (in place).

    Declaration

    Swift

    public static func += (lhs: inout Vector2, rhs: Vector2)
  • Difference.

    Declaration

    Swift

    public static func - (lhs: Vector2, rhs: Vector2) -> Vector2
  • Difference (in place).

    Declaration

    Swift

    public static func -= (lhs: inout Vector2, rhs: Vector2)
  • Scalar-Vector product.

    Declaration

    Swift

    public static func * (lhs: Scalar, rhs: Vector2) -> Vector2