Elliptical arc formulas conversion

35 Views Asked by At

I need to convert an elliptical arc from this parameterized representation:

  • (x0 y0 rx ry xar laf sf x1 y1), where:

    • x0, y0 are the absolute coordinates of the initial point of the arc.

    • rx, ry are the radii of the ellipse (also known as its semi-major and semi-minor axes);

    • xar is the angle from the x-axis of the current coordinate system to the x-axis of the ellipse;

    • laf is the large arc flag, and is 0 if an arc spanning less than or equal to 180 degrees is chosen, or 1 if an arc spanning greater than 180 degrees is chosen;

    • sf is the sweep flag, and is 0 if the line joining center to arc sweeps through decreasing angles, or 1 if it sweeps through increasing angles.

    • x1, y1 are the absolute coordinates of the final point of the arc.

to this:

  • (cx cy r a0 a1 dir), where:

    • cx, cy is the arc center;

    • r is the arc radius

    • a0, a1 are the angles which the arc is drawn from angle a0 to a1;

    • dir: is the direction of the arc sweep (I believe this one is the same as sf of the formula above).

Can anyone help me define the steps to convert from one representation to the other?

EDIT:

Specifically saying, I need a way to map from this parameters (x0 y0 rx ry xar laf sf x1 y1) to this (cx cy r a0 a1 dir).