mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 06:39:13 +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 {
|
try {
|
||||||
next_shape_model = create_shape_model_for_next_entity();
|
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 (...) {}
|
} catch (...) {}
|
||||||
|
|
||||||
if (next_shape_model) {
|
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 ( l->hasAxis() ) IfcGeom::CgalKernel::convert(l->Axis(),axis);
|
||||||
if ( hasRef ) IfcGeom::CgalKernel::convert(l->RefDirection(),refDirection);
|
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.
|
// TODO: From Thomas' email. Should be checked.
|
||||||
Kernel::Vector_3 y = CGAL::cross_product(axis, refDirection);
|
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),
|
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(1), y.cartesian(1), axis.cartesian(1), o.cartesian(1),
|
||||||
refDirection.cartesian(2), y.cartesian(2), axis.cartesian(2), o.cartesian(2));
|
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)
|
// CACHE(IfcAxis2Placement3D,l,trsf)
|
||||||
return true;
|
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);
|
Logger::Message(Logger::LOG_ERROR, "Unsupported IfcObjectPlacement:", l->entity);
|
||||||
return false;
|
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;
|
IfcSchema::IfcLocalPlacement* current = (IfcSchema::IfcLocalPlacement*)l;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
cgal_placement_t trsf2;
|
cgal_placement_t trsf2;
|
||||||
|
|
||||||
IfcSchema::IfcAxis2Placement* relplacement = current->RelativePlacement();
|
IfcSchema::IfcAxis2Placement* relplacement = current->RelativePlacement();
|
||||||
if ( relplacement->is(IfcSchema::Type::IfcAxis2Placement3D) ) {
|
if ( relplacement->is(IfcSchema::Type::IfcAxis2Placement3D) ) {
|
||||||
IfcGeom::CgalKernel::convert((IfcSchema::IfcAxis2Placement3D*)relplacement,trsf2);
|
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?
|
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() ) {
|
if ( current->hasPlacementRelTo() ) {
|
||||||
IfcSchema::IfcObjectPlacement* relto = current->PlacementRelTo();
|
IfcSchema::IfcObjectPlacement* relto = current->PlacementRelTo();
|
||||||
|
|||||||
@@ -35,7 +35,8 @@ namespace IfcGeom {
|
|||||||
|
|
||||||
virtual double Value(int i, int j) const {
|
virtual double Value(int i, int j) const {
|
||||||
// TODO: Check
|
// 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) {
|
virtual void Multiply(const ConversionResultPlacement* other) {
|
||||||
// TODO: Check
|
// TODO: Check
|
||||||
|
|||||||
@@ -97,6 +97,13 @@ IfcGeom::NativeElement<double>* IfcGeom::CgalKernel::create_brep_for_representat
|
|||||||
convert(product->ObjectPlacement(), trsf);
|
convert(product->ObjectPlacement(), trsf);
|
||||||
} catch (...) {}
|
} 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?
|
// Does the IfcElement have any IfcOpenings?
|
||||||
// Note that openings for IfcOpeningElements are not processed
|
// Note that openings for IfcOpeningElements are not processed
|
||||||
IfcSchema::IfcRelVoidsElement::list::ptr openings = find_openings(product);
|
IfcSchema::IfcRelVoidsElement::list::ptr openings = find_openings(product);
|
||||||
|
|||||||
Reference in New Issue
Block a user