예제 #1
0
        public static TSVector3 Cross(TSVector3 vector1, TSVector3 vector2)
        {
            TSVector3 result;

            TSVector3.Cross(ref vector1, ref vector2, out result);
            return(result);
        }
예제 #2
0
        public static TSQuaternion FromToRotation(TSVector3 fromVector, TSVector3 toVector)
        {
            TSVector3    w = TSVector3.Cross(fromVector, toVector);
            TSQuaternion q = new TSQuaternion(w.x, w.y, w.z, TSVector3.Dot(fromVector, toVector));

            q.w += FP.Sqrt(fromVector.sqrMagnitude * toVector.sqrMagnitude);
            q.Normalize();

            return(q);
        }
예제 #3
0
        public static void LookAt(TSVector3 forward, TSVector3 upwards, out TSMatrix result)
        {
            TSVector3 zaxis = forward; zaxis.Normalize();
            TSVector3 xaxis = TSVector3.Cross(upwards, zaxis); xaxis.Normalize();
            TSVector3 yaxis = TSVector3.Cross(zaxis, xaxis);

            result.M11 = xaxis.x;
            result.M21 = yaxis.x;
            result.M31 = zaxis.x;
            result.M12 = xaxis.y;
            result.M22 = yaxis.y;
            result.M32 = zaxis.y;
            result.M13 = xaxis.z;
            result.M23 = yaxis.z;
            result.M33 = zaxis.z;
        }
예제 #4
0
        public static TSVector3 operator %(TSVector3 value1, TSVector3 value2)
        {
            TSVector3 result; TSVector3.Cross(ref value1, ref value2, out result);

            return(result);
        }