Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TXTRU.h
Go to the documentation of this file.
1 //@@(#)root/g3d:$Id$
2 // Author: Robert Hatcher (rhatcher@fnal.gov) 2000.09.06
3 
4 ////////////////////////////////////////////////////////////////////////////
5 // $Id$
6 //
7 // TXTRU
8 //
9 // TXTRU is an extrusion with fixed outline shape in x-y and a sequence
10 // of z extents (segments). The overall scale of the outline scales
11 // linearly between z points and the center can have an x-y offset.
12 //
13 // Author: R. Hatcher 2000.04.21
14 //
15 ////////////////////////////////////////////////////////////////////////////
16 
17 #ifndef ROOT_TXTRU
18 #define ROOT_TXTRU
19 
20 #include "TShape.h"
21 
22 class TXTRU : public TShape {
23 public:
24  TXTRU();
25  TXTRU(const char *name, const char *title, const char *material,
26  Int_t nyx, Int_t nz);
27  TXTRU(const TXTRU &xtru);
28  virtual ~TXTRU();
29  TXTRU& operator=(const TXTRU& rhs);
30 
31  virtual void Copy(TObject &xtru) const;
32  virtual void DefineSection(Int_t secNum, Float_t z, Float_t scale=1.,
33  Float_t x0=0., Float_t y0=0.);
34  virtual void DefineVertex(Int_t pointNum, Float_t x, Float_t y);
35  virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
36  virtual const TBuffer3D &GetBuffer3D(Int_t) const;
37  virtual Int_t GetNxy() const { return fNxy; }
38  virtual Int_t GetNz() const { return fNz; }
39  virtual Float_t GetOutlinePointX(Int_t pointNum) const;
40  virtual Float_t GetOutlinePointY(Int_t pointNum) const;
41  virtual Float_t GetSectionX0(Int_t secNum) const;
42  virtual Float_t GetSectionY0(Int_t secNum) const;
43  virtual Float_t GetSectionScale(Int_t secNum) const;
44  virtual Float_t GetSectionZ(Int_t secNum) const;
45  virtual Float_t *GetXvtx() const {return fXvtx; }
46  virtual Float_t *GetYvtx() const {return fYvtx; }
47  virtual Float_t *GetZ() const {return fZ; }
48  virtual Float_t *GetScale() const {return fScale; }
49  virtual Float_t *GetX0() const {return fX0; }
50  virtual Float_t *GetY0() const {return fY0; }
51  virtual void Print(Option_t *option="") const;
52  virtual void Sizeof3D() const;
53  void SplitConcavePolygon(Bool_t split = kTRUE);
54  virtual void TruncateNxy(Int_t npts);
55  virtual void TruncateNz(Int_t npts);
56 
57 protected:
58  void CheckOrdering();
59  virtual void SetPoints(Double_t *points) const;
60 
61  Int_t fNxy; // number of x-y points in the cross section
62  Int_t fNxyAlloc; // number of x-y points allocated
63  Int_t fNz; // number of z planes
64  Int_t fNzAlloc; // number of z planes allocated
65  Float_t *fXvtx; //[fNxyAlloc] array of x positions
66  Float_t *fYvtx; //[fNxyAlloc] array of y positions
67  Float_t *fZ; //[fNzAlloc] array of z planes
68  Float_t *fScale; //[fNzAlloc] array of scale factors (for each z)
69  Float_t *fX0; //[fNzAlloc] array of x offsets (for each z)
70  Float_t *fY0; //[fNzAlloc] array of y offsets (for each z)
71 
72  enum EXYChecked {kUncheckedXY, kMalformedXY,
73  kConvexCCW, kConvexCW,
74  kConcaveCCW, kConcaveCW};
75  enum EZChecked {kUncheckedZ, kMalformedZ,
76  kConvexIncZ, kConvexDecZ,
77  kConcaveIncZ, kConcaveDecZ};
78 
79  EXYChecked fPolygonShape; // CCW vs. CW, convex vs. concave
80  EZChecked fZOrdering; // increasing or decreasing
81 
82  // Concave polygon division (into convex polygons) is not yet supported
83  // but if split one gets correct solid rendering but extra lines
84  // in wire mode; if not split....the converse.
85  Bool_t fSplitConcave;
86 
87 private:
88  void DumpPoints(int npoints, float *pointbuff) const;
89  void DumpSegments(int nsegments, int *segbuff) const;
90  void DumpPolygons(int npolygons, int *polybuff, int buffsize) const;
91 
92  ClassDef(TXTRU,1) //TXTRU shape
93 };
94 
95 #endif