Jump to content
  • Advertisement

Archived

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

Xeno

creating a 3D sphere

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all!. ok , my story is like that: im trying to build a function that will create 3D sphere vertices. its looks like that: void Objects::CreateHalf3DSphere(D3DVERTEX *D3DSphereVrtx,D3DVECTOR SphereOrigin,float Radius,int Segments,int Levels,bool Up) { D3DVECTOR SVertex; D3DVECTOR n; float phi; float theta; for(theta = -90; theta < 91; theta += 10) { for(phi = 0; phi < 361; phi += 72) { SVertex = D3DVECTOR(cos(phi) * sin(theta), sin(phi), cos(phi) * cos(theta)) * Radius; n = Normalize(SVertex - SphereOrigin); *D3DSphereVrtx++ = D3DVERTEX(SVertex , n ,0.0f,0.0f); } } } now , when i rendering it with POINTLIST its looks like that:

as you can see (its hard to see it ) some points is stafe right , and some to left , and there is places without points at all. somebody know why and what is the problem? thamks a lot! Posted By Xeno. Kobe Bryant - "Just believe in yourself" Visit my web site : VSoft

Share this post


Link to post
Share on other sites
Advertisement
You''ve got the right idea, but you need to use radians, not degrees for the angles.
Replace -90 with -PI/2, 90 with PI/2, and 360 with 2*PI. To make things easy use <= rather than < in the "for" statements.

Share this post


Link to post
Share on other sites
ohhhhhhhhh!!!!
i was so angry about that so i didnt even noticed it
thanks a lot
its seems to work fine now

Posted By Xeno.
Kobe Bryant - "Just believe in yourself"

Visit my web site : VSoft

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!