programming a spehre
in
Programming Questions
•
3 years ago
could anyone tell me why this isn't working? it's just displaying a half circle.
it's not the whole code (and exactly the right code, but it should be still somehow the same) because this would be too long. Hope you can help me anyway...
- int m1=20, m2=20; // number of steps
float t=PI/m1; // angle 1
float t2=2*PI/m2; // angle 2
float x,y,z; - float xm=10;
- float ym=20;
- float zm=0;
- for(int i=1;i<=m1+1;i++){
for(int j=1;j<=m2+1;j++){
x=xm+r*sin(t*i)*cos(t*j);
y=ym+r*sin(t*i)*sin(t*j);
z=zm+r*cos(t*i); - point(x,y,z);
} - }
1