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!
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_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 );