Beispiel #1
0
 public static MapPoint GetPoint(Cell cell)
 {
     return(MapPoint.GetPoint(cell.Id));
 }
Beispiel #2
0
 public bool Equals(MapPoint other)
 {
     return(!object.ReferenceEquals(null, other) && (object.ReferenceEquals(this, other) || (other.m_cellId == this.m_cellId && other.m_x == this.m_x && other.m_y == this.m_y)));
 }
Beispiel #3
0
 public static bool IsInMap(MapPoint cell)
 {
     return(IsInMap(cell.X, cell.Y));
 }
Beispiel #4
0
        public DirectionsEnum OrientationToAdjacent(MapPoint point)
        {
            Point left = new Point
            {
                X = (point.X > this.m_x) ? 1 : ((point.X < this.m_x) ? -1 : 0),
                Y = (point.Y > this.m_y) ? 1 : ((point.Y < this.m_y) ? -1 : 0)
            };
            DirectionsEnum result;

            if (left == MapPoint.VectorRight)
            {
                result = DirectionsEnum.DIRECTION_EAST;
            }
            else
            {
                if (left == MapPoint.VectorDownRight)
                {
                    result = DirectionsEnum.DIRECTION_SOUTH_EAST;
                }
                else
                {
                    if (left == MapPoint.VectorDown)
                    {
                        result = DirectionsEnum.DIRECTION_SOUTH;
                    }
                    else
                    {
                        if (left == MapPoint.VectorDownLeft)
                        {
                            result = DirectionsEnum.DIRECTION_SOUTH_WEST;
                        }
                        else
                        {
                            if (left == MapPoint.VectorLeft)
                            {
                                result = DirectionsEnum.DIRECTION_WEST;
                            }
                            else
                            {
                                if (left == MapPoint.VectorUpLeft)
                                {
                                    result = DirectionsEnum.DIRECTION_NORTH_WEST;
                                }
                                else
                                {
                                    if (left == MapPoint.VectorUp)
                                    {
                                        result = DirectionsEnum.DIRECTION_NORTH;
                                    }
                                    else
                                    {
                                        if (left == MapPoint.VectorUpRight)
                                        {
                                            result = DirectionsEnum.DIRECTION_NORTH_EAST;
                                        }
                                        else
                                        {
                                            result = DirectionsEnum.DIRECTION_EAST;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(result);
        }
Beispiel #5
0
 public bool IsAdjacentTo(MapPoint point)
 {
     return(this.DistanceToCell(point) == 1u);
 }
Beispiel #6
0
 public uint DistanceToCell(MapPoint point)
 {
     return((uint)(System.Math.Abs(this.m_x - point.X) + System.Math.Abs(this.m_y - point.Y)));
 }
Beispiel #7
0
 public uint DistanceTo(MapPoint point)
 {
     return((uint)System.Math.Sqrt((double)((point.X - this.m_x) * (point.X - this.m_x) + (point.Y - this.m_y) * (point.Y - this.m_y))));
 }