我正在为我的分析表面计算表面法线。我得到的正常情况的某些部分是正确的,但不是全部。代码是:
SurfaceVertices3f[pos] = i;
SurfaceVertices3f[pos+1] = j;
SurfaceVertices3f[pos+2] = (cos(i)*sin(j));
/*a and b hold the poutput of partial differentiation of vertices from above three lines.a is wrt i and b is wrt j */
a[0]=1;
a[1]=0;
a[2]=-sin(i)*sin(j);
b[0]=0;
b[1]=1;
b[2]=cos(i)*cos(j);
normal_var=Vec3Df::crossProduct( a, b);
normal_var.normalize();
我的输出看起来像这样,右图是我的,左图是我用作参考。 http://tinypic.com/view.php?pic=73l9co&s=5
谁能告诉我我在做什么错误?