I have a 3D surface, (think about the xy plane). The plane can be slanted. (think about a slope road).
Given a list of 3D coordinates that define the surface(Point3D1X
, Point3D1Y
, Point3D1Z
, Point3D12X
, Point3D2Y
, Point3D2Z
, Point3D3X
, Point3D3Y
, Point3D3Z
, and so on), how to calculate the area of the surface?
Note that my question here is analogous to finding area in 2D plane. In 2D plane we have a list of points that defines a polygon, and using this list of points we can find the area of the polygon. Now assuming that all these points have z
values in such a way that they are elevated in 3D to form a surface. My question is how to find the area of that 3D surface?
I upvoted a few answers which I think are correct. But I think the simplest way to do it-- regardless of whether it's in 2D or 3D, is to use the following formula:
area = sum(V(i+1) × V(i))/2;
Where ×
is the vector cross.
The code to do this is:
public double Area(List<Point3D> PtList)
{
int nPts = PtList.Count;
Point3D a;
int j = 0;
for (int i = 0; i < nPts; ++i)
{
j = (i + 1) % nPts;
a += Point3D.Cross(PtList[i], PtList[j]);
}
a /= 2;
return Point3D.Distance(a,default(Point3D));
}
public static Point3D Cross(Point3D v0, Point3D v1)
{
return new Point3D(v0.Y * v1.Z - v0.Z * v1.Y,
v0.Z * v1.X - v0.X * v1.Z,
v0.X * v1.Y - v0.Y * v1.X);
}
Note that the solution doesn't depend on projection to x-plane, which I think is clunky.
What do you think?