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")
231 inline unsigned int Cell(
unsigned int x,
unsigned int y)
const {
246 template<
class Po
intWithInfoMap,
typename ValueType >
247 struct Data_access :
public std::unary_function< typename PointWithInfoMap::key_type,
248 std::pair<ValueType, bool> >
251 Data_access(
const PointWithInfoMap&
points,
const ValueType * values)
252 : _points(
points), _values(values){};
254 std::pair< ValueType, bool>
255 operator()(
const typename PointWithInfoMap::key_type&
p)
const {
256 typename PointWithInfoMap::const_iterator mit = _points.find(
p);
257 if(mit!= _points.end())
258 return std::make_pair(_values[mit->second],
true);
259 return std::make_pair(ValueType(),
false);
262 const PointWithInfoMap& _points;
263 const ValueType * _values;
266 typedef CGAL::Exact_predicates_inexact_constructions_kernel
K;
267 typedef CGAL::Triangulation_vertex_base_with_info_2<uint, K> Vb;
268 typedef CGAL::Triangulation_data_structure_2<Vb> Tds;
269 typedef CGAL::Delaunay_triangulation_2<K, Tds> Delaunay;
270 typedef CGAL::Interpolation_traits_2<K> Traits;
271 typedef K::FT Coord_type;
272 typedef K::Point_2 Point;
273 typedef std::map<Point, Vb::Info, K::Less_xy_2> PointWithInfoMap;
274 typedef Data_access< PointWithInfoMap, double > Value_access;
276 Delaunay fCGALdelaunay;
277 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
int fNpoints
! Number of data points
double fXNmin
! Minimum value of fXN
std::set< unsigned int > fCells[(fNCells+1) *(fNCells+1)]
! grid cells with containing triangles
int fNdt
! Number of Delaunay triangles found
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
double fOffsetY
! Normalization offset Y
Delaunay2D & operator=(const Delaunay2D &)
double ZOuterValue() const
return the user defined Z-outer value
Triangles fTriangles
! Triangles of Triangulation
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
bool fInit
! True if FindAllTriangles() has been performed
unsigned int Cell(unsigned int x, unsigned int y) const
std::vector< double > fXN
! normalized X
double fXCellStep
! inverse denominator to calculate X cell = fNCells / (fXNmax - fXNmin)
double fYNmin
! Minimum value of fYN
double fOffsetX
! Normalization offset X
std::vector< Triangle > Triangles
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
int NumberOfTriangles() const
return the number of triangles
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.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
constexpr Double_t K()
Boltzmann's constant in : .