public void addPoint(JagPoint p) { points.Add(p); }
public double distanceFrom(JagPoint a) { return JagPoint.distanceBetween(a,this); }
public static double slopeTheta(JagPoint a, JagPoint b) { return Math.Atan2(b.y - a.y, b.x - a.x); }
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)); }
public Boolean isWithinTheshhold(double threshhold, JagPoint a) { if (getTargetPoint().distanceFrom(a) < threshhold) { return true; } else { return false; } }
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); } }