Arbitrary Elliptical Arcs

Started by vojo, September 28, 2012, 02:32:24 PM

0 Members and 1 Guest are viewing this topic.

vojo

I am trying to draw an arbitrary elliptical arc   (use controls to define end points of the arc)

I came upon a curious issue.   Since control points are referenced to X axis, one could have 2 control points where the angles null out (1 control point is 30 deg...other is 330 deg....a wedge opening to the right).  When this happens, the values that would go in the A,B cell "blow up" in that it no longer tracks to the ellipse path.  I have tried a bunch of different approaches, but either result in the values for A (the important one here) either resolve to 0 or 2X the control point length.....2X would be fine except when angles are like 30 deg and 20 deg, the arc blows up way way way too large.  As far as I can tell, subtracting or adding angles gives same results.   I considered the idea of doing this in 2 chunks (2 half size arcs)....still playing with that (in order to make this truly an arbitrary arc...would need to move that midpoint around to bisect the control points.

FYI...I have managed to take the pie shape and turn it into an elliptical pie.....but has only 1 control point to worry about (other point is the base axis).

Thoughts??

wapperdude

Sounds like a fun problem, would you be interested in uploading the shape?

I'm assuming you used standard geometry equations for ellipse, translated into Visio-ese...i.e., uses width/height.  Did you lock the calculation of the WH such that it doesn't change--that'll mess up your angles?  (Only thing that occurs to me off the top of my head.)

Wapperdude
Visio 2019 Pro

vojo

UPDATE:

First problem resolved.   it turns out ATAN2 needs the major/minor axis reversed to give the right angle.   For example, if you have a wide ellipse with a 2:1 ratio, the obvious usage of ATAN2 would be ATAN2(y,2*x)....however, to get the correct angle it actually needs to be ATAN(2*Y,X).   I played with the axis ratio and angle....did not make a difference RE the problem.

So now to next problem.   ANG360, used to set the angles on a full 360 spectrum, works MOST of the time.   When bisecting the 2 angles governed by the control points, if one angle is say 220 deg and the other is 10 deg, bisection needs to be 285 deg but instead ANG360 gives 115 degrees.  I guess I got to put value checks and decide which way to go on the math.