封闭轮廓的定向区域,由线段曲线组成

问题描述

有一些代码可以确定路径的“方向” - 即顺时针绘制或逆时针绘制。 我无法理解当前段 p1 - p2 的面积是如何计算的:

Ar += (p1.y+p2.y)*(p1.x-p2.x)/2

假设将曲线(段)的坐标转换为坐标x和y,计算积分之和 但由于除以 2 (ab / 2),三角形的面积可以相加。

for (int i = 0;i < m_pCoEdges.GetSize();i++) // passing through an array of elements (segments) that make up a closed contourcfgn
{
m_pCoEdges[i]->GetUVCurve()->GetPointAt(0.0,p1); // for the current segment (contour),its first (starting 0.0) point p1 (end point of segment 1.0) is taken and converted to x and y coordinates
    for (double t = Step;t < 1.0 + Step/2;t+=Step)''' //the second point is taken on the same segment (curve) with a step of Step = 0.01
    {
        m_pCoEdges[i]->GetUVCurve()->GetPointAt(t,p2);//the second point p2 of the same segment is taken and converted to coordinates x and y
        Ar += (p1.y+p2.y)*(p1.x-p2.x)/2; //**calculates the area from p1 to p2. I'm trying to figure out how**
        p1 = p2;
    }
}

问题与代码的变化、向新函数的转换有关,其中没有将曲线上的点转换为 2D 坐标,而是转换为 3D(全局坐标),并且,相应地,使用x,y,z计算轮廓的定向面积。 任何帮助确定用于计算定向面积的方法,并使用点 p1 b p2 的三个坐标进行计数

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)