00001
00002
00003 #ifndef __BV_DIST_ROT_H
00004 #define __BV_DIST_ROT_H
00005
00006 #include <esg/geometry/includes.h>
00007 #include <esg/spacesorting/DistRot.h>
00008
00009 #include <esg/Export>
00010
00011
00012
00013
00014
00015
00016 namespace esg {
00017
00018 class OGSCENE_EXPORT BVDistRot : public DistRot {
00019 protected:
00020 Geometry * _pTwin;
00021
00022 public:
00023 BVDistRot (const Geometry& g,
00024 const Matrix4& multi,
00025 double sr = 1.0)
00026 : DistRot(sr)
00027 {
00028 _pTwin = (Geometry*) g.clone(&multi);
00029 }
00030
00031 virtual ~BVDistRot () { if (_pTwin) delete _pTwin; }
00032
00033 virtual double distance (Geometry& g ,
00034 double d ,
00035 Vector3* v )
00036 {
00037 if (!_pTwin) return MAXFLOAT;
00038 double dd = g.distance(*_pTwin, v) / _scaleRatio;
00039 return ((dd >= d) ? MAXFLOAT : dd);
00040 }
00041
00042
00043
00044
00045
00046
00047 virtual bool separation (Geometry& g ,
00048 Vector3* v )
00049 {
00050 return ((_pTwin) ? g.separation(*_pTwin, v) : true);
00051 }
00052 };
00053
00054 };
00055
00056 #endif // __BV_DIST_ROT_H