Logo ROOT   6.08/07
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 #ifndef ROOT_TShape
21 #include "TShape.h"
22 #endif
23 
24 class TXTRU : public TShape {
25 public:
26  TXTRU();
27  TXTRU(const char *name, const char *title, const char *material,
28  Int_t nyx, Int_t nz);
29  TXTRU(const TXTRU &xtru);
30  virtual ~TXTRU();
31  TXTRU& operator=(const TXTRU& rhs);
32 
33  virtual void Copy(TObject &xtru) const;
34  virtual void DefineSection(Int_t secNum, Float_t z, Float_t scale=1.,
35  Float_t x0=0., Float_t y0=0.);
36  virtual void DefineVertex(Int_t pointNum, Float_t x, Float_t y);
37  virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
38  virtual const TBuffer3D &GetBuffer3D(Int_t) const;
39  virtual Int_t GetNxy() const { return fNxy; }
40  virtual Int_t GetNz() const { return fNz; }
41  virtual Float_t GetOutlinePointX(Int_t pointNum) const;
42  virtual Float_t GetOutlinePointY(Int_t pointNum) const;
43  virtual Float_t GetSectionX0(Int_t secNum) const;
44  virtual Float_t GetSectionY0(Int_t secNum) const;
45  virtual Float_t GetSectionScale(Int_t secNum) const;
46  virtual Float_t GetSectionZ(Int_t secNum) const;
47  virtual Float_t *GetXvtx() const {return fXvtx; }
48  virtual Float_t *GetYvtx() const {return fYvtx; }
49  virtual Float_t *GetZ() const {return fZ; }
50  virtual Float_t *GetScale() const {return fScale; }
51  virtual Float_t *GetX0() const {return fX0; }
52  virtual Float_t *GetY0() const {return fY0; }
53  virtual void Print(Option_t *option="") const;
54  virtual void Sizeof3D() const;
55  void SplitConcavePolygon(Bool_t split = kTRUE);
56  virtual void TruncateNxy(Int_t npts);
57  virtual void TruncateNz(Int_t npts);
58 
59 protected:
60  void CheckOrdering();
61  virtual void SetPoints(Double_t *points) const;
62 
63  Int_t fNxy; // number of x-y points in the cross section
64  Int_t fNxyAlloc; // number of x-y points allocated
65  Int_t fNz; // number of z planes
66  Int_t fNzAlloc; // number of z planes allocated
67  Float_t *fXvtx; //[fNxyAlloc] array of x positions
68  Float_t *fYvtx; //[fNxyAlloc] array of y positions
69  Float_t *fZ; //[fNzAlloc] array of z planes
70  Float_t *fScale; //[fNzAlloc] array of scale factors (for each z)
71  Float_t *fX0; //[fNzAlloc] array of x offsets (for each z)
72  Float_t *fY0; //[fNzAlloc] array of y offsets (for each z)
73 
80 
81  EXYChecked fPolygonShape; // CCW vs. CW, convex vs. concave
82  EZChecked fZOrdering; // increasing or decreasing
83 
84  // Concave polygon division (into convex polygons) is not yet supported
85  // but if split one gets correct solid rendering but extra lines
86  // in wire mode; if not split....the converse.
88 
89 private:
90  void DumpPoints(int npoints, float *pointbuff) const;
91  void DumpSegments(int nsegments, int *segbuff) const;
92  void DumpPolygons(int npolygons, int *polybuff, int buffsize) const;
93 
94  ClassDef(TXTRU,1) //TXTRU shape
95 };
96 
97 #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:47
EZChecked fZOrdering
Definition: TXTRU.h:82
float Float_t
Definition: RtypesCore.h:53
const char Option_t
Definition: RtypesCore.h:62
EXYChecked fPolygonShape
Definition: TXTRU.h:81
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:74
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:66
Int_t fNz
Definition: TXTRU.h:65
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:254
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:72
Int_t fNxyAlloc
Definition: TXTRU.h:64
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:48
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:24
This is the base class for all geometry shapes.
Definition: TShape.h:47
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:50
Float_t * fX0
Definition: TXTRU.h:71
Int_t fNxy
Definition: TXTRU.h:63
Float_t * fXvtx
Definition: TXTRU.h:67
virtual Float_t * GetZ() const
Definition: TXTRU.h:49
Generic 3D primitive description class.
Definition: TBuffer3D.h:19
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:68
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:87
Float_t * fScale
Definition: TXTRU.h:70
virtual Int_t GetNz() const
Definition: TXTRU.h:40
const Bool_t kTRUE
Definition: Rtypes.h:91
virtual Float_t * GetY0() const
Definition: TXTRU.h:52
Float_t * fZ
Definition: TXTRU.h:69
virtual Int_t GetNxy() const
Definition: TXTRU.h:39
EZChecked
Definition: TXTRU.h:77
char name[80]
Definition: TGX11.cxx:109
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:51
virtual Float_t GetSectionY0(Int_t secNum) const
Return y0 shift of a z section.
Definition: TXTRU.cxx:387