39 Eigen::PlainObjectBase<DerivedY> &
Y,
40 Eigen::PlainObjectBase<DerivedIX> &IX)
42 using namespace Eigen;
44 using YScalar =
typename Eigen::PlainObjectBase<DerivedY>::Scalar;
47 int num_outer = (dim == 1 ?
X.cols() :
X.rows());
49 int num_inner = (dim == 1 ?
X.rows() :
X.cols());
52 using Index =
typename Eigen::PlainObjectBase<DerivedIX>::Scalar;
53 IX.resize(
X.rows(),
X.cols());
55 IX.row(0).setConstant(0);
56 IX.row(1).setConstant(1);
57 IX.row(2).setConstant(2);
60 IX.col(0).setConstant(0);
61 IX.col(1).setConstant(1);
62 IX.col(2).setConstant(2);
68 for (
const Index
i : range) {
69 YScalar &a = (dim == 1 ?
Y(0,
i) :
Y(
i, 0));
70 YScalar &
b = (dim == 1 ?
Y(1,
i) :
Y(
i, 1));
71 YScalar &c = (dim == 1 ?
Y(2,
i) :
Y(
i, 2));
72 Index &ai = (dim == 1 ? IX(0,
i) : IX(
i, 0));
73 Index &bi = (dim == 1 ? IX(1,
i) : IX(
i, 1));
74 Index &ci = (dim == 1 ? IX(2,
i) : IX(
i, 2));
117 const Eigen::PlainObjectBase<DerivedF> &
F,
118 Eigen::PlainObjectBase<DeriveddblA> &dblA)
120 const int dim =
V.cols();
123 const size_t m =
F.rows();
125 Eigen::Matrix<typename DerivedV::Scalar, Eigen::Dynamic, 3>
l;
128 const auto &proj_doublearea = [&
V, &
F](
const int x,
const int y,
const int f) ->
double {
129 auto rx =
V(
F(f, 0),
x) -
V(
F(f, 2),
x);
130 auto sx =
V(
F(f, 1),
x) -
V(
F(f, 2),
x);
131 auto ry =
V(
F(f, 0),
y) -
V(
F(f, 2),
y);
132 auto sy =
V(
F(f, 1),
y) -
V(
F(f, 2),
y);
133 return rx * sy - ry * sx;
138 dblA = Eigen::PlainObjectBase<DeriveddblA>::Zero(m, 1);
139 for (
size_t f = 0; f < m; f++) {
140 for (
int d = 0; d < 3; d++) {
141 double dblAd = proj_doublearea(d, (d + 1) % 3, f);
142 dblA(f) += dblAd * dblAd;
145 dblA = dblA.array().sqrt().eval();
150 for (
size_t f = 0; f < m; f++) {
151 dblA(f) = proj_doublearea(0, 1, f);
static void doublearea_sort3(const Eigen::PlainObjectBase< DerivedX > &X, const int dim, const bool ascending, Eigen::PlainObjectBase< DerivedY > &Y, Eigen::PlainObjectBase< DerivedIX > &IX)