Пример #1
0
 public IndexedBasisMatrix(ref IndexedQuaternion q)
 {
     float d = q.LengthSquared();
     Debug.Assert(d != 0.0f);
     float s = 2.0f / d;
     float xs = q.X * s, ys = q.Y * s, zs = q.Z * s;
     float wx = q.W * xs, wy = q.W * ys, wz = q.W * zs;
     float xx = q.X * xs, xy = q.X * ys, xz = q.X * zs;
     float yy = q.Y * ys, yz = q.Y * zs, zz = q.Z * zs;
     _el0 = new IndexedVector3(1.0f - (yy + zz), xy - wz, xz + wy);
     _el1 = new IndexedVector3(xy + wz, 1.0f - (xx + zz), yz - wx);
     _el2 = new IndexedVector3(xz - wy, yz + wx, 1.0f - (xx + yy));
 }
Пример #2
0
        public IndexedBasisMatrix(ref IndexedQuaternion q)
        {
            float d = q.LengthSquared();

            Debug.Assert(d != 0.0f);
            float s = 2.0f / d;
            float xs = q.X * s, ys = q.Y * s, zs = q.Z * s;
            float wx = q.W * xs, wy = q.W * ys, wz = q.W * zs;
            float xx = q.X * xs, xy = q.X * ys, xz = q.X * zs;
            float yy = q.Y * ys, yz = q.Y * zs, zz = q.Z * zs;

            _el0 = new IndexedVector3(1.0f - (yy + zz), xy - wz, xz + wy);
            _el1 = new IndexedVector3(xy + wz, 1.0f - (xx + zz), yz - wx);
            _el2 = new IndexedVector3(xz - wy, yz + wx, 1.0f - (xx + yy));
        }
Пример #3
0
        public void SetRotation(ref IndexedQuaternion q)
        {
            float d = q.LengthSquared();

            Debug.Assert(d != 0.0f);
            float s = 2.0f / d;
            float xs = q.X * s, ys = q.Y * s, zs = q.Z * s;
            float wx = q.W * xs, wy = q.W * ys, wz = q.W * zs;
            float xx = q.X * xs, xy = q.X * ys, xz = q.X * zs;
            float yy = q.Y * ys, yz = q.Y * zs, zz = q.Z * zs;

            SetValue(1.0f - (yy + zz), xy - wz, xz + wy,
                     xy + wz, 1.0f - (xx + zz), yz - wx,
                     xz - wy, yz + wx, 1.0f - (xx + yy));
        }
Пример #4
0
 public void SetRotation(ref IndexedQuaternion q)
 {
     float d = q.LengthSquared();
     Debug.Assert(d != 0.0f);
     float s = 2.0f / d;
     float xs = q.X * s, ys = q.Y * s, zs = q.Z * s;
     float wx = q.W * xs, wy = q.W * ys, wz = q.W * zs;
     float xx = q.X * xs, xy = q.X * ys, xz = q.X * zs;
     float yy = q.Y * ys, yz = q.Y * zs, zz = q.Z * zs;
     SetValue(1.0f - (yy + zz), xy - wz, xz + wy,
         xy + wz, 1.0f - (xx + zz), yz - wx,
         xz - wy, yz + wx, 1.0f - (xx + yy));
 }