Logo ROOT   6.08/07
Reference Guide
TGraphDelaunay.h
Go to the documentation of this file.
1 // @(#)root/hist:$Id: TGraphDelaunay.h,v 1.00
2 // Author: Olivier Couet, Luke Jones (Royal Holloway, University of London)
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TGraphDelaunay
13 #define ROOT_TGraphDelaunay
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TGraphDelaunay //
19 // //
20 // This class uses the Delaunay triangles technique to interpolate and //
21 // render the data set. //
22 // //
23 //////////////////////////////////////////////////////////////////////////
24 
25 #ifndef ROOT_TNamed
26 #include "TNamed.h"
27 #endif
28 
29 class TGraph2D;
30 class TView;
31 
32 class TGraphDelaunay : public TNamed {
33 
34 private:
35 
36  TGraphDelaunay(const TGraphDelaunay&); // Not implemented
37  TGraphDelaunay& operator=(const TGraphDelaunay&); // Not implemented
38 
39 protected:
40 
41  Int_t fNdt; //!Number of Delaunay triangles found
42  Int_t fNpoints; //!Number of data points in fGraph2D
43  Int_t fNhull; //!Number of points in the hull
44  Double_t *fX; //!Pointer to fGraph2D->fX
45  Double_t *fY; //!Pointer to fGraph2D->fY
46  Double_t *fZ; //!Pointer to fGraph2D->fZ
47  Double_t *fXN; //!fGraph2D vectors normalized of size fNpoints
48  Double_t *fYN; //!fGraph2D vectors normalized of size fNpoints
49  Double_t fXNmin; //!Minimum value of fXN
50  Double_t fXNmax; //!Maximum value of fXN
51  Double_t fYNmin; //!Minimum value of fYN
52  Double_t fYNmax; //!Maximum value of fYN
54  Double_t fYoffset; //!Parameters used to normalize user data
57  Double_t fZout; //!Histogram bin height for points lying outside the convex hull
58  Double_t *fDist; //!Array used to order mass points by distance
59  Int_t fMaxIter; //!Maximum number of iterations to find Delaunay triangles
60  Int_t fTriedSize; //!Real size of the fxTried arrays
61  Int_t *fPTried; //!
62  Int_t *fNTried; //!Delaunay triangles storage of size fNdt
63  Int_t *fMTried; //!
64  Int_t *fHullPoints; //!Hull points of size fNhull
65  Int_t *fOrder; //!Array used to order mass points by distance
66  Bool_t fAllTri; //!True if FindAllTriangles() has been performed on fGraph2D
67  Bool_t fInit; //!True if CreateTrianglesDataStructure() and FindHull() have been performed
68  TGraph2D *fGraph2D; //!2D graph containing the user data
69 
71  Bool_t Enclose(Int_t T1, Int_t T2, Int_t T3, Int_t Ex) const;
72  void FileIt(Int_t P, Int_t N, Int_t M);
73  void FindHull();
74  Bool_t InHull(Int_t E, Int_t X) const;
75  Double_t InterpolateOnPlane(Int_t TI1, Int_t TI2, Int_t TI3, Int_t E) const;
76 
77 public:
78 
81 
82  virtual ~TGraphDelaunay();
83 
85  void FindAllTriangles();
86  TGraph2D *GetGraph2D() const {return fGraph2D;}
88  Int_t GetNdt() const {return fNdt;}
89  Int_t *GetPTried() const {return fPTried;}
90  Int_t *GetNTried() const {return fNTried;}
91  Int_t *GetMTried() const {return fMTried;}
92  Double_t *GetXN() const {return fXN;}
93  Double_t *GetYN() const {return fYN;}
94  Double_t GetXNmin() const {return fXNmin;}
95  Double_t GetXNmax() const {return fXNmax;}
96  Double_t GetYNmin() const {return fYNmin;}
97  Double_t GetYNmax() const {return fYNmax;}
99  void SetMaxIter(Int_t n=100000);
101 
102  ClassDef(TGraphDelaunay,1) // Delaunay triangulation
103 };
104 
105 #endif
Double_t GetMarginBinsContent() const
Double_t * fZ
Pointer to fGraph2D->fY.
void SetMaxIter(Int_t n=100000)
Defines the number of triangles tested for a Delaunay triangle (number of iterations) before abandoni...
Double_t * fYN
fGraph2D vectors normalized of size fNpoints
Double_t * fX
Number of points in the hull.
Double_t fYNmin
Maximum value of fXN.
#define T3
Definition: md5.inl:147
Int_t * GetNTried() const
See TView3D.
Definition: TView.h:29
Double_t GetXNmin() const
Int_t fNhull
Number of data points in fGraph2D.
#define N
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
Double_t fYNmax
Minimum value of fYN.
Int_t fTriedSize
Maximum number of iterations to find Delaunay triangles.
Int_t * GetPTried() const
Double_t * fDist
Histogram bin height for points lying outside the convex hull.
Double_t * fXN
Pointer to fGraph2D->fZ.
Double_t fXoffset
Maximum value of fYN.
Double_t fYoffset
Bool_t InHull(Int_t E, Int_t X) const
Is point e inside the hull defined by all points apart from x ?
void FileIt(Int_t P, Int_t N, Int_t M)
Files the triangle defined by the 3 vertices p, n and m into the fxTried arrays.
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:254
Double_t ComputeZ(Double_t x, Double_t y)
Return the z value corresponding to the (x,y) point in fGraph2D.
TGraph2D * GetGraph2D() const
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
Double_t fXNmax
Minimum value of fXN.
void SetMarginBinsContent(Double_t z=0.)
Sets the histogram bin height for points lying outside the convex hull ie: the bins in the margin...
TGraphDelaunay()
TGraphDelaunay default constructor.
Int_t * fHullPoints
Int_t GetNdt() const
Double_t fYScaleFactor
Int_t fNpoints
Number of Delaunay triangles found.
TGraphDelaunay & operator=(const TGraphDelaunay &)
Double_t fXScaleFactor
Parameters used to normalize user data.
static double P[]
Int_t * fOrder
Hull points of size fNhull.
Double_t E()
Definition: TMath.h:54
Double_t InterpolateOnPlane(Int_t TI1, Int_t TI2, Int_t TI3, Int_t E) const
Finds the z-value at point e given that it lies on the plane defined by t1,t2,t3. ...
Double_t fXNmin
fGraph2D vectors normalized of size fNpoints
void CreateTrianglesDataStructure()
2D graph containing the user data
Double_t * fY
Pointer to fGraph2D->fX.
Bool_t fInit
True if FindAllTriangles() has been performed on fGraph2D.
Bool_t Enclose(Int_t T1, Int_t T2, Int_t T3, Int_t Ex) const
Is point e inside the triangle t1-t2-t3 ?
double Double_t
Definition: RtypesCore.h:55
#define T2
Definition: md5.inl:146
Double_t y[n]
Definition: legend1.C:17
TGraph2D * fGraph2D
True if CreateTrianglesDataStructure() and FindHull() have been performed.
Bool_t fAllTri
Array used to order mass points by distance.
Int_t * GetMTried() const
you should not use this method at all Int_t Int_t z
Definition: TRolke.cxx:630
Int_t * fPTried
Real size of the fxTried arrays.
Double_t * GetXN() const
#define T1
Definition: md5.inl:145
Int_t * fMTried
Delaunay triangles storage of size fNdt.
Double_t * GetYN() const
void FindAllTriangles()
Attempt to find all the Delaunay triangles of the point set.
Graphics object made of three arrays X, Y and Z with the same number of points each.
Definition: TGraph2D.h:50
virtual ~TGraphDelaunay()
TGraphDelaunay destructor.
Int_t fMaxIter
Array used to order mass points by distance.
Double_t GetXNmax() const
const Int_t n
Definition: legend1.C:16
TGraphDelaunay generates a Delaunay triangulation of a TGraph2D.
void FindHull()
Finds those points which make up the convex hull of the set.
Double_t Interpolate(Double_t x, Double_t y)
Finds the Delaunay triangle that the point (xi,yi) sits in (if any) and calculate a z-value for it by...
Double_t GetYNmin() const
Double_t GetYNmax() const