Vector
open class Vector
Represents a vector.
-
Initializes a new vector with start at (0,0)
Declaration
Swift
public convenience init()Return Value
The newly created Vector.
-
Initializes a new Vector with the specified start point.
Declaration
Swift
public init(x: Double, y: Double)Parameters
xThe x-coordinate of this Vector’s start point.
yThe y-coordinate of this Vector’s start point.
Return Value
The newly created Vector.
-
Undocumented
Declaration
Swift
public init(p: Point) -
Returns the Vector which turns 90 grads to the left measured from the perspective of the specified Vector.
Declaration
Swift
public static func left(_ v: Vector) -> VectorParameters
vThe Vector whose perspective is considered.
Return Value
The resulting Vector.
-
Returns the Vector which turns 90 grads to the right measured from the perspective of the specified Vector.
Declaration
Swift
public static func right(_ v: Vector) -> VectorParameters
vThe Vector whose perspective is considered.
Return Value
The resulting Vector.
-
Calculates the multiplication Vector if the specified two Vector-s.
Declaration
Swift
public static func multiply(_ vector1: Vector, vector2: Vector) -> DoubleParameters
vector1The first Vector.
vector2The second Vector.
Return Value
A double, which represents the multiplication of the two Vector-s.
-
Multiplies the specified Vector by the specified scalar.
Declaration
Swift
public static func multiply(_ vector: Vector, scalar: Double) -> VectorParameters
vectorThe Vector to multiply.
scalarThe scalar by which the vector is multiplied.
Return Value
The result of the multiplication of the Vector with the scalar.
-
Multiplies the specified scalar by the specified Vector.
Declaration
Swift
public static func multiply(_ scalar: Double, vector: Vector) -> VectorParameters
scalarThe scalar to multiply.
vectorThe Vector by which the scalar is multiplied.
Return Value
The result of the multiplication of the scalar with the Vector.
-
Specifies the x-coordinate of this Vector.
Declaration
Swift
open var x: Double -
Specifies the y-coordinate of this Vector.
Declaration
Swift
open var y: Double -
Specifies the length-coordinate of this Vector.
Declaration
Swift
open var length: Double { get }
Vector Class Reference