Logo ROOT   6.16/01
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
22class TXTRU : public TShape {
23public:
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
57protected:
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
87private:
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
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
float Float_t
Definition: RtypesCore.h:53
const Bool_t kTRUE
Definition: RtypesCore.h:87
const char Option_t
Definition: RtypesCore.h:62
#define ClassDef(name, id)
Definition: Rtypes.h:324
point * points
Definition: X3DBuffer.c:22
Generic 3D primitive description class.
Definition: TBuffer3D.h:18
Mother of all ROOT objects.
Definition: TObject.h:37
This is the base class for all geometry shapes.
Definition: TShape.h:35
A poly-extrusion.
Definition: TXTRU.h:22
Float_t * fScale
Definition: TXTRU.h:68
Float_t * fXvtx
Definition: TXTRU.h:65
void CheckOrdering()
Determine ordering over which to process points, segments, surfaces so that they render correctly.
Definition: TXTRU.cxx:592
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
virtual Float_t * GetY0() const
Definition: TXTRU.h:50
virtual const TBuffer3D & GetBuffer3D(Int_t) const
Get buffer 3d.
Definition: TXTRU.cxx:768
void SplitConcavePolygon(Bool_t split=kTRUE)
(Dis)Enable the splitting of concave polygon outlines into multiple convex polygons.
Definition: TXTRU.cxx:550
virtual Float_t * GetX0() const
Definition: TXTRU.h:49
virtual Float_t GetSectionX0(Int_t secNum) const
Return x0 shift of a z section.
Definition: TXTRU.cxx:376
EZChecked fZOrdering
Definition: TXTRU.h:80
virtual Float_t * GetYvtx() const
Definition: TXTRU.h:46
virtual void SetPoints(Double_t *points) const
Create TXTRU points in buffer order as expected by other methods (counterclockwise xy,...
Definition: TXTRU.cxx:499
void DumpSegments(int nsegments, int *segbuff) const
Dump the segment info for visual inspection.
Definition: TXTRU.cxx:725
virtual void Print(Option_t *option="") const
Dump the info of this TXTRU shape Option:
Definition: TXTRU.cxx:424
virtual ~TXTRU()
TXTRU destructor deallocates arrays.
Definition: TXTRU.cxx:163
TXTRU & operator=(const TXTRU &rhs)
Deep assignment operator.
Definition: TXTRU.cxx:190
Float_t * fY0
Definition: TXTRU.h:70
EZChecked
Definition: TXTRU.h:75
@ kConvexDecZ
Definition: TXTRU.h:76
@ kConcaveDecZ
Definition: TXTRU.h:77
@ kMalformedZ
Definition: TXTRU.h:75
@ kConvexIncZ
Definition: TXTRU.h:76
@ kUncheckedZ
Definition: TXTRU.h:75
@ kConcaveIncZ
Definition: TXTRU.h:77
Float_t * fYvtx
Definition: TXTRU.h:66
virtual Float_t GetOutlinePointX(Int_t pointNum) const
Return x coordinate of a vertex point.
Definition: TXTRU.cxx:354
Bool_t fSplitConcave
Definition: TXTRU.h:85
virtual Int_t GetNxy() const
Definition: TXTRU.h:37
virtual Float_t GetSectionScale(Int_t secNum) const
Return scale factor for a z section.
Definition: TXTRU.cxx:398
Int_t fNxyAlloc
Definition: TXTRU.h:62
virtual Float_t GetSectionY0(Int_t secNum) const
Return y0 shift of a z section.
Definition: TXTRU.cxx:387
virtual Float_t * GetXvtx() const
Definition: TXTRU.h:45
void DumpPolygons(int npolygons, int *polybuff, int buffsize) const
Dump the derived polygon info for visual inspection.
Definition: TXTRU.cxx:742
virtual Int_t GetNz() const
Definition: TXTRU.h:38
EXYChecked fPolygonShape
Definition: TXTRU.h:79
void DumpPoints(int npoints, float *pointbuff) const
Dump the vertex points for visual inspection.
Definition: TXTRU.cxx:708
virtual void TruncateNxy(Int_t npts)
Truncate the vertex list.
Definition: TXTRU.cxx:566
virtual void Sizeof3D() const
Return total X3D needed by TNode::ls (when called with option "x")
Definition: TXTRU.cxx:535
Int_t fNzAlloc
Definition: TXTRU.h:64
virtual Float_t GetSectionZ(Int_t secNum) const
Return z of a z section.
Definition: TXTRU.cxx:409
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
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
Int_t fNxy
Definition: TXTRU.h:61
EXYChecked
Definition: TXTRU.h:72
@ kConcaveCW
Definition: TXTRU.h:74
@ kMalformedXY
Definition: TXTRU.h:72
@ kConvexCCW
Definition: TXTRU.h:73
@ kConcaveCCW
Definition: TXTRU.h:74
@ kConvexCW
Definition: TXTRU.h:73
@ kUncheckedXY
Definition: TXTRU.h:72
virtual Float_t * GetScale() const
Definition: TXTRU.h:48
Float_t * fX0
Definition: TXTRU.h:69
virtual Float_t * GetZ() const
Definition: TXTRU.h:47
virtual void Copy(TObject &xtru) const
TXTRU Copy method.
Definition: TXTRU.cxx:213
Int_t fNz
Definition: TXTRU.h:63
Float_t * fZ
Definition: TXTRU.h:67
TXTRU()
TXTRU shape - default constructor.
Definition: TXTRU.cxx:76
virtual void TruncateNz(Int_t npts)
Truncate the z section list.
Definition: TXTRU.cxx:578
virtual Float_t GetOutlinePointY(Int_t pointNum) const
Return y coordinate of a vertex point.
Definition: TXTRU.cxx:365
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17