69 if (
n == 0 || !
x || !
y || !z )
return;
72 xmin = *std::min_element(
x,
x+
n);
73 xmax = *std::max_element(
x,
x+
n);
75 ymin = *std::min_element(
y,
y+
n);
76 ymax = *std::max_element(
y,
y+
n);
182 CDT::RemoveDuplicates(
points);
185 "This TGraph2D has duplicated vertices. To remove them call RemoveDuplicates before drawing");
187 CDT::Triangulation<double>
cdt;
189 cdt.eraseSuperTriangle();
204 tri.idx[0] = t.vertices[0];
209 tri.idx[1] = t.vertices[1];
214 tri.idx[2] = t.vertices[2];
221 auto bx = std::minmax({
tri.x[0],
tri.x[1],
tri.x[2]});
222 auto by = std::minmax({
tri.y[0],
tri.y[1],
tri.y[2]});
249 auto bayCoords = [&](
const unsigned int t) -> std::tuple<double, double, double> {
257 return std::make_tuple(
la,
lb, (1 -
la -
lb));
265 auto inTriangle = [](
const std::tuple<double, double, double> &coords) ->
bool {
266 constexpr double eps = -4 * std::numeric_limits<double>::epsilon();
267 return std::get<0>(coords) > eps && std::get<1>(coords) > eps && std::get<2>(coords) > eps;
299void Delaunay2D::DonormalizePoints() {
315 [] (
const Delaunay::Face
face) -> Triangle {
319 auto transform = [&] (const unsigned int i) {
320 tri.x[i] = face.vertex(i)->point().x();
321 tri.y[i] = face.vertex(i)->point().y();
322 tri.idx[i] = face.vertex(i)->info();
335double Delaunay2D::DoInterpolateNormalized(
double xx,
double yy)
347 std::vector<std::pair<Point, Coord_type> > coords;
349 std::back_inserter(coords));
356 Coord_type res = CGAL::linear_interpolation(coords.begin(), coords.end(),
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
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 points
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
double Interpolate(double x, double y)
Return the Interpolated z value corresponding to the given (x,y) point.
const double * fZ
! Pointer to Z array
double fXNmax
! Maximum value of fXN
double fZout
! Height for points lying outside the convex hull
double fOffsetY
! Normalization offset Y
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
Delaunay2D(int n, const double *x, const double *y, const double *z, double xmin=0, double xmax=0, double ymin=0, double ymax=0)
class constructor from array of data points
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
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
const_iterator begin() const
const_iterator end() const
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...