获取多面体的表面区域(3D对象) [英] Get the Surface Area of a Polyhedron (3D object)

查看:180
本文介绍了获取多面体的表面区域(3D对象)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个3D表面,(想想xy平面)。飞机可以倾斜。 (想想坡道)。给定一个定义曲面的3D坐标列表( Point3D1X Point3D1Y code>, Point3D1Z Point3D12X Point3D2Y Point3D2Z Point3D3X Point3D3Y Point3D3Z 等等),如何计算曲面的面积?

请注意,这里我的问题类似于找到面积在二维平面。在2D平面中,我们有一个定义多边形的点列表,使用这个点列表可以找到多边形的区域。现在假设所有这些点都以<3DC>来形成表面的方式具有 z 值。我的问题是如何找到3D表面的区域?

解决方案

我upvoted 一些 。但我认为最简单的方法 - 无论是2D还是3D,都是使用以下公式:

  area = sum(V(i + 1)XV(i))/ 2; 

其中 X vector cross



执行此操作的代码是:

  public double Area(List< Point3D> PtList)
{

int nPts = PtList.Count;
Point3D a;
int j = 0; (int i = 0; i {
$ b =(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)
{
返回新的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);
}

请注意,解决方案并不依赖投影到x平面,我认为是笨重的。



您怎么看?

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)XV(i))/2;

Where X 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?

这篇关于获取多面体的表面区域(3D对象)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆