Open PaperOpt
OpenPaperOpt/OrientClipBox.h
Go to the documentation of this file.
00001 #ifndef ORIENTCLIPBOX_H
00002 #define ORIENTCLIPBOX_H
00003 
00004 #include "utilities.h"
00005 #include "RayTag.h"
00006 #include "RndFiberSeg.h"
00007 #include "RndFiber.h"
00008 #include "V3.h"
00009 
00010 
00011 #ifndef MAX_THREADS
00012 #define MAX_THREADS 2
00013 #endif
00014 
00015 namespace p3d{
00016 
00022         class ClipBoxRef {
00023         public:
00024 
00025                 ClipBoxRef(int dX,int dY,int ref,int next):mDx(dX),mDy(dY),mRef(ref),mNext(next) {}
00026 
00027                 int Ref()  const {return mRef;}
00028                 int Next() const {return mNext;}
00029                 int Dx()   const {return mDx;}
00030                 int Dy()   const {return mDy;}
00031 
00032         private:
00033 
00034                 int mDx,mDy; //Displacement from origo to view
00035                 int mRef;    //Index of the refferenced box
00036                 int mNext;   //Index of the next reference in the list
00037         };
00038 
00044         class OrientClipBox {
00045 
00046                 friend class RndRay;
00047 
00048         private:
00049 
00050                 V3  <double>  mNorm[3]; //Normals
00051                 double mD[6];    //Constants in (small,large) order for each normal
00052 
00053                 RayTag mTags[MAX_THREADS];
00054 
00055                 const RndFiberSeg* mBegin;
00056                 const RndFiberSeg* mEnd;
00057                 RndFiber*          mFiber;
00058 
00059         public:
00060 
00061                 OrientClipBox() {mBegin=0;mEnd=0;mFiber=0;}
00062 
00063                 void Init(const RndFiberSeg* begin,const RndFiberSeg* end,RndFiber* f);
00064 
00065                 void GetExtents(V3 <double>& min,V3 <double>& max) const; //Evaluate extents from pointers
00066 
00067                 void Reset() {for (int i=0;i<MAX_THREADS;i++) {mTags[i].Reset();}}
00068         };
00069 }
00070 
00071 #endif