0
$\begingroup$

I am facing problem to convert ellipse standard parameters. Everything I say here is refer to http://en.wikipedia.org/wiki/Ellipse

I know what are the General parametric form parameter . Lets call them $a$,$b$,$\varphi$, $t_X$, $t_Y$

Now I need to find the general polar form parameter. I follow the equation in wikipedia But I may misunderstand what it says.

Here is what I think

$$r_0 = \sqrt{tx^2+ty^2}$$ $$\theta_0 = \tan^{-1} \frac{t_Y}{t_X}$$ and $$ \phi = \varphi$$

I think I am worng, because the output plot was not right. Please help

The following is my MATLAB code, the upper section is the general parametric form, I also draw the ellispe. The lower section is my incorrect general polar form

%==================

close all

            data = [0.6397 0.9520 15.9195 1.1430 -0.3844];

            a = data(1);
            b = data(2);
            ang = data(3);
            tranX = -data(4);
            tranY = -data(5);

            x = zeros(1,3601);
            y = zeros(1,3601);

            counter = 1;

            for t = 0:.1:360
            x(counter) = tranX + a*cosd(t)*cosd(ang) - b*sind(t)*sind(ang);
            y(counter) = tranY + a*cosd(t)*sind(ang) + b*sind(t)*cosd(ang);
            counter=counter+1;
            end

            figure;plot(x,y)

            %=============================================

            r0 = norm([tranX tranY]);
            theta0 = atand(tranY/tranX);
            rho = ang;
            rr  = zeros(1,3601);
            counter = 1;

            for t = 0:.1:360
                P(counter) = r0*[(b*b-a*a)*cosd(t+theta0-2*rho)+(a*a+b*b)*cosd(t-theta0)];
                R(counter) = (b*b-a*a)*cosd(2*t-2*rho)+a*a+b*b;
                Q(counter) = sqrt(2)*a*b*sqrt(R(counter)-2*r0*r0*(sind(t-theta0))^2);
                rr(counter) = (P(counter)+Q(counter))/R(counter);
                counter = counter + 1;
            end

            [XX,YY] = pol2cart((0:.1:360)*2*pi/180,rr);

            figure; plot(XX,YY,'.')
$\endgroup$
  • $\begingroup$ Please, write in $\LaTeX$. You can learn some codes like, ${x}^{2n+1}$ makes ${x}^{2n+1}$, $\sin \theta$ makes $\sin \theta$ and $T_{2n}$ makes $T_{2n}$ $\endgroup$ – Pedro Tamaroff Mar 5 '12 at 21:02
1
$\begingroup$

Problem solved: General parametric form parameter does not require origin inside ellipse, but I think general polar form parameter does because 'Q' in general polar form parameter could be complex number if r0 is large

$\endgroup$
0
$\begingroup$

Maybe $r=\sqrt{t_X^2+t_Y^2}$. Else you got a part of a circle.

(I'm french. I hope you will excuse my english.)

$\endgroup$
  • $\begingroup$ I did it like this, but Peter T.off edit my question and he had a typo $\endgroup$ – Marco Mar 5 '12 at 21:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.