30 }
catch (
const std::exception& ex) {
31 throw std::runtime_error(
"G4OCCT_STEPSolid: failed to import '" + path +
"' (" + ex.what() +
43 static constexpr double kRelativeDeflection = 0.01;
44 BRepMesh_IncrementalMesh mesher(shape, kRelativeDeflection,
50 for (TopExp_Explorer explorer(shape, TopAbs_FACE); explorer.More(); explorer.Next()) {
51 const TopoDS_Face& face = TopoDS::Face(explorer.Current());
52 TopLoc_Location location;
53 const Handle(Poly_Triangulation) & tri = BRep_Tool::Triangulation(face, location);
54 if (tri.IsNull() || tri->NbTriangles() == 0) {
58 const gp_Trsf& transform = location.Transformation();
59 const bool reverseWinding = (face.Orientation() == TopAbs_REVERSED);
61 for (Standard_Integer i = 1; i <= tri->NbTriangles(); ++i) {
62 Standard_Integer n1, n2, n3;
63 tri->Triangle(i).Get(n1, n2, n3);
68 const gp_Pnt p1 = tri->Node(n1).Transformed(transform);
69 const gp_Pnt p2 = tri->Node(n2).Transformed(transform);
70 const gp_Pnt p3 = tri->Node(n3).Transformed(transform);
73 facet.
v[0] = {p1.X(), p1.Y(), p1.Z()};
74 facet.
v[1] = {p2.X(), p2.Y(), p2.Z()};
75 facet.
v[2] = {p3.X(), p3.Y(), p3.Z()};
81 throw std::runtime_error(
"G4OCCT_STEPSolid: tessellation of '" + path +
82 "' produced no triangles");