Added Helpers.VecMag(LLVector3 vector) and VecNorm(LLVector3 vector)
git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@605 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
@@ -206,6 +206,23 @@ public class Helpers
|
||||
return (float)Math.Sqrt(xd * xd + yd * yd + zd * zd);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the magnitutde of the supplied vector
|
||||
/// </summary>
|
||||
public static float VecMag(LLVector3 vector)
|
||||
{
|
||||
return (float)Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y + vector.Z * vector.Z);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the supplied vector in normalized form
|
||||
/// </summary>
|
||||
public static LLVector3 VecDist(LLVector3 vector)
|
||||
{
|
||||
float mag = VecMag(vector);
|
||||
return new LLVector3(vector.X/mag,vector.Y/mag,vector.Z/mag);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode a zerocoded byte array, used to decompress packets marked
|
||||
/// with the zerocoded flag
|
||||
|
||||
Reference in New Issue
Block a user