mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-29 03:37:21 +00:00
CgalShape: Triangulate before calculating area/volume
This commit is contained in:
@@ -36,7 +36,7 @@ void ifcopenshell::geometry::CgalShape::to_poly() const {
|
|||||||
|
|
||||||
convert_to_polyhedron(*nef_, *shape_);
|
convert_to_polyhedron(*nef_, *shape_);
|
||||||
// @todo why is this necessary? we have the mark of the volumes?
|
// @todo why is this necessary? we have the mark of the volumes?
|
||||||
CGAL::Polygon_mesh_processing::orient(*shape_);
|
CGAL::Polygon_mesh_processing::orient_to_bound_a_volume(*shape_);
|
||||||
|
|
||||||
// nef_->convert_to_polyhedron(*shape_);
|
// nef_->convert_to_polyhedron(*shape_);
|
||||||
}
|
}
|
||||||
@@ -275,13 +275,17 @@ OpaqueNumber* ifcopenshell::geometry::CgalShape::CgalShape::length()
|
|||||||
OpaqueNumber* ifcopenshell::geometry::CgalShape::area()
|
OpaqueNumber* ifcopenshell::geometry::CgalShape::area()
|
||||||
{
|
{
|
||||||
to_poly();
|
to_poly();
|
||||||
return new NumberType(CGAL::Polygon_mesh_processing::area(*shape_));
|
auto s = *shape_;
|
||||||
|
CGAL::Polygon_mesh_processing::triangulate_faces(s);
|
||||||
|
return new NumberType(CGAL::Polygon_mesh_processing::area(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
OpaqueNumber* ifcopenshell::geometry::CgalShape::volume()
|
OpaqueNumber* ifcopenshell::geometry::CgalShape::volume()
|
||||||
{
|
{
|
||||||
to_poly();
|
to_poly();
|
||||||
return new NumberType(CGAL::Polygon_mesh_processing::volume(*shape_));
|
auto s = *shape_;
|
||||||
|
CGAL::Polygon_mesh_processing::triangulate_faces(s);
|
||||||
|
return new NumberType(CGAL::Polygon_mesh_processing::volume(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
OpaqueCoordinate<3> ifcopenshell::geometry::CgalShape::position()
|
OpaqueCoordinate<3> ifcopenshell::geometry::CgalShape::position()
|
||||||
|
|||||||
Reference in New Issue
Block a user