14#ifndef ROOT_Math_Delaunay2D
15#define ROOT_Math_Delaunay2D
35 #pragma push_macro("PTR")
38 #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
39 #include <CGAL/Delaunay_triangulation_2.h>
40 #include <CGAL/Triangulation_vertex_base_with_info_2.h>
41 #include <CGAL/Interpolation_traits_2.h>
42 #include <CGAL/natural_neighbor_coordinates_2.h>
43 #include <CGAL/interpolation_functions.h>
45 #pragma pop_macro("PTR")
172 enum class Initialization :
char {
UNINITIALIZED, INITIALIZING, INITIALIZED};
173 std::atomic<Initialization>
fInit;
185 template<
class Po
intWithInfoMap,
typename ValueType >
186 struct Data_access :
public std::unary_function< typename PointWithInfoMap::key_type,
187 std::pair<ValueType, bool> >
190 Data_access(
const PointWithInfoMap&
points,
const ValueType * values)
191 : _points(
points), _values(values){};
193 std::pair< ValueType, bool>
194 operator()(
const typename PointWithInfoMap::key_type&
p)
const {
195 typename PointWithInfoMap::const_iterator mit = _points.find(
p);
196 if(mit!= _points.end())
197 return std::make_pair(_values[mit->second],
true);
198 return std::make_pair(ValueType(),
false);
201 const PointWithInfoMap& _points;
202 const ValueType * _values;
205 typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
206 typedef CGAL::Triangulation_vertex_base_with_info_2<uint, K> Vb;
207 typedef CGAL::Triangulation_data_structure_2<Vb> Tds;
208 typedef CGAL::Delaunay_triangulation_2<K, Tds> Delaunay;
209 typedef CGAL::Interpolation_traits_2<K> Traits;
210 typedef K::FT Coord_type;
211 typedef K::Point_2 Point;
212 typedef std::map<Point, Vb::Info, K::Less_xy_2> PointWithInfoMap;
213 typedef Data_access< PointWithInfoMap, double > Value_access;
215 Delaunay fCGALdelaunay;
216 PointWithInfoMap fNormalizedPoints;
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t points
TRObject operator()(const T1 &t1) const
Class to generate a Delaunay triangulation of a 2D set of points.
Triangles::const_iterator end() const
double fXNmin
! Minimum value of fXN
double DoInterpolateNormalized(double x, double y)
internal method to compute the interpolation
int CellY(double y) const
Triangles::const_iterator begin() const
Delaunay2D(const Delaunay2D &)
const double * fZ
! Pointer to Z array
double fXNmax
! Maximum value of fXN
void SetZOuterValue(double z=0.)
set z value to be returned for points outside the region
double fZout
! Height for points lying outside the convex hull
Int_t NumberOfTriangles() const
return the number of triangles
double fOffsetY
! Normalization offset Y
Delaunay2D & operator=(const Delaunay2D &)
Int_t fNdt
! Number of Delaunay triangles found
double ZOuterValue() const
return the user defined Z-outer value
Triangles fTriangles
! Triangles of Triangulation
unsigned int Cell(UInt_t x, UInt_t y) const
double Linear_transform(double x, double offset, double factor)
double fYCellStep
! inverse denominator to calculate X cell = fNCells / (fYNmax - fYNmin)
std::vector< double > fYN
! normalized Y
void FindAllTriangles()
Find all triangles.
static const int fNCells
! number of cells to divide the normalized space
std::vector< double > fXN
! normalized X
double fXCellStep
! inverse denominator to calculate X cell = fNCells / (fXNmax - fXNmin)
std::set< UInt_t > fCells[(fNCells+1) *(fNCells+1)]
! grid cells with containing triangles
double fYNmin
! Minimum value of fYN
double fOffsetX
! Normalization offset X
Int_t fNpoints
! Number of data points
std::vector< Triangle > Triangles
Bool_t fInit
! True if FindAllTriangles() has been performed
const double * fY
! Pointer to Y array
void SetInputPoints(int n, const double *x, const double *y, const double *z, double xmin=0, double xmax=0, double ymin=0, double ymax=0)
set the input points for building the graph
const double * fX
! Pointer to X array (managed externally)
void DoNormalizePoints()
internal function to normalize the points
double fYNmax
! Maximum value of fYN
double fScaleFactorY
! Normalization factor Y
double fScaleFactorX
! Normalization factor X
void DoFindTriangles()
internal function to find the triangle use Triangle or CGAL if flag is set
int CellX(double x) const
#define Interpolate(a, x, b, y)
Namespace for new Math classes and functions.
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
static const Int_t UNINITIALIZED