user3326720 user3326720 - 1 year ago 81
Java Question

JavaFX: How to find the x,y of a specific point along a Circle given only the radius and the center x,y position?

In JavaFX, there is the possibility to create a circle shape. This, however, only seems to offer the radius through


Essentially, given a specific point (either in radians or degrees), I want to find the x,y position that correlates with that spot along the circle's perimeter

How would I go about finding it?

Answer Source

Try this simple geometric approach, using awt's Point:

double radius = circle.getRadius();
double angleInRad = getInputAngle();
Point p = new (circleCenterX,circleCentery);
p.translate(Math.sin(angleInRad)*radius, Math.cos(angleInRad)*radius);

Now, you can just print the x,y contents of the Point object.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download