コード例 #1
0
 /// <summary>
 /// Determines whether the specified <see cref="MyMatrix3x2"/> is equal to this instance.
 /// </summary>
 /// <param name="other">The <see cref="MyMatrix3x2"/> to compare with this instance.</param>
 /// <returns>
 /// <c>true</c> if the specified <see cref="MyMatrix3x2"/> is equal to this instance; otherwise, <c>false</c>.
 /// </returns>
 public bool Equals(ref MyMatrix3x2 other)
 {
     return(MyMathf.NearEqual(other.M11, M11) &&
            MyMathf.NearEqual(other.M12, M12) &&
            MyMathf.NearEqual(other.M21, M21) &&
            MyMathf.NearEqual(other.M22, M22) &&
            MyMathf.NearEqual(other.M31, M31) &&
            MyMathf.NearEqual(other.M32, M32));
 }
コード例 #2
0
        /// <summary>
        /// Determines whether a <see cref="MyOrientedBoundingBox"/> contains a point. 
        /// </summary>
        /// <param name="point">The point to test.</param>
        /// <returns>The type of containment the two objects have.</returns>
        public MyContainmentType Contains(ref MyVector3 point)
        {
            // Transform the point into the obb coordinates
            MyMatrix invTrans;
            MyMatrix.Invert(ref Transformation, out invTrans);

            MyVector3 locPoint;
            MyVector3.TransformCoordinate(ref point, ref invTrans, out locPoint);

            locPoint.X = Math.Abs(locPoint.X);
            locPoint.Y = Math.Abs(locPoint.Y);
            locPoint.Z = Math.Abs(locPoint.Z);

            //Simple axes-aligned BB check
            if (MyMathf.NearEqual(locPoint.X, Extents.X) && MyMathf.NearEqual(locPoint.Y, Extents.Y) && MyMathf.NearEqual(locPoint.Z, Extents.Z))
                return MyContainmentType.Intersects;
            if (locPoint.X < Extents.X && locPoint.Y < Extents.Y && locPoint.Z < Extents.Z)
                return MyContainmentType.Contains;
            else
                return MyContainmentType.Disjoint;
        }
コード例 #3
0
 /// <summary>
 /// Determines whether the specified <see cref="MyMatrix5x4"/> is equal to this instance.
 /// </summary>
 /// <param name="other">The <see cref="MyMatrix5x4"/> to compare with this instance.</param>
 /// <returns>
 /// <c>true</c> if the specified <see cref="MyMatrix5x4"/> is equal to this instance; otherwise, <c>false</c>.
 /// </returns>
 public bool Equals(ref MyMatrix5x4 other)
 {
     return(MyMathf.NearEqual(other.M11, M11) &&
            MyMathf.NearEqual(other.M12, M12) &&
            MyMathf.NearEqual(other.M13, M13) &&
            MyMathf.NearEqual(other.M14, M14) &&
            MyMathf.NearEqual(other.M21, M21) &&
            MyMathf.NearEqual(other.M22, M22) &&
            MyMathf.NearEqual(other.M23, M23) &&
            MyMathf.NearEqual(other.M24, M24) &&
            MyMathf.NearEqual(other.M31, M31) &&
            MyMathf.NearEqual(other.M32, M32) &&
            MyMathf.NearEqual(other.M33, M33) &&
            MyMathf.NearEqual(other.M34, M34) &&
            MyMathf.NearEqual(other.M41, M41) &&
            MyMathf.NearEqual(other.M42, M42) &&
            MyMathf.NearEqual(other.M43, M43) &&
            MyMathf.NearEqual(other.M44, M44) &&
            MyMathf.NearEqual(other.M51, M51) &&
            MyMathf.NearEqual(other.M52, M52) &&
            MyMathf.NearEqual(other.M53, M53) &&
            MyMathf.NearEqual(other.M54, M54));
 }
コード例 #4
0
ファイル: MyViewport.cs プロジェクト: ly774508966/MyHalp
        /// <summary>
        /// Determines whether the specified <see cref="MyViewport"/> is equal to this instance.
        /// </summary>
        /// <param name="other">The <see cref="MyViewport"/> to compare with this instance.</param>
        /// <returns>
        /// <c>true</c> if the specified <see cref="MyViewport"/> is equal to this instance; otherwise, <c>false</c>.
        /// </returns>

        public bool Equals(ref MyViewport other)
        {
            return(X == other.X && Y == other.Y && Width == other.Width && Height == other.Height && MyMathf.NearEqual(MinDepth, other.MinDepth) && MyMathf.NearEqual(MaxDepth, other.MaxDepth));
        }