Difference between revisions of "LlVecNorm"

From Second Life Wiki
Jump to navigation Jump to search
m (-footnote +note)
m (upgrading to the footnote)
Line 1: Line 1:
{{Issues/SVC-4711}}{{LSL_Function
{{LSL_Function
|inject-2={{Issues/SVC-4711}}
|func=llVecNorm
|func=llVecNorm
|func_id=13|func_sleep=0.0|func_energy=10.0
|func_id=13|func_sleep=0.0|func_energy=10.0
|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 {{LSLP|vec}} normalized (a unit vector sharing the same direction as {{LSLP|vec}}).
|func_footnote
|func_footnote=If {{LSLP|vec}} is a [[ZERO_VECTOR]], than the value returned is a [[ZERO_VECTOR]].
|spec
|spec
|caveats=*Will return <0.0, 0.0, 0.0> when <0.0, 0.0, 0.0> is given as input.
|caveats
|examples=
|examples=
<lsl>
<lsl>

Revision as of 11:06, 29 June 2012

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

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

Caveats

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 );