summaryrefslogtreecommitdiffstats
path: root/src/2geom
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2015-03-07 12:55:16 +0000
committerJabiertxof <jtx@jtx.marker.es>2015-03-07 12:55:16 +0000
commit62ebac099d8fa013e34a773c0fe3aee56b5a5758 (patch)
treed1eea7a31f9fd8f261bc1322f76167c228dcf0b8 /src/2geom
parentAdd to po files (diff)
downloadinkscape-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')
-rw-r--r--src/2geom/pointwise.cpp2
-rw-r--r--src/2geom/satellite.cpp39
-rw-r--r--src/2geom/satellite.h12
3 files changed, 25 insertions, 28 deletions
diff --git a/src/2geom/pointwise.cpp b/src/2geom/pointwise.cpp
index 1d1c69cee..3b182916a 100644
--- a/src/2geom/pointwise.cpp
+++ b/src/2geom/pointwise.cpp
@@ -132,7 +132,7 @@ Pointwise::len_to_rad(double A, std::pair<unsigned int,Geom::Satellite> satelli
boost::optional<Geom::D2<Geom::SBasis> >
Pointwise::getCurveIn(std::pair<unsigned int,Satellite> sat){
//curve out = sat.first;
- std::vector<Geom::Path> path_in_processed = pathv_to_linear_and_cubic_beziers(path_from_piecewise(_pwd2, 0.001));
+ std::vector<Geom::Path> path_in_processed = path_from_piecewise(_pwd2, 0.001);
unsigned int counterTotal = 0;
for (PathVector::const_iterator path_it = path_in_processed.begin(); path_it != path_in_processed.end(); ++path_it) {
if (path_it->empty()){
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
diff --git a/src/2geom/satellite.h b/src/2geom/satellite.h
index 4b0797620..d14a98a7f 100644
--- a/src/2geom/satellite.h
+++ b/src/2geom/satellite.h
@@ -45,7 +45,7 @@ class Satellite
public:
Satellite();
- Satellite(SatelliteType satellitetype, bool isTime, bool isClosing, bool isStart, bool active, bool hasMirror, bool hidden, double ammount, double angle, unsigned int steps);
+ Satellite(SatelliteType satellitetype, bool isTime, bool isClosing, bool isStart, bool active, bool hasMirror, bool hidden, double amount, double angle, unsigned int steps);
virtual ~Satellite();
@@ -89,9 +89,9 @@ class Satellite
{
_hidden = A;
}
- void setAmmount(double A)
+ void setAmount(double A)
{
- _ammount = A;
+ _amount = A;
}
void setAngle(double A)
@@ -145,9 +145,9 @@ class Satellite
return _hidden;
}
- double getAmmount() const
+ double getAmount() const
{
- return _ammount;
+ return _amount;
}
double getAngle() const
@@ -177,7 +177,7 @@ class Satellite
bool _active;
bool _hasMirror;
bool _hidden;
- double _ammount;
+ double _amount;
double _angle;
unsigned int _steps;
};