llVecNorm

From Second Life Wiki
Revision as of 10:06, 29 June 2012 by Strife Onizuka (talk | contribs) (upgrading to the footnote)
Jump to navigation Jump to search

Summary

Function: vector llVecNorm( vector vec );
0.0 Forced Delay
10.0 Energy

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

• vector vec Any valid vector

If vec is a ZERO_VECTOR, than the value returned is a ZERO_VECTOR.

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>

Notes

  • Mathematically equivalent to:
    • vec / llVecMag( vec )
    • vec / llSqrt( vec.x * vec.x + vec.y * vec.y + vec.z * vec.z )

See Also

Functions

•  llVecMag
•  llVecDist

Deep Notes

Signature

function vector llVecNorm( vector vec );