#### Archived

This topic is now archived and is closed to further replies.

# Spheres

This topic is 6428 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I''d like a function that generates a (triangulated)sphere, like in 3d-modeling programs where you say ''Give me a sphere with X-segment or detail level X'' if you know an algo, or a link to info I''d appreciate it. Gyzmo ======================== Having a ''sig''-crisis

##### Share on other sites
it'' simple...
you have to think thata a sphere is like Earth: you can subdivide it in many squares like latitude e longitude.

every square has 4 vertex and 2 triangle that link them.
eache vertex may be opthaind so:

for(i = 0; i < x; i++){
for(j = 0; j < x; j++){
latitude = (6.28 / x * i);
longitude = (3.14 / x * j);
}
}

then every triangle links three vertex, and every for vertex make a square:

vertex[i][j], vertex[i+1][j], vertex[i+1][j+1] vetrex[i][j+1] make a square.

fede

##### Share on other sites
quote:
Original post by federickrex
for(i = 0; i < x; i++){
for(j = 0; j < x; j++){
latitude = (6.28 / x * i);
longitude = (3.14 / x * j);

Thanks, I haven''t tried it, but this WILL give a division by zero, I take it it must be something like

for(i = 1; i <= x; i++){   for(j = 1; j <= x; j++){       latitude = (6.28 / x * i);       longitude = (3.14 / x * j);

am I right?

##### Share on other sites
G''day!

If you''re using DX8, you can use D3DXCreateSphere().

Stay Casual,

Ken
Drunken Hyena

1. 1
Rutin
46
2. 2
3. 3
4. 4
5. 5

• 11
• 9
• 12
• 10
• 13
• ### Forum Statistics

• Total Topics
632988
• Total Posts
3009736
• ### Who's Online (See full list)

There are no registered users currently online

×