示例#1
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)));
 }
示例#2
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);
        }
示例#3
0
 public bool IsInLine(MapPoint point)
 {
     return(point.X == this.X || point.Y == this.Y);
 }
示例#4
0
 public bool IsAdjacentTo(MapPoint point)
 {
     return(this.DistanceToCell(point) == 1u);
 }
示例#5
0
 public uint DistanceToCell(MapPoint point)
 {
     return((uint)(System.Math.Abs(this.m_x - point.X) + System.Math.Abs(this.m_y - point.Y)));
 }
示例#6
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))));
 }