summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1d545c5)
raw | patch | inline | side by side (parent: 1d545c5)
author | Johan Engelen <goejendaagh@zonnet.nl> | |
Sat, 15 May 2010 22:46:50 +0000 (00:46 +0200) | ||
committer | Johan Engelen <goejendaagh@zonnet.nl> | |
Sat, 15 May 2010 22:46:50 +0000 (00:46 +0200) |
src/live_effects/lpe-knot.cpp | patch | blob | history |
index b3aa2df459e1961a975b9a168ffed6ddcbe54775..b8e9b8cf9609bd6d858d9eea25a579a6d6c92e22 100644 (file)
static
std::vector<Geom::Interval> complementOf(Geom::Interval I, std::vector<Geom::Interval> domain){
std::vector<Geom::Interval> ret;
- double min = domain.front().min();
- double max = domain.back().max();
- Geom::Interval I1 = Geom::Interval(min,I.min());
- Geom::Interval I2 = Geom::Interval(I.max(),max);
-
- for (unsigned i = 0; i<domain.size(); i++){
- boost::optional<Geom::Interval> I1i = intersect(domain.at(i),I1);
- if (I1i && !I1i->isSingular()) ret.push_back(I1i.get());
- boost::optional<Geom::Interval> I2i = intersect(domain.at(i),I2);
- if (I2i && !I2i->isSingular()) ret.push_back(I2i.get());
- }
+ if (!domain.empty()) {
+ double min = domain.front().min();
+ double max = domain.back().max();
+ Geom::Interval I1 = Geom::Interval(min,I.min());
+ Geom::Interval I2 = Geom::Interval(I.max(),max);
+
+ for (unsigned i = 0; i<domain.size(); i++){
+ boost::optional<Geom::Interval> I1i = intersect(domain.at(i),I1);
+ if (I1i && !I1i->isSingular()) ret.push_back(I1i.get());
+ boost::optional<Geom::Interval> I2i = intersect(domain.at(i),I2);
+ if (I2i && !I2i->isSingular()) ret.push_back(I2i.get());
+ }
+ }
return ret;
}