Ignore:
Timestamp:
10/26/05 19:18:30 (19 years ago)
Author:
mattausch
Message:

updated ray based subdivision

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/src/X3dExporter.cpp

    r333 r349  
    7272  stream<<"</IndexedLineSet>"<<endl; 
    7373  stream<<"</Shape>"<<endl; 
     74  return true; 
     75} 
     76 
     77bool 
     78X3dExporter::ExportRays(const RayContainer &rays, 
     79                                                const float length, 
     80                                                const RgbColor &color) 
     81{ 
     82  RayContainer::const_iterator ri = rays.begin(); 
     83 
     84  stream<<"<Shape>"<<endl; 
     85  stream<<"<Appearance>"<<endl; 
     86  stream<<"<Material ambientColor=\""<<color.r<<" "<<color.g<<" "<<color.b<< 
     87    "\" />"<<endl; 
     88  stream<<"</Appearance>"<<endl; 
     89   
     90  stream<<"<IndexedLineSet coordIndex=\""<<endl; 
     91 
     92  int index = 0; 
     93  for (; ri != rays.end(); ri++) { 
     94    stream<<index<<" "<<index+1<<" -1\n"; 
     95    index+=2; 
     96  } 
     97   
     98  stream<<"\" >"<<endl; 
     99   
     100  stream<<"<Coordinate  point=\""<<endl; 
     101   
     102  ri = rays.begin(); 
     103  for (; ri != rays.end(); ri++) { 
     104    Vector3 a = (*ri)->GetLoc(); 
     105     
     106    Vector3 b; 
     107    if (length < 0) 
     108      b = (*ri)->GetLoc() - length*(*ri)->GetDir(); 
     109    else 
     110      if ((*ri)->intersections.size()==0) 
     111        b = (*ri)->GetLoc() + length*(*ri)->GetDir(); 
     112      else 
     113        b = (*ri)->Extrap((*ri)->intersections[0].mT); 
     114     
     115    stream<<a.x<<" "<<a.y<<" "<<a.z<<" ,"; 
     116    stream<<b.x<<" "<<b.y<<" "<<b.z<<" ,\n"; 
     117  } 
     118   
     119  stream<<"\" >"<<endl; 
     120  stream<<"</Coordinate>"<<endl; 
     121  stream<<"</IndexedLineSet>"<<endl; 
     122  stream<<"</Shape>"<<endl; 
     123 
    74124  return true; 
    75125} 
     
    668718                                Polygon3 *backPoly = new Polygon3(); 
    669719 
    670                                 if (planePoly->ClassifyPlane(*tData.mPlanes[i]) == Plane3::SPLIT) 
     720                                if (planePoly->ClassifyPlane(*tData.mPlanes[i]) == Polygon3::SPLIT) 
    671721                                { 
    672722                                        planePoly->Split(*tData.mPlanes[i], *frontPoly, *backPoly, splitPts); 
Note: See TracChangeset for help on using the changeset viewer.