 half sphere

hi, can anyone give some idea how to model half a sphere? I will just have half of it and it will look like a sort of shell…
ok, thanks.

This is more of a Maths-related question. Simply look at how a sphere is drawn and restrict one of the two parameters so that you only get half a sphere. I’ll move your topic in the correct section.

Hello Magnuse,

I’ve written a little opengl function for you, which draws a half sphere (without normals):

/*scalex - scaling of sphere around x-axis
scaley - scaling of sphere around y-axis
*/
void drawHalfSphere(int scaley, int scalex, GLfloat r) {
int i, j;
GLfloat v[scalex*scaley];

for (i=0; i<scalex; ++i) {
for (j=0; j<scaley; ++j) {
v[i*scaley+j]=r*cos(j*2*M_PI/scaley)*cos(i*M_PI/(2*scalex));
v[i*scaley+j]=r*sin(i*M_PI/(2*scalex));
v[i*scaley+j]=r*sin(j*2*M_PI/scaley)*cos(i*M_PI/(2*scalex));
}
}

for (i=0; i<scalex-1; ++i) {
for (j=0; j<scaley; ++j) {
glVertex3fv(v[i*scaley+j]);
glVertex3fv(v[i*scaley+(j+1)%scaley]);
glVertex3fv(v[(i+1)*scaley+(j+1)%scaley]);
glVertex3fv(v[(i+1)*scaley+j]);
}
}
glEnd();
}

You can give as parameters the scaling around the y-axis, the scaling above the x-axis and the radius. I hope it is correct. :rolleyes:

drawHalfSphere(24, 24, 2) would look like Sumpfratte