Beispiel #1
0
 /************************************************************/
 static EVector3()
 {
     ms_zeroVector = new EVector3 (true);
     ms_oneVector = new EVector3 (1.0f);
 }
Beispiel #2
0
 // "direction" must be a unit vector
 public EVector3 project(EVector3 direction)
 {
     float mag = dot (direction);
     return (mag * direction);
 }
Beispiel #3
0
 public EVector3 projectOntoNonUnitVector(EVector3 v)
 {
     float mag = dot (v) / v.normSquared ();
     return (mag * v);
 }
Beispiel #4
0
 public void multiplyComponents(EVector3 v)
 {
     X *= v.X;
     Y *= v.Y;
     Z *= v.Z;
 }
Beispiel #5
0
 public EVector3 multiplyComponents(EVector3 v1, EVector3 v2)
 {
     EVector3 prodV = v1;
     prodV.multiplyComponents (v2);
     return (prodV);
 }
Beispiel #6
0
 public EVector3 cross(EVector3 v)
 {
     float rx, ry, rz;
     rx =  Y * v.Z - Z * v.Y;
     ry = -X * v.Z + Z * v.X;
     rz =  X * v.Y - Y * v.X;
     return (new EVector3 (rx, ry, rz));
 }
Beispiel #7
0
 public float dot(EVector3 v)
 {
     return (X * v.X + Y * v.Y + Z * v.Z);
 }
Beispiel #8
0
 // Return the perpendicular component of the projection of
 //   this onto "direction"
 // "direction" must be a unit vector
 public EVector3 computePerpendicularComponentWrt(EVector3 direction)
 {
     return (this - project (direction));
 }
Beispiel #9
0
 // consider "v" non-normal regardless of "isNormal"
 public EVector3 computePerpendicularComponentWrt(EVector3 v, bool isNormal)
 {
     return (this - projectOntoNonUnitVector (v));
 }
Beispiel #10
0
 public static EVector3 lerp(EVector3 source, EVector3 destination, float destinationWeight)
 {
     EVector3 result = (1 - destinationWeight) * source + destinationWeight * destination;
     return (result);
 }
Beispiel #11
0
 public static float dot(EVector3 v1, EVector3 v2)
 {
     return (v1.dot (v2));
 }
Beispiel #12
0
 public static EVector3 cross(EVector3 v1, EVector3 v2)
 {
     return (v1.cross (v2));
 }
Beispiel #13
0
 public Matrix3(EVector3 right, EVector3 up, EVector3 forward)
 {
     m00 = right.X;
     m01 = right.Y;
     m02 = right.Z;
     m10 = up.X;
     m11 = up.Y;
     m12 = up.Z;
     m20 = -forward.X;
     m21 = -forward.Y;
     m22 = -forward.Z;
 }
Beispiel #14
0
 public void decompose(out Vector3 scale, out Quaternion rotation)
 {
     EVector3 right = new EVector3 (this.Right);
     scale.X = right.normalize ();
     EVector3 up = new EVector3 (this.Up);
     scale.Y = up.normalize ();
     EVector3 forward = new EVector3 (this.Forward);
     scale.Z = forward.normalize ();
     Matrix3 m = new Matrix3 (right, up, forward);
     rotation = m.getQuaternion ();
 }