79 #ifdef CEPS_DEBUG_ENABLED
80 CEPS_ABORT_IF(dim>2,
"Cannot set vertex coordinate in dimension " << dim);
103 for (
CepsUInt dim = 0; dim < 3U; ++dim)
113 #ifdef CEPS_DEBUG_ENABLED
116 "Scaling vertex coordinates by very small factor : " << scaleFactor
146 #ifdef CEPS_DEBUG_ENABLED
155 #ifdef CEPS_DEBUG_ENABLED
210 case 1U:
return abs (_x);
211 case 2U:
return std::sqrt (_x * _x + _y * _y);
212 case 3U:
return sqrt (_x * _x + _y * _y + _z * _z);
227 val = (std::abs (
m_coor[i]) > val ? std::abs (
m_coor[i]) : val);
233 for (
CepsUInt i = 0; i < dim; ++i) {
234 val += std::pow (std::abs(
m_coor[i]), p);
236 return std::pow (val, 1.0 / p);
244 case 1U:
return x () * other.
x ();
245 case 2U:
return x () * other.
x () +
y () * other.
y ();
246 case 3U:
return x () * other.
x () +
y () * other.
y () +
z () * other.
z ();
257 << vertex.
z () <<
")";
266 case 1U:
return a.
x () * b.
x ();
267 case 2U:
return a.
x () * b.
x () + a.
y () * b.
y ();
268 case 3U:
return a.
x () * b.
x () + a.
y () * b.
y () + a.
z () * b.
z ();
#define CEPS_WARNS_IF(condition, message)
If condition is true, writes a warning in the debug log and in the terminal (stderr).
#define CEPS_ABORT_IF(condition, message)
Stops the execution with a message if condition is true. If testing is enabled, only throws a runtime...
#define CEPS_IO_DECIMAL_PRECISION
Length of floats on std outputs and log files.
size_t CepsSize
Size unsigned.
std::make_unsigned_t< CepsInt > CepsUInt
Unsigned version on CepsInt.
float CepsReal
Need single precision floating point.
Eigen::Matrix< CepsScalar, 3, 1 > CepsMathVertex
Vertex, eigen format.
CepsArray3< CepsReal > CepsReal3D
Three real scalars, used like this for compatibility in polynomials.
int32_t CepsInt
Need 32 bit integer.
#define FLOATING_POINT_EPSILON
CepsReal dotProduct(const CepsVertex &a, const CepsVertex &b, const CepsSize &dim)
Scalar product. dim restricts which components are used (1:(x), 2:(x,y), 3:(x,y,z))
std::ostream & operator<<(std::ostream &os, const CepsVertex &vertex)
Display stream operator.
CepsVertex(const CepsReal &x=0.0, const CepsReal &y=0.0, const CepsReal &z=0.0)
Constructor with coordinates.
CepsReal & operator[](const CepsUInt &dim)
Get coordinate of dimension 0 1 2, read & write.
void setX(const CepsReal &x)
Set vertex x coordinate.
CepsMathVertex getCoordinatesForEigen() const
Get three coordinates.
const CepsReal & x() const
Vertex x coordinate.
void setCoordinates(const CepsReal &x, const CepsReal &y=0., const CepsReal &z=0.)
Set the 3 coordinates at once.
CepsReal & getCoordinate(const CepsSize &dim)
Get coordinate of dimension 0 1 2, read & write.
CepsReal dot(const CepsVertex &other, const CepsSize &dim=3) const
Scalar product. dim restricts which components are used (1:(x), 2:(x,y), 3:(x,y,z))
void setY(const CepsReal &y)
Set vertex y coordinate.
void scale(const CepsReal &scaleFactor)
Scale all coordinates of this node.
const CepsReal & y() const
Vertex y coordinate.
void setCoordinate(const CepsUInt &dim, const CepsReal &coor)
Set the three coordinates.
CepsReal norm2(const CepsSize &dim=3) const
Euclidian norm of coordinates.
CepsReal normp(const CepsInt &p, const CepsSize &dim=3) const
Norm p (for p =-1, 1, 2, etc) with p=-1 gives the inf norm.
void setZ(const CepsReal &z)
Set vertex z coordinate.
const CepsReal & z() const
Vertex z coordinate.
CepsReal3D & getCoordinates()
Get three coordinates, read & write.
CepsBool equals(const CepsVertex &vert, const CepsReal &errorFactor=1.0)
Check for coordinates equality.
CepsBool approxEquals(CepsReal a, CepsReal b, CepsReal epsilon)
Approximate equality with epsilon tolerance.