SolidKit3D.Vector struct

From Solid Graphics Wiki

(Redirected from Vector struct)
Jump to: navigation, search
SolidKit3D.Vector struct
Namespace: SolidKit3D
Base type: (none)
Assembly: SolidKit.dll
Platform: .NET

The Vector struct specifies (x, y, z) direction in 3D space using float precision. A vector can be thought as arrow drawn in space from point A to point B. Other main property of a vector is it's size (also commonly reffered as lenght or magnitude).



Constructors

Struct constructors allow to initialize the Vector object from other vector, or point, or set of three float values, or float values array, or double values array.

Fields

Field name Type Description
x float the X coordinate of vector direction
y float the Y coordinate of vector direction
z float the Z coordinate of vector direction

Methods

Method name Description
(indexer) Allows to access vector coordinates by index, index 0 returns x, index 1 returns y, index 2 returns z coordinate.
Normalize Changes the vector so it's size is one unit.
Dot Calculates dot product of two vectors. The result is single float value which is equal to multiplication of sizes of both vectors and cosinus of their angle.
Cross Calculates cross product of two vectors. The result is a vector which is perpendicular to both input vectors and it's size is multiplication of sizes of both vectors and sinus of their angle.
Size Returns the vector size (length).
SquaredSize Returns sqaured vector's size.
IsBetween The IsBetween function returns true if it lies in between angle created by by turning two given vectors in counterclockwise direction. Othervise the return value is false.
IsCollinear The function returns true if the vector point in the same direction as a vector given as parameter. Othervise the return value is false.
AngleTo Calculates angle needed to turn the vector counterclockwise so the vector point to the same direction as other given vector.
YXRotationAngles Calculates Y axis and X axis rotations needed to point the Z axis vector into the direction of the vector.

Operators

* Depending on the other operand type (which can be other vector or float) the operator return a vector which is either cross product of the two vectors or multiplication of the vector by the float value.
/ Returns a vector which is calculated by dividing the vector coordinates by given float value.
+ Returns a vector which is calculated by adding coordinates of two vector.
- Returns a vector which is calculated by subtracting two vectors.
= The assignment operator allows to assign a point coordinates to the vector.

See Also

   


SolidKit Library Documentation

Personal tools