if a shape to be rotated is a vertex, and it is located ON the Revolution Axis, then the algorithm builds a circle with null radius. Incorrect, visualization of such shape fails. This case is checked and revolution is not done in this case.

This commit is contained in:
asv 2005-08-01 12:51:04 +00:00
parent f24ba2bafa
commit 60efe138c3

View File

@ -15,6 +15,8 @@ using namespace std;
#include <TopExp.hxx> #include <TopExp.hxx>
#include <gp_Pnt.hxx> #include <gp_Pnt.hxx>
#include <gp_Lin.hxx>
#include <gp_Dir.hxx>
#include <Precision.hxx> #include <Precision.hxx>
#include <StdFail_NotDone.hxx> #include <StdFail_NotDone.hxx>
#include <Standard_TypeMismatch.hxx> #include <Standard_TypeMismatch.hxx>
@ -75,6 +77,14 @@ Standard_Integer GEOMImpl_RevolutionDriver::Execute(TFunction_Logbook& log) cons
("End vertices of edge, defining the Revolution Axis, are too close"); ("End vertices of edge, defining the Revolution Axis, are too close");
} }
if (aShapeBase.ShapeType() == TopAbs_VERTEX) {
gp_Lin aL(BRep_Tool::Pnt(V1), gp_Dir(aV));
Standard_Real d = aL.Distance(BRep_Tool::Pnt(TopoDS::Vertex(aShapeBase)));
if (d < Precision::Confusion()) {
Standard_ConstructionError::Raise("Vertex to be rotated is too close to Revolution Axis");
}
}
gp_Ax1 anAxis (BRep_Tool::Pnt(V1), aV); gp_Ax1 anAxis (BRep_Tool::Pnt(V1), aV);
BRepPrimAPI_MakeRevol MR (aShapeBase, anAxis, aCI.GetAngle(), Standard_False); BRepPrimAPI_MakeRevol MR (aShapeBase, anAxis, aCI.GetAngle(), Standard_False);
if (!MR.IsDone()) MR.Build(); if (!MR.IsDone()) MR.Build();