00001 #include <esg/geometry/Geometry.h> 00002 00003 using namespace esg; 00004 00005 const float Geometry::EPS = 1e-03; 00006 00007 void Geometry::_duplicate_attributes (const Geometry& src) 00008 { 00009 _insideOut = ((Geometry&)src)._insideOut; 00010 } 00011 00012 bool Geometry::randomDirection(const Vector3& pov, 00013 Vector3& dir, 00014 double* pdf) 00015 { 00016 PointEnv pe; 00017 randomSample(ENV_WANT_INTERSECTION, pe, pdf); 00018 if (!(pe.mask|ENV_HAVE_INTERSECTION)) return false; 00019 dir.set(pe.intersection); 00020 dir.sub(pov); 00021 dir.normalize(); 00022 } 00023 00024 Mesh* Geometry::mesh(int density) const 00025 { 00026 Mesh* pMesh = _mesh(density); 00027 if (pMesh && _insideOut) (void) pMesh->turnInsideOut(); 00028 return pMesh; 00029 }