Beispiel #1
0
 /// <summary>
 /// Returns the shortest distance between given point and any point inside the cuboid
 /// </summary>
 public double ShortestVerticalDistanceFrom(double y)
 {
     return(y - GameMath.Clamp(y, Y1, Y2));
 }
Beispiel #2
0
 /// <summary>
 /// Returns the face if current face would be horizontally clockwise rotated, only works for horizontal faces
 /// </summary>
 /// <returns></returns>
 public BlockFacing GetCW()
 {
     return(HORIZONTALS_ANGLEORDER[GameMath.Mod(horizontalAngleIndex - 1, 4)]);
 }
Beispiel #3
0
        /// <summary>
        /// Returns the closest horizontal face from given angle (0 degree = east). Uses HORIZONTALS_ANGLEORDER
        /// </summary>
        /// <param name="radiant"></param>
        /// <returns></returns>
        public static BlockFacing HorizontalFromAngle(float radiant)
        {
            int index = GameMath.Mod(((int)(Math.Round(radiant * GameMath.RAD2DEG / 90))), 4);

            return(HORIZONTALS_ANGLEORDER[index]);
        }
Beispiel #4
0
 /// <summary>
 /// Returns the length of this vector
 /// </summary>
 /// <returns></returns>
 public float Length()
 {
     return(GameMath.RootSumOfSquares(X, Y, Z));
 }