Creating Smooth 3D Model from Multiple Profiles with Tangent Continuity

Hello everyone, I urgently need help.

I need to create a 3D model from 4 different profiles (TopoDS_Wire). These profiles can vary slightly—for example, one profile may be longer than another. So far, I have managed to create a wireframe model that ensures the final model will be continuous by controlling tangency at the transitions between profiles.

I tried using BRepOffsetAPI_MakePipeShell, but it doesn't work the way I need. I also tried creating a surface bounded by the profiles, but in that case, tangency continuity was not guaranteed.

Could you please advise me on how to properly create a smooth, continuous 3D shape from these 4 wires, ensuring tangential continuity between them?

Thank you very much in advance!

Attachments: 
Filip Huser's picture

CODE: std::vector<std::pair<Orientation, Orientation>> quadrants{
{Orientation::NORTH, Orientation::EAST},
{Orientation::EAST, Orientation::SOUTH},
{Orientation::SOUTH, Orientation::WEST},
{Orientation::WEST, Orientation::NORTH}
};

auto getTangentFromOrientation = [](Orientation dir) -> gp_Vec {
switch (dir) {
case Orientation::NORTH: return gp_Vec(0, 1, 0);
case Orientation::EAST: return gp_Vec(0, 0, 1);
case Orientation::SOUTH: return gp_Vec(0, -1, 0);
case Orientation::WEST: return gp_Vec(0, 0, -1);
default: return gp_Vec(0, 0, 0);
}
};

int index{ 0 };
for (const auto& quadrant : quadrants)
{
ProfileData startProfile = this->profiles[quadrant.first];
ProfileData endProfile = this->profiles[quadrant.second];

gp_Trsf startTrsf, endTrsf;
startTrsf.SetRotation(rotationAxis, rotationMap[quadrant.first]);
endTrsf.SetRotation(rotationAxis, rotationMap[quadrant.second]);

TopoDS_Wire sWire = TopoDS::Wire(BRepBuilderAPI_Transform(startProfile.profile, startTrsf).Shape());
TopoDS_Wire eWire = TopoDS::Wire(BRepBuilderAPI_Transform(endProfile.profile, endTrsf).Shape());

gp_Pnt P1(startProfile.reflector.end.x, startProfile.reflector.end.y, 0.0);
P1.Transform(startTrsf);

gp_Pnt P2(endProfile.reflector.end.x, endProfile.reflector.end.y, 0.0);
P2.Transform(endTrsf);

Handle(TColgp_HArray1OfPnt) points = new TColgp_HArray1OfPnt(1, 2);
points->SetValue(1, P2);
points->SetValue(2, P1);

GeomAPI_Interpolate interpolator(points, Standard_False, Precision::Confusion());
interpolator.Load(getTangentFromOrientation(quadrant.second), getTangentFromOrientation(quadrant.first), Standard_True);
interpolator.Perform();

Handle(Geom_BSplineCurve) spline = interpolator.Curve();
TopoDS_Edge arcEdge = BRepBuilderAPI_MakeEdge(spline);
TopoDS_Wire arcWire = BRepBuilderAPI_MakeWire(arcEdge);

builder.Add(collimator, arcWire);
builder.Add(collimator, sWire);
builder.Add(collimator, eWire);
builder.Add(collimator , spineWires[index]);
index++;

}

Matthias K.'s picture

This should work using a loft surface created by BRepOffsetAPI_ThruSections. However, I am not sure how tangentiality is fullfilled at the closing edge.

Filip Huser's picture

Hi thanks for reply, but with BRepOffsetAPI_ThruSections you cant control tangentiality between the profiles and also it is kind of "black box"