diff --git a/src/Geom/Geom_OffsetSurface.cxx b/src/Geom/Geom_OffsetSurface.cxx index c708bb0a9f..049a5c1387 100644 --- a/src/Geom/Geom_OffsetSurface.cxx +++ b/src/Geom/Geom_OffsetSurface.cxx @@ -1625,16 +1625,33 @@ Handle(Geom_Surface) Geom_OffsetSurface::Surface() const { Handle(Geom_ConicalSurface) C = Handle(Geom_ConicalSurface)::DownCast(Base); - Standard_Real Alpha = C->SemiAngle(); - Standard_Real Radius = C->RefRadius() + offsetValue * Cos(Alpha); - gp_Ax3 Axis = C->Position(); - if ( Radius >= 0.) { - gp_Vec Z( Axis.Direction()); - Z *= - offsetValue * Sin(Alpha); - Axis.Translate(Z); - Result = new Geom_ConicalSurface(Axis, Alpha, Radius); + gp_Ax3 anAxis = C->Position(); + Standard_Boolean isDirect = anAxis.Direct(); + Standard_Real anAlpha = C->SemiAngle(); + Standard_Real aRadius; + if (isDirect) + { + aRadius = C->RefRadius() + offsetValue * Cos (anAlpha); } - else + else + { + aRadius = C->RefRadius() - offsetValue * Cos (anAlpha); + } + if (aRadius >= 0.) + { + gp_Vec aZ (anAxis.Direction()); + if (isDirect) + { + aZ *= -offsetValue * Sin (anAlpha); + } + else + { + aZ *= offsetValue * Sin (anAlpha); + } + anAxis.Translate (aZ); + Result = new Geom_ConicalSurface (anAxis, anAlpha, aRadius); + } + else { // surface degeneree } diff --git a/tests/bugs/moddata_3/bug26369 b/tests/bugs/moddata_3/bug26369 new file mode 100644 index 0000000000..f732aac757 --- /dev/null +++ b/tests/bugs/moddata_3/bug26369 @@ -0,0 +1,29 @@ +puts "============" +puts "CR26369" +puts "============" +puts "" +################################################################################### +# Modeling Data - Geom_OffsetSurface direction is wrong for indirect conical surface +################################################################################### + +restore [locate_data_file bug26369_conicsurf.brep] conic_face + +mksurface conic_surf conic_face +offset conic_surf_offset conic_surf 0.05 +mkface conic_face_offset conic_surf_offset + +set sprops_s [sprops conic_face_offset] +set cog_x -0.00408684 +set cog_y 0.00408684 +set cog_z -0.03213030 +set cog_tol 0.00000010 + +regexp {X += +([-0-9.+eE]+)} $sprops_s full res_cog_x +regexp {Y += +([-0-9.+eE]+)} $sprops_s full res_cog_y +regexp {Z += +([-0-9.+eE]+)} $sprops_s full res_cog_z + +if { ([expr abs($cog_x - $res_cog_x)] > $cog_tol) + || ([expr abs($cog_y - $res_cog_y)] > $cog_tol) + || ([expr abs($cog_z - $res_cog_z)] > $cog_tol) } { + puts "Error: The center of gravity for offset of conical surface is wrong." +}