[vox-tech] [OT] Math question: help me make a rainbow
Bill Kendrick
nbs at sonic.net
Tue Mar 31 21:24:05 PDT 2009
On Tue, Mar 31, 2009 at 07:21:36PM -0700, Bill Broadley wrote:
> Some. Not sure what you are getting at though. You want to draw 180 degrees
> of a circle with the end points defined by p1 and p2? What if you want to
> make an upside down rainbow? Or 1/2 of one?
I only want to draw all 180 degress if y1==y2. Otherwise, it'd be
less of the arc. (See my ASCII diagrams)
> In any case the center is trivial. Lets call the center M, so:
> M.x = abs ( p1.x - p2.x ) / 2 + p1.x
> M.y = abs ( p1.y - p2.y ) / 2 + p1.y
Based on my sketches on paper, I know that the center of the circle
is only the midpoint of P1 and P2 when y1==y2. Otherwise, one of the
points is closer.
Constraint-wise, I think a minimum of a 90 degree arc, and perhaps
a minimum radius (if the user clicks and releases very close to the
same place, which happens when kids don't understand to click/drag/release)
would be useful, too.
-bill!
More information about the vox-tech
mailing list