From 3d4fe6dafc4ba7fe012536b9c48aa961fc437889 Mon Sep 17 00:00:00 2001 From: PKV <> Date: Thu, 11 Aug 2011 12:04:41 +0000 Subject: [PATCH] 0022588: Revolution with negative volume in some cases. --- src/BRepSweep/BRepSweep_Rotation.cxx | 59 +++++++++++++++++++++++++--- 1 file changed, 53 insertions(+), 6 deletions(-) diff --git a/src/BRepSweep/BRepSweep_Rotation.cxx b/src/BRepSweep/BRepSweep_Rotation.cxx index 75845ef50e..8389d3c1e0 100755 --- a/src/BRepSweep/BRepSweep_Rotation.cxx +++ b/src/BRepSweep/BRepSweep_Rotation.cxx @@ -627,15 +627,61 @@ void BRepSweep_Rotation::SetDirectingPCurve thePCurve); } - +//modified by NIZNHY-PKV Tue Jun 14 08:33:55 2011f //======================================================================= //function : DirectSolid //purpose : //======================================================================= - -TopAbs_Orientation BRepSweep_Rotation::DirectSolid - (const TopoDS_Shape& aGenS, - const Sweep_NumShape&) +TopAbs_Orientation + BRepSweep_Rotation::DirectSolid (const TopoDS_Shape& aGenS, + const Sweep_NumShape&) +{ // compare the face normal and the direction + Standard_Real aU1, aU2, aV1, aV2, aUx, aVx, aX, aMV2, aTol2, aTx; + TopAbs_Orientation aOr; + gp_Pnt aP; + gp_Vec du,dv; + BRepAdaptor_Surface surf(TopoDS::Face(aGenS)); + // + aTol2=Precision::Confusion(); + aTol2=aTol2*aTol2; + // + const gp_Pnt& aPAxeLoc=myAxe.Location(); + const gp_Dir& aPAxeDir=myAxe.Direction(); + // + aU1=surf.FirstUParameter(); + aU2=surf.LastUParameter(); + aV1=surf.FirstVParameter(); + aV2=surf.LastVParameter(); + // + aTx=0.5; + aUx=aTx*(aU1+aU2); + aVx=aTx*(aV1+aV2); + surf.D1(aUx, aVx, aP, du, dv); + // + gp_Vec aV(aPAxeLoc, aP); + aV.Cross(aPAxeDir); + aMV2=aV.SquareMagnitude(); + if (aMV2 0.) ? TopAbs_FORWARD : TopAbs_REVERSED; + return aOr; +} +/* +//======================================================================= +//function : DirectSolid +//purpose : +//======================================================================= +TopAbs_Orientation + BRepSweep_Rotation::DirectSolid (const TopoDS_Shape& aGenS, + const Sweep_NumShape&) { // compare the face normal and the direction BRepAdaptor_Surface surf(TopoDS::Face(aGenS)); @@ -651,7 +697,8 @@ TopAbs_Orientation BRepSweep_Rotation::DirectSolid TopAbs_Orientation orient = (x > 0) ? TopAbs_FORWARD : TopAbs_REVERSED; return orient; } - +*/ +//modified by NIZNHY-PKV Tue Jun 14 08:33:59 2011t //======================================================================= //function : GGDShapeIsToAdd