I am generating 2D arcs using the following code.
final Arc2D.Double arcPath = new Arc2D.Double();
arcPath.setArcByCenter(centerPoint.getX(), centerPoint.getY(), radius, fDXFArc.getStartAngle(), fDXFArc.getTotalAngle(), Arc2D.OPEN);
The arcs are perfectly rendered on my Canvas but I do not know if they are Clockwise or Counter Clockwise. Can someone share the algorithm to detect the arc's orientation ?
I see two hints for
always counterclockwise
(80% sure):First
java.awt.geom.Arc2D
itself tells in it's class description:This can only be true if
0 degrees
are at12 pm
and degrees measuredclockwise
or3 pm
and degrees measuredcounterclockwise
.Second
public void setAngles()
in the same package measure degreescounterclockwise
:following that it would make sense to follow the same pattern in all functions of that class.
If you need to be sure: Ask the author of that class: