> > I've been reading the list heaps and finding out almost all
> that I need to
> > know at this stage but I have one big problem.
> >
> > I am developing a stack that needs to redraw an ellipse and a
> circular arc
> > that intersects with the ellipse at two points. I thought that the oval
> > graphic was the best tool for the job but how do I find the
> intersection
> > points. The rect of the arc is set and the user sets the rect of the
> > ellipse. I really only need to know the x coordinates so I can
> calculate the
> > arcAngle and the startAngle of the arc.
> >
> > My understanding is that an oval has no real mathematical
> definition so is
> > the oval tool actually an ellipse?

a little meta geometry should help here...
given that im not sure what you mean with elipses and ovals (pretty
ambiguous here)
you can do a lot of precise enough calculations with geometry...
If you draw a rectangle (rect) over that same oval you have an easier view
to "estimate" your points...

the thing is algebra level, and it's easy to find code (borrowed from c or
java anywhere on the net... (all the keywords for the search are in that
previous sentence - will take ya right to it). There's also tons of good
programming books on this subject! im a little tempted to do some too
lately... i'll c what I can find!


draw a circle as a Bezier (or B-spline) curve?
tell whether a point is within a planar polygon?

in sum without code or more
there I found...

How do I draw a circle as a Bezier (or B-spline) curve?
The short answer is, "You can't." Unless you use a rational spline you can
only approximate a circle. The approximation may look acceptable, but it is
sensitive to scale. Magnify the scale and the error of approximation
magnifies. Deviations from circularity that were not visible in the small
can become glaring in the large. If you want to do the job right, consult
the article:
"A Menagerie of Rational B-Spline Circles" by Leslie Piegl and Wayne Tiller
in IEEE Computer Graphics and Applications, volume 9, number 9, September,
1989, pages 48-56.
(www.ieee.org or something like that...)

For rough, non-rational approximations, consult the book:

Computational Geometry for Design and Manufacture by I. D. Faux and M. J.
Pratt, Ellis Horwood Publishers, Halsted Press, John Wiley 1980.

For the best known non-rational approximations, consult the article:

"Good Approximation of Circles by Curvature-continuous Bezier Curves" by Tor
Dokken, Morten Daehlen, Tom Lyche, and Knut Morken in Computer Aided
Geometric Design, volume 7, numbers 1-4 (combined), June, 1990, pages 33-41
[Elsevier Science Publishers (North-Holland)]

How do I tell whether a point is within a planar polygon?
Consider a ray originating at the point of interest and continuing to
infinity. If it crosses an odd number of polygon edges along the way, the
point is within the polygon. If the ray crosses an even number of edges, the
point is either outside the polygon, or within an interior hole formed from
intersecting polygon edges. This idea is known in the trade as the Jordan
curve theorem; see Eric Haines' article in Glassner's ray tracing book
(above) for more information, including treatment of special cases.
Another method is to sum the absolute angles from the point to all the
vertices on the polygon. If the sum is 2 pi, the point is inside, if the sum
is 0 the point is outside. However, this method is about an order of
magnitude slower than the previous method because evaluating the
trigonometric functions is usually quite costly.

www.ddj.com might have some nice algorythms too!!! almost forgot my bible!

Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.

Reply via email to