有俩角度 a 是球面点与z轴正方向夹角 另一个是b 是连线在xy这个面的投影与x正轴夹角 R作为球半径
每个点的xyz z很好看出来 就是R*cosa
R*sina得到在xy平面投影 还需要带入b夹角 b [-180=>180],x=R*sina*cosb;
y=R*sina*sinb;
for (a = 0; a <= 180; a += 1)
{
glBegin(GL_LINE_LOOP);
for (b = 0; b <= 360; b += 1)
{
glVertex3f(
R*sin(transradian(a))*cos(transradian(b)),
R*sin(transradian(a))*sin(transradian(b)),
R*cos(transradian(a))
);
glVertex3f(
sin(transradian(a))*cos(transradian(b)),
sin(transradian(a))*sin(transradian(b)),
cos(transradian(a))
);
}
glEnd();
}