예제 #1
0
파일: Object3D.cs 프로젝트: lvarvel/aura
 protected Object3D()
 {
     position = new Vector3(0, 0, 0);
     scale = 1;
     rotation = new Quaternion(0, 0, 1, 0);
     _id = IDManager.NewID;
 }
예제 #2
0
파일: Quaternion.cs 프로젝트: lvarvel/aura
 Quaternion(ref Quaternion copy)
 {
     data = new float[4];
     data[0] = copy.data[0];
     data[1] = copy.data[1];
     data[2] = copy.data[2];
     data[3] = copy.data[3];
 }
예제 #3
0
파일: Matrix.cs 프로젝트: lvarvel/aura
 public Matrix(Vector3 position, Quaternion rotation, float scale)
 {
     throw new NotImplementedException();
 }
예제 #4
0
파일: Quaternion.cs 프로젝트: lvarvel/aura
        public Vector3 transformVector(Vector3 vec)
        {
            Vector3 vn = new Vector3(ref vec);
            vn.normalize();

            Quaternion vecQuat = new Quaternion();
            Quaternion resQuat = new Quaternion();
            vecQuat.X = vn.X;
            vecQuat.Y = vn.Y;
            vecQuat.Z = vn.Z;
            vecQuat.W = 0.0f;

            resQuat = vecQuat * conjugate();
            resQuat = this * resQuat;

            return new Vector3(resQuat.X, resQuat.Y, resQuat.Z);
        }
예제 #5
0
파일: Tree.cs 프로젝트: lvarvel/aura
 protected Vector3 getNext(float length, float angleClamp, Vector3 normal)
 {
     Vector3 rand = new Vector3((float)Util.r.NextDouble() * Util.r.NextSign(),
         (float)Util.r.NextDouble() * Util.r.NextSign(),
         (float)Util.r.NextDouble() * Util.r.NextSign());
     rand = rand * length;
     /*
     Vector3 result;
     Vector3 axis = rand.cross(normal);
     float theta = (float)Math.Acos(rand.dot(normal));
     theta = (theta > angleClamp) ? theta - (angleClamp * 2f) : theta;
     Quaternion rot = new Quaternion(theta, axis.X, axis.Y, axis.Z);
     result = rot.transformVector(rand);
     theta = (float)(Util.r.NextDouble() * Math.PI * 2);
     rot = new Quaternion(theta, normal.X, normal.Y, normal.Z);
     result = rot.transformVector(result);
     return result;
     */
     Quaternion rot = new Quaternion(angleClamp, rand.X, rand.Y, rand.Z);
     Vector3 result = rot.transformVector(normal);
     return result;
 }