User Tools

Site Tools


3d_vector

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

3d_vector [2022/05/01 18:36] (current)
max created
Line 1: Line 1:
 +====== Vector3 ======
 +
 +Vector3 also supports the same access methods as [[2d_vector|Vector2]], with an additional ''z'' component.
 +
 +==== Construction methods ====
 +
 +Vector3 objects can be constructed by either:
 +  * Supplying the ''x, y, z'' components as floats.
 +  * Supplying nothing, defaulting to a zero vector.
 +
 +<note tip>
 +If you need a unit Vector3, you can use the static ''Vector3::ZERO'', ''Vector3::UNIT_X'', and similar instead of creating new objects initialized to those values. 
 +</note>
 +
 +==== Utility functions ====
 +  * ''Dot''
 +  * ''Magnitude''
 +  * ''MagnitudeFast'', which omits the slower square root function call.
 +  * ''Distance''
 +  * ''Cross'', which can either return a new Vector3 or apply to the current one depending on the arguments.
 +  * ''Angle''
 +  * ''Project'', always returns a new object, taking the ''length'' and ''direction'' as Vector3 objects
 +  * ''Perpendicular'', always returns a new object, taking the ''length'' and ''direction'' as Vector3 objects
 +  * ''Reflection'', always return a new object, taking an existing Vector3 and a normal as Vector3 objects.
 +
 +Note that the typical !=, ==, *= operators are all implemented for this class.
 +
  
3d_vector.txt ยท Last modified: 2022/05/01 18:36 by max