mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0031855: Modeling Algorithms - regression of the unifysamedom command.
Transformation of 2d-curves on elementary surfaces has been corrected.
This commit is contained in:
parent
16ed73bec5
commit
3e98579a83
@ -854,9 +854,13 @@ static void TransformPCurves(const TopoDS_Face& theRefFace,
|
|||||||
SurfFace = (Handle(Geom_RectangularTrimmedSurface)::DownCast(SurfFace))->BasisSurface();
|
SurfFace = (Handle(Geom_RectangularTrimmedSurface)::DownCast(SurfFace))->BasisSurface();
|
||||||
|
|
||||||
Standard_Boolean ToModify = Standard_False,
|
Standard_Boolean ToModify = Standard_False,
|
||||||
ToTranslate = Standard_False, Y_Reverse = Standard_False, ToProject = Standard_False;
|
ToTranslate = Standard_False,
|
||||||
|
ToRotate = Standard_False,
|
||||||
|
X_Reverse = Standard_False,
|
||||||
|
Y_Reverse = Standard_False,
|
||||||
|
ToProject = Standard_False;
|
||||||
|
|
||||||
gp_Vec2d Translation(0.,0.);
|
Standard_Real aTranslation = 0., anAngle = 0.;
|
||||||
|
|
||||||
//Get axes of surface of face and of surface of RefFace
|
//Get axes of surface of face and of surface of RefFace
|
||||||
Handle(Geom_ElementarySurface) ElemSurfFace = Handle(Geom_ElementarySurface)::DownCast(SurfFace);
|
Handle(Geom_ElementarySurface) ElemSurfFace = Handle(Geom_ElementarySurface)::DownCast(SurfFace);
|
||||||
@ -872,27 +876,37 @@ static void TransformPCurves(const TopoDS_Face& theRefFace,
|
|||||||
Standard_Real aParam = ElCLib::LineParameter(AxisOfSurfFace.Axis(), OriginRefSurf);
|
Standard_Real aParam = ElCLib::LineParameter(AxisOfSurfFace.Axis(), OriginRefSurf);
|
||||||
|
|
||||||
if (Abs(aParam) > Precision::PConfusion())
|
if (Abs(aParam) > Precision::PConfusion())
|
||||||
Translation.SetY(-aParam);
|
aTranslation = -aParam;
|
||||||
|
|
||||||
gp_Dir VdirSurfFace = AxisOfSurfFace.Direction();
|
gp_Dir VdirSurfFace = AxisOfSurfFace.Direction();
|
||||||
gp_Dir VdirRefSurf = AxisOfRefSurf.Direction();
|
gp_Dir VdirRefSurf = AxisOfRefSurf.Direction();
|
||||||
gp_Dir XdirSurfFace = AxisOfSurfFace.XDirection();
|
gp_Dir XdirSurfFace = AxisOfSurfFace.XDirection();
|
||||||
gp_Dir XdirRefSurf = AxisOfRefSurf.XDirection();
|
gp_Dir XdirRefSurf = AxisOfRefSurf.XDirection();
|
||||||
|
|
||||||
Standard_Real anAngle = XdirRefSurf.AngleWithRef(XdirSurfFace, VdirRefSurf);
|
gp_Dir CrossProd1 = AxisOfRefSurf.XDirection() ^ AxisOfRefSurf.YDirection();
|
||||||
if (!AxisOfRefSurf.Direct())
|
gp_Dir CrossProd2 = AxisOfSurfFace.XDirection() ^ AxisOfSurfFace.YDirection();
|
||||||
anAngle *= -1;
|
if (CrossProd1 * CrossProd2 < 0.)
|
||||||
|
X_Reverse = Standard_True;
|
||||||
if (Abs(anAngle) > Precision::PConfusion())
|
|
||||||
Translation.SetX(anAngle);
|
|
||||||
|
|
||||||
Standard_Real ScalProd = VdirSurfFace * VdirRefSurf;
|
Standard_Real ScalProd = VdirSurfFace * VdirRefSurf;
|
||||||
if (ScalProd < 0.)
|
if (ScalProd < 0.)
|
||||||
Y_Reverse = Standard_True;
|
Y_Reverse = Standard_True;
|
||||||
|
|
||||||
ToTranslate = !(Translation.XY().IsEqual(gp_XY(0.,0.), Precision::PConfusion()));
|
if (!X_Reverse && !Y_Reverse)
|
||||||
|
{
|
||||||
|
gp_Dir DirRef = VdirRefSurf;
|
||||||
|
if (!AxisOfRefSurf.Direct())
|
||||||
|
DirRef.Reverse();
|
||||||
|
anAngle = XdirRefSurf.AngleWithRef(XdirSurfFace, DirRef);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
anAngle = XdirRefSurf.Angle(XdirSurfFace);
|
||||||
|
|
||||||
ToModify = ToTranslate || Y_Reverse;
|
ToRotate = (Abs(anAngle) > Precision::PConfusion());
|
||||||
|
|
||||||
|
ToTranslate = (Abs(aTranslation) > Precision::PConfusion());
|
||||||
|
|
||||||
|
ToModify = ToTranslate || ToRotate || X_Reverse || Y_Reverse;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -933,9 +947,16 @@ static void TransformPCurves(const TopoDS_Face& theRefFace,
|
|||||||
aNewPCurve = Handle(Geom2d_Curve)::DownCast(aPCurve->Copy());
|
aNewPCurve = Handle(Geom2d_Curve)::DownCast(aPCurve->Copy());
|
||||||
}
|
}
|
||||||
if (ToTranslate)
|
if (ToTranslate)
|
||||||
aNewPCurve->Translate(Translation);
|
aNewPCurve->Translate(gp_Vec2d(0., aTranslation));
|
||||||
if (Y_Reverse)
|
if (Y_Reverse)
|
||||||
aNewPCurve->Mirror(gp::OX2d());
|
aNewPCurve->Mirror(gp::OX2d());
|
||||||
|
if (X_Reverse)
|
||||||
|
{
|
||||||
|
aNewPCurve->Mirror(gp::OY2d());
|
||||||
|
aNewPCurve->Translate(gp_Vec2d(2*M_PI, 0.));
|
||||||
|
}
|
||||||
|
if (ToRotate)
|
||||||
|
aNewPCurve->Translate(gp_Vec2d(anAngle, 0.));
|
||||||
|
|
||||||
theMapEdgesWithTemporaryPCurves.Add(anEdge);
|
theMapEdgesWithTemporaryPCurves.Add(anEdge);
|
||||||
|
|
||||||
@ -2256,7 +2277,7 @@ void ShapeUpgrade_UnifySameDomain::IntUnifyFaces(const TopoDS_Shape& theInpShape
|
|||||||
|
|
||||||
// surface and location to construct result
|
// surface and location to construct result
|
||||||
TopLoc_Location aBaseLocation;
|
TopLoc_Location aBaseLocation;
|
||||||
Handle(Geom_Surface) aBaseSurface = BRep_Tool::Surface(aFace,aBaseLocation);
|
Handle(Geom_Surface) aBaseSurface = BRep_Tool::Surface(aFace);
|
||||||
aBaseSurface = ClearRts(aBaseSurface);
|
aBaseSurface = ClearRts(aBaseSurface);
|
||||||
TopAbs_Orientation RefFaceOrientation = aFace.Orientation();
|
TopAbs_Orientation RefFaceOrientation = aFace.Orientation();
|
||||||
|
|
||||||
|
19
tests/bugs/heal/bug31855_1
Normal file
19
tests/bugs/heal/bug31855_1
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
puts "================================================="
|
||||||
|
puts "OCC31855: Regression of the unifysamedom command."
|
||||||
|
puts "================================================="
|
||||||
|
puts ""
|
||||||
|
|
||||||
|
restore [locate_data_file bug31855_1.brep] a
|
||||||
|
unifysamedom result a
|
||||||
|
|
||||||
|
checkshape result
|
||||||
|
|
||||||
|
checknbshapes result -vertex 89 -edge 134 -wire 47 -face 47 -shell 1 -solid 1
|
||||||
|
|
||||||
|
set tolres [checkmaxtol result]
|
||||||
|
|
||||||
|
if { ${tolres} > 0.0006} {
|
||||||
|
puts "Error: bad tolerance of result"
|
||||||
|
}
|
||||||
|
|
||||||
|
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
19
tests/bugs/heal/bug31855_2
Normal file
19
tests/bugs/heal/bug31855_2
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
puts "================================================="
|
||||||
|
puts "OCC31855: Regression of the unifysamedom command."
|
||||||
|
puts "================================================="
|
||||||
|
puts ""
|
||||||
|
|
||||||
|
restore [locate_data_file bug31855_2.brep] a
|
||||||
|
unifysamedom result a
|
||||||
|
|
||||||
|
checkshape result
|
||||||
|
|
||||||
|
checknbshapes result -vertex 664 -edge 996 -wire 484 -face 406 -shell 1 -solid 1
|
||||||
|
|
||||||
|
set tolres [checkmaxtol result]
|
||||||
|
|
||||||
|
if { ${tolres} > 2.e-7} {
|
||||||
|
puts "Error: bad tolerance of result"
|
||||||
|
}
|
||||||
|
|
||||||
|
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
19
tests/bugs/heal/bug31855_3
Normal file
19
tests/bugs/heal/bug31855_3
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
puts "================================================="
|
||||||
|
puts "OCC31855: Regression of the unifysamedom command."
|
||||||
|
puts "================================================="
|
||||||
|
puts ""
|
||||||
|
|
||||||
|
restore [locate_data_file bug31855_3.brep] a
|
||||||
|
unifysamedom result a
|
||||||
|
|
||||||
|
checkshape result
|
||||||
|
|
||||||
|
checknbshapes result -vertex 272 -edge 408 -wire 150 -face 143 -shell 1 -solid 1
|
||||||
|
|
||||||
|
set tolres [checkmaxtol result]
|
||||||
|
|
||||||
|
if { ${tolres} > 2.e-7} {
|
||||||
|
puts "Error: bad tolerance of result"
|
||||||
|
}
|
||||||
|
|
||||||
|
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
Loading…
x
Reference in New Issue
Block a user