示例#1
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.Add(ref Max, ref Min, out var center);
            center.X *= 0.5f; center.Y *= 0.5f; center.Z *= 0.5f;

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

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

            JMath.Absolute(ref orientation, out var 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);
        }
示例#2
0
文件: JVector.cs 项目: WeeirJoe/Joe
        /// <summary>
        /// Adds two vectors.
        /// </summary>
        /// <param name="value1">The first vector.</param>
        /// <param name="value2">The second vector.</param>
        /// <returns>The sum of both vectors.</returns>
        #region public static JVector operator +(JVector value1, JVector value2)
        public static JVector operator +(JVector value1, JVector value2)
        {
            JVector result; JVector.Add(ref value1, ref value2, out result);

            return(result);
        }