Thread: Generating an icosphere

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607

    Generating an icosphere

    Does anyone have any links for this? I used to but every time I google this I get stupid Photoshop, Blender, GIMP, or other tutorials for other apps that I could care less about.

    I know I can start with a geometric primitive like a tetrahedron, dodecahedron, cube, etc, and recursively split it to arrive at my sphere but I forget exactly how to do that.

    Code:
    void CIcoSphere::Split(Vertex &Result,Vertex v1,Vertex v2,Vertex v3)
    {
      D3DXVECTOR3 vec1=v1.Pos-v2.Pos;
      D3DXVECTOR3 vec2=v1.Pos-v3.Pos;
    
      D3DXVec3Lerp(&Result.Pos,&vec1,&vec2,0.5f);
    
      D3DXVECTOR2 vecU=v1.TexCoord1-v2.TexCoord1;
      D3DXVECTOR2 vecV=v1.TexCoord1-v3.TexCoord1;
    
      D3DXVec3Lerp(&Result.TexCoord1,&vecU,&vecV,0.5f);
    }
    Something like that maybe?

    I'm abandoning UV spheres in my game engine because texturing them is far too problematic.
    Last edited by VirtualAce; 07-22-2007 at 06:41 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Generating random 2D mountains/terrain
    By Flaug in forum C++ Programming
    Replies: 7
    Last Post: 04-12-2009, 02:49 PM
  2. Doxygen failing
    By Elysia in forum A Brief History of Cprogramming.com
    Replies: 19
    Last Post: 04-16-2008, 01:24 PM
  3. help with generating numbers
    By kurz7 in forum C Programming
    Replies: 8
    Last Post: 08-06-2003, 08:29 AM
  4. Generating a random character/letter, stuck!
    By DanFraser in forum C++ Programming
    Replies: 4
    Last Post: 06-11-2003, 11:30 AM
  5. dynamically generating content from an ASP page:
    By edwardtisdale in forum Windows Programming
    Replies: 0
    Last Post: 11-22-2001, 02:44 PM