mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0028326: Checking invariant shapes in revolve is incomplete
Check for bspline and bezier curves coinciding with the axis of rotation. Minor correction of test case bugs/modalg_6/bug28003
This commit is contained in:
parent
7c441da0d1
commit
d76b39abf1
@ -65,7 +65,8 @@
|
|||||||
#include <TopoDS.hxx>
|
#include <TopoDS.hxx>
|
||||||
#include <TopoDS_Shape.hxx>
|
#include <TopoDS_Shape.hxx>
|
||||||
#include <TopoDS_Vertex.hxx>
|
#include <TopoDS_Vertex.hxx>
|
||||||
|
#include <Geom_BSplineCurve.hxx>
|
||||||
|
#include <Geom_BezierCurve.hxx>
|
||||||
|
|
||||||
#include <TopExp_Explorer.hxx>
|
#include <TopExp_Explorer.hxx>
|
||||||
static Standard_Real ComputeTolerance(TopoDS_Edge& E,
|
static Standard_Real ComputeTolerance(TopoDS_Edge& E,
|
||||||
@ -890,18 +891,32 @@ Standard_Boolean BRepSweep_Rotation::HasShape
|
|||||||
Standard_Boolean BRepSweep_Rotation::IsInvariant
|
Standard_Boolean BRepSweep_Rotation::IsInvariant
|
||||||
(const TopoDS_Shape& aGenS)const
|
(const TopoDS_Shape& aGenS)const
|
||||||
{
|
{
|
||||||
if(aGenS.ShapeType()==TopAbs_EDGE){
|
if(aGenS.ShapeType()==TopAbs_EDGE)
|
||||||
TopLoc_Location Loc;
|
{
|
||||||
Standard_Real First,Last;
|
BRepAdaptor_Curve aC(TopoDS::Edge(aGenS));
|
||||||
Handle(Geom_Curve)
|
if (aC.GetType() == GeomAbs_Line ||
|
||||||
C = BRep_Tool::Curve(TopoDS::Edge(aGenS),Loc,First,Last);
|
aC.GetType() == GeomAbs_BSplineCurve ||
|
||||||
if (C.IsNull() || C->DynamicType() == STANDARD_TYPE(Geom_Line)) {
|
aC.GetType() == GeomAbs_BezierCurve)
|
||||||
|
{
|
||||||
TopoDS_Vertex V1, V2;
|
TopoDS_Vertex V1, V2;
|
||||||
TopExp::Vertices(TopoDS::Edge(aGenS), V1, V2);
|
TopExp::Vertices(TopoDS::Edge(aGenS), V1, V2);
|
||||||
return ( IsInvariant(V1) && IsInvariant(V2));
|
if (IsInvariant(V1) && IsInvariant(V2))
|
||||||
}
|
{
|
||||||
else{
|
if (aC.GetType() == GeomAbs_Line)
|
||||||
return Standard_False;
|
return Standard_True;
|
||||||
|
|
||||||
|
Standard_Real aTol = Max(BRep_Tool::Tolerance(V1), BRep_Tool::Tolerance(V2));
|
||||||
|
gp_Lin Lin(myAxe.Location(), myAxe.Direction());
|
||||||
|
const TColgp_Array1OfPnt& aPoles = (aC.GetType() == GeomAbs_BSplineCurve
|
||||||
|
? aC.BSpline()->Poles() : aC.Bezier()->Poles());
|
||||||
|
|
||||||
|
for (Standard_Integer i=aPoles.Lower(); i <= aPoles.Upper(); i++)
|
||||||
|
{
|
||||||
|
if (Lin.Distance(aPoles(i)) > aTol)
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
return Standard_True;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(aGenS.ShapeType()==TopAbs_VERTEX){
|
else if(aGenS.ShapeType()==TopAbs_VERTEX){
|
||||||
@ -909,8 +924,7 @@ Standard_Boolean BRepSweep_Rotation::IsInvariant
|
|||||||
gp_Lin Lin (myAxe.Location(), myAxe.Direction());
|
gp_Lin Lin (myAxe.Location(), myAxe.Direction());
|
||||||
return ( Lin.Distance(P) <= BRep_Tool::Tolerance(TopoDS::Vertex(aGenS)));
|
return ( Lin.Distance(P) <= BRep_Tool::Tolerance(TopoDS::Vertex(aGenS)));
|
||||||
}
|
}
|
||||||
else
|
return Standard_False;
|
||||||
return Standard_False;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
15
tests/bugs/modalg_6/bug28003
Normal file
15
tests/bugs/modalg_6/bug28003
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
puts "========"
|
||||||
|
puts "OCC28003"
|
||||||
|
puts "========"
|
||||||
|
puts ""
|
||||||
|
#################################################
|
||||||
|
# Cannot revolve a face with a straight B-spline edge lying on axis of revolution
|
||||||
|
#################################################
|
||||||
|
|
||||||
|
restore [locate_data_file bug28003_Surf_Bezier.brep] s
|
||||||
|
revol result s 0 0 0 0 0 1 360
|
||||||
|
|
||||||
|
checkshape result
|
||||||
|
checkprops result -s 129536
|
||||||
|
|
||||||
|
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
16
tests/bugs/modalg_6/bug28326
Normal file
16
tests/bugs/modalg_6/bug28326
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
puts "========"
|
||||||
|
puts "OCC28326"
|
||||||
|
puts "========"
|
||||||
|
puts ""
|
||||||
|
#################################################
|
||||||
|
# Checking invariant shapes in revolve is incomplete
|
||||||
|
#################################################
|
||||||
|
|
||||||
|
polyline w 0 0 0 10 0 0 10 5 0 0 0 0
|
||||||
|
nurbsconvert wn w
|
||||||
|
revol result wn 0 0 0 1 0 0 90
|
||||||
|
|
||||||
|
checkshape result
|
||||||
|
checkprops result -s 63.54
|
||||||
|
|
||||||
|
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
Loading…
x
Reference in New Issue
Block a user