示例#1
0
 public Base6Directions.Direction TransformDirectionInverse(Base6Directions.Direction baseDirection)
 {
     Base6Directions.Axis axis = Base6Directions.GetAxis(baseDirection);
     if (axis == Base6Directions.GetAxis(this.Forward))
     {
         if (baseDirection != this.Forward)
         {
             return(Base6Directions.Direction.Backward);
         }
         return(Base6Directions.Direction.Forward);
     }
     if (axis == Base6Directions.GetAxis(this.Left))
     {
         if (baseDirection != this.Left)
         {
             return(Base6Directions.Direction.Right);
         }
         return(Base6Directions.Direction.Left);
     }
     if (baseDirection != this.Up)
     {
         return(Base6Directions.Direction.Down);
     }
     return(Base6Directions.Direction.Up);
 }
示例#2
0
        public Base6Directions.Direction TransformDirection(Base6Directions.Direction baseDirection)
        {
            Base6Directions.Axis axis = Base6Directions.GetAxis(baseDirection);
            int num = (int)(baseDirection % Base6Directions.Direction.Left);

            switch (axis)
            {
            case Base6Directions.Axis.ForwardBackward:
                if (num != 1)
                {
                    return(this.Forward);
                }
                return(Base6Directions.GetFlippedDirection(this.Forward));

            case Base6Directions.Axis.LeftRight:
                if (num != 1)
                {
                    return(this.Left);
                }
                return(Base6Directions.GetFlippedDirection(this.Left));
            }
            if (num != 1)
            {
                return(this.Up);
            }
            return(Base6Directions.GetFlippedDirection(this.Up));
        }
示例#3
0
        /// <summary>
        /// Returns the direction that this orientation transforms to baseDirection
        /// </summary>
        public Base6Directions.Direction TransformDirectionInverse(Base6Directions.Direction baseDirection)
        {
            Base6Directions.Axis axis = Base6Directions.GetAxis(baseDirection);

            if (axis == Base6Directions.GetAxis(Forward))
            {
                return(baseDirection == Forward ? Base6Directions.Direction.Forward : Base6Directions.Direction.Backward);
            }
            if (axis == Base6Directions.GetAxis(Left))
            {
                return(baseDirection == Left ? Base6Directions.Direction.Left : Base6Directions.Direction.Right);
            }
            Debug.Assert(axis == Base6Directions.GetAxis(Up), "Direction invalid in MyBlockOrientation");
            return(baseDirection == Up ? Base6Directions.Direction.Up : Base6Directions.Direction.Down);
        }
示例#4
0
        /// <summary>
        /// Returns the direction baseDirection will point to after transformation
        /// </summary>
        public Base6Directions.Direction TransformDirection(Base6Directions.Direction baseDirection)
        {
            Base6Directions.Axis axis = Base6Directions.GetAxis(baseDirection);
            int flip = ((int)baseDirection % 2);

            if (axis == Base6Directions.Axis.ForwardBackward)
            {
                return(flip == 1 ? Base6Directions.GetFlippedDirection(Forward) : Forward);
            }
            if (axis == Base6Directions.Axis.LeftRight)
            {
                return(flip == 1 ? Base6Directions.GetFlippedDirection(Left) : Left);
            }
            Debug.Assert(axis == Base6Directions.Axis.UpDown, "Axis invalid in MyBlockOrientation");
            return(flip == 1 ? Base6Directions.GetFlippedDirection(Up) : Up);
        }
示例#5
0
        public static MatrixI CreateRotation(Base6Directions.Direction oldA, Base6Directions.Direction oldB, Base6Directions.Direction newA, Base6Directions.Direction newB)
        {
            Debug.Assert(Base6Directions.GetAxis(oldA) != Base6Directions.GetAxis(oldB), "Original vectors must not lie in line!");
            Debug.Assert(Base6Directions.GetAxis(newA) != Base6Directions.GetAxis(newB), "Transformed vectors must not lie in line!");

            MatrixI newMatrix = new MatrixI();

            newMatrix.Translation = Vector3I.Zero;

            Base6Directions.Direction oldC = Base6Directions.GetCross(oldA, oldB);
            Base6Directions.Direction newC = Base6Directions.GetCross(newA, newB);

            newMatrix.SetDirection(oldA, newA);
            newMatrix.SetDirection(oldB, newB);
            newMatrix.SetDirection(oldC, newC);

            return(newMatrix);
        }