Face created by MakeRevol is bumpy or inaccurate sometimes


I'm using BRepPrimAPI_MakeRevol to create a tangent ogive from a circular arc. I find that in certain cases the resulting surface is poorly faceted or is completely inaccurate.

For example, in the attached image, the center ogive is poorly faceted.

Increasing the ogive height, as shown at right, the resulting shape is asymmetric. The off-center apex appears to be co-located with the protruding vertex on the center example.

If the tip of ogive is truncated (so there is no point discontinuity), as shown in the left example, the ogive is rendered perfectly.

I've tried applying ShapeFix_Shell and ShellUpgrade_ShellSewing to the resulting shape with no improvement.

Does anyone know what I'm doing wrong? Example code is below. Thank you!

Harry Voorhees

TopoDS_Shape makeTangentOgive( double baseRadius, double ogiveHeight, double topHeight, double segmentAngleSpan )
// Compute the circular arc that, when revolved, defines the ogive segment surface
const double ogiveRadius = (baseRadius*baseRadius + ogiveHeight*ogiveHeight) / (2*baseRadius);
const double topAngle = asin( topHeight / ogiveRadius );
const gp_Vec ogiveCenter( baseRadius - ogiveRadius, 0, 0 );

// Rotate the circular arc about -y axis passing through ogive center
gp_Ax2 ogiveArcAxis( gp_Pnt( ogiveCenter.X(), ogiveCenter.Y(), ogiveCenter.Z() ),
gp_Dir( 0, -1, 0 ));
ogiveArcAxis.SetXDirection( gp_Dir( 1, 0, 0 ));
BRepBuilderAPI_MakeWire wire;
BRepBuilderAPI_MakeEdge arc( gp_Circ( ogiveArcAxis, ogiveRadius ), 0, topAngle );
wire.Add( arc );

// Revolve the wire about the z axis to create the ogive section.
gp_Ax1 axis( gp_Pnt( 0, 0, 0 ), gp_Dir( 0, 0, 1 ));
return BRepPrimAPI_MakeRevol( wire.Wire(), axis, segmentAngleSpan );

AP's picture

Try doing this before displaying

TopoDS_Shape myrev = BRepPrimAPI_MakeRevol.Shape();

BRepMesh::Mesh(myrev, 0.2);

AIS_Shape anAIS = new AIS_Shape(myrev);
myAISContext->Display(new AIS_Gauss(anAIS, true));

if it improves, then i suspect it is a decimation problem, remember analytic surfaces are infinitely continuous, you can triangulate them just to show it in the screen, which is finite in the number of triangles it can show, but given a super-fast computer and enough time you could make the most accurate tessellation over your analytic surface.

also check by exporting as igs or step and opening it in another software, if it looks as it should, then again it just a surface decimation problem.



AP's picture

fix this:
AIS_Shape anAIS = new AIS_Shape(myrev);

hlvoorhees's picture

AlexP, a belated thank you for the reply.

Just to follow up for anyone else who may encounter this issue: I found that remeshing did not help, but removing the tip of the ogive did help - it can be replaced with a cone or similar end cap.