64#include "../Common/Assert.h"
74 template <
typename DataPo
int>
77 using MatrixType =
typename DataPoint::MatrixType;
78 using Scalar =
typename DataPoint::Scalar;
79 using VectorType =
typename DataPoint::VectorType;
81 static constexpr Scalar
epsilon = Eigen::NumTraits<Scalar>::epsilon();
87 static bool isDegenerate(
const VectorType&
a,
const VectorType& b,
const VectorType&
c)
103 static void polarTriangle(
const VectorType&
a,
const VectorType& b,
const VectorType&
c, VectorType&
Ap,
104 VectorType&
Bp, VectorType&
Cp)
130 if (
Ta == VectorType::Zero() ||
Tb == VectorType::Zero() ||
Tc == VectorType::Zero())
134 Scalar
ca = std::max(Scalar(-1.0), std::min(Scalar(1.0),
Tb.dot(
Tc)));
135 Scalar
cb = std::max(Scalar(-1.0), std::min(Scalar(1.0),
Tc.dot(
Ta)));
136 Scalar
cc = std::max(Scalar(-1.0), std::min(Scalar(1.0),
Ta.dot(
Tb)));
144 static Scalar
area(
const VectorType&
a,
const VectorType& b,
const VectorType&
c)
156 static Scalar
algebraicArea(
const VectorType&
a,
const VectorType& b,
const VectorType&
c)
159 VectorType
M =
a + b +
c;
163 return M.dot(
X) < 0.0 ? -
S :
S;
185 const VectorType&
ua,
const VectorType&
ub,
const VectorType&
uc,
190 VectorType
uM = (
ua +
ub +
uc) / 3.0;
212 const VectorType&
ua,
const VectorType&
ub,
const VectorType&
uc,
216 VectorType
uM = (
ua +
ub +
uc) / Scalar(3.0);
219 return Scalar(0.25) * (
uM.cross(
uc -
ub).dot(
a) +
uM.cross(
ua -
uc).dot(b) +
uM.cross(
ub -
ua).dot(
c));
235 const VectorType&
ua,
const VectorType&
ub,
const VectorType&
uc,
244 return Scalar(0.5) * (
ua.cross(
ub).dot(
uc));
257 const VectorType&
ua,
const VectorType&
ub,
const VectorType&
uc,
260 MatrixType T = MatrixType::Zero();
261 VectorType
uM = (
ua +
ub +
uc) / 3.0;
264 const VectorType
uac =
uc -
ua;
265 const VectorType
uab =
ub -
ua;
266 const VectorType
ab = b -
a;
267 const VectorType
ac =
c -
a;
268 for (
size_t i = 0;
i < 3; ++
i)
270 VectorType
X = VectorType::Zero();
272 for (
size_t j = 0;
j < 3; ++
j)
302 const Scalar
coef_N = Scalar(1000.0) * area;
304 for (
int j = 0;
j < 3;
j++)
305 for (
int k = 0; k < 3; k++)
308 Eigen::SelfAdjointEigenSolver<MatrixType>
eigensolver(
M);
318 return std::pair<VectorType, VectorType>(
v1,
v2);
334 const Scalar
coef_N = Scalar(1000.0) * area;
336 for (
int j = 0;
j < 3;
j++)
337 for (
int k = 0; k < 3; k++)
340 Eigen::SelfAdjointEigenSolver<MatrixType>
eigensolver(
M);
354 return std::make_tuple(Scalar(0.0), Scalar(0.0),
v1,
v2);
Aggregator class used to declare specialized structures using CRTP.
Copyright (c) 2022 Jacques-Olivier Lachaud (jacques-olivier.lachaud@univ-savoie.fr) Laboratory of Mat...
Represents a triangle on a sphere of radius one.
static void polarTriangle(const VectorType &a, const VectorType &b, const VectorType &c, VectorType &Ap, VectorType &Bp, VectorType &Cp)
static Scalar area(const VectorType &a, const VectorType &b, const VectorType &c)
static Scalar algebraicArea(const VectorType &a, const VectorType &b, const VectorType &c)
static bool isDegenerate(const VectorType &a, const VectorType &b, const VectorType &c)
Spherical point data type.
static void interiorAngles(const VectorType &a, const VectorType &b, const VectorType &c, Scalar &alpha, Scalar &beta, Scalar &gamma)
Returns the interior angles of the spherical triangle ABC.
This class contains some stand-alone CorrectedNormalCurrent formulas for triangles,...
static Scalar mu2InterpolatedU(const VectorType &a, const VectorType &b, const VectorType &c, const VectorType &ua, const VectorType &ub, const VectorType &uc, bool unit_u=false)
Computes mu2 measure (Gaussian curvature) of triangle abc given an interpolated corrected normal vect...
static Scalar mu0InterpolatedU(const VectorType &a, const VectorType &b, const VectorType &c, const VectorType &ua, const VectorType &ub, const VectorType &uc, bool unit_u=false)
Computes mu0 measure (area) of triangle abc given an interpolated corrected normal vector ua,...
static MatrixType muXYInterpolatedU(const VectorType &a, const VectorType &b, const VectorType &c, const VectorType &ua, const VectorType &ub, const VectorType &uc, bool unit_u=false)
Computes muXY measure (anisotropic curvature) of triangle abc given an interpolated corrected normal ...
static std::tuple< Scalar, Scalar, VectorType, VectorType > curvaturesFromTensor(const MatrixType &tensor, const Scalar area, const VectorType &N)
Computing principal curvatures k1 and k2 from tensor.
static Scalar mu1InterpolatedU(const VectorType &a, const VectorType &b, const VectorType &c, const VectorType &ua, const VectorType &ub, const VectorType &uc, bool unit_u=false)
Computes mu1 measure (mean curvature) of triangle abc given an interpolated corrected normal vector u...
static constexpr Scalar epsilon
Small constant used to approximate zero.
static std::pair< VectorType, VectorType > curvDirFromTensor(const MatrixType &tensor, const Scalar area, const VectorType &N)
Computing principal curvatures k1 and k2 from tensor.