Logo ROOT   6.10/09
Reference Guide
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 
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.
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
virtual const TBuffer3D & GetBuffer3D(Int_t) const
Get buffer 3d.
Definition: TXTRU.cxx:768
virtual void Copy(TObject &xtru) const
TXTRU Copy method.
Definition: TXTRU.cxx:213
TXTRU & operator=(const TXTRU &rhs)
Deep assignment operator.
Definition: TXTRU.cxx:190
virtual Float_t GetOutlinePointX(Int_t pointNum) const
Return x coordinate of a vertex point.
Definition: TXTRU.cxx:354
virtual Float_t * GetXvtx() const
Definition: TXTRU.h:45
EZChecked fZOrdering
Definition: TXTRU.h:80
float Float_t
Definition: RtypesCore.h:53
const char Option_t
Definition: RtypesCore.h:62
EXYChecked fPolygonShape
Definition: TXTRU.h:79
virtual void Print(Option_t *option="") const
Dump the info of this TXTRU shape Option:
Definition: TXTRU.cxx:424
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
EXYChecked
Definition: TXTRU.h:72
TXTRU()
TXTRU shape - default constructor.
Definition: TXTRU.cxx:76
virtual void TruncateNz(Int_t npts)
Truncate the z section list.
Definition: TXTRU.cxx:578
Int_t fNzAlloc
Definition: TXTRU.h:64
Int_t fNz
Definition: TXTRU.h:63
virtual Float_t GetOutlinePointY(Int_t pointNum) const
Return y coordinate of a vertex point.
Definition: TXTRU.cxx:365
virtual void Sizeof3D() const
Return total X3D needed by TNode::ls (when called with option "x")
Definition: TXTRU.cxx:535
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:297
void DumpSegments(int nsegments, int *segbuff) const
Dump the segment info for visual inspection.
Definition: TXTRU.cxx:725
virtual Float_t GetSectionX0(Int_t secNum) const
Return x0 shift of a z section.
Definition: TXTRU.cxx:376
Float_t * fY0
Definition: TXTRU.h:70
Int_t fNxyAlloc
Definition: TXTRU.h:62
virtual void SetPoints(Double_t *points) const
Create TXTRU points in buffer order as expected by other methods (counterclockwise xy...
Definition: TXTRU.cxx:499
virtual Float_t * GetYvtx() const
Definition: TXTRU.h:46
void CheckOrdering()
Determine ordering over which to process points, segments, surfaces so that they render correctly...
Definition: TXTRU.cxx:592
virtual ~TXTRU()
TXTRU destructor deallocates arrays.
Definition: TXTRU.cxx:163
point * points
Definition: X3DBuffer.c:20
virtual void DefineSection(Int_t secNum, Float_t z, Float_t scale=1., Float_t x0=0., Float_t y0=0.)
Set z section iz information expand size of array if necessary.
Definition: TXTRU.cxx:250
A poly-extrusion.
Definition: TXTRU.h:22
This is the base class for all geometry shapes.
Definition: TShape.h:35
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute the distance from point px,py to a TXTRU by calculating the closest approach to each corner...
Definition: TXTRU.cxx:345
virtual void TruncateNxy(Int_t npts)
Truncate the vertex list.
Definition: TXTRU.cxx:566
virtual Float_t * GetScale() const
Definition: TXTRU.h:48
Float_t * fX0
Definition: TXTRU.h:69
Int_t fNxy
Definition: TXTRU.h:61
Float_t * fXvtx
Definition: TXTRU.h:65
virtual Float_t * GetZ() const
Definition: TXTRU.h:47
Generic 3D primitive description class.
Definition: TBuffer3D.h:17
virtual Float_t GetSectionZ(Int_t secNum) const
Return z of a z section.
Definition: TXTRU.cxx:409
void DumpPolygons(int npolygons, int *polybuff, int buffsize) const
Dump the derived polygon info for visual inspection.
Definition: TXTRU.cxx:742
double Double_t
Definition: RtypesCore.h:55
Float_t * fYvtx
Definition: TXTRU.h:66
Double_t y[n]
Definition: legend1.C:17
void DumpPoints(int npoints, float *pointbuff) const
Dump the vertex points for visual inspection.
Definition: TXTRU.cxx:708
Mother of all ROOT objects.
Definition: TObject.h:37
virtual void DefineVertex(Int_t pointNum, Float_t x, Float_t y)
Set vertex point ipt to (x,y) expand size of array if necessary.
Definition: TXTRU.cxx:304
you should not use this method at all Int_t Int_t z
Definition: TRolke.cxx:630
void SplitConcavePolygon(Bool_t split=kTRUE)
(Dis)Enable the splitting of concave polygon outlines into multiple convex polygons.
Definition: TXTRU.cxx:550
Bool_t fSplitConcave
Definition: TXTRU.h:85
Float_t * fScale
Definition: TXTRU.h:68
virtual Int_t GetNz() const
Definition: TXTRU.h:38
virtual Float_t * GetY0() const
Definition: TXTRU.h:50
Float_t * fZ
Definition: TXTRU.h:67
const Bool_t kTRUE
Definition: RtypesCore.h:91
virtual Int_t GetNxy() const
Definition: TXTRU.h:37
EZChecked
Definition: TXTRU.h:75
virtual Float_t GetSectionScale(Int_t secNum) const
Return scale factor for a z section.
Definition: TXTRU.cxx:398
virtual Float_t * GetX0() const
Definition: TXTRU.h:49
virtual Float_t GetSectionY0(Int_t secNum) const
Return y0 shift of a z section.
Definition: TXTRU.cxx:387