| 25 | #ifdef SCHEMA_HAS_IfcFixedReferenceSweptAreaSolid |
| 26 | |
| 27 | taxonomy::ptr mapping::map_impl(const IfcSchema::IfcFixedReferenceSweptAreaSolid* inst) { |
| 28 | auto dir = map(inst->Directrix()); |
| 29 | auto ref = taxonomy::cast<taxonomy::direction3>(map(inst->FixedReference())); |
| 30 | auto profile = taxonomy::cast<taxonomy::face>(map(inst->SweptArea())); |
| 31 | |
| 32 | auto loft = taxonomy::make<taxonomy::loft>(); |
| 33 | // @todo intialize as default |
| 34 | loft->axis = nullptr; |
| 35 | // Check if this instance has alignment elements |
| 36 | // @todo currently only the case is handled where directrix returns a piecewise_function |
| 37 | if (auto fn = std::dynamic_pointer_cast<taxonomy::function_item>(dir)) { |
| 38 | function_item_evaluator evaluator(settings_, fn); |
| 39 | double start = 0; |
| 40 | double end = fn->length(); |
| 41 | #ifdef SCHEMA_HAS_IfcDirectrixCurveSweptAreaSolid |
| 42 | // IfcDirectrixCurveSweptAreaSolid introduced in 4.3 changed attribute type |
| 43 | // from optional IfcParamValue to optional IfcCurveMeasureSelect. |
| 44 | // Invocation of mapping on pre-4.3 models can never result in a piecewise_function. |
| 45 | if (inst->StartParam() && inst->StartParam()->as<IfcSchema::IfcLengthMeasure>()) { |
| 46 | double s = *inst->StartParam()->as<IfcSchema::IfcLengthMeasure>(); |
| 47 | if (s > start) { |
| 48 | start = s; |
| 49 | } |
| 50 | } |
| 51 | if (inst->EndParam() && inst->EndParam()->as<IfcSchema::IfcLengthMeasure>()) { |
| 52 | double e = *inst->EndParam()->as<IfcSchema::IfcLengthMeasure>(); |
| 53 | if (e < end) { |
| 54 | end = e; |
| 55 | } |
| 56 | } |
| 57 | #endif |
| 58 | auto evaluation_points = evaluator.evaluation_points(); |
| 59 | for (const auto& dist_along : evaluation_points) { |
| 60 | auto m4 = evaluator.evaluate(dist_along); |
| 61 | |
| 62 | /* |
| 63 | std::stringstream ss; |
| 64 | ss << m4; |
| 65 | auto s = ss.str(); |
| 66 | std::wcout << s.c_str() << std::endl; |
| 67 | std::wcout << "determinant: " << m4.determinant() << std::endl; |
| 68 | */ |
| 69 | |
| 70 | Eigen::Matrix4d m4b = Eigen::Matrix4d::Identity(); |
| 71 | bool is_directrix_derived = false; |
| 72 | |
| 73 | #ifdef SCHEMA_HAS_IfcDirectrixDerivedReferenceSweptAreaSolid |
| 74 | if (inst->as<IfcSchema::IfcDirectrixDerivedReferenceSweptAreaSolid>()) { |
| 75 | is_directrix_derived = true; |
| 76 | } |
| 77 | #endif |
| 78 | auto pos = m4.col(3).head<3>(); |
| 79 | |
| 80 | if (is_directrix_derived) { |
| 81 | m4b.col(0).head<3>() = m4.col(1).head<3>(); |
| 82 | m4b.col(1).head<3>() = m4.col(0).head<3>().cross(m4.col(1).head<3>()); |
| 83 | m4b.col(2).head<3>() = m4.col(0).head<3>(); |
| 84 | m4b.col(3).head<3>() = pos; |
nothing calls this directly
no test coverage detected