user3326720 - 7 months ago 46

Java Question

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

`circle#getRadius()`

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

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.

Source (Stackoverflow)