Difference between revisions of "LlVecNorm"

From Second Life Wiki
Jump to navigation Jump to search
(Issues/SVC-4711)
m (-footnote +note)
Line 5: Line 5:
|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
|spec
|spec
|caveats=*Will return <0.0, 0.0, 0.0> when <0.0, 0.0, 0.0> is given as input.
|caveats=*Will return <0.0, 0.0, 0.0> when <0.0, 0.0, 0.0> is given as input.
Line 24: Line 24:
|also_tests
|also_tests
|also_articles
|also_articles
|notes
|notes=
* Mathematically equivalent to:
** vec / [[llVecMag]]( vec )
** vec / llSqrt( vec.x * vec.x + vec.y * vec.y + vec.z * vec.z )
|cat1=Math/3D
|cat1=Math/3D
|cat2=Vector
|cat2=Vector

Revision as of 03:18, 10 October 2011

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

Caveats

  • Will return <0.0, 0.0, 0.0> when <0.0, 0.0, 0.0> is given as input.

Important Issues

~ All Issues ~ Search JIRA for related Bugs
   llVecNorm returns zero vector as result when input is below a certain magnitude

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

All Issues

~ Search JIRA for related Issues
   llVecNorm returns zero vector as result when input is below a certain magnitude

Signature

function vector llVecNorm( vector vec );