コード例 #1
0
        public void Transform(ref JMatrix orientation)
        {
            JVector halfExtents = 0.5f * (Max - Min);
            JVector center      = 0.5f * (Max + Min);

            JVector.Transform(ref center, ref orientation, out center);

            JMatrix abs; JMath.Absolute(ref orientation, out abs);

            JVector.Transform(ref halfExtents, ref abs, out halfExtents);

            Max = center + halfExtents;
            Min = center - halfExtents;
        }
コード例 #2
0
        public static JMatrix CreateRotationY(float radians)
        {
            float num2 = JMath.Cos(radians);
            float num  = JMath.Sin(radians);

            return(new JMatrix(
                       m11: num2,
                       m12: 0f,
                       m13: -num,
                       m21: 0f,
                       m22: 1f,
                       m23: 0f,
                       m31: num,
                       m32: 0f,
                       m33: num2));
        }
コード例 #3
0
        public static void CreateRotationX(float radians, out JMatrix result)
        {
            float num2 = JMath.Cos(radians);
            float num  = JMath.Sin(radians);

            result = new JMatrix(
                m11: 1f,
                m12: 0f,
                m13: 0f,
                m21: 0f,
                m22: num2,
                m23: num,
                m31: 0f,
                m32: -num,
                m33: num2);
        }
コード例 #4
0
        /// <summary>
        /// Transforms the bounding box into the space given by orientation and position.
        /// </summary>
        /// <param name="position"></param>
        /// <param name="orientation"></param>
        /// <param name="result"></param>
        internal void InverseTransform(ref JVector position, ref JMatrix orientation)
        {
            JVector.Subtract(ref Max, ref position, out Max);
            JVector.Subtract(ref Min, ref position, out Min);

            JVector center;

            JVector.Add(ref Max, ref Min, out center);
            center.X *= 0.5f; center.Y *= 0.5f; center.Z *= 0.5f;

            JVector halfExtents;

            JVector.Subtract(ref Max, ref Min, out halfExtents);
            halfExtents.X *= 0.5f; halfExtents.Y *= 0.5f; halfExtents.Z *= 0.5f;

            JVector.TransposedTransform(ref center, ref orientation, out center);

            JMatrix abs; JMath.Absolute(ref orientation, out abs);

            JVector.TransposedTransform(ref halfExtents, ref abs, out halfExtents);

            JVector.Add(ref center, ref halfExtents, out Max);
            JVector.Subtract(ref center, ref halfExtents, out Min);
        }