예제 #1
0
 public void addPoint(JagPoint p)
 {
     points.Add(p);
 }
예제 #2
0
 public double distanceFrom(JagPoint a)
 {
     return JagPoint.distanceBetween(a,this);
 }
예제 #3
0
 public static double slopeTheta(JagPoint a, JagPoint b)
 {
     return Math.Atan2(b.y - a.y, b.x - a.x);
 }
예제 #4
0
 public static double distanceBetween(JagPoint a, JagPoint b)
 {
     return Math.Sqrt(Math.Pow(a.x-b.x,2)+Math.Pow(a.y-b.y,2));
 }
예제 #5
0
 public Boolean isWithinTheshhold(double threshhold, JagPoint a)
 {
     if (getTargetPoint().distanceFrom(a) < threshhold)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
예제 #6
0
        private void drawPoint(Graphics g, Pen pen, int xCenter, int yCenter, JagPoint p)
        {
            //Draw x,y
            int radius = 5;
            int xPoint = (int)(p.x * mapResolution);
            int yPoint = (int)(p.y * mapResolution);
            g.DrawEllipse(pen, new Rectangle(xCenter + xPoint - radius, yCenter - yPoint - radius, 2 * radius, 2 * radius));

            //Draw theta
            if (p.hasTheta())
            {
                int dy = (int)(3 * radius * Math.Sin(p.theta));
                int dx = (int)(3 * radius * Math.Cos(p.theta));
                g.DrawLine(pen, xCenter + xPoint, yCenter - yPoint, xCenter + xPoint + dx, yCenter - yPoint - dy);
            }
        }