Vector2
public struct Vector2 : Deserializable
                Representation of a 2D Vector
- 
                  
                  
The
xcomponent of a vector, the first componentDeclaration
Swift
public let x: Float - 
                  
                  
The
ycomponent of a vector, the second componentDeclaration
Swift
public let y: Float - 
                  
                  
Initialize a
Vector2with x & y both equal to 0Declaration
Swift
public init() - 
                  
                  
Initialize a vector with the supplied x & y components
Declaration
Swift
public init(_ x: Float, _ y: Float) - 
                  
                  
Initialize a vector with the supplied x & y components
Declaration
Swift
public init(x: Float, y: Float) - 
                  
                  
The length of the line to the power of two.
Equivalent to:
x*x + y*yDeclaration
Swift
public var lengthSquared: Float { get } - 
                  
                  
The length of the ‘Vector2’
Declaration
Swift
public var length: Float { get } - 
                  
                  
Return a vector that is scaled such that it’s length is equal to 1. This maintains the same direction as the base vector.
Declaration
Swift
public var normalized: Vector2 { get } - 
                  
                  
Calculate the angle of this vector
Declaration
Swift
public func angle() -> Float - 
                  
                  
Calculate an angle between two vectors
Declaration
Swift
public func angle(to: Vector2) -> Float - 
                  
                  
Declaration
Swift
static var expectedSize: Int { get } 
View on GitHub
        Vector2 Structure Reference