Vector3D

From SDK
Revision as of 20:32, 3 August 2021 by WikiSysop (talk | contribs) (Created page with "right|50px|link=Low Level Geometry Category:SDK This object represents a 3D vector (X, Y and Z values). It is used by many other objects and can also be...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Back.jpg

This object represents a 3D vector (X, Y and Z values). It is used by many other objects and can also be used with other geometry objects such as Point3D to perform calculations.

Constructor

Vector3D()

This construct an uninitialized vector with invalid x, y and z values which can be tested for using the .IsInvalid property.


Vector3D(double x, double y, double z)

A vector point with the specified values x(double) the value for the x coordinate of the vector y(double) the value for the y coordinate of the vector z(double) the value for the z coordinate of the vector

Vector3D(Vector3D vec)

A new vector with the same X, Y and Z values as the passed vector vec (Vector3D)

Note: an existing vector to copy values from

Properties

.IsInvalid

Returns: (bool) true if the vector is invalid Note: not initialised or:SetInvalid called

.Length

Returns: (the length of the vector

.LengthSq

Returns: (the length squared of the vector. If comparing distance between points etc. using LengthSq instead of Length will be

faster as it avoids the square root operation required to find the exact length.

.X or .x

Interaction: Read and Write

Returns:(double) x coordinate for point


.Y or .y

Interaction: Read and Write

Returns:(double) y coordinate for point


.Z or .z

Interaction: Read and Write

Returns:(double) z coordinate for point



Methods

:Cross(Vector3D vec)

Returns: (the cross product (a Vector3D) of this vector and passed vector


:Dot(Vector3D vec)

Returns: (the dot product (a double value) of this vector and passed vector


:Dot(Point3D vec)

Returns: (the dot product (a double value) of this vector and passed point. The X,Y,Z values of the point are treated exactly the same as for the Vector3D version of this method.


:Normalize()

Normalize this vector to make it a unit vector


:Set(double x, double y, double z)

Set the x, y and z values for the vector x(double) new x value for vector y(double) new y value for vector z(double) new z value for vector


:SetInvalid()

Set the vector to invalid state X, Y and Z will be lost

Operations

Double * Vector3D

Returns: a new vector multiplied by double value


Vector3D + Vector3D

Adding a vector to a vector will returns a new vector.

Vector3D - Vector3D

Subtracting a vector from a point will returns a new vector.


- Vector3D

Negates x,y and z values of vector (reverses vector direction)


Back.jpg

References

Please Note: The base material for the contents found in this WiKi was sourced from Vectric Lua Interface for Gadgets, version 2.05, published September 12, 2018. by Vectric Ltd. Most current document from Vertric can be downloaded at Vertric Developer Information