yoda is hosted by Hepforge, IPPP Durham
YODA - Yet more Objects for Data Analysis 2.1.0
Point.h
Go to the documentation of this file.
1// -*- C++ -*-
2//
3// This file is part of YODA -- Yet more Objects for Data Analysis
4// Copyright (C) 2008-2025 The YODA collaboration (see AUTHORS for details)
5//
6#ifndef YODA_POINT_H
7#define YODA_POINT_H
8
10#include "YODA/Exceptions.h"
11#include "YODA/Transformation.h"
14#include "YODA/Utils/Traits.h"
15#include "YODA/Utils/ndarray.h"
16#include <utility>
17#include <algorithm>
18#include <iostream>
19
20
21namespace YODA {
22
23
25 class Point {
26 public:
27
28 using ValuePair = std::pair<double,double>;
29
30
32 virtual ~Point() {};
33
34
37
39 virtual size_t dim() const = 0;
40
42 virtual double val(size_t i) const = 0;
43
45 virtual void setVal(const size_t i, const double val) = 0;
46
48
49
52
54 //virtual const std::pair<double,double>& errs(size_t i) const = 0;
56 virtual void setErr(const size_t i, const double e) = 0;
57
59 virtual void setErrs(const size_t i, const double eminus, const double eplus) = 0;
60
62 virtual void setErrs(const size_t i, const std::pair<double,double>& e) = 0;
63
65 //virtual double errMinus(size_t i) const = 0;
67 virtual void setErrMinus(const size_t i, const double eminus) = 0;
68
70 //virtual double errPlus(size_t i) const = 0;
72 virtual void setErrPlus(const size_t i, const double eplus) = 0;
73
75 //virtual double errAvg(size_t i) const = 0;
76
77 // /// Get value minus negative error for direction @a i
78 // double min(size_t i) const = 0;
79 // /// Get value plus positive error for direction @a i
80 // double max(size_t i) const = 0;*/
81
83
84
87
89 virtual void set(const size_t i, const double val, const double e) = 0;
90
92 virtual void set(const size_t i, const double val, const double eminus, const double eplus) = 0;
93
95 virtual void set(const size_t i, const double val, const std::pair<double,double>& e) = 0;
96
98
99
102
103 // /// Scaling of direction @a i
104 virtual void scale(const size_t i, const double scale) = 0;
105
106 //template<typename FN>
107 //void scale(size_t i, FN f) = 0;
108
110
111 };
112
113
114
115
116
118 template<size_t N>
119 class PointBase : public Point {
120 protected:
121
122 // Convenient aliases
123 using Pair = std::pair<double,double>;
124 using ValList = std::initializer_list<double>;
125 using PairList = std::initializer_list<Pair>;
126
127 // extract the content type of an array Arr
128 template<typename Arr>
129 using containedType = std::decay_t<decltype(*std::declval<Arr>().begin())>;
130
131 // check if content type of an array Arr is Pair
132 template<typename Arr>
133 using containsPair = typename std::is_same<containedType<Arr>, Pair>;
134
135 // succeeds if T is an iterable container
136 template<typename T>
137 using isIterable = std::enable_if_t<Iterable<T>::value>;
138
139 // succeeds if T is an iterable container and its content type is Pair
140 template<typename T, typename U>
142
143 public:
144
145 // Typedefs
146 using NdVal = typename Utils::ndarray<double, N>;
147 using NdValPair = typename Utils::ndarray<std::pair<double,double>, N>;
148 using DataSize = std::integral_constant<size_t, 3*N>;
149
150
153
154 // @brief Default constructor
156 clear();
157 }
158
159
161 template <typename ValRange = ValList, typename = isIterable<ValRange>>
162 PointBase(ValRange&& val) : _val(std::forward<ValRange>(val)) { }
163
164
166 template <typename ValRange = ValList,
167 typename PairRange = PairList,
168 typename = isIterableWithPair<ValRange,PairRange>>
169 PointBase(ValRange&& val, PairRange&& errs)
170 : _val(std::forward<ValRange>(val)), _errs(std::forward<PairRange>(errs)) { }
171
173 template <typename ValRange = ValList, typename = isIterable<ValRange>>
174 PointBase(ValRange&& val, ValRange&& errs)
175 : _val(std::forward<ValRange>(val)) {
176 if (val.size() != N || errs.size() != N)
177 throw RangeError("Expected " + std::to_string(N) + " dimensions.");
178 size_t i = 0;
179 auto it = std::begin(errs);
180 const auto& itEnd = std::end(errs);
181 for (; it != itEnd; ++it) {
182 _errs[i++] = std::make_pair(*it, *it);
183 }
184 }
185
186
188 template <typename ValRange = ValList, typename = isIterable<ValRange>>
189 PointBase(ValRange&& val, ValRange&& errsdn, ValRange&& errsup)
190 : _val(std::forward<ValRange>(val)) {
191 if (val.size() != N || errsdn.size() != N || errsup.size() != N)
192 throw RangeError("Expected " + std::to_string(N) + " dimensions.");
193 size_t i = 0;
194 auto itdn = std::begin(errsdn);
195 auto itup = std::begin(errsup);
196 const auto& itEnd = std::end(errsdn);
197 for (; itdn != itEnd; ) {
198 _errs[i++] = std::make_pair(*itdn++, *itup++);
199 }
200 }
201
202 PointBase(const PointBase& p) : _val(p._val), _errs(p._errs) { }
203
204 PointBase(PointBase&& p) : _val(std::move(p._val)), _errs(std::move(p._errs)) { }
205
207
209 size_t dim() const { return N; }
210
213
214 void _renderYODA(std::ostream& os, const int width = 13) const noexcept {
215
216 for (size_t i = 0; i < N; ++i) {
217 os << std::setw(width) << std::left << _val[i] << "\t"
218 << std::setw(width) << std::left << _errs[i].first << "\t"
219 << std::setw(width) << std::left << _errs[i].second << "\t";
220 }
221 os << "\n";
222
223 }
224
226
229
231 void clear() {
232 for (size_t i = 0; i < N; ++i) {
233 _val[i] = 0;
234 _errs[i] = {0.,0.};
235 }
236 }
237
240 if (this != &p) {
241 _val = p._val;
242 _errs = p._errs;
243 }
244 return *this;
245 }
246
249 if (this != &p) {
250 _val = std::move(p._val);
251 _errs = std::move(p._errs);
252 }
253 return *this;
254 }
255
257
259
260
261 public:
262
265
267 NdVal& vals() { return _val; }
268
270 const NdVal& vals() const { return _val; }
271
273 double val(size_t i) const {
274 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
275 return _val[i];
276 }
277
279 void setVal(const NdVal& val) {
280 _val = val;
281 }
282
284 void setVal(const size_t i, const double val) {
285 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
286 _val[i] = val;
287 }
288
290
291
294
297 return _errs;
298 }
299
301 const NdValPair& errs() const {
302 return _errs;
303 }
304
306 Pair errs(const size_t i) const {
307 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
308 return _errs[i];
309 }
310
312 double errMinus(const size_t i) const {
313 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
314 return _errs[i].first;
315 }
316
318 double errPlus(const size_t i) const {
319 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
320 return _errs[i].second;
321 }
322
323 // Get the average error along axis @a i
324 double errAvg(const size_t i) const {
325 return 0.5*(errMinus(i) + errPlus(i));
326 }
327
329 double min(const size_t i) const {
330 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
331 return _val[i] - _errs[i].first;
332 }
333
335 double max(const size_t i) const {
336 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
337 return _val[i] + _errs[i].second;
338 }
339
341 void setErr(const size_t i, const double e) {
342 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
343 const double err = fabs(e);
344 _errs[i] = { err, err};
345 }
346
348 void setErrs(const size_t i, const double eminus, const double eplus) {
349 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
350 _errs[i] = { eminus, eplus};
351 }
352
354 void setErrs(const size_t i, const std::pair<double,double>& e) {
355 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
356 _errs[i] = e;
357 }
358
360 void setErrMinus(const size_t i, const double eminus) {
361 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
362 _errs[i].first = eminus;
363 }
364
366 void setErrPlus(const size_t i, const double eplus) {
367 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
368 _errs[i].second = eplus;
369 }
370
372
375
376 void set(const size_t i, const double val, const double e) {
377 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
378 const double err = fabs(e);
379 _val[i] = val;
380 _errs[i] = {err,err};
381 }
382
383 void set(const size_t i, const double val, const double eminus, const double eplus) {
384 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
385 _val[i] = val;
386 _errs[i].first = eminus;
387 _errs[i].second = eplus;
388 }
389
390 void set(const size_t i, const double val, const std::pair<double,double>& e) {
391 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
392 _val[i] = val;
393 _errs[i] = e;
394 }
395
397
400
402 void scaleVal(const size_t i, const double scale) {
403 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
404 _val[i] *= scale;
405 }
406
408 void scaleErr(const size_t i, const double scale) {
409 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
410 _errs[i].first *= scale;
411 _errs[i].second *= scale;
412 }
413
415 void scale(const size_t i, const double scale) {
416 scaleVal(i, scale);
417 scaleErr(i, scale);
418 }
419
421 void scale(const NdVal& scales) {
422 for (size_t i = 0; i < N; ++i) {
423 scale(i, scales[i]);
424 }
425 }
426
428 void scale(const Trf<N>& trf) {
429 trf.transform(_val, _errs);
430 }
431
434 void scale(const size_t i, const Trf<N>& trf) {
435 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
436 trf.transform(_val[i], _errs[i]);
437 }
438 //
439 void transform(const size_t i, const Trf<N>& trf) {
440 scale(i, trf);
441 }
442
444
446
447
448 std::vector<double> _serializeContent() const noexcept {
449 std::vector<double> rtn;
450 rtn.reserve(DataSize::value);
451 rtn.insert(rtn.end(), _val.begin(), _val.end());
452 for (auto err : _errs) {
453 rtn.push_back(std::move(err.first));
454 rtn.push_back(std::move(err.second));
455 }
456 return rtn;
457 }
458
459 void _deserializeContent(const std::vector<double>& data) {
460
461 if (data.size() != DataSize::value)
462 throw UserError("Length of serialized data should be "+std::to_string(DataSize::value)+"!");
463
464 for (size_t i = 0; i < N; ++i) {
465 _val[i] = data[i];
466 _errs[i] = { data[N+i], data[2*N+i] };
467 }
468
469 }
470
471 // @}
472
473 protected:
474
477
478 NdVal _val;
479 NdValPair _errs;
480
482
483 };
484
485
486
489
491 template <size_t N>
492 inline bool operator==(const PointBase<N>& a, const PointBase<N>& b) {
493 // Compare valitions
494 for (size_t i = 0; i < N; ++i) {
495 if ( !fuzzyEquals(a.vals()[i], b.vals()[i]) ) return false;
496 if ( !fuzzyEquals(a.errs()[i].first, b.errs()[i].first)) return false;
497 if ( !fuzzyEquals(a.errs()[i].second, b.errs()[i].second)) return false;
498 }
499 return true;
500 }
501
503 template <size_t N>
504 inline bool operator!=(const PointBase<N>& a, const PointBase<N>& b) {
505 return !(a == b);
506 }
507
508
510 template <size_t N>
511 inline bool operator<(const PointBase<N>& a, const PointBase<N>& b) {
512 #define LT_IF_NOT_EQ(a,b) { if (!fuzzyEquals(a, b)) return a < b; }
513 for (size_t i = 0; i < N; ++i) {
514 LT_IF_NOT_EQ(a.vals()[i], b.vals()[i]);
515 LT_IF_NOT_EQ(a.errs()[i].first, b.errs()[i].first);
516 LT_IF_NOT_EQ(a.errs()[i].second, b.errs()[i].second);
517 }
518 #undef LT_IF_NOT_EQ
519 return false;
520 }
521
523 template <size_t N>
524 inline bool operator<=(const PointBase<N>& a, const PointBase<N>& b) {
525 if (a == b) return true;
526 return a < b;
527 }
528
530 template <size_t N>
531 inline bool operator>(const PointBase<N>& a, const PointBase<N>& b) {
532 return !(a <= b);
533 }
534
536 template <size_t N>
537 inline bool operator>=(const PointBase<N>& a, const PointBase<N>& b) {
538 return !(a < b);
539 }
540
542
543 template <size_t N>
544 class PointND : public PointBase<N> {
545 using BaseT = PointBase<N>;
546 using BaseT::BaseT;
547 };
548
549
550
552 template <>
553 class PointND<1> : public PointBase<1>,
554 public XDirectionMixin<PointND<1>> {
555 public:
556
558 using BaseT::BaseT;
559
562
564 PointND(double x, double ex=0.0)
565 : BaseT({x}, {{ex, ex}}) { }
566
567
569 PointND(double x, double exminus, double explus)
570 : BaseT({x}, {{exminus, explus}}) { }
571
572
574 PointND(double x, const std::pair<double,double>& ex)
575 : BaseT( {x}, {ex}) { }
576
577
579 PointND(const BaseT& other) : BaseT(other) {}
580
582 PointND(BaseT&& other) : BaseT(std::move(other)) {}
583
585
586
589
591 double val(size_t i=0) const {
592 if (i >= 1) throw RangeError("Invalid axis int, must be in range 0..dim-1");
593 return _val[i];
594 }
595
597
598 };
599
600
601
603 template <>
604 class PointND<2> : public PointBase<2>,
605 public XDirectionMixin<PointND<2>>,
606 public YDirectionMixin<PointND<2>> {
607 public:
608
610 using BaseT::BaseT;
611
614
616 PointND(double x, double y, double ex=0.0, double ey=0.0)
617 : BaseT( {x,y}, {{ex,ex}, {ey,ey}}) { }
618
619
621 PointND(double x, double y,
622 double exminus, double explus,
623 double eyminus, double eyplus)
624 : BaseT({x,y}, {{exminus,explus}, {eyminus,eyplus}}) { }
625
626
628 PointND(double x, double y, const std::pair<double,double>& ex, const std::pair<double,double>& ey)
629 : BaseT({x,y}, {ex, ey}) { }
630
631
633 PointND(const BaseT& other) : BaseT(other) { }
634
636 PointND(BaseT&& other) : BaseT(std::move(other)) { }
637
639
640
641 // @name Manipulations
643
645 void scaleXY(double scalex, double scaley) {
646 scaleX(scalex);
647 scaleY(scaley);
648 }
649
651
652 };
653
654
655
657 template <>
658 class PointND<3> : public PointBase<3>,
659 public XDirectionMixin<PointND<3>>,
660 public YDirectionMixin<PointND<3>>,
661 public ZDirectionMixin<PointND<3>> {
662 public:
663
665 using BaseT::BaseT;
666
669
671 PointND(double x, double y, double z, double ex=0.0, double ey=0.0, double ez=0.0)
672 : BaseT({x,y,z}, {{ex,ex}, {ey,ey}, {ez,ez}}) { }
673
674
676 PointND(double x, double y, double z,
677 double exminus, double explus,
678 double eyminus, double eyplus,
679 double ezminus, double ezplus)
680 : BaseT({x,y,z}, {{exminus,explus}, {eyminus,eyplus}, {ezminus,ezplus}}) { }
681
683 PointND(double x, double y, double z,
684 const std::pair<double,double>& ex,
685 const std::pair<double,double>& ey,
686 const std::pair<double,double>& ez)
687 : BaseT({x,y,z}, {ex,ey,ez}) { }
688
689
691 PointND(const BaseT& other) : BaseT(other) { }
692
694 PointND(BaseT&& other) : BaseT(std::move(other)) { }
695
697
698 // @name Manipulations
700
702 void scaleXYZ(double scalex, double scaley, double scalez) {
703 scaleX(scalex);
704 scaleY(scaley);
705 scaleZ(scalez);
706 }
707
709
710 };
711
712
718
719}
720
721#endif
#define LT_IF_NOT_EQ(a, b)
The base for an N-dimensional data point to be contained in a Scatter<N>
Definition Point.h:119
PointBase(ValRange &&val, PairRange &&errs)
Constructor from values and a set of asymmetric errors.
Definition Point.h:169
double val(size_t i) const
Get the value along direction i.
Definition Point.h:273
void scale(const size_t i, const Trf< N > &trf)
Definition Point.h:434
PointBase(PointBase &&p)
Definition Point.h:204
typename std::is_same< containedType< Arr >, Pair > containsPair
Definition Point.h:133
void scale(const Trf< N > &trf)
Generalised transformations with functors.
Definition Point.h:428
std::enable_if_t<(Iterable< T >::value &&Iterable< U >::value &&containsPair< U >::value)> isIterableWithPair
Definition Point.h:141
void setErr(const size_t i, const double e)
Set a symmetric error pair along axis i.
Definition Point.h:341
void setErrs(const size_t i, const std::pair< double, double > &e)
Set a specific error pair along axis i.
Definition Point.h:354
PointBase & operator=(const PointBase &p)
Assignment operator.
Definition Point.h:239
PointBase(ValRange &&val)
Constructor from position values without errors.
Definition Point.h:162
NdValPair & errs()
Get error values.
Definition Point.h:296
double errMinus(const size_t i) const
Get the minus error along axis i.
Definition Point.h:312
size_t dim() const
Space dimension of the point.
Definition Point.h:209
std::pair< double, double > Pair
Definition Point.h:123
std::decay_t< decltype(*std::declval< Arr >().begin())> containedType
Definition Point.h:129
typename Utils::ndarray< double, N > NdVal
Definition Point.h:146
void setVal(const NdVal &val)
Set the coordinate vector.
Definition Point.h:279
void setVal(const size_t i, const double val)
Set a specific coordinate.
Definition Point.h:284
double errPlus(const size_t i) const
Get the plus error along axis i.
Definition Point.h:318
std::integral_constant< size_t, 3 *N > DataSize
Definition Point.h:148
void set(const size_t i, const double val, const std::pair< double, double > &e)
Set value and asymmetric error for direction i.
Definition Point.h:390
std::initializer_list< double > ValList
Definition Point.h:124
void scaleErr(const size_t i, const double scale)
Scaling error along direction i.
Definition Point.h:408
void set(const size_t i, const double val, const double e)
Set value and symmetric error for direction i.
Definition Point.h:376
std::initializer_list< Pair > PairList
Definition Point.h:125
PointBase(ValRange &&val, ValRange &&errs)
Constructor from values and a set of symmetric errors.
Definition Point.h:174
const NdValPair & errs() const
Get error values (const version)
Definition Point.h:301
PointBase(const PointBase &p)
Definition Point.h:202
double errAvg(const size_t i) const
Definition Point.h:324
void setErrMinus(const size_t i, const double eminus)
Set a specific minus error along axis i.
Definition Point.h:360
std::enable_if_t< Iterable< T >::value > isIterable
Definition Point.h:137
void setErrs(const size_t i, const double eminus, const double eplus)
Set an asymmetric error pair along axis i.
Definition Point.h:348
NdVal & vals()
Get the coordinate vector.
Definition Point.h:267
void set(const size_t i, const double val, const double eminus, const double eplus)
Set value and asymmetric error for direction i.
Definition Point.h:383
void transform(const size_t i, const Trf< N > &trf)
Definition Point.h:439
void scale(const NdVal &scales)
Uniform scaling.
Definition Point.h:421
void setErrPlus(const size_t i, const double eplus)
Set a specific plus error along axis i.
Definition Point.h:366
typename Utils::ndarray< std::pair< double, double >, N > NdValPair
Definition Point.h:147
Pair errs(const size_t i) const
Get error values along axis i.
Definition Point.h:306
const NdVal & vals() const
Get the coordinate vector (const version)
Definition Point.h:270
double min(const size_t i) const
Get value minus negative error along axis i.
Definition Point.h:329
void scale(const size_t i, const double scale)
Scaling along direction i.
Definition Point.h:415
void scaleVal(const size_t i, const double scale)
Scaling value along direction i.
Definition Point.h:402
PointBase(ValRange &&val, ValRange &&errsdn, ValRange &&errsup)
Constructor from values and a set of asymmetric errors.
Definition Point.h:189
double max(const size_t i) const
Get value plus positive error along axis i.
Definition Point.h:335
void clear()
Clear the point values and errors.
Definition Point.h:231
A 1D data point to be contained in a Scatter1D.
Definition Point.h:554
PointND(BaseT &&other)
Move constructor.
Definition Point.h:582
PointND(double x, double ex=0.0)
Constructor from values with optional symmetric errors.
Definition Point.h:564
PointND(double x, double exminus, double explus)
Constructor from values with explicit asymmetric errors.
Definition Point.h:569
PointND(double x, const std::pair< double, double > &ex)
Constructor from values with asymmetric errors.
Definition Point.h:574
double val(size_t i=0) const
Get the value along direction i.
Definition Point.h:591
PointND(const BaseT &other)
Copy constructor.
Definition Point.h:579
A 2D data point to be contained in a Scatter2D.
Definition Point.h:606
PointND(double x, double y, const std::pair< double, double > &ex, const std::pair< double, double > &ey)
Constructor from values with asymmetric errors on both x and y.
Definition Point.h:628
PointND(double x, double y, double exminus, double explus, double eyminus, double eyplus)
Constructor from values with explicit asymmetric errors.
Definition Point.h:621
PointND(const BaseT &other)
Copy constructor.
Definition Point.h:633
PointND(BaseT &&other)
Move constructor.
Definition Point.h:636
void scaleXY(double scalex, double scaley)
Scaling of both axes.
Definition Point.h:645
PointND(double x, double y, double ex=0.0, double ey=0.0)
Constructor from values with optional symmetric errors.
Definition Point.h:616
A 3D data point to be contained in a Scatter3D.
Definition Point.h:661
PointND(BaseT &&other)
Move constructor.
Definition Point.h:694
PointND(double x, double y, double z, double exminus, double explus, double eyminus, double eyplus, double ezminus, double ezplus)
Constructor from values with explicit asymmetric errors.
Definition Point.h:676
PointND(const BaseT &other)
Copy constructor.
Definition Point.h:691
PointND(double x, double y, double z, double ex=0.0, double ey=0.0, double ez=0.0)
Constructor from values with optional symmetric errors.
Definition Point.h:671
PointND(double x, double y, double z, const std::pair< double, double > &ex, const std::pair< double, double > &ey, const std::pair< double, double > &ez)
Constructor from asymmetric errors given as vectors.
Definition Point.h:683
void scaleXYZ(double scalex, double scaley, double scalez)
Scaling of both axes.
Definition Point.h:702
Base class for all Point*Ds, providing generic access to their numerical properties.
Definition Point.h:25
virtual void setErrMinus(const size_t i, const double eminus)=0
Get negative error value for direction i.
virtual void set(const size_t i, const double val, const double e)=0
Set value and symmetric error for direction i.
virtual void setErrs(const size_t i, const std::pair< double, double > &e)=0
Set error pair for direction i.
virtual void scale(const size_t i, const double scale)=0
virtual void setErrPlus(const size_t i, const double eplus)=0
Get positive error value for direction i.
std::pair< double, double > ValuePair
Definition Point.h:28
virtual void setVal(const size_t i, const double val)=0
Set the point value for direction i.
virtual void setErr(const size_t i, const double e)=0
Get error values for direction i.
virtual void set(const size_t i, const double val, const double eminus, const double eplus)=0
Set value and asymmetric error for direction i.
virtual void set(const size_t i, const double val, const std::pair< double, double > &e)=0
Set value and asymmetric error for direction i.
virtual void setErrs(const size_t i, const double eminus, const double eplus)=0
Set asymmetric error for direction i.
virtual ~Point()
Virtual destructor for inheritance.
Definition Point.h:32
virtual double val(size_t i) const =0
Get the point value for direction i.
virtual size_t dim() const =0
Space dimension of the point.
Error for e.g. use of invalid bin ranges.
Definition Exceptions.h:34
void transform(double &val, Args &&... args) const
Transform value val.
Anonymous namespace to limit visibility.
PointND< 4 > Point4D
Definition Point.h:717
bool operator<=(const PointBase< N > &a, const PointBase< N > &b)
Less-than-or-equals operator used to sort points.
Definition Point.h:524
bool operator>=(const PointBase< N > &a, const PointBase< N > &b)
Greater-than-or-equals operator used to sort points.
Definition Point.h:537
bool operator<(const PointBase< N > &a, const PointBase< N > &b)
Less-than operator used to sort points.
Definition Point.h:511
std::enable_if_t< std::is_arithmetic_v< N1 > &&std::is_arithmetic_v< N2 > &&(std::is_floating_point_v< N1 >||std::is_floating_point_v< N2 >), bool > fuzzyEquals(N1 a, N2 b, double tolerance=1e-5)
Compare two numbers for equality with a degree of fuzziness.
Definition MathUtils.h:96
bool operator>(const PointBase< N > &a, const PointBase< N > &b)
Greater-than operator used to sort points.
Definition Point.h:531
bool operator==(const PointBase< N > &a, const PointBase< N > &b)
Equality test.
Definition Point.h:492
bool operator!=(const PointBase< N > &a, const PointBase< N > &b)
Inequality test.
Definition Point.h:504
CRTP mixin introducing convenience aliases along X axis.
Definition PointUtils.h:18
CRTP mixin introducing convenience aliases along Y axis.
Definition PointUtils.h:142
CRTP mixin introducing convenience aliases along Z axis.
Definition PointUtils.h:281