diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2015-03-07 12:55:16 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2015-03-07 12:55:16 +0000 |
| commit | 62ebac099d8fa013e34a773c0fe3aee56b5a5758 (patch) | |
| tree | d1eea7a31f9fd8f261bc1322f76167c228dcf0b8 /src/2geom/satellite.cpp | |
| parent | Add to po files (diff) | |
| download | inkscape-62ebac099d8fa013e34a773c0fe3aee56b5a5758.tar.gz inkscape-62ebac099d8fa013e34a773c0fe3aee56b5a5758.zip | |
finish helper paths and beter handle of fillet/chamfer overflow. Also make the satellitepairarray LPE parameter usable for other pointwise effects, not only to fillet chamfer
(bzr r13645.1.35)
Diffstat (limited to 'src/2geom/satellite.cpp')
| -rw-r--r-- | src/2geom/satellite.cpp | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/src/2geom/satellite.cpp b/src/2geom/satellite.cpp index 22c3c8bed..3420db7f6 100644 --- a/src/2geom/satellite.cpp +++ b/src/2geom/satellite.cpp @@ -40,8 +40,8 @@ namespace Geom { Satellite::Satellite(){}; -Satellite::Satellite(SatelliteType satellitetype, bool isTime, bool isClosing, bool isStart, bool active, bool hasMirror, bool hidden, double ammount, double angle, unsigned int steps) - : _satellitetype(satellitetype), _isTime(isTime), _isClosing(isClosing), _isStart(isStart), _active(active), _hasMirror(hasMirror), _hidden(hidden), _ammount(ammount), _angle(angle), _steps(steps){}; +Satellite::Satellite(SatelliteType satellitetype, bool isTime, bool isClosing, bool isStart, bool active, bool hasMirror, bool hidden, double amount, double angle, unsigned int steps) + : _satellitetype(satellitetype), _isTime(isTime), _isClosing(isClosing), _isStart(isStart), _active(active), _hasMirror(hasMirror), _hidden(hidden), _amount(amount), _angle(angle), _steps(steps){}; Satellite::~Satellite() {}; @@ -49,13 +49,14 @@ double Satellite::toTime(double A,Geom::D2<Geom::SBasis> d2_in) { if(!d2_in.isFinite() || d2_in.isZero() || A == 0){ - _ammount = 0; return 0; } double t = 0; double lenghtPart = Geom::length(d2_in, Geom::EPSILON); - if (A > lenghtPart) { - t = 1; + if (A > lenghtPart || d2_in[0].degreesOfFreedom() == 2) { + if (lenghtPart != 0) { + t = A / lenghtPart; + } } else if (d2_in[0].degreesOfFreedom() != 2) { Geom::Piecewise<Geom::D2<Geom::SBasis> > u; u.push_cut(0); @@ -64,15 +65,8 @@ Satellite::toTime(double A,Geom::D2<Geom::SBasis> d2_in) if (t_roots.size() > 0) { t = t_roots[0]; } - } else { - //to be sure - if (lenghtPart != 0) { - t = A / lenghtPart; - } - } - if(t > 0.998){ - t = 1; } + return t; } @@ -80,19 +74,18 @@ double Satellite::toSize(double A,Geom::D2<Geom::SBasis> d2_in) { if(!d2_in.isFinite() || d2_in.isZero() || A == 0){ - _ammount = 0; return 0; } double s = 0; double lenghtPart = Geom::length(d2_in, Geom::EPSILON); - if (d2_in[0].degreesOfFreedom() != 2) { + if (A > lenghtPart || d2_in[0].degreesOfFreedom() == 2) { + s = (A * lenghtPart); + } else if (d2_in[0].degreesOfFreedom() != 2) { Geom::Piecewise<Geom::D2<Geom::SBasis> > u; u.push_cut(0); u.push(d2_in, 1); u = Geom::portion(u, 0.0, A); s = Geom::length(u, 0.001); - } else { - s = (A * lenghtPart); } return s; } @@ -110,16 +103,19 @@ Satellite::getOpositeTime(double s, Geom::D2<Geom::SBasis> d2_in) double Satellite::getTime(Geom::D2<Geom::SBasis> d2_in){ - double t = getAmmount(); + double t = getAmount(); if(!getIsTime()){ t = toTime(t, d2_in); } + if(t > 1){ + t = 1; + } return t; } double Satellite::getSize(Geom::D2<Geom::SBasis> d2_in){ - double s = getAmmount(); + double s = getAmount(); if(getIsTime()){ s = toSize(s, d2_in); } @@ -129,7 +125,8 @@ Satellite::getSize(Geom::D2<Geom::SBasis> d2_in){ Geom::Point Satellite::getPosition(Geom::D2<Geom::SBasis> d2_in){ - return d2_in.valueAt(getTime(d2_in)); + double t = getTime(d2_in); + return d2_in.valueAt(t); } void @@ -139,7 +136,7 @@ Satellite::setPosition(Geom::Point p, Geom::D2<Geom::SBasis> d2_in) if(!getIsTime()){ A = toSize(A, d2_in); } - setAmmount(A); + setAmount(A); } } // end namespace Geom |
