Code

Convenience access functions for first and last value of a Geom::Piecewise<>
authorcilix42 <cilix42@users.sourceforge.net>
Sun, 18 May 2008 18:31:07 +0000 (18:31 +0000)
committercilix42 <cilix42@users.sourceforge.net>
Sun, 18 May 2008 18:31:07 +0000 (18:31 +0000)
src/2geom/piecewise.h

index d548ea0e9f76f98fbd1d37d472663b213528336c..3b115cb95d971d4f2ed070613ba2b5b25af1eacb 100644 (file)
@@ -73,6 +73,12 @@ class Piecewise {
         unsigned n = segN(t);
         return segs[n](segT(t, n));
     }
+    inline output_type firstValue() const {
+        return valueAt(cuts.front());
+    }
+    inline output_type lastValue() const {
+        return valueAt(cuts.back());
+    }
     std::vector<output_type> valueAndDerivatives(double t, unsigned cnt) const {
         unsigned n = segN(t);
         std::vector<output_type> ret, val = segs[n].valueAndDerivatives(segT(t, n), cnt);