TXTRU.h

Go to the documentation of this file.
00001 //@@(#)root/g3d:$Id: TXTRU.h 27157 2009-01-15 14:05:12Z brun $
00002 // Author: Robert Hatcher (rhatcher@fnal.gov) 2000.09.06
00003 
00004 ////////////////////////////////////////////////////////////////////////////
00005 // $Id: TXTRU.h 27157 2009-01-15 14:05:12Z brun $
00006 //
00007 // TXTRU
00008 //
00009 // TXTRU is an extrusion with fixed outline shape in x-y and a sequence
00010 // of z extents (segments).  The overall scale of the outline scales
00011 // linearly between z points and the center can have an x-y offset.
00012 //
00013 // Author:  R. Hatcher 2000.04.21
00014 //
00015 ////////////////////////////////////////////////////////////////////////////
00016 
00017 #ifndef ROOT_TXTRU
00018 #define ROOT_TXTRU
00019 
00020 #ifndef ROOT_TShape
00021 #include "TShape.h"
00022 #endif
00023 
00024 class TXTRU : public TShape {
00025 public:
00026    TXTRU();
00027    TXTRU(const char *name, const char *title, const char *material,
00028          Int_t nyx, Int_t nz);
00029    TXTRU(const TXTRU &xtru);
00030    virtual ~TXTRU();
00031    TXTRU& operator=(const TXTRU& rhs);
00032 
00033    virtual void     Copy(TObject &xtru) const;
00034    virtual void     DefineSection(Int_t secNum, Float_t z, Float_t scale=1.,
00035                                   Float_t x0=0., Float_t y0=0.);
00036    virtual void     DefineVertex(Int_t pointNum, Float_t x, Float_t y);
00037    virtual Int_t    DistancetoPrimitive(Int_t px, Int_t py);
00038    virtual const    TBuffer3D &GetBuffer3D(Int_t) const;
00039    virtual Int_t    GetNxy() const { return fNxy; }
00040    virtual Int_t    GetNz() const { return fNz; }
00041    virtual Float_t  GetOutlinePointX(Int_t pointNum) const;
00042    virtual Float_t  GetOutlinePointY(Int_t pointNum) const;
00043    virtual Float_t  GetSectionX0(Int_t secNum) const;
00044    virtual Float_t  GetSectionY0(Int_t secNum) const;
00045    virtual Float_t  GetSectionScale(Int_t secNum) const;
00046    virtual Float_t  GetSectionZ(Int_t secNum) const;
00047    virtual Float_t *GetXvtx() const {return fXvtx; }
00048    virtual Float_t *GetYvtx() const {return fYvtx; }
00049    virtual Float_t *GetZ() const {return fZ; }
00050    virtual Float_t *GetScale() const {return fScale; }
00051    virtual Float_t *GetX0() const {return fX0; }
00052    virtual Float_t *GetY0() const {return fY0; }
00053    virtual void     Print(Option_t *option="") const;
00054    virtual void     Sizeof3D() const;
00055    void             SplitConcavePolygon(Bool_t split = kTRUE);
00056    virtual void     TruncateNxy(Int_t npts);
00057    virtual void     TruncateNz(Int_t npts);
00058 
00059 protected:
00060    void            CheckOrdering();
00061    virtual void    SetPoints(Double_t *points) const;
00062 
00063    Int_t       fNxy;       // number of x-y points in the cross section
00064    Int_t       fNxyAlloc;  // number of x-y points allocated
00065    Int_t       fNz;        // number of z planes
00066    Int_t       fNzAlloc;   // number of z planes allocated
00067    Float_t    *fXvtx;      //[fNxyAlloc] array of x positions
00068    Float_t    *fYvtx;      //[fNxyAlloc] array of y positions
00069    Float_t    *fZ;         //[fNzAlloc] array of z planes
00070    Float_t    *fScale;     //[fNzAlloc] array of scale factors (for each z)
00071    Float_t    *fX0;        //[fNzAlloc] array of x offsets (for each z)
00072    Float_t    *fY0;        //[fNzAlloc] array of y offsets (for each z)
00073 
00074    enum EXYChecked {kUncheckedXY, kMalformedXY,
00075                     kConvexCCW,   kConvexCW,
00076                     kConcaveCCW,  kConcaveCW};
00077    enum EZChecked  {kUncheckedZ,  kMalformedZ,
00078                     kConvexIncZ,  kConvexDecZ,
00079                     kConcaveIncZ, kConcaveDecZ};
00080 
00081    EXYChecked  fPolygonShape;   // CCW vs. CW, convex vs. concave
00082    EZChecked   fZOrdering;      // increasing or decreasing
00083 
00084    // Concave polygon division (into convex polygons) is not yet supported
00085    // but if split one gets correct solid rendering but extra lines
00086    // in wire mode; if not split....the converse.
00087    Bool_t      fSplitConcave;
00088 
00089 private:
00090    void DumpPoints(int npoints, float *pointbuff) const;
00091    void DumpSegments(int nsegments, int *segbuff) const;
00092    void DumpPolygons(int npolygons, int *polybuff, int buffsize) const;
00093 
00094    ClassDef(TXTRU,1)  //TXTRU shape
00095 };
00096 
00097 #endif

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