# Measuring surface area between points

## Homework Statement

I want to calculate the surface area, mapped with points. For starters, I've mapped the edge of a circle with 200 points, then created a few more circles, each with 200 points. The problem is I get different surface areas for the same size circles. The only difference between the circles is the location.

## Homework Equations

The method for mapping the circle with points is:

for i = 1:N+1
X(i,1) = x0 +R *cos(2*pi/N*(i-1));
X(i,2) = y0 +R *sin(2*pi/N*(i-1));
end

where x0 and y0 are coordinates of the circle's center. R is the radius of the circle, N the number of points.

To get the surface of the circle, I've tried the equation S = 1/2 int[ (r×ds)], where r is the vector to the i-th point and ds vector to the i+1-ith point.

## The Attempt at a Solution

This is the loop I wanted to do the work with:

for i = 1:N-1
d = X(i,1) *(X(i+1,2) - X(i,2)) - X(i,2) *(X(i+1,1) - X(i,1));
S = S + 0.5*d;
end

It's basically a vector product between vectors r and ds. X is a 200×2 array of coordinates of points, first row for x coordinates, second row for y coordinates. I get the value of vector ds by doing the difference between the i-th point and the next point.

I will be doing this with shapes other than circles but I need to have it working with circles first. I know this must be caused by some dumb mistake of mine so don't be afraid to tell me.

HallsofIvy
Homework Helper
Yes, the area of a triangle with two sides $\vec{u}$ and $\vec{v}$ is given by $\left|\vec{u}\times\vec{v}\right|$ but your triangles are NOT inside your circle unless the origin is also. That is, you are measuring the area swept out by a line from the origin to points of the figure, not the area of the figure.

Probably the simplest thing to do is to "translate" your figure so the origin is inside it. That is, subtract the components of the center of circle from the corresponding components of the points on the circle.

Equivalently, replace your vector r by r minus the center of the circle.

For a circle, the center is the simplest point to use, but for other figures all you really need is some point inside the figure.

Dick
Homework Helper
The common origin point doesn't HAVE to be inside of the circle. It will work fine if you don't take the absolute values on the cross product. The signs will cancel the overlap between the triangles. I think the real problem is that you are splitting the circle into N triangles but you are only summing over N-1 of them.

Yes, Dick, you are right. I added another line below the loop that took the last and the first line of the array and added it. I knew there's was something stupid on my part. I'm not in my best lately but the work still needs to be done.

Thanks for the help.

Dick
Homework Helper
Yes, Dick, you are right. I added another line below the loop that took the last and the first line of the array and added it. I knew there's was something stupid on my part. I'm not in my best lately but the work still needs to be done.

Thanks for the help.

That's one way to do it. But it looks like you generated N+1 points with the last the same as the first. You could move the endpoint of the loop up to N, right?

No, I divided the circle into 200 sections but the counter for making points only goes to 199 because the 200th point would be the same as the first. I wanted to avoid doing one point twice but now it seems that would make sense.

I need to put every point I create through an equation system that uses NSolve. It would mean making one calculation twice needlessly. If I have 250 circles to mimic motion of that circle, this would mean 250 needless calculations.