Vector
public struct Vector : Equatable
Vector object
In the Euclidean geometry, a vector is what is needed to “carry” the point A to the point B; it is a geometric object that has magnitude (or length) and direction. Vectors can be added to other vectors according to vector algebra. A Euclidean vector is frequently represented by a line segment with a definite direction, or graphically as an arrow, connecting an initial point A with a terminal point B, and denoted by \overrightarrow{AB}.
-
X-coordinate of the vector
Declaration
Swift
public var x: BigDouble -
Y-coordinate of the vector
Declaration
Swift
public var y: BigDouble -
X, Y and higher dimensions
Declaration
Swift
public var dims: [BigDouble] -
Origin of the vector
Declaration
Swift
public var origin: Point -
Simple 2D Vector
Parameters
xX coordinate
yY coordinate
-
Simple 1D Vector
Parameters
xX coordinate
-
Vector in more than 2 dimensions
Parameters
multipleDimensionsAn containing the coordinates:
[x, y, z, ...] -
Converts a Vector into a Matrix
Declaration
Swift
public var matrix: Matrix { get } -
Origin point translated by the vector
Declaration
Swift
public var translated: Point { get } -
Sum of two vectors
Declaration
Swift
public static func + (rhs: Vector, lhs: Vector) -> Vector -
Dot product of two vectors
Declaration
Swift
public static func * (rhs: Vector, lhs: Vector) -> BigDouble -
Equality between vectors
Declaration
Swift
public static func == (rhs: Vector, lhs: Vector) -> Bool
View on GitHub
Vector Structure Reference