Skip to content

Commit

Permalink
Fix #1937 mis-shapen projections in TechDraw and Drawing
Browse files Browse the repository at this point in the history
Complex curves need more bezier segments for accurate representation.
  • Loading branch information
WandererFan authored and wwmayer committed May 30, 2017
1 parent fabc800 commit 052704e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Mod/Drawing/App/DrawingExport.cpp
Expand Up @@ -362,7 +362,7 @@ void SVGOutput::printBSpline(const BRepAdaptor_Curve& c, int id, std::ostream& o
Handle(Geom_BSplineCurve) spline = c.BSpline();
if (spline->Degree() > 3 || spline->IsRational()) {
Standard_Real tol3D = 0.001;
Standard_Integer maxDegree = 3, maxSegment = 50;
Standard_Integer maxDegree = 3, maxSegment = 100;
Handle(BRepAdaptor_HCurve) hCurve = new BRepAdaptor_HCurve(c);
// approximate the curve using a tolerance
Approx_Curve3d approx(hCurve,tol3D,GeomAbs_C0,maxSegment,maxDegree);
Expand Down
7 changes: 2 additions & 5 deletions src/Mod/TechDraw/App/Geometry.cpp
Expand Up @@ -433,13 +433,10 @@ BSpline::BSpline(const TopoDS_Edge &e)
bool fail = false;
double f,l;
gp_Pnt s,m,ePt;
//if startpoint == endpoint conversion to BSpline will fail
//Base::Console().Message("TRACE - Geometry::BSpline - start(%.3f,%.3f,%.3f) end(%.3f,%.3f,%.3f)\n",
// s.X(),s.Y(),s.Z(),ePt.X(),ePt.Y(),ePt.Z());

if (spline->Degree() > 3) { //if spline is too complex, approximate it
if (spline->Degree() > 3 || spline->IsRational()) { //if spline is too complex, approximate it
Standard_Real tol3D = 0.001; //1/1000 of a mm? screen can't resolve this
Standard_Integer maxDegree = 3, maxSegment = 10;
Standard_Integer maxDegree = 3, maxSegment = 100;
Handle(BRepAdaptor_HCurve) hCurve = new BRepAdaptor_HCurve(c);
// approximate the curve using a tolerance
//Approx_Curve3d approx(hCurve, tol3D, GeomAbs_C2, maxSegment, maxDegree); //gives degree == 5 ==> too many poles ==> buffer overrun
Expand Down

0 comments on commit 052704e

Please sign in to comment.