Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:12:04

0001 // @(#)root/hist:$Id: TGraphDelaunay.h,v 1.00
0002 // Author: Olivier Couet, Luke Jones (Royal Holloway, University of London)
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TGraphDelaunay
0013 #define ROOT_TGraphDelaunay
0014 
0015 
0016 //////////////////////////////////////////////////////////////////////////
0017 //                                                                      //
0018 // TGraphDelaunay                                                       //
0019 //                                                                      //
0020 // This class uses the Delaunay triangles technique to interpolate and  //
0021 // render the data set.                                                 //
0022 //                                                                      //
0023 //////////////////////////////////////////////////////////////////////////
0024 
0025 #include "TNamed.h"
0026 
0027 class TGraph2D;
0028 class TView;
0029 
0030 class TGraphDelaunay : public TNamed {
0031 
0032 private:
0033 
0034    TGraphDelaunay(const TGraphDelaunay&) = delete;
0035    TGraphDelaunay& operator=(const TGraphDelaunay&) = delete;
0036 
0037 protected:
0038 
0039    Int_t       fNdt;          ///<! Number of Delaunay triangles found
0040    Int_t       fNpoints;      ///<! Number of data points in fGraph2D
0041    Int_t       fNhull;        ///<! Number of points in the hull
0042    Double_t   *fX;            ///<! Pointer to fGraph2D->fX
0043    Double_t   *fY;            ///<! Pointer to fGraph2D->fY
0044    Double_t   *fZ;            ///<! Pointer to fGraph2D->fZ
0045    Double_t   *fXN;           ///<! fGraph2D vectors normalized of size fNpoints
0046    Double_t   *fYN;           ///<! fGraph2D vectors normalized of size fNpoints
0047    Double_t    fXNmin;        ///<! Minimum value of fXN
0048    Double_t    fXNmax;        ///<! Maximum value of fXN
0049    Double_t    fYNmin;        ///<! Minimum value of fYN
0050    Double_t    fYNmax;        ///<! Maximum value of fYN
0051    Double_t    fXoffset;      ///<!
0052    Double_t    fYoffset;      ///<! Parameters used to normalize user data
0053    Double_t    fXScaleFactor; ///<!
0054    Double_t    fYScaleFactor; ///<!
0055    Double_t    fZout;         ///<! Histogram bin height for points lying outside the convex hull
0056    Double_t   *fDist;         ///<! Array used to order mass points by distance
0057    Int_t       fMaxIter;      ///<! Maximum number of iterations to find Delaunay triangles
0058    Int_t       fTriedSize;    ///<! Real size of the fxTried arrays
0059    Int_t      *fPTried;       ///<!
0060    Int_t      *fNTried;       ///<! Delaunay triangles storage of size fNdt
0061    Int_t      *fMTried;       ///<!
0062    Int_t      *fHullPoints;   ///<! Hull points of size fNhull
0063    Int_t      *fOrder;        ///<! Array used to order mass points by distance
0064    Bool_t      fAllTri;       ///<! True if FindAllTriangles() has been performed on fGraph2D
0065    Bool_t      fInit;         ///<! True if CreateTrianglesDataStructure() and FindHull() have been performed
0066    TGraph2D   *fGraph2D;      ///<! 2D graph containing the user data
0067 
0068    void     CreateTrianglesDataStructure();
0069    Bool_t   Enclose(Int_t T1, Int_t T2, Int_t T3, Int_t Ex) const;
0070    void     FileIt(Int_t P, Int_t N, Int_t M);
0071    void     FindHull();
0072    Bool_t   InHull(Int_t E, Int_t X) const;
0073    Double_t InterpolateOnPlane(Int_t TI1, Int_t TI2, Int_t TI3, Int_t E) const;
0074 
0075 public:
0076 
0077    TGraphDelaunay();
0078    TGraphDelaunay(TGraph2D *g);
0079 
0080    ~TGraphDelaunay() override;
0081 
0082    Double_t  ComputeZ(Double_t x, Double_t y);
0083    void      FindAllTriangles();
0084    TGraph2D *GetGraph2D() const {return fGraph2D;}
0085    Double_t  GetMarginBinsContent() const {return fZout;}
0086    Int_t     GetNdt() const {return fNdt;}
0087    Int_t    *GetPTried() const {return fPTried;}
0088    Int_t    *GetNTried() const {return fNTried;}
0089    Int_t    *GetMTried() const {return fMTried;}
0090    Double_t *GetXN() const {return fXN;}
0091    Double_t *GetYN() const {return fYN;}
0092    Double_t  GetXNmin() const {return fXNmin;}
0093    Double_t  GetXNmax() const {return fXNmax;}
0094    Double_t  GetYNmin() const {return fYNmin;}
0095    Double_t  GetYNmax() const {return fYNmax;}
0096    Double_t  Interpolate(Double_t x, Double_t y);
0097    void      SetMaxIter(Int_t n=100000);
0098    void      SetMarginBinsContent(Double_t z=0.);
0099 
0100    ClassDefOverride(TGraphDelaunay,1)  // Delaunay triangulation
0101 };
0102 
0103 #endif