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$>
References: <g1bsct$ggh$> <g1c6l2$b04$> <j2ellm$gt5$> <j2eomo$q1e$> <j2gopq$78p$> <j2hcup$fh9$> <j2ja2d$ebk$> <j2l4p3$cus$> <j2lfef$coo$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1313778009 12412 (19 Aug 2011 18:20:09 GMT)
NNTP-Posting-Date: Fri, 19 Aug 2011 18:20:09 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: comp.soft-sys.matlab:740623

"Rob Comer" <> wrote in message <j2lfef$coo$>...
> 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