Difference between revisions of "LlVecNorm"

From Second Life Wiki
Jump to navigation Jump to search
(adding zero vector caveat)
m (changed it back to |Return_text: since there's only one normalized vector)
Line 4: Line 4:
|p1_type=vector|p1_name=vec|p1_desc=Any valid vector
|p1_type=vector|p1_name=vec|p1_desc=Any valid vector
|return_type=vector
|return_type=vector
|return_text=that is '''vec''' normalized (a unit vector sharing the same direction as '''vec''').
|Return_text=that is '''vec''' normalized (a unit vector sharing the same direction as '''vec''').
|func_footnote=Functionally equivalent to: <code>'''vec''' / [[llVecMag]]('''vec'''))</code>
|func_footnote=Functionally equivalent to: <code>'''vec''' / [[llVecMag]]('''vec'''))</code>
|spec
|spec

Revision as of 03:14, 11 August 2009

Summary

Function: vector llVecNorm( vector vec );

Returns the vector that is vec normalized (a unit vector sharing the same direction as vec).

• vector vec Any valid vector

Functionally equivalent to: vec / llVecMag(vec))

Caveats

  • Will return <0.0, 0.0, 0.0> when <0.0, 0.0, 0.0> is given as input.
All Issues ~ Search JIRA for related Bugs

Examples

<lsl> default {

   state_entry()
   {
       vector input = <1.0,2.0,3.0>;
       llSay(0,"The unit vector on "+(string)input+" is: "+(string)llVecNorm(input) );
   }

}

</lsl>

See Also

Functions

•  llVecMag
•  llVecDist

Deep Notes

Search JIRA for related Issues

Signature

function vector llVecNorm( vector vec );