# Compute the area of a oval based 2d geometry

I know that the area of a shape generated as below

$R=r_0+a_1\cos(\theta)+a_2\cos(2\theta)+a_3\cos(3\theta)+...$

Where you can plot it and see the area value in matlab by:

th=0:0.01:2*pi;
R=r0+a1*cos(th)+a2*cos(2*th)+a3*cos(3*th);
x=R.*cos(th);
y=R.*sin(th);
plot(x,y);
Area=polyarea(x,y)


Could be computed by integral: $\frac{1}{2} \int R^2d\theta$

Which is equal to: $\pi{r_0}^2+\frac{1}{2}\pi({a_1}^2+{a_2}^2+{a_2}^2...)$

I am wondering how can I compute the area of a shape generated as below in a similar way analetically:

$R_x=r_0+a_1\cos(\theta)+a_2\cos(2\theta)+a_3\cos(3\theta)+...$ $R_y=r_0+{a_1}'\cos(\theta)+{a_2}'\cos(2\theta)+{a_3}'\cos(3\theta)+...$

Where you can plot it and see the area value in matlab by:

th=0:0.01:2*pi;
Rx=r0+a1*cos(th)+a2*cos(2*th)+a3*cos(3*th);
Ry=r0+a11*cos(th)+a22*cos(2*th)+a33*cos(3*th);
x=Rx.*cos(th);
y=Ry.*sin(th);
plot(x,y);


But what is the analytical expression for the area of the shape? Area=polyarea(x,y)

Use Green's Theorem: If $$\gamma:\quad t\mapsto \bigl(x(t),y(t)\bigr)\qquad(0\leq t\leq T)$$ is a simply closed curve bounding counterclockwise a region $B\subset{\mathbb R}^2$ then $${\rm area}(B)={1\over2}\int_0^T\bigl(x(t)\dot y(t)-y(t)\dot x(t)\bigr)\>dt\ .$$
By the way: If you have a parametric representation of the form $$x(\theta):=R_1(\theta)\cos\theta,\quad y(\theta)=R_2(\theta)\sin\theta\ ,$$ whereby the functions $R_1$, $R_2$ have been chosen independently, the variable $\theta$ no longer is the polar angle of the running point. It is just a parameter variable ("time") used to produce the curve in question.
You can use the formula you already know, by defining: $$R^2=R_x^2\cos^2\theta+R_y^2\sin^2\theta.$$
• In the second example $\theta$ is just "time", not the polar angle. – Christian Blatter Jun 9 '16 at 9:26
• @ChristianBlatter Why do you think so? By looking at the code, I think $\theta$ is just the polar angle, as it is in the first example. – Aretino Jun 9 '16 at 9:32
• Looking at the code now I think the OP has no idea what $\theta$, $R_x$ and $R_y$ are. – Christian Blatter Jun 9 '16 at 9:39
• @ChristianBlatter Actually $\theta$ is polar angle not time, I do not know how you came to that conclusion that it is time! bascially the second example tries to make the possibility that an oval also be generated, but in its special case when Rx=Ry a circle would also come out. The second one is a more general expression of the first one. – Soyol Jun 9 '16 at 17:12