ROOT logo
// @(#)root/hist:$Id: TGraphDelaunay.h,v 1.00
// Author: Olivier Couet, Luke Jones (Royal Holloway, University of London)

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TGraphDelaunay
#define ROOT_TGraphDelaunay


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TGraphDelaunay                                                       //
//                                                                      //
// This class uses the Delaunay triangles technique to interpolate and  //
// render the data set.                                                 //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TNamed
#include "TNamed.h"
#endif

class TGraph2D;
class TView;

class TGraphDelaunay : public TNamed {

private:

   TGraphDelaunay(const TGraphDelaunay&); // Not implemented
   TGraphDelaunay& operator=(const TGraphDelaunay&); // Not implemented

protected:

   Int_t       fNdt;         //!Number of Delaunay triangles found
   Int_t       fNpoints;     //!Number of data points in fGraph2D
   Int_t       fNhull;       //!Number of points in the hull
   Double_t   *fX;           //!Pointer to fGraph2D->fX
   Double_t   *fY;           //!Pointer to fGraph2D->fY
   Double_t   *fZ;           //!Pointer to fGraph2D->fZ
   Double_t   *fXN;          //!fGraph2D vectors normalized of size fNpoints
   Double_t   *fYN;          //!fGraph2D vectors normalized of size fNpoints
   Double_t    fXNmin;       //!Minimum value of fXN
   Double_t    fXNmax;       //!Maximum value of fXN
   Double_t    fYNmin;       //!Minimum value of fYN
   Double_t    fYNmax;       //!Maximum value of fYN
   Double_t    fXoffset;     //!
   Double_t    fYoffset;     //!Parameters used to normalize user data
   Double_t    fXScaleFactor; //!
   Double_t    fYScaleFactor; //!
   Double_t    fZout;        //!Histogram bin height for points lying outside the convex hull
   Double_t   *fDist;        //!Array used to order mass points by distance
   Int_t       fMaxIter;     //!Maximum number of iterations to find Delaunay triangles
   Int_t       fTriedSize;   //!Real size of the fxTried arrays
   Int_t      *fPTried;      //!
   Int_t      *fNTried;      //!Delaunay triangles storage of size fNdt
   Int_t      *fMTried;      //!
   Int_t      *fHullPoints;  //!Hull points of size fNhull
   Int_t      *fOrder;       //!Array used to order mass points by distance
   Bool_t      fAllTri;      //!True if FindAllTriangles() has been performed on fGraph2D
   Bool_t      fInit;        //!True if CreateTrianglesDataStructure() and FindHull() have been performed
   TGraph2D   *fGraph2D;     //!2D graph containing the user data

   void     CreateTrianglesDataStructure();
   Bool_t   Enclose(Int_t T1, Int_t T2, Int_t T3, Int_t Ex) const;
   void     FileIt(Int_t P, Int_t N, Int_t M);
   void     FindHull();
   Bool_t   InHull(Int_t E, Int_t X) const;
   Double_t InterpolateOnPlane(Int_t TI1, Int_t TI2, Int_t TI3, Int_t E) const;

public:

   TGraphDelaunay();
   TGraphDelaunay(TGraph2D *g);

   virtual ~TGraphDelaunay();

   Double_t  ComputeZ(Double_t x, Double_t y);
   void      FindAllTriangles();
   TGraph2D *GetGraph2D() const {return fGraph2D;}
   Double_t  GetMarginBinsContent() const {return fZout;}
   Int_t     GetNdt() const {return fNdt;}
   Int_t    *GetPTried() const {return fPTried;}
   Int_t    *GetNTried() const {return fNTried;}
   Int_t    *GetMTried() const {return fMTried;}
   Double_t *GetXN() const {return fXN;}
   Double_t *GetYN() const {return fYN;}
   Double_t  GetXNmin() const {return fXNmin;}
   Double_t  GetXNmax() const {return fXNmax;}
   Double_t  GetYNmin() const {return fYNmin;}
   Double_t  GetYNmax() const {return fYNmax;}
   Double_t  Interpolate(Double_t x, Double_t y);
   void      SetMaxIter(Int_t n=100000);
   void      SetMarginBinsContent(Double_t z=0.);

   ClassDef(TGraphDelaunay,1)  // Delaunay triangulation
};

#endif
 TGraphDelaunay.h:1
 TGraphDelaunay.h:2
 TGraphDelaunay.h:3
 TGraphDelaunay.h:4
 TGraphDelaunay.h:5
 TGraphDelaunay.h:6
 TGraphDelaunay.h:7
 TGraphDelaunay.h:8
 TGraphDelaunay.h:9
 TGraphDelaunay.h:10
 TGraphDelaunay.h:11
 TGraphDelaunay.h:12
 TGraphDelaunay.h:13
 TGraphDelaunay.h:14
 TGraphDelaunay.h:15
 TGraphDelaunay.h:16
 TGraphDelaunay.h:17
 TGraphDelaunay.h:18
 TGraphDelaunay.h:19
 TGraphDelaunay.h:20
 TGraphDelaunay.h:21
 TGraphDelaunay.h:22
 TGraphDelaunay.h:23
 TGraphDelaunay.h:24
 TGraphDelaunay.h:25
 TGraphDelaunay.h:26
 TGraphDelaunay.h:27
 TGraphDelaunay.h:28
 TGraphDelaunay.h:29
 TGraphDelaunay.h:30
 TGraphDelaunay.h:31
 TGraphDelaunay.h:32
 TGraphDelaunay.h:33
 TGraphDelaunay.h:34
 TGraphDelaunay.h:35
 TGraphDelaunay.h:36
 TGraphDelaunay.h:37
 TGraphDelaunay.h:38
 TGraphDelaunay.h:39
 TGraphDelaunay.h:40
 TGraphDelaunay.h:41
 TGraphDelaunay.h:42
 TGraphDelaunay.h:43
 TGraphDelaunay.h:44
 TGraphDelaunay.h:45
 TGraphDelaunay.h:46
 TGraphDelaunay.h:47
 TGraphDelaunay.h:48
 TGraphDelaunay.h:49
 TGraphDelaunay.h:50
 TGraphDelaunay.h:51
 TGraphDelaunay.h:52
 TGraphDelaunay.h:53
 TGraphDelaunay.h:54
 TGraphDelaunay.h:55
 TGraphDelaunay.h:56
 TGraphDelaunay.h:57
 TGraphDelaunay.h:58
 TGraphDelaunay.h:59
 TGraphDelaunay.h:60
 TGraphDelaunay.h:61
 TGraphDelaunay.h:62
 TGraphDelaunay.h:63
 TGraphDelaunay.h:64
 TGraphDelaunay.h:65
 TGraphDelaunay.h:66
 TGraphDelaunay.h:67
 TGraphDelaunay.h:68
 TGraphDelaunay.h:69
 TGraphDelaunay.h:70
 TGraphDelaunay.h:71
 TGraphDelaunay.h:72
 TGraphDelaunay.h:73
 TGraphDelaunay.h:74
 TGraphDelaunay.h:75
 TGraphDelaunay.h:76
 TGraphDelaunay.h:77
 TGraphDelaunay.h:78
 TGraphDelaunay.h:79
 TGraphDelaunay.h:80
 TGraphDelaunay.h:81
 TGraphDelaunay.h:82
 TGraphDelaunay.h:83
 TGraphDelaunay.h:84
 TGraphDelaunay.h:85
 TGraphDelaunay.h:86
 TGraphDelaunay.h:87
 TGraphDelaunay.h:88
 TGraphDelaunay.h:89
 TGraphDelaunay.h:90
 TGraphDelaunay.h:91
 TGraphDelaunay.h:92
 TGraphDelaunay.h:93
 TGraphDelaunay.h:94
 TGraphDelaunay.h:95
 TGraphDelaunay.h:96
 TGraphDelaunay.h:97
 TGraphDelaunay.h:98
 TGraphDelaunay.h:99
 TGraphDelaunay.h:100
 TGraphDelaunay.h:101
 TGraphDelaunay.h:102
 TGraphDelaunay.h:103
 TGraphDelaunay.h:104
 TGraphDelaunay.h:105