Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TBuffer3D.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/base:$Id: TBuffer3D.h,v 1.00
0002 // Author: Olivier Couet   05/05/04
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TBuffer3D
0013 #define ROOT_TBuffer3D
0014 
0015 #include "TObject.h"
0016 
0017 class TBuffer3D : public TObject
0018 {
0019 private:
0020    const Int_t fType;        // Primitive type - predefined ones in TBuffer3DTypes.h
0021 
0022    UInt_t    fNbPnts;        // Number of points describing the shape
0023    UInt_t    fNbSegs;        // Number of segments describing the shape
0024    UInt_t    fNbPols;        // Number of polygons describing the shape
0025 
0026    UInt_t    fPntsCapacity;  // Current capacity of fPnts space
0027    UInt_t    fSegsCapacity;  // Current capacity of fSegs space
0028    UInt_t    fPolsCapacity;  // Current capacity of fSegs space
0029 
0030    UInt_t    fSections;      // Section validity flags
0031 
0032    void Init();
0033 
0034    // Non-copyable class
0035    TBuffer3D(const TBuffer3D &) = delete;
0036    TBuffer3D & operator=(const TBuffer3D &) = delete;
0037 
0038    //CS specific
0039    static UInt_t fgCSLevel;
0040 
0041 public:
0042    //CS specific
0043    enum EBoolOpCode {kCSUnion, kCSIntersection, kCSDifference, kCSNoOp};
0044 
0045    static UInt_t GetCSLevel();
0046    static void IncCSLevel();
0047    static UInt_t DecCSLevel();
0048 
0049    enum ESection { kNone            = BIT(0),
0050                    kCore            = BIT(1),
0051                    kBoundingBox     = BIT(2),
0052                    kShapeSpecific   = BIT(3),
0053                    kRawSizes        = BIT(4),
0054                    kRaw             = BIT(5),
0055                    kAll             = kCore|kBoundingBox|kShapeSpecific|kRawSizes|kRaw
0056    };
0057 
0058    TBuffer3D(Int_t type,
0059              UInt_t reqPnts = 0, UInt_t reqPntsCapacity = 0,
0060              UInt_t reqSegs = 0, UInt_t reqSegsCapacity = 0,
0061              UInt_t reqPols = 0, UInt_t reqPolsCapacity = 0);
0062    virtual  ~TBuffer3D();
0063 
0064    // Section validity flags
0065    void   SetSectionsValid(UInt_t mask)     { fSections |= mask & kAll; }
0066    void   ClearSectionsValid();
0067    Bool_t SectionsValid(UInt_t mask) const   { return (Bool_t) (GetSections(mask) == mask); }
0068    UInt_t GetSections(UInt_t mask)   const   { return (UInt_t) (fSections & mask); }
0069 
0070    // Convenience functions
0071    void   SetLocalMasterIdentity();                  // Set fLocalMaster in kCore to identity
0072    void   SetAABoundingBox(const Double_t origin[3], // Set fBBVertex in kBoundingBox to axis aligned BB
0073                            const Double_t halfLengths[3]);
0074 
0075    // SECTION: kRawSize get/set
0076    Bool_t SetRawSizes(UInt_t reqPnts, UInt_t reqPntsCapacity,
0077                       UInt_t reqSegs, UInt_t reqSegsCapacity,
0078                       UInt_t reqPols, UInt_t reqPolsCapacity);
0079 
0080    UInt_t NbPnts() const { return fNbPnts; }
0081    UInt_t NbSegs() const { return fNbSegs; }
0082    UInt_t NbPols() const { return fNbPols; }
0083 
0084    // SECTION: kCore
0085    Int_t  Type() const { return fType; }
0086 
0087    TObject    *fID;              // ID/object generating buffer - see TVirtualViewer3D for setting
0088    Int_t       fColor;           // Color index
0089    Short_t     fTransparency;    // Percentage transparency [0,100]
0090    Bool_t      fLocalFrame;      // True = Local, False = Master reference frame
0091    Bool_t      fReflection;      // Matrix is reflection
0092    Bool_t      fScaled;          // The shape is scaled
0093    Double_t    fLocalMaster[16]; // Local->Master Matrix - identity if master frame
0094 
0095    // SECTION: kBoundingBox
0096    //
0097    // Local frame (fLocalFrame true) axis aligned
0098    // Master frame (fLocalFrame false) oriented
0099    // Could be more compact (2 and 3 vertices respectively) and rest
0100    // calculated as needed - but not worth it
0101    //   7-------6
0102    //  /|      /|
0103    // 3-------2 |
0104    // | 4-----|-5
0105    // |/      |/
0106    // 0-------1
0107    //
0108    Double_t    fBBVertex[8][3];  // 8 vertices defining bounding box.
0109 
0110    // SECTION: kShapeSpecific - none for base class
0111 
0112    // SECTION: kRaw
0113    Double_t *fPnts;              // x0, y0, z0, x1, y1, z1, ..... ..... ....
0114    Int_t    *fSegs;              // c0, p0, q0, c1, p1, q1, ..... ..... ....
0115    Int_t    *fPols;              // c0, n0, s0, s1, ... sn, c1, n1, s0, ... sn
0116 
0117 
0118    // OUTPUT SECTION, filled by viewer as response
0119    mutable UInt_t fPhysicalID;   // Unique replica ID.
0120 
0121 
0122    ClassDefOverride(TBuffer3D,0)     // 3D primitives description
0123 };
0124 
0125 /** \class TBuffer3DSphere
0126 Sphere description class - see TBuffer3DTypes for producer classes
0127 Supports hollow and cut spheres.*/
0128 
0129 class TBuffer3DSphere : public TBuffer3D
0130 {
0131 private:
0132    // Non-copyable class
0133    TBuffer3DSphere(const TBuffer3DSphere &) = delete;
0134    TBuffer3DSphere & operator=(const TBuffer3DSphere &) = delete;
0135 
0136 public:
0137    TBuffer3DSphere(UInt_t reqPnts = 0, UInt_t reqPntsCapacity = 0,
0138                    UInt_t reqSegs = 0, UInt_t reqSegsCapacity = 0,
0139                    UInt_t reqPols = 0, UInt_t reqPolsCapacity = 0);
0140 
0141    Bool_t IsSolidUncut() const;
0142 
0143    // SECTION: kShapeSpecific
0144    Double_t fRadiusInner;
0145    Double_t fRadiusOuter;
0146    Double_t fThetaMin;     // Lower theta limit (orientation?)
0147    Double_t fThetaMax;     // Higher theta limit (orientation?)
0148    Double_t fPhiMin;       // Lower phi limit (orientation?)
0149    Double_t fPhiMax;       // Higher phi limit (orientation?)
0150 };
0151 
0152 /** \class TBuffer3DTube
0153 Complete tube description class - see TBuffer3DTypes for producer classes
0154 */
0155 
0156 class TBuffer3DTube : public TBuffer3D
0157 {
0158 private:
0159    // Non-copyable class
0160    TBuffer3DTube(const TBuffer3DTube &) = delete;
0161    TBuffer3DTube & operator=(const TBuffer3DTube &) = delete;
0162 
0163 protected:
0164    TBuffer3DTube(Int_t type,
0165                  UInt_t reqPnts = 0, UInt_t reqPntsCapacity = 0,
0166                  UInt_t reqSegs = 0, UInt_t reqSegsCapacity = 0,
0167                  UInt_t reqPols = 0, UInt_t reqPolsCapacity = 0);
0168 
0169 public:
0170    TBuffer3DTube(UInt_t reqPnts = 0, UInt_t reqPntsCapacity = 0,
0171                  UInt_t reqSegs = 0, UInt_t reqSegsCapacity = 0,
0172                  UInt_t reqPols = 0, UInt_t reqPolsCapacity = 0);
0173 
0174    // SECTION: kShapeSpecific
0175    Double_t fRadiusInner;  // Inner radius
0176    Double_t fRadiusOuter;  // Outer radius
0177    Double_t fHalfLength;   // Half length (dz)
0178 };
0179 
0180 /** \class TBuffer3DTubeSeg
0181 Tube segment description class - see TBuffer3DTypes for producer classes
0182 */
0183 
0184 class TBuffer3DTubeSeg : public TBuffer3DTube
0185 {
0186 private:
0187    // Non-copyable class
0188    TBuffer3DTubeSeg(const TBuffer3DTubeSeg &);
0189    TBuffer3DTubeSeg & operator=(const TBuffer3DTubeSeg &) = delete;
0190 
0191 protected:
0192    TBuffer3DTubeSeg(Int_t type,
0193                     UInt_t reqPnts = 0, UInt_t reqPntsCapacity = 0,
0194                     UInt_t reqSegs = 0, UInt_t reqSegsCapacity = 0,
0195                     UInt_t reqPols = 0, UInt_t reqPolsCapacity = 0);
0196 
0197 public:
0198    TBuffer3DTubeSeg(UInt_t reqPnts = 0, UInt_t reqPntsCapacity = 0,
0199                     UInt_t reqSegs = 0, UInt_t reqSegsCapacity = 0,
0200                     UInt_t reqPols = 0, UInt_t reqPolsCapacity = 0);
0201 
0202    // SECTION: kShapeSpecific
0203    Double_t fPhiMin;       // Lower phi limit
0204    Double_t fPhiMax;       // Higher phi limit
0205 };
0206 
0207 /** \class TBuffer3DCutTube
0208 Cut tube segment description class - see TBuffer3DTypes for producer classes
0209 */
0210 
0211 class TBuffer3DCutTube : public TBuffer3DTubeSeg
0212 {
0213 private:
0214    // Non-copyable class
0215    TBuffer3DCutTube(const TBuffer3DTubeSeg &) = delete;
0216    TBuffer3DCutTube & operator=(const TBuffer3DTubeSeg &) = delete;
0217 
0218 public:
0219    TBuffer3DCutTube(UInt_t reqPnts = 0, UInt_t reqPntsCapacity = 0,
0220                     UInt_t reqSegs = 0, UInt_t reqSegsCapacity = 0,
0221                     UInt_t reqPols = 0, UInt_t reqPolsCapacity = 0);
0222 
0223    // SECTION: kShapeSpecific
0224    Double_t fLowPlaneNorm[3];  // Normal to lower cut plane
0225    Double_t fHighPlaneNorm[3]; // Normal to highest cut plane
0226 };
0227 
0228 #endif