示例#1
0
        public Vector3d getPositionFromElements(OrbitalElementsPieces computed)
        {
            /*	if(!computed) return new THREE.Vector3(0,0,0);
             *
             *                  var a1 = new THREE.Euler(computed.tilt || 0, 0, computed.o, 'XYZ');
             *                  var q1 = new THREE.Quaternion().setFromEuler(a1);
             *                  var a2 = new THREE.Euler(computed.i, 0, computed.w, 'XYZ');
             *                  var q2 = new THREE.Quaternion().setFromEuler(a2);
             *
             *                  var planeQuat = new THREE.Quaternion().multiplyQuaternions(q1, q2);
             *                  computed.pos.applyQuaternion(planeQuat);
             *                  return computed.pos;
             */
            if (computed == null)
            {
                return(new Vector3d(0, 0, 0));
            }

            var         a1 = new Vector3d(computed.tilt, 0, computed.o.Value);
            QuaternionD q1 = QuaternionD.EulerRad(a1);
            var         a2 = new Vector3d(computed.i.Value, 0, computed.w.Value);
            QuaternionD q2 = QuaternionD.EulerRad(a2);

            QuaternionD planeQuat = q1 * q2;
            Vector3d    pos       = planeQuat * computed.pos; // bomb (should it apply in place?)

            return(pos);
        }