Ignore:
Timestamp:
04/12/06 08:18:49 (18 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/Mesh.cpp

    r534 r750  
    4949  return box; 
    5050} 
     51 
    5152 
    5253int 
     
    461462  AddFace(new Face(index + 0, index + 1, index + 2, index + 3) ); 
    462463} 
     464 
     465 
     466 
     467Mesh *CreateBox(const AxisAlignedBox3 &box) 
     468{ 
     469        Mesh *mesh = new Mesh; 
     470  // add 8 vertices of the box 
     471  int index = (int)mesh->mVertices.size(); 
     472  for (int i=0; i < 8; i++) { 
     473    Vector3 v; 
     474    box.GetVertex(i, v); 
     475    mesh->mVertices.push_back(v); 
     476  } 
     477   
     478  mesh->AddFace(new Face(index + 0, index + 1, index + 3, index + 2) ); 
     479  mesh->AddFace(new Face(index + 0, index + 2, index + 6, index + 4) ); 
     480  mesh->AddFace(new Face(index + 4, index + 6, index + 7, index + 5) ); 
     481   
     482  mesh->AddFace(new Face(index + 3, index + 1, index + 5, index + 7) ); 
     483  mesh->AddFace(new Face(index + 0, index + 4, index + 5, index + 1) ); 
     484  mesh->AddFace(new Face(index + 2, index + 3, index + 7, index + 6) ); 
     485   
     486  return mesh; 
     487} 
Note: See TracChangeset for help on using the changeset viewer.