Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //@@(#)root/g3d:$Id$
0002 // Author: Robert Hatcher (rhatcher@fnal.gov) 2000.09.06
0003 
0004 ////////////////////////////////////////////////////////////////////////////
0005 // $Id$
0006 //
0007 // TXTRU
0008 //
0009 // TXTRU is an extrusion with fixed outline shape in x-y and a sequence
0010 // of z extents (segments).  The overall scale of the outline scales
0011 // linearly between z points and the center can have an x-y offset.
0012 //
0013 // Author:  R. Hatcher 2000.04.21
0014 //
0015 ////////////////////////////////////////////////////////////////////////////
0016 
0017 #ifndef ROOT_TXTRU
0018 #define ROOT_TXTRU
0019 
0020 #include "TShape.h"
0021 
0022 class TXTRU : public TShape {
0023 public:
0024    TXTRU();
0025    TXTRU(const char *name, const char *title, const char *material,
0026          Int_t nyx, Int_t nz);
0027    TXTRU(const TXTRU &xtru);
0028    ~TXTRU() override;
0029    TXTRU& operator=(const TXTRU& rhs);
0030 
0031    void     Copy(TObject &xtru) const override;
0032    virtual void     DefineSection(Int_t secNum, Float_t z, Float_t scale=1.,
0033                                   Float_t x0=0., Float_t y0=0.);
0034    virtual void     DefineVertex(Int_t pointNum, Float_t x, Float_t y);
0035    Int_t    DistancetoPrimitive(Int_t px, Int_t py) override;
0036    const    TBuffer3D &GetBuffer3D(Int_t) const override;
0037    virtual Int_t    GetNxy() const { return fNxy; }
0038    virtual Int_t    GetNz() const { return fNz; }
0039    virtual Float_t  GetOutlinePointX(Int_t pointNum) const;
0040    virtual Float_t  GetOutlinePointY(Int_t pointNum) const;
0041    virtual Float_t  GetSectionX0(Int_t secNum) const;
0042    virtual Float_t  GetSectionY0(Int_t secNum) const;
0043    virtual Float_t  GetSectionScale(Int_t secNum) const;
0044    virtual Float_t  GetSectionZ(Int_t secNum) const;
0045    virtual Float_t *GetXvtx() const {return fXvtx; }
0046    virtual Float_t *GetYvtx() const {return fYvtx; }
0047    virtual Float_t *GetZ() const {return fZ; }
0048    virtual Float_t *GetScale() const {return fScale; }
0049    virtual Float_t *GetX0() const {return fX0; }
0050    virtual Float_t *GetY0() const {return fY0; }
0051    void     Print(Option_t *option="") const override;
0052    void     Sizeof3D() const override;
0053    void             SplitConcavePolygon(Bool_t split = kTRUE);
0054    virtual void     TruncateNxy(Int_t npts);
0055    virtual void     TruncateNz(Int_t npts);
0056 
0057 protected:
0058    void            CheckOrdering();
0059    void    SetPoints(Double_t *points) const override;
0060 
0061    Int_t       fNxy{0};             // number of x-y points in the cross section
0062    Int_t       fNxyAlloc{0};        // number of x-y points allocated
0063    Int_t       fNz{0};              // number of z planes
0064    Int_t       fNzAlloc{0};         // number of z planes allocated
0065    Float_t    *fXvtx{nullptr};      //[fNxyAlloc] array of x positions
0066    Float_t    *fYvtx{nullptr};      //[fNxyAlloc] array of y positions
0067    Float_t    *fZ{nullptr};         //[fNzAlloc] array of z planes
0068    Float_t    *fScale{nullptr};     //[fNzAlloc] array of scale factors (for each z)
0069    Float_t    *fX0{nullptr};        //[fNzAlloc] array of x offsets (for each z)
0070    Float_t    *fY0{nullptr};        //[fNzAlloc] array of y offsets (for each z)
0071 
0072    enum EXYChecked {kUncheckedXY, kMalformedXY,
0073                     kConvexCCW,   kConvexCW,
0074                     kConcaveCCW,  kConcaveCW};
0075    enum EZChecked  {kUncheckedZ,  kMalformedZ,
0076                     kConvexIncZ,  kConvexDecZ,
0077                     kConcaveIncZ, kConcaveDecZ};
0078 
0079    EXYChecked  fPolygonShape{kUncheckedXY};   // CCW vs. CW, convex vs. concave
0080    EZChecked   fZOrdering{kUncheckedZ};      // increasing or decreasing
0081 
0082    // Concave polygon division (into convex polygons) is not yet supported
0083    // but if split one gets correct solid rendering but extra lines
0084    // in wire mode; if not split....the converse.
0085    Bool_t      fSplitConcave{kFALSE};
0086 
0087 private:
0088    void DumpPoints(int npoints, float *pointbuff) const;
0089    void DumpSegments(int nsegments, int *segbuff) const;
0090    void DumpPolygons(int npolygons, int *polybuff, int buffsize) const;
0091 
0092    ClassDefOverride(TXTRU,1)  //TXTRU shape
0093 };
0094 
0095 #endif