summaryrefslogtreecommitdiffstats
path: root/src/2geom
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2015-03-01 22:23:56 +0000
committerJabiertxof <jtx@jtx.marker.es>2015-03-01 22:23:56 +0000
commitf77b5496f69a5391bc548be95c85659539a92fe9 (patch)
tree119950ee4b1106292d43cc1de4d3eee8f664c3b5 /src/2geom
parentadding mirror knot (diff)
downloadinkscape-f77b5496f69a5391bc548be95c85659539a92fe9.tar.gz
inkscape-f77b5496f69a5391bc548be95c85659539a92fe9.zip
added mirror knots
(bzr r13645.1.26)
Diffstat (limited to 'src/2geom')
-rw-r--r--src/2geom/pointwise.cpp35
-rw-r--r--src/2geom/pointwise.h2
-rw-r--r--src/2geom/satellite.cpp10
-rw-r--r--src/2geom/satellite.h26
4 files changed, 64 insertions, 9 deletions
diff --git a/src/2geom/pointwise.cpp b/src/2geom/pointwise.cpp
index bc468343c..3c359eddc 100644
--- a/src/2geom/pointwise.cpp
+++ b/src/2geom/pointwise.cpp
@@ -123,6 +123,41 @@ Pointwise::findSatellites(int A, int B) const
return ret;
}
+std::vector<Satellite>
+Pointwise::findClosingSatellites(int A, int B) const
+{
+ std::vector<Satellite> ret;
+ bool finded = false;
+ for(unsigned i = 0; i < _satellites.size(); i++){
+ if(finded && _satellites[i].second.getIsStart()){
+ return ret;
+ }
+ if(finded && _satellites[i].second.getIsClosing()){
+ ret.push_back(_satellites[i].second);
+ }
+ if(_satellites[i].first == A){
+ finded = true;
+ }
+ }
+ return ret;
+}
+
+std::vector<Satellite>
+Pointwise::findPeviousSatellites(int A, int B) const
+{
+ std::vector<Satellite> ret;
+ for(unsigned i = 0; i < _satellites.size(); i++){
+ if(_satellites[i].first == A){
+ if(!_satellites[i].second.getIsStart()){
+ ret = findSatellites(_satellites[i-1].first, B);
+ } else {
+ ret = findClosingSatellites(_satellites[i].first, B);
+ }
+ }
+ }
+ return ret;
+}
+
}
/*
Local Variables:
diff --git a/src/2geom/pointwise.h b/src/2geom/pointwise.h
index 5937264ad..c7426dc9d 100644
--- a/src/2geom/pointwise.h
+++ b/src/2geom/pointwise.h
@@ -67,6 +67,8 @@ class Pointwise
Pointwise(Piecewise<D2<SBasis> > pwd2, std::vector<std::pair<int,Satellite> > satellites);
virtual ~Pointwise();
std::vector<Satellite> findSatellites(int A, int B = -1) const;
+ std::vector<Satellite> findPeviousSatellites(int A, int B) const;
+ std::vector<Satellite> findClosingSatellites(int A, int B) const;
std::vector<std::pair<int,Satellite> > getSatellites();
void setSatellites(std::vector<std::pair<int,Satellite> > sat);
Piecewise<D2<SBasis> > getPwd2();
diff --git a/src/2geom/satellite.cpp b/src/2geom/satellite.cpp
index 21361147c..9c253523e 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 active, bool hasMirror, bool hidden, double ammount, double angle)
- : _satellitetype(satellitetype), _isTime(isTime), _active(active), _hasMirror(hasMirror), _hidden(hidden), _ammount(ammount), _angle(angle){};
+Satellite::Satellite(SatelliteType satellitetype, bool isTime, bool isClosing, bool isStart, bool active, bool hasMirror, bool hidden, double ammount, double angle)
+ : _satellitetype(satellitetype), _isTime(isTime), _isClosing(isClosing), _isStart(isStart), _active(active), _hasMirror(hasMirror), _hidden(hidden), _ammount(ammount), _angle(angle){};
Satellite::~Satellite() {};
@@ -98,12 +98,8 @@ Satellite::toSize(double A,Geom::D2<Geom::SBasis> d2_in)
}
double
-Satellite::getOpositeTime(Geom::D2<Geom::SBasis> d2_in)
+Satellite::getOpositeTime(double s, Geom::D2<Geom::SBasis> d2_in)
{
- double s = getAmmount();
- if(getIsTime()){
- s = toSize(s, d2_in);
- }
if(s == 0){
return 1;
}
diff --git a/src/2geom/satellite.h b/src/2geom/satellite.h
index c66770bb6..7581e6e34 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 active, bool hasMirror, bool hidden, double ammount, double angle);
+ Satellite(SatelliteType satellitetype, bool isTime, bool isClosing, bool isStart, bool active, bool hasMirror, bool hidden, double ammount, double angle);
virtual ~Satellite();
@@ -65,6 +65,16 @@ class Satellite
_isTime = A;
}
+ void setIsClosing(bool A)
+ {
+ _isClosing = A;
+ }
+
+ void setIsStart(bool A)
+ {
+ _isStart = A;
+ }
+
void setActive(bool A)
{
_active = A;
@@ -105,6 +115,16 @@ class Satellite
return _isTime;
}
+ bool getIsClosing() const
+ {
+ return _isClosing;
+ }
+
+ bool getIsStart() const
+ {
+ return _isStart;
+ }
+
bool getActive() const
{
return _active;
@@ -133,7 +153,7 @@ class Satellite
void setPosition(Geom::Point p, Geom::D2<Geom::SBasis> d2_in);
Geom::Point getPosition(Geom::D2<Geom::SBasis> curve);
double getTime(Geom::D2<Geom::SBasis> d2_in);
- double getOpositeTime(Geom::D2<Geom::SBasis> SBasisCurve);
+ double getOpositeTime(double A,Geom::D2<Geom::SBasis> SBasisCurve);
double toSize(double A,Geom::D2<Geom::SBasis> d2_in);
double toTime(double A,Geom::D2<Geom::SBasis> d2_in);
@@ -141,6 +161,8 @@ class Satellite
SatelliteType _satellitetype;
bool _isTime;
+ bool _isClosing;
+ bool _isStart;
bool _active;
bool _hasMirror;
bool _hidden;