mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
Trying to find out why placements don’t arrive at Triangulate()
This commit is contained in:
@@ -702,6 +702,13 @@ namespace IfcGeom {
|
||||
|
||||
try {
|
||||
next_shape_model = create_shape_model_for_next_entity();
|
||||
|
||||
// std::cout << "trsf" << std::endl;
|
||||
// for (int i = 0; i < 3; ++i) {
|
||||
// for (int j = 0; j < 4; ++j) {
|
||||
// std::cout << next_shape_model->transformation().matrix().data() << " ";
|
||||
// } std::cout << std::endl;
|
||||
// }
|
||||
} catch (...) {}
|
||||
|
||||
if (next_shape_model) {
|
||||
|
||||
@@ -139,12 +139,22 @@ bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcAxis2Placement3D* l, cgal_
|
||||
if ( l->hasAxis() ) IfcGeom::CgalKernel::convert(l->Axis(),axis);
|
||||
if ( hasRef ) IfcGeom::CgalKernel::convert(l->RefDirection(),refDirection);
|
||||
|
||||
// std::cout << "Ref direction: " << refDirection << std::endl;
|
||||
// std::cout << "Axis: " << axis << std::endl;
|
||||
// std::cout << "Origin: " << o << std::endl;
|
||||
|
||||
// TODO: From Thomas' email. Should be checked.
|
||||
Kernel::Vector_3 y = CGAL::cross_product(axis, refDirection);
|
||||
trsf = Kernel::Aff_transformation_3(refDirection.cartesian(0), y.cartesian(0), axis.cartesian(0), o.cartesian(0),
|
||||
refDirection.cartesian(1), y.cartesian(1), axis.cartesian(1), o.cartesian(1),
|
||||
refDirection.cartesian(2), y.cartesian(2), axis.cartesian(2), o.cartesian(2));
|
||||
|
||||
// for (int i = 0; i < 3; ++i) {
|
||||
// for (int j = 0; j < 4; ++j) {
|
||||
// std::cout << trsf.cartesian(i, j) << " ";
|
||||
// } std::cout << std::endl;
|
||||
// }
|
||||
|
||||
// CACHE(IfcAxis2Placement3D,l,trsf)
|
||||
return true;
|
||||
}
|
||||
@@ -156,13 +166,37 @@ bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcObjectPlacement* l, cgal_p
|
||||
Logger::Message(Logger::LOG_ERROR, "Unsupported IfcObjectPlacement:", l->entity);
|
||||
return false;
|
||||
}
|
||||
|
||||
// std::cout << "initial trsf (identity?)" << std::endl;
|
||||
// for (int i = 0; i < 3; ++i) {
|
||||
// for (int j = 0; j < 4; ++j) {
|
||||
// std::cout << trsf.cartesian(i, j) << " ";
|
||||
// } std::cout << std::endl;
|
||||
// }
|
||||
|
||||
IfcSchema::IfcLocalPlacement* current = (IfcSchema::IfcLocalPlacement*)l;
|
||||
for (;;) {
|
||||
cgal_placement_t trsf2;
|
||||
|
||||
IfcSchema::IfcAxis2Placement* relplacement = current->RelativePlacement();
|
||||
if ( relplacement->is(IfcSchema::Type::IfcAxis2Placement3D) ) {
|
||||
IfcGeom::CgalKernel::convert((IfcSchema::IfcAxis2Placement3D*)relplacement,trsf2);
|
||||
|
||||
// std::cout << "trsf2" << std::endl;
|
||||
// for (int i = 0; i < 3; ++i) {
|
||||
// for (int j = 0; j < 4; ++j) {
|
||||
// std::cout << trsf2.cartesian(i, j) << " ";
|
||||
// } std::cout << std::endl;
|
||||
// }
|
||||
|
||||
trsf = trsf * trsf2; // TODO: I think it's fine, but maybe should it be the other way around?
|
||||
|
||||
// std::cout << "trsf (after multiplication)" << std::endl;
|
||||
// for (int i = 0; i < 3; ++i) {
|
||||
// for (int j = 0; j < 4; ++j) {
|
||||
// std::cout << trsf.cartesian(i, j) << " ";
|
||||
// } std::cout << std::endl;
|
||||
// }
|
||||
}
|
||||
if ( current->hasPlacementRelTo() ) {
|
||||
IfcSchema::IfcObjectPlacement* relto = current->PlacementRelTo();
|
||||
|
||||
@@ -35,7 +35,8 @@ namespace IfcGeom {
|
||||
|
||||
virtual double Value(int i, int j) const {
|
||||
// TODO: Check
|
||||
return CGAL::to_double(trsf_.cartesian(i, j));
|
||||
// std::cout << "Getting CgalPlacement with i = " << i << " and j = " << j << std::endl;
|
||||
return CGAL::to_double(trsf_.cartesian(i-1, j-1));
|
||||
}
|
||||
virtual void Multiply(const ConversionResultPlacement* other) {
|
||||
// TODO: Check
|
||||
@@ -51,7 +52,7 @@ namespace IfcGeom {
|
||||
private:
|
||||
cgal_placement_t trsf_;
|
||||
};
|
||||
|
||||
|
||||
class CgalShape : public ConversionResultShape {
|
||||
public:
|
||||
CgalShape(const cgal_shape_t& shape)
|
||||
|
||||
@@ -96,6 +96,13 @@ IfcGeom::NativeElement<double>* IfcGeom::CgalKernel::create_brep_for_representat
|
||||
try {
|
||||
convert(product->ObjectPlacement(), trsf);
|
||||
} catch (...) {}
|
||||
|
||||
std::cout << "trsf" << std::endl;
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int j = 0; j < 4; ++j) {
|
||||
std::cout << trsf.cartesian(i, j) << " ";
|
||||
} std::cout << std::endl;
|
||||
}
|
||||
|
||||
// Does the IfcElement have any IfcOpenings?
|
||||
// Note that openings for IfcOpeningElements are not processed
|
||||
|
||||
Reference in New Issue
Block a user