fix compilation issues - missing template keywords

This commit is contained in:
PavelMikus 2022-12-12 11:11:08 +01:00
parent cda29fa4ac
commit 15046aba42
3 changed files with 4 additions and 14 deletions

View File

@ -112,7 +112,7 @@ inline double angle(const Eigen::MatrixBase<Derived> &v1, const Eigen::MatrixBas
template<typename Derived> template<typename Derived>
Eigen::Matrix<typename Derived::Scalar, 2, 1, Eigen::DontAlign> to_2d(const Eigen::MatrixBase<Derived> &ptN) { Eigen::Matrix<typename Derived::Scalar, 2, 1, Eigen::DontAlign> to_2d(const Eigen::MatrixBase<Derived> &ptN) {
static_assert(Derived::IsVectorAtCompileTime && int(Derived::SizeAtCompileTime) >= 3, "to_2d(): first parameter is not a 3D or higher dimensional vector"); static_assert(Derived::IsVectorAtCompileTime && int(Derived::SizeAtCompileTime) >= 3, "to_2d(): first parameter is not a 3D or higher dimensional vector");
return ptN.head<2>(); return ptN.template head<2>();
} }
template<typename Derived> template<typename Derived>

View File

@ -121,7 +121,7 @@ public:
Vec3f get_cell_center(const Vec3i &cell_coords) const Vec3f get_cell_center(const Vec3i &cell_coords) const
{ {
return origin + cell_coords.cast<float>().cwiseProduct(this->cell_size) + this->cell_size.cwiseQuotient(Vec3f(2.0f, 2.0f, 2.0)); return origin + cell_coords.cast<float>().cwiseProduct(this->cell_size) + this->cell_size.cwiseQuotient(Vec3f(2.0f, 2.0f, 2.0f));
} }
void take_position(const Vec3f &position) { taken_cells.insert(to_cell_index(to_cell_coords(position))); } void take_position(const Vec3f &position) { taken_cells.insert(to_cell_index(to_cell_coords(position))); }
@ -199,16 +199,6 @@ struct ExtrusionPropertiesAccumulator
} }
}; };
// base function: ((e^(((1)/(x^(2)+1)))-1)/(e-1))
// checkout e.g. here: https://www.geogebra.org/calculator
float gauss(float value, float mean_x_coord, float mean_value, float falloff_speed)
{
float shifted = value - mean_x_coord;
float denominator = falloff_speed * shifted * shifted + 1.0f;
float exponent = 1.0f / denominator;
return mean_value * (std::exp(exponent) - 1.0f) / (std::exp(1.0f) - 1.0f);
}
std::vector<ExtrusionLine> to_short_lines(const ExtrusionEntity *e, float length_limit) std::vector<ExtrusionLine> to_short_lines(const ExtrusionEntity *e, float length_limit)
{ {
assert(!e->is_collection()); assert(!e->is_collection());

View File

@ -206,7 +206,7 @@ inline FacetSliceType slice_facet(
// All three vertices are aligned with slice_z. // All three vertices are aligned with slice_z.
line_out.edge_type = IntersectionLine::FacetEdgeType::Horizontal; line_out.edge_type = IntersectionLine::FacetEdgeType::Horizontal;
result = FacetSliceType::Cutting; result = FacetSliceType::Cutting;
double normal = cross2((to_2d(v1) - to_2d(v0)).cast<double>(), (to_2d(v2) - to_2d(v1)).cast<double>()); double normal = cross2((to_2d(v1) - to_2d(v0)).template cast<double>(), (to_2d(v2) - to_2d(v1)).template cast<double>());
if (normal < 0) { if (normal < 0) {
// If normal points downwards this is a bottom horizontal facet so we reverse its point order. // If normal points downwards this is a bottom horizontal facet so we reverse its point order.
std::swap(a, b); std::swap(a, b);
@ -292,7 +292,7 @@ inline FacetSliceType slice_facet(
static_cast<Point&>(point) = static_cast<Point&>(point) =
t <= 0. ? v3f_scaled_to_contour_point(*a) : t <= 0. ? v3f_scaled_to_contour_point(*a) :
t >= 1. ? v3f_scaled_to_contour_point(*b) : t >= 1. ? v3f_scaled_to_contour_point(*b) :
v3f_scaled_to_contour_point(a->head<2>().cast<double>() * (1. - t) + b->head<2>().cast<double>() * t + Vec2d(0.5, 0.5)); v3f_scaled_to_contour_point(a->template head<2>().template cast<double>() * (1. - t) + b->template head<2>().template cast<double>() * t + Vec2d(0.5, 0.5));
point.edge_id = edge_id; point.edge_id = edge_id;
++ num_points; ++ num_points;
#endif #endif