2015-04-19 103 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,可能會給你一些想法。