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
Properties | Description |
---|---|
.[0]: Scalar | Returns a the value x of this vector. |
.[1]: Scalar | Returns a the value y of this vector. |
.[2]: Scalar | Returns a the value z of this vector. |
Basic Getter Methods
Properties | Description |
---|---|
.x(): Scalar | Returns a the value x of this vector. |
.y(): Scalar | Returns a the value x of this vector. |
.z(): Scalar | Returns a the value x of this vector. |
.print(): void |
Basic Setter Methods
Properties | Description |
---|---|
.set(Scalar s): this | Copies the value to this Vector x, y, z . |
.set(Vector v): this | Copies the values of x, y, z to this Vector. |
.setX(Scalar s): this | Copies the value of x to this Vector. |
.setY(Scalar s): this | Copies the value of y to this Vector. |
.setZ(Scalar s): this | Copies the value of z to this Vector. |
Basic Math Methodsβ
Basic Operations
Properties | Description |
---|---|
+(): Vector | |
-(): Vector | |
+(Scalar s): Vector | |
-(Scalar s): Vector | |
*(Scalar s): Vector | |
/(Scalar s): Vector | |
+(Vector v): Vector | Calculates the add product of this vector and v. |
-(Vector v): Vector | Calculates the sub product of this vector and v. |
*(Vector v): Vector | Calculates the cross product of this vector and v. |
Basic Calculations
Properties | Description |
---|---|
.dot(Vector v): Scalar | Calculates the dot product of this vector and v. |
.length(): Scalar | Calculates the Euclidean length from(0, 0) to(x, y, z). |
.triple(): Scalar | Calculates the triple product of this vector and v. |
.cross(Vector v1, Vector v2): Vector | Calculates the cross product of this vector, v1 and v2. |
.clone(): Vector | Returns a new Vector with the same x and y values as this one. |