Fix 2d transform op + fixed ref column order #5048

This commit is contained in:
Thomas Krijnen
2024-07-22 04:33:27 +02:00
parent aa31436c67
commit 41f1d66fee
2 changed files with 21 additions and 3 deletions
@@ -32,10 +32,18 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCartesianTransformationOpera
if (inst->Axis1()) {
taxonomy::direction3::ptr ax1 = taxonomy::cast<taxonomy::direction3>(map(inst->Axis1()));
axis1 << *ax1->components_, 0.0;
if (!inst->Axis2()) {
// orthogonal complement
axis2 << -axis1(1), axis1(0), 0., 0.;
}
}
if (inst->Axis2()) {
taxonomy::direction3::ptr ax2 = taxonomy::cast<taxonomy::direction3>(map(inst->Axis2()));
axis2 << *ax2->components_, 0.0;
if (!inst->Axis2()) {
// orthogonal complement
axis1 << -axis2(1), axis2(0), 0., 0.;
}
}
double scale1, scale2;
@@ -65,7 +65,8 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcFixedReferenceSweptAreaSolid
num_steps = (size_t) std::ceil(param);
}
for (size_t i = 0; i <= num_steps; ++i) {
auto m4 = pwf->evaluate(start + curve_length / num_steps * i);
auto distalong = start + curve_length / num_steps * i;
auto m4 = pwf->evaluate(distalong);
/*
std::stringstream ss;
@@ -96,10 +97,19 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcFixedReferenceSweptAreaSolid
proj.normalize();
auto ref = proj.cross(tangent);
m4b.col(0).head<3>() = ref;
m4b.col(1).head<3>() = proj;
m4b.col(0).head<3>() = proj;
m4b.col(1).head<3>() = ref;
m4b.col(2).head<3>() = tangent;
m4b.col(3).head<3>() = pos;
/*
Eigen::JacobiSVD<decltype(m4b)> svd(m4b);
auto condition_number = svd.singularValues()(0)
/ svd.singularValues()(svd.singularValues().size() - 1);
if (condition_number > 1.e10) {
Logger::Error("Non-invertible matrix at " + std::to_string(distalong) + " conversion will likely fail.");
}
*/
}
// @todo taxonomy::clone() does not actually clone. That's really confusing.