#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
-
+#include <Geom_BSplineCurve.hxx>
+#include <Geom_BezierCurve.hxx>
#include <TopExp_Explorer.hxx>
static Standard_Real ComputeTolerance(TopoDS_Edge& E,
Standard_Boolean BRepSweep_Rotation::IsInvariant
(const TopoDS_Shape& aGenS)const
{
- if(aGenS.ShapeType()==TopAbs_EDGE){
- TopLoc_Location Loc;
- Standard_Real First,Last;
- Handle(Geom_Curve)
- C = BRep_Tool::Curve(TopoDS::Edge(aGenS),Loc,First,Last);
- if (C.IsNull() || C->DynamicType() == STANDARD_TYPE(Geom_Line)) {
+ if(aGenS.ShapeType()==TopAbs_EDGE)
+ {
+ BRepAdaptor_Curve aC(TopoDS::Edge(aGenS));
+ if (aC.GetType() == GeomAbs_Line ||
+ aC.GetType() == GeomAbs_BSplineCurve ||
+ aC.GetType() == GeomAbs_BezierCurve)
+ {
TopoDS_Vertex V1, V2;
TopExp::Vertices(TopoDS::Edge(aGenS), V1, V2);
- return ( IsInvariant(V1) && IsInvariant(V2));
- }
- else{
- return Standard_False;
+ if (IsInvariant(V1) && IsInvariant(V2))
+ {
+ if (aC.GetType() == GeomAbs_Line)
+ 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){
gp_Lin Lin (myAxe.Location(), myAxe.Direction());
return ( Lin.Distance(P) <= BRep_Tool::Tolerance(TopoDS::Vertex(aGenS)));
}
- else
- return Standard_False;
+ return Standard_False;
}
//=======================================================================
--- /dev/null
+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
--- /dev/null
+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