diff --git a/src/ifcgeom/mapping/IfcCurveSegment.cpp b/src/ifcgeom/mapping/IfcCurveSegment.cpp index 65ec09bb67..61fc913c15 100644 --- a/src/ifcgeom/mapping/IfcCurveSegment.cpp +++ b/src/ifcgeom/mapping/IfcCurveSegment.cpp @@ -63,14 +63,10 @@ public: #ifdef SCHEMA_HAS_IfcClothoid // Then initialize Function(double) -> Vector3, by means of IfcCurve subtypes - void operator()(boost::type) { - if (!curve_->as()) { - return; - } - + void operator()(IfcSchema::IfcClothoid* c) { // @todo verify auto L = start_ + length_; - auto A = curve_->as()->ClothoidConstant(); + auto A = c->ClothoidConstant(); auto R = A * A / L; auto RL = R * L; @@ -93,13 +89,18 @@ public: #endif // Another IfcCurve subtype - void operator()(boost::type) { - if (!curve_->as()) { - return; - } + void operator()(IfcSchema::IfcLine*) { throw std::runtime_error("not implemented"); } + // Take the boost::type value from mpl::for_each and test it against our curve instance + template + void operator()(boost::type) { + if (curve_->as()) { + (*this)(curve_->as()); + } + } + // Then, with function populated based on IfcCurve subtype, we can evaluate to points Eigen::Vector3d operator()(double u) { if (eval_) {