Skip to main content

Vector

Code Example​

::STAR::Vector a( 0, 1, 0 );

::STAR::Vector b(); // will be initialised to( 0, 0, 0 )

::STAR::Vector c = a + b;

Constructor​

Vector vector(Scalar x, Scalar y, Scalar z)

Vector vector(Vector v)
  • x - the x value of this vector. Default is 0
  • y - the y value of this vector. Default is 0
  • z - the z value of this vector. Default is 0

Methods​

Basic Properties Methods​

Basic Operations

PropertiesDescription
.[0]: ScalarReturns a the value x of this vector.
.[1]: ScalarReturns a the value y of this vector.
.[2]: ScalarReturns a the value z of this vector.

Basic Getter Methods

PropertiesDescription
.x(): ScalarReturns a the value x of this vector.
.y(): ScalarReturns a the value x of this vector.
.z(): ScalarReturns a the value x of this vector.
.print(): void

Basic Setter Methods

PropertiesDescription
.set(Scalar s): thisCopies the value to this Vector x, y, z.
.set(Vector v): thisCopies the values of x, y, z to this Vector.
.setX(Scalar s): thisCopies the value of x to this Vector.
.setY(Scalar s): thisCopies the value of y to this Vector.
.setZ(Scalar s): thisCopies the value of z to this Vector.

Basic Math Methods​

Basic Operations

PropertiesDescription
+(): Vector
-(): Vector
+(Scalar s): Vector
-(Scalar s): Vector
*(Scalar s): Vector
/(Scalar s): Vector
+(Vector v): VectorCalculates the add product of this vector and v.
-(Vector v): VectorCalculates the sub product of this vector and v.
*(Vector v): VectorCalculates the cross product of this vector and v.

Basic Calculations

PropertiesDescription
.dot(Vector v): ScalarCalculates the dot product of this vector and v.
.length(): ScalarCalculates the Euclidean length from(0, 0) to(x, y, z).
.triple(): ScalarCalculates the triple product of this vector and v.
.cross(Vector v1, Vector v2): VectorCalculates the cross product of this vector, v1 and v2.
.clone(): VectorReturns a new Vector with the same x and y values as this one.