mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 18:21:59 +00:00
#3098 Move boost::type application to curve to template function
This commit is contained in:
@@ -63,14 +63,10 @@ public:
|
|||||||
|
|
||||||
#ifdef SCHEMA_HAS_IfcClothoid
|
#ifdef SCHEMA_HAS_IfcClothoid
|
||||||
// Then initialize Function(double) -> Vector3, by means of IfcCurve subtypes
|
// Then initialize Function(double) -> Vector3, by means of IfcCurve subtypes
|
||||||
void operator()(boost::type<IfcSchema::IfcClothoid>) {
|
void operator()(IfcSchema::IfcClothoid* c) {
|
||||||
if (!curve_->as<IfcSchema::IfcClothoid>()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @todo verify
|
// @todo verify
|
||||||
auto L = start_ + length_;
|
auto L = start_ + length_;
|
||||||
auto A = curve_->as<IfcSchema::IfcClothoid>()->ClothoidConstant();
|
auto A = c->ClothoidConstant();
|
||||||
auto R = A * A / L;
|
auto R = A * A / L;
|
||||||
auto RL = R * L;
|
auto RL = R * L;
|
||||||
|
|
||||||
@@ -93,13 +89,18 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Another IfcCurve subtype
|
// Another IfcCurve subtype
|
||||||
void operator()(boost::type<IfcSchema::IfcLine>) {
|
void operator()(IfcSchema::IfcLine*) {
|
||||||
if (!curve_->as<IfcSchema::IfcLine>()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
throw std::runtime_error("not implemented");
|
throw std::runtime_error("not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Take the boost::type value from mpl::for_each and test it against our curve instance
|
||||||
|
template <typename T>
|
||||||
|
void operator()(boost::type<T>) {
|
||||||
|
if (curve_->as<T>()) {
|
||||||
|
(*this)(curve_->as<T>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Then, with function populated based on IfcCurve subtype, we can evaluate to points
|
// Then, with function populated based on IfcCurve subtype, we can evaluate to points
|
||||||
Eigen::Vector3d operator()(double u) {
|
Eigen::Vector3d operator()(double u) {
|
||||||
if (eval_) {
|
if (eval_) {
|
||||||
|
|||||||
Reference in New Issue
Block a user