Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Topic: create polygon coordinates
Replies: 5   Last Post: Jan 20, 2013 10:40 AM

 Search Thread: Advanced Search

 Messages: [ Previous | Next ]
 Jessica Posts: 147 Registered: 3/7/08
Re: create polygon coordinates
Posted: Jan 19, 2013 6:50 PM
 Plain Text Reply

"Roger Stafford" wrote in message <kdera0\$71t\$1@newscl01ah.mathworks.com>...
> "Jessica" wrote in message <kdenag\$nth\$1@newscl01ah.mathworks.com>...
> > I have coordinates such as this:
> >
> > 384 360 60 69
> >
> > that represent the left, top, width, and height of an ellipse. How can I turn these values into a list that specifies a polygon?
> >
> > I would like to use this polygon list to find out whether particular X and Y coordinates fall inside this ellipse:
> >
> > k_inside1= inpolygon(X_Coordinate, Y_Coordinate, X_Polygon3, Y_Polygon3);
> >
> > Thanks!

> - - - - - - - - -
> It seems a shame to approximate an ellipse with a polygon to see if points lie inside it, when a direct test with the simple equation of the ellipse would accomplish the same thing with much better accuracy and simplicity.
>
> However, here are n vertices of a polygon approximating an ellipse. Let the ellipse be defined by the equation
>
> (x-x0)^2/a^2 + (y-y0)^2/b^2 = 1
>
> Then the vertices are given by:
>
> t = linspace(0,2*pi,n); % <-- You choose n
> x = a*cos(t)+x0;
> y = b*sin(t)+y0;
>
> Note: The spacing along the polygon is not uniform here. To do that would require the use of elliptic integrals.
>
> Roger Stafford

Thanks for the tip! Do you mind explaining how I could test whether a coordinate falls within an ellipse using just the equation of an ellipse and not converting it to polygon coordinates?

Date Subject Author
1/19/13 Jessica
1/19/13 Roger Stafford
1/19/13 Jessica
1/19/13 Roger Stafford
1/20/13 Roger Stafford
1/20/13 Jessica

© The Math Forum at NCTM 1994-2017. All Rights Reserved.
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}