mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-14 03:14:23 +00:00
Fix placements
This commit is contained in:
@@ -223,6 +223,15 @@ taxonomy::item* mapping::map_impl(const IfcSchema::IfcPolyLoop* inst) {
|
||||
taxonomy::item* mapping::map_impl(const IfcSchema::IfcCartesianPoint* inst) {
|
||||
auto coords = inst->Coordinates();
|
||||
return new taxonomy::point3(
|
||||
coords.size() >= 1 ? coords[0] * length_unit_ : 0.,
|
||||
coords.size() >= 2 ? coords[1] * length_unit_ : 0.,
|
||||
coords.size() >= 3 ? coords[2] * length_unit_ : 0.
|
||||
);
|
||||
}
|
||||
|
||||
taxonomy::item* mapping::map_impl(const IfcSchema::IfcDirection* inst) {
|
||||
auto coords = inst->DirectionRatios();
|
||||
return new taxonomy::direction3(
|
||||
coords.size() >= 1 ? coords[0] : 0.,
|
||||
coords.size() >= 2 ? coords[1] : 0.,
|
||||
coords.size() >= 3 ? coords[2] : 0.
|
||||
@@ -320,6 +329,7 @@ taxonomy::item* mapping::map_impl(const IfcSchema::IfcLocalPlacement* inst) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return m4;
|
||||
}
|
||||
|
||||
IfcSchema::IfcProduct::list::ptr mapping::products_represented_by(const IfcSchema::IfcRepresentation* representation) {
|
||||
|
||||
@@ -118,7 +118,7 @@ BIND(IfcPolyLoop);
|
||||
#endif
|
||||
|
||||
BIND(IfcCartesianPoint);
|
||||
// BIND(IfcDirection);
|
||||
BIND(IfcDirection);
|
||||
// BIND(IfcAxis2Placement2D);
|
||||
BIND(IfcAxis2Placement3D);
|
||||
// BIND(IfcAxis1Placement);
|
||||
|
||||
@@ -42,6 +42,9 @@ ifcopenshell::geometry::NativeElement* ifcopenshell::geometry::Converter::create
|
||||
|
||||
// @todo decide how to get placement from product
|
||||
auto placement = (taxonomy::geom_item*) mapping_->map(product);
|
||||
if (placement == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
kernel_->convert(rep_item, shapes);
|
||||
|
||||
shape = new ifcopenshell::geometry::Representation::BRep(s, representation_id_builder.str(), shapes);
|
||||
|
||||
@@ -53,8 +53,8 @@ struct matrix4 : public item {
|
||||
auto Z = z.normalized();
|
||||
components <<
|
||||
X(0), Y(0), Z(0), o(0),
|
||||
X(1), Y(1), Z(1), o(0),
|
||||
X(2), Y(2), Z(2), o(0),
|
||||
X(1), Y(1), Z(1), o(1),
|
||||
X(2), Y(2), Z(2), o(2),
|
||||
0, 0, 0, 1.;
|
||||
}
|
||||
|
||||
|
||||
@@ -204,13 +204,13 @@ void ColladaSerializer::ColladaExporter::ColladaScene::add(
|
||||
|
||||
// @todo verify
|
||||
|
||||
const double* posmatrix = transformation_towrite->data().components.data();
|
||||
const double* m = transformation_towrite->data().components.data();
|
||||
|
||||
double matrix_array[4][4] = {
|
||||
{ (double)posmatrix[0], (double)posmatrix[3], (double)posmatrix[6], (double)posmatrix[9] },
|
||||
{ (double)posmatrix[1], (double)posmatrix[4], (double)posmatrix[7], (double)posmatrix[10] },
|
||||
{ (double)posmatrix[2], (double)posmatrix[5], (double)posmatrix[8], (double)posmatrix[11] },
|
||||
{ 0, 0, 0, 1 }
|
||||
{ m[0], m[4], m[8], m[12] },
|
||||
{ m[1], m[5], m[9], m[13] },
|
||||
{ m[2], m[6], m[10], m[14] },
|
||||
{ m[3], m[7], m[11], m[15] }
|
||||
};
|
||||
|
||||
/// @todo: TFK: Rather than applying this offset to all leafs (which might be undesirable) should this offset be applied to a node higher up in the hierarchy?
|
||||
|
||||
Reference in New Issue
Block a user