19 template <
class TPo
int>
20 auto proj(Eigen::MatrixBase<TPoint>
const& p)
21 -> Eigen::Vector<
typename TPoint::Scalar, TPoint::RowsAtCompileTime - 1> {
22 static_assert(TPoint::ColsAtCompileTime == 1,
"p must be a column-vector");
23 static_assert(TPoint::RowsAtCompileTime >= 2,
"p must have at least 2 rows");
24 return p.template head<TPoint::RowsAtCompileTime - 1>() /
25 p[TPoint::RowsAtCompileTime - 1];
30 template <
class TPo
int>
32 Eigen::MatrixBase<TPoint>
const& p,
const typename TPoint::Scalar& z = 1.0)
33 -> Eigen::Vector<typename TPoint::Scalar, TPoint::RowsAtCompileTime + 1> {
34 using Scalar =
typename TPoint::Scalar;
35 static_assert(TPoint::ColsAtCompileTime == 1,
"p must be a column-vector");
36 Eigen::Vector<Scalar, TPoint::RowsAtCompileTime + 1> out;
37 out.template head<TPoint::RowsAtCompileTime>() = z * p;
38 out[TPoint::RowsAtCompileTime] = z;