Hi,
I have two points (I am drawing 2 circles) and have to measure the angle between these 2 points - they are connected with a line.
I know that I have to do something like
Math.toDegrees(Math.atan2(x,y))
but I don't know how to exactly implement it.
I thought about doing something like the following:
boolean angleGreaterThan45(Line2D lineBetweenPoints, Point2D pointCenter) {
return pointCenter.Math.toDegrees ( Math.atan2 ( lineBetweenPoints.x, lineBetweenPoints.y ) ) );
}
However this doesn't work...
The 2 points are coded like this:
public Point createStartPoint() {
Random rand = new Random();
startX = rand.nextInt(maxStartX + 1);
startY = rand.nextInt(maxStartY + 1);
return new Point(startX, startY);
}
...and the line between the 2 points like this:
Line2D.Double lineBetweenPoints, = new Line2D.Double(startPoint, endPoint);
Thanks a lot for your help!