TBuffer3D.h

Go to the documentation of this file.
00001 // @(#)root/base:$Id: TBuffer3D.h,v 1.00 
00002 // Author: Olivier Couet   05/05/04
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TBuffer3D
00013 #define ROOT_TBuffer3D
00014 
00015 //////////////////////////////////////////////////////////////////////////
00016 //                                                                      //
00017 // TBuffer3D                                                            //
00018 //                                                                      //
00019 // Generic 3D primitive description class - see TBuffer3DTypes for      //
00020 // producer classes                                                     //
00021 //////////////////////////////////////////////////////////////////////////
00022 
00023 #ifndef ROOT_TObject
00024 #include "TObject.h"
00025 #endif
00026 
00027 class TBuffer3D : public TObject
00028 {
00029 private:
00030    const Int_t fType;        // Primitive type - predefined ones in TBuffer3DTypes.h
00031                                 
00032    UInt_t    fNbPnts;        // Number of points describing the shape
00033    UInt_t    fNbSegs;        // Number of segments describing the shape
00034    UInt_t    fNbPols;        // Number of polygons describing the shape
00035    
00036    UInt_t    fPntsCapacity;  // Current capacity of fPnts space
00037    UInt_t    fSegsCapacity;  // Current capacity of fSegs space
00038    UInt_t    fPolsCapacity;  // Current capacity of fSegs space
00039       
00040    UInt_t    fSections;      // Section validity flags
00041 
00042    void Init();   
00043 
00044    // Non-copyable class
00045    TBuffer3D(const TBuffer3D &);
00046    const TBuffer3D & operator=(const TBuffer3D &);
00047 
00048    //CS specific
00049    static UInt_t fgCSLevel;
00050    ///////////////////////////////
00051 public:
00052    //CS specific
00053    enum EBoolOpCode {kCSUnion, kCSIntersection, kCSDifference, kCSNoOp};
00054 
00055    static UInt_t GetCSLevel();
00056    static void IncCSLevel();
00057    static UInt_t DecCSLevel();
00058    ///////////////////////////////
00059 
00060    enum ESection { kNone            = BIT(0),
00061                    kCore            = BIT(1),
00062                    kBoundingBox     = BIT(2),
00063                    kShapeSpecific   = BIT(3),
00064                    kRawSizes        = BIT(4), 
00065                    kRaw             = BIT(5),
00066                    kAll             = kCore|kBoundingBox|kShapeSpecific|kRawSizes|kRaw 
00067    };
00068    
00069    TBuffer3D(Int_t type, 
00070              UInt_t reqPnts = 0, UInt_t reqPntsCapacity = 0,
00071              UInt_t reqSegs = 0, UInt_t reqSegsCapacity = 0, 
00072              UInt_t reqPols = 0, UInt_t reqPolsCapacity = 0); 
00073    virtual  ~TBuffer3D();
00074 
00075    // Section validity flags
00076    void   SetSectionsValid(UInt_t mask)     { fSections |= mask & kAll; }
00077    void   ClearSectionsValid();
00078    Bool_t SectionsValid(UInt_t mask) const   { return (Bool_t) (GetSections(mask) == mask); }
00079    UInt_t GetSections(UInt_t mask)   const   { return (UInt_t) (fSections & mask); }
00080       
00081    // Convenience functions
00082    void   SetLocalMasterIdentity();                  // Set fLocalMaster in kCore to identity
00083    void   SetAABoundingBox(const Double_t origin[3], // Set fBBVertex in kBoundingBox to axis aligned BB
00084                            const Double_t halfLengths[3]); 
00085 
00086    // SECTION: kRawSize get/set
00087    Bool_t SetRawSizes(UInt_t reqPnts, UInt_t reqPntsCapacity,
00088                       UInt_t reqSegs, UInt_t reqSegsCapacity, 
00089                       UInt_t reqPols, UInt_t reqPolsCapacity);
00090    
00091    UInt_t NbPnts() const { return fNbPnts; }   
00092    UInt_t NbSegs() const { return fNbSegs; }      
00093    UInt_t NbPols() const { return fNbPols; }  
00094 
00095    // SECTION: kCore
00096    Int_t  Type() const { return fType; }
00097 
00098    TObject    *fID;              // ID/object generating buffer - see TVirtualViewer3D for setting
00099    Int_t       fColor;           // Color index
00100    Short_t     fTransparency;    // Percentage transparency [0,100]
00101    Bool_t      fLocalFrame;      // True = Local, False = Master reference frame
00102    Bool_t      fReflection;      // Matrix is reflection - TODO: REMOVE when OGL viewer rewokred to local frame
00103    Double_t    fLocalMaster[16]; // Local->Master Matrix - identity if master frame
00104 
00105    // SECTION: kBoundingBox
00106    //
00107    // Local frame (fLocalFrame true) axis aligned
00108    // Master frame (fLocalFrame false) orientated
00109    // Could be more compact (2 and 3 verticies respectively) and rest
00110    // calculated as needed - but not worth it
00111    //   7-------6
00112    //  /|      /|
00113    // 3-------2 |
00114    // | 4-----|-5
00115    // |/      |/
00116    // 0-------1 
00117    //
00118    Double_t    fBBVertex[8][3];  // 8 verticies defining bounding box. 
00119 
00120    // SECTION: kShapeSpecific - none for base class
00121 
00122    // SECTION: kRaw
00123    Double_t *fPnts;              // x0, y0, z0, x1, y1, z1, ..... ..... ....
00124    Int_t    *fSegs;              // c0, p0, q0, c1, p1, q1, ..... ..... ....  
00125    Int_t    *fPols;              // c0, n0, s0, s1, ... sn, c1, n1, s0, ... sn
00126 
00127 
00128    // OUTPUT SECTION, filled by viewer as response
00129    mutable UInt_t fPhysicalID;   // Unique replica ID.
00130 
00131 
00132    ClassDef(TBuffer3D,0)     // 3D primitives description
00133 };
00134 
00135 //////////////////////////////////////////////////////////////////////////
00136 //                                                                      //
00137 // TBuffer3DSphere                                                      //
00138 //                                                                      //
00139 // Sphere description class - see TBuffer3DTypes for producer classes   //
00140 // Supports hollow and cut spheres.                                     //
00141 //////////////////////////////////////////////////////////////////////////
00142 
00143 class TBuffer3DSphere : public TBuffer3D
00144 {
00145 private:
00146    // Non-copyable class
00147    TBuffer3DSphere(const TBuffer3DSphere &);
00148    const TBuffer3DSphere & operator=(const TBuffer3DSphere &);
00149    
00150 public:
00151    TBuffer3DSphere(UInt_t reqPnts = 0, UInt_t reqPntsCapacity = 0,
00152                    UInt_t reqSegs = 0, UInt_t reqSegsCapacity = 0, 
00153                    UInt_t reqPols = 0, UInt_t reqPolsCapacity = 0);
00154 
00155    Bool_t IsSolidUncut() const;
00156 
00157    // SECTION: kShapeSpecific
00158    Double_t fRadiusInner;  
00159    Double_t fRadiusOuter;  
00160    Double_t fThetaMin;     // Lower theta limit (orientation?)
00161    Double_t fThetaMax;     // Higher theta limit (orientation?)
00162    Double_t fPhiMin;       // Lower phi limit (orientation?)
00163    Double_t fPhiMax;       // Higher phi limit (orientation?)
00164 };
00165 
00166 //////////////////////////////////////////////////////////////////////////
00167 //                                                                      //
00168 // TBuffer3DTube                                                        //
00169 //                                                                      //
00170 // Complete tube description class - see TBuffer3DTypes for producer    // 
00171 // classes                                                              //
00172 //////////////////////////////////////////////////////////////////////////
00173 
00174 class TBuffer3DTube : public TBuffer3D
00175 {
00176 private:
00177    // Non-copyable class
00178    TBuffer3DTube(const TBuffer3DTube &);
00179    const TBuffer3DTube & operator=(const TBuffer3DTube &);
00180 
00181 protected:
00182    TBuffer3DTube(Int_t type,
00183                  UInt_t reqPnts = 0, UInt_t reqPntsCapacity = 0,
00184                  UInt_t reqSegs = 0, UInt_t reqSegsCapacity = 0, 
00185                  UInt_t reqPols = 0, UInt_t reqPolsCapacity = 0);
00186 
00187 public:
00188    TBuffer3DTube(UInt_t reqPnts = 0, UInt_t reqPntsCapacity = 0,
00189                  UInt_t reqSegs = 0, UInt_t reqSegsCapacity = 0, 
00190                  UInt_t reqPols = 0, UInt_t reqPolsCapacity = 0);
00191 
00192    // SECTION: kShapeSpecific
00193    Double_t fRadiusInner;  // Inner radius
00194    Double_t fRadiusOuter;  // Outer radius
00195    Double_t fHalfLength;   // Half length (dz)           
00196 };
00197 
00198 //////////////////////////////////////////////////////////////////////////
00199 //                                                                      //
00200 // TBuffer3DTubeSeg                                                     //
00201 //                                                                      //
00202 // Tube segment description class - see TBuffer3DTypes for producer     //
00203 // classes                                                              //
00204 //////////////////////////////////////////////////////////////////////////
00205 
00206 class TBuffer3DTubeSeg : public TBuffer3DTube
00207 {
00208 private:
00209    // Non-copyable class
00210    TBuffer3DTubeSeg(const TBuffer3DTubeSeg &);
00211    const TBuffer3DTubeSeg & operator=(const TBuffer3DTubeSeg &);
00212 
00213 protected:
00214    TBuffer3DTubeSeg(Int_t type,
00215                     UInt_t reqPnts = 0, UInt_t reqPntsCapacity = 0,
00216                     UInt_t reqSegs = 0, UInt_t reqSegsCapacity = 0, 
00217                     UInt_t reqPols = 0, UInt_t reqPolsCapacity = 0);
00218 
00219 public:
00220    TBuffer3DTubeSeg(UInt_t reqPnts = 0, UInt_t reqPntsCapacity = 0,
00221                     UInt_t reqSegs = 0, UInt_t reqSegsCapacity = 0, 
00222                     UInt_t reqPols = 0, UInt_t reqPolsCapacity = 0);
00223 
00224    // SECTION: kShapeSpecific
00225    Double_t fPhiMin;       // Lower phi limit
00226    Double_t fPhiMax;       // Higher phi limit
00227 };
00228 
00229 //////////////////////////////////////////////////////////////////////////
00230 //                                                                      //
00231 // TBuffer3DCutTube                                                     //
00232 //                                                                      //
00233 // Cut tube segment description class - see TBuffer3DTypes for producer //
00234 // classes                                                              //
00235 //////////////////////////////////////////////////////////////////////////
00236 
00237 class TBuffer3DCutTube : public TBuffer3DTubeSeg
00238 {
00239 private:
00240    // Non-copyable class
00241    TBuffer3DCutTube(const TBuffer3DTubeSeg &);
00242    const TBuffer3DCutTube & operator=(const TBuffer3DTubeSeg &);
00243 
00244 public:
00245    TBuffer3DCutTube(UInt_t reqPnts = 0, UInt_t reqPntsCapacity = 0,
00246                     UInt_t reqSegs = 0, UInt_t reqSegsCapacity = 0, 
00247                     UInt_t reqPols = 0, UInt_t reqPolsCapacity = 0);
00248 
00249    // SECTION: kShapeSpecific
00250    Double_t fLowPlaneNorm[3];  // Normal to lower cut plane 
00251    Double_t fHighPlaneNorm[3]; // Normal to highet cut plane 
00252 };
00253 
00254 #endif

Generated on Tue Jul 5 14:10:23 2011 for ROOT_528-00b_version by  doxygen 1.5.1