Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 ~TXTRU() override;
29 TXTRU& operator=(const TXTRU& rhs);
30
31 void Copy(TObject &xtru) const override;
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 Int_t DistancetoPrimitive(Int_t px, Int_t py) override;
36 const TBuffer3D &GetBuffer3D(Int_t) const override;
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 void Print(Option_t *option="") const override;
52 void Sizeof3D() const override;
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 void SetPoints(Double_t *points) const override;
60
61 Int_t fNxy{0}; // number of x-y points in the cross section
62 Int_t fNxyAlloc{0}; // number of x-y points allocated
63 Int_t fNz{0}; // number of z planes
64 Int_t fNzAlloc{0}; // number of z planes allocated
65 Float_t *fXvtx{nullptr}; //[fNxyAlloc] array of x positions
66 Float_t *fYvtx{nullptr}; //[fNxyAlloc] array of y positions
67 Float_t *fZ{nullptr}; //[fNzAlloc] array of z planes
68 Float_t *fScale{nullptr}; //[fNzAlloc] array of scale factors (for each z)
69 Float_t *fX0{nullptr}; //[fNzAlloc] array of x offsets (for each z)
70 Float_t *fY0{nullptr}; //[fNzAlloc] array of y offsets (for each z)
71
78
79 EXYChecked fPolygonShape{kUncheckedXY}; // CCW vs. CW, convex vs. concave
80 EZChecked fZOrdering{kUncheckedZ}; // 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 ClassDefOverride(TXTRU,1) //TXTRU shape
93};
94
95#endif
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kFALSE
Definition RtypesCore.h:94
double Double_t
Definition RtypesCore.h:59
constexpr Bool_t kTRUE
Definition RtypesCore.h:93
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t points
char name[80]
Definition TGX11.cxx:110
Generic 3D primitive description class.
Definition TBuffer3D.h:18
Mother of all ROOT objects.
Definition TObject.h:41
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:562
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:274
virtual Float_t * GetY0() const
Definition TXTRU.h:50
void SplitConcavePolygon(Bool_t split=kTRUE)
(Dis)Enable the splitting of concave polygon outlines into multiple convex polygons.
Definition TXTRU.cxx:520
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:346
EZChecked fZOrdering
Definition TXTRU.h:80
virtual Float_t * GetYvtx() const
Definition TXTRU.h:46
void DumpSegments(int nsegments, int *segbuff) const
Dump the segment info for visual inspection.
Definition TXTRU.cxx:695
TXTRU & operator=(const TXTRU &rhs)
Deep assignment operator.
Definition TXTRU.cxx:166
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
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Compute the distance from point px,py to a TXTRU by calculating the closest approach to each corner.
Definition TXTRU.cxx:315
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:324
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:368
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:357
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:712
virtual Int_t GetNz() const
Definition TXTRU.h:38
EXYChecked fPolygonShape
Definition TXTRU.h:79
void Copy(TObject &xtru) const override
TXTRU Copy method.
Definition TXTRU.cxx:178
void DumpPoints(int npoints, float *pointbuff) const
Dump the vertex points for visual inspection.
Definition TXTRU.cxx:678
virtual void TruncateNxy(Int_t npts)
Truncate the vertex list.
Definition TXTRU.cxx:536
void Print(Option_t *option="") const override
Dump the info of this TXTRU shape Option:
Definition TXTRU.cxx:394
Int_t fNzAlloc
Definition TXTRU.h:64
virtual Float_t GetSectionZ(Int_t secNum) const
Return z of a z section.
Definition TXTRU.cxx:379
const TBuffer3D & GetBuffer3D(Int_t) const override
Get buffer 3d.
Definition TXTRU.cxx:738
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:220
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
void SetPoints(Double_t *points) const override
Create TXTRU points in buffer order as expected by other methods (counterclockwise xy,...
Definition TXTRU.cxx:469
Int_t fNz
Definition TXTRU.h:63
Float_t * fZ
Definition TXTRU.h:67
void Sizeof3D() const override
Return total X3D needed by TNode::ls (when called with option "x")
Definition TXTRU.cxx:505
TXTRU()
TXTRU shape - default constructor.
Definition TXTRU.cxx:76
~TXTRU() override
TXTRU destructor deallocates arrays.
Definition TXTRU.cxx:139
virtual void TruncateNz(Int_t npts)
Truncate the z section list.
Definition TXTRU.cxx:548
virtual Float_t GetOutlinePointY(Int_t pointNum) const
Return y coordinate of a vertex point.
Definition TXTRU.cxx:335
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17