2015-04-19 109 views
2

我试图将Gauss-Bonnet定理应用于我的C++ OpenGL应用程序,并计算我网格中相邻三角形Fi中顶点Vi处的内角的值。计算角度/曲率?

我没有做这个职位之前一些搜索,我知道,对于一个2D模型做到这一点,我们可以使用下面的函数来获取角度:

void angles(double points[][2], double angles[], int npoints){ 
for(int i = 0; i < npoints; i++){ 
    int last = (i - 1 + npoints) % npoints; 
    int next = (i + 1) % npoints; 
    double x1 = points[i][0] - points[last][0]; 
    double y1 = points[i][1] - points[last][1]; 
    double x2 = points[next][0] - points[i][0]; 
    double y2 = points[next][1] - points[i][1]; 
    double theta1 = atan2(y1, x1)*180/3.1415926358979323; 
    double theta2 = atan2(y2, x2)*180/3.1415926358979323; 
    angles[i] = (180 + theta1 - theta2 + 360); 
    while(angles[i]>360)angles[i]-=360; 
} } 

但我怎么能找到角度3D网格(x,y和z)顶点?

回答

0

3D中的类似概念被称为高斯曲率。情况要比2D复杂得多,并且没有单一的好方法来计算或估计网格的高斯曲率。有一个survey paper,可能会给你一些想法。