微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

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

有一些代码可以确定路径的“方向” - 即顺时针绘制或逆时针绘制。 我无法理解当前段 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 举报,一经查实,本站将立刻删除。