Open PaperOpt
OpenPaperOpt/RndFiberSeg.h
Go to the documentation of this file.
00001 #ifndef RNDFIBERSEG_H
00002 #define RNDFIBERSEG_H
00003 
00004 #include "V3.h"
00005 #include "V2.h"
00006 #include "FiberStatic.h"
00007 #include "utilities.h"
00008 
00009 using namespace std;
00010 
00016 namespace p3d{
00017 
00018         class RndFiberSeg{
00019                 friend class RndRay;
00020 
00021         private:
00022 
00023                 V3 <double> mBndPos[8];  //Positions              |Upper-left first, then clockwhise in
00024                 V3 <double> mBndNrm[8];  //Vertex normals         |length, Left-upper is last
00025                 V3 <double> mLumPos[8];  //Positions for lumen
00026                 V3 <double> mLumNrm[8];  //Vertex normals for lumen
00027 
00028                 V3 <double> mEdgeNormal; //Normal of edge plane
00029                 double  mEdgeD;      //d in plane eqw of edge
00030 
00031                 V3 <double> mPlnNrm[16]; //Plane normals, upper first (not valid for end capping), pointing outwards
00032                 double  mPlnD[16];   //Plane d:s
00033 
00034                 V3 <double> mInrNrm[16]; //Inner plane normals, upper first (not valid for end capping), pointing outwards
00035                 double  mInrD[16];   //Plane d:s
00036 
00037                 char  mBndDrp[16];  //CDrop boundary, 0-x, 1-y, 2-z
00038                 char  mLmnDrp[16];  //CDrop lumen
00039 
00040                 int   mFlags; //0-Begin, 1-End (set on capping)
00041 
00042                 double mMaxFibDiag; //Largest diagonal inside segment           //TODO: Round upwards!
00043                 double mMaxLumDiag; //Largest diagonal inside lumen of segment
00044                 //NOTE: These are special for end capping, only including local ring!
00045 
00046                 double mLenBnd[8];     //Inverted lengths of outer vectors
00047                 double mLenLum[8];     //Inverted lengths of outer vectors
00048 
00049         public:
00050                 RndFiberSeg() {mFlags=0;}
00051                 ~RndFiberSeg() {}
00052 
00062                 void Set_ROTZ(const FiberSegment* fs,const Fiber* f,int segNo,double shrnk=0.4,double sideX=2.0f/3,double sideY=2.0f/3);
00070                 void CalcFaces(RndFiberSeg* next);
00079                 void CalcNormals(RndFiberSeg* prev,int last=0);
00084                 void SetFlags(int f) {mFlags|=f;}
00085 
00086 
00087                 const V3 <double> *GetPosVec() const {return mBndPos;}
00088         };
00089 }
00090 
00091 #endif