Skip to content

Commit

Permalink
remember reparametrized curves, trim gordon surface at profs/guides
Browse files Browse the repository at this point in the history
  • Loading branch information
joergbrech committed Dec 11, 2024
1 parent 1c72fb8 commit 7707bc1
Showing 1 changed file with 34 additions and 2 deletions.
36 changes: 34 additions & 2 deletions src/geometry/CTiglMakeLoft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
#include <BRepGProp.hxx>
#include <GProp_GProps.hxx>
#include <BRep_Tool.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>

namespace {
TopoDS_Shape ResortFaces(TopoDS_Shape const& shape, int nu, int nv, bool umajor2vmajor = true);
Expand Down Expand Up @@ -248,12 +250,42 @@ void CTiglMakeLoft::makeLoftGordon()
auto surface = interpolator.Surface();

auto face_maker = BRepBuilderAPI_MakeFace(surface, _myTolerance);
_result = face_maker.Face();
auto gordon_face = face_maker.Face();


// trim gordon face at intersections, so that we have a face for every patch which is enclosed
// by two guides and two profiles
TopoDS_Shell faces;
BRep_Builder builder;
builder.MakeShell(faces);
auto const& us = interpolator.ParametersProfiles();
auto const& vs = interpolator.ParametersGuides();
for (size_t i = 0; i < us.size() - 1; ++i) {
for (size_t j = 0; j < vs.size() - 1; ++j) {
builder.Add(faces, TrimFace(gordon_face, us[i], us[i+1], vs[j], vs[j+1]));
#ifdef DEBUG
tigl::dumpShape(_result, "debugShapes", "gordon_face");
tigl::dumpShape(TrimFace(gordon_face, us[i], us[i+1], vs[j], vs[j+1]), "debugShapes", "gordon_face", i*vs.size() + j);
#endif

}
}
_result = faces;

// since the Gordon Surface algorithm reparametrizes its profiles and guide curves,
// we need to make sure that this instance stores the reparametrized curves before
// closing the shape. Otherwise, there might be tolerance issues when sewing the
// gordon surface faces with side caps.
std::transform(
interpolator.ReparametrizedProfiles().begin(),
interpolator.ReparametrizedProfiles().end(),
profiles.begin(),
[](Handle(Geom_BSplineCurve) const& curve){
auto edge_maker = BRepBuilderAPI_MakeEdge(curve);
auto wire_maker = BRepBuilderAPI_MakeWire(edge_maker.Edge());
return wire_maker.Wire();
}
);


// make surface to face(s). We likely needSurface to trim along profiles and guides.

Expand Down

0 comments on commit 7707bc1

Please sign in to comment.