Path: news.mathworks.com!not-for-mail From: <HIDDEN> Newsgroups: comp.soft-sys.matlab Subject: Re: how to find pixels inside ellipse ? Date: Fri, 19 Aug 2011 18:20:09 +0000 (UTC) Organization: The MathWorks, Inc. Lines: 23 Message-ID: <j2m9gp$c3s$1@newscl01ah.mathworks.com> References: <g1bsct$ggh$1@fred.mathworks.com> <g1c6l2$b04$1@fred.mathworks.com> <j2ellm$gt5$1@newscl01ah.mathworks.com> <j2eomo$q1e$1@newscl01ah.mathworks.com> <j2gopq$78p$1@newscl01ah.mathworks.com> <j2hcup$fh9$1@newscl01ah.mathworks.com> <j2ja2d$ebk$1@newscl01ah.mathworks.com> <j2l4p3$cus$1@newscl01ah.mathworks.com> <j2lfef$coo$1@newscl01ah.mathworks.com> Reply-To: <HIDDEN> NNTP-Posting-Host: www-02-blr.mathworks.com Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: newscl01ah.mathworks.com 1313778009 12412 172.30.248.47 (19 Aug 2011 18:20:09 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Fri, 19 Aug 2011 18:20:09 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 1187260 Xref: news.mathworks.com comp.soft-sys.matlab:740623 "Rob Comer" <rob.comer.nospam@mathworks.com> wrote in message <j2lfef$coo$1@newscl01ah.mathworks.com>... > Roger, I agree that this is the case at least figuratively. One does need take into account that the polar angle and parametric angle are not equivalent except when the ellipse is a circle (just as the geocentric and parametric latitudes on an oblate spheroid are not the same). -- Rob > ......... - - - - - - - - - - I am not sure what you mean by "figuratively", Rob. The equivalence is mathematically exact if I understand your method. In your step 2. you say "Determine theta from the computed azimuth and the rotation angle for the ellipse" where theta is the parameter in the equations x = a*cos(theta) y = b*sin(theta) Combining your azimuth angle with the ellipse's rotation angle should give an angle phi between the (geodesic) path and the major axis. To get from angle phi to the parameter theta it is necessary to make a transformation since these are very different quantities: tan(theta) = a/b*y/x = a/b*tan(phi) theta = atan(a/b*tan(phi)) This what I understood you meant to be done in step 2. (If that is not the case then I simply don't understand your step 2.) Then in step 3. you do e = sqrt((a*cos(theta))^2+(b*sin(theta))^2) This is the precise equivalent of the polar coordinate procedure I outlined where r is e. It is not necessary to bring the parameter theta into the computation since the distance can be computed directly from a, b, and phi by the simple formula I gave. The results will be exactly the same. Roger Stafford