public ContainmentType Contains(ref MyOrientedBoundingBoxD other)
        {
            Quaternion quaternion;
            Quaternion quaternion2;

            Quaternion.Conjugate(ref this.Orientation, out quaternion);
            Quaternion.Multiply(ref quaternion, ref other.Orientation, out quaternion2);
            MatrixD mB = MatrixD.CreateFromQuaternion(quaternion2);

            mB.Translation = Vector3D.Transform(other.Center - this.Center, quaternion);
            return(ContainsRelativeBox(ref this.HalfExtent, ref other.HalfExtent, ref mB));
        }
Esempio n. 2
0
        public static void Transform(ref MyTransform t1, ref MyTransform t2, out MyTransform result)
        {
            Vector3 newPos;

            Vector3.Transform(ref t1.Position, ref t2.Rotation, out newPos);
            newPos += t2.Position;
            Quaternion newRot;

            Quaternion.Multiply(ref t1.Rotation, ref t2.Rotation, out newRot);
            result.Position = newPos;
            result.Rotation = newRot;
        }
Esempio n. 3
0
        // Determine whether this box contains, intersects, or is disjoint from
        // the given other box.
        public ContainmentType Contains(ref MyOrientedBoundingBoxD other)
        {
            // Build the 3x3 rotation matrix that defines the orientation of 'other' relative to this box
            Quaternion invOrient;

            Quaternion.Conjugate(ref Orientation, out invOrient);
            Quaternion relOrient;

            Quaternion.Multiply(ref invOrient, ref other.Orientation, out relOrient);

            MatrixD relTransform = MatrixD.CreateFromQuaternion(relOrient);

            relTransform.Translation = Vector3D.Transform(other.Center - Center, invOrient);

            return(ContainsRelativeBox(ref HalfExtent, ref other.HalfExtent, ref relTransform));
        }