User Tools

Site Tools


hpl3:community:scripting:classes:cvector2f

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
hpl3:community:scripting:classes:cvector2f [2015/11/06 03:29]
abion47 [Remarks]
hpl3:community:scripting:classes:cvector2f [2015/11/06 03:38] (current)
abion47 [Remarks]
Line 14: Line 14:
 | float | SqrLength | const | Returns the length-squared of this vector. | | float | SqrLength | const | Returns the length-squared of this vector. |
 | float | Length | const | Returns the length of this vector. | | float | Length | const | Returns the length of this vector. |
-| float | Normalize |     ​| ​Calculates ​the normalization factor for this vector. (See Remarks.) |+| float | Normalize |     ​| ​Returns ​the normalization factor for this vector. (See Remarks.) |
  
 ====Remarks==== ====Remarks====
  
-A normalized vector is a vector whose length is equal to one, otherwise known as a unit vector. To convert a vector into a unit vector, get the normalization factor by calling the ''​Normalize''​ function, then divide each of the vector'​s x and y coordinates by the factor.+A normalized vector is a vector whose length is equal to one, otherwise known as a unit vector. To convert a vector into a unit vector, get the normalization factor by calling the ''​Normalize''​ function, then divide each of the vector'​s x and y coordinates by that factor.
  
 +<​code=c++>​cVector2f vBaseVector(2.0,​ 5.0);
 +float fNormFactor = vBaseVector.Normalize();​
 +cVector2f vNormalizedVector(vBaseVector.x / fNormFactor, ​
 +                            vBaseVector.y / fNormFactor);</​code>​
hpl3/community/scripting/classes/cvector2f.1446780562.txt.gz ยท Last modified: 2015/11/06 03:29 by abion47