This function returns the normalized (a.k.a. unit) vector representing

Oversimplification starting point: This reduces the vector to "one". In SL the unit of measure is a meter, so it is somewhat useful to think of this as, instead of a direction pointing 20m to a place, how about reducing it to 1m, but still pointing in the same direction. <0,0,2> (2m up) becomes <0,0,1>. Or, on the complex side: <-1.37821, -0.85432, 2.75875> becomes <-0.43069, -0.26698, 0.86211>.

//definition vector VecNorm(vector v) { return (v / VecMag(v)); } float VecMag(vector v) { return llSqrt(v.x*v.x + v.y*v.y + v.z*v.z); } float VecDist(vector a, vector b) { return VecMag(a - b); }

Compare with

This article wasn't helpful for you? Maybe the related article at the LSL Portal is able to bring enlightenment.

Functions | Vector

There is no comment on this page.
[Display comments/form]