Code

simplify SPCurve::penultimate_point and return 2geom type
authorjohanengelen <johanengelen@users.sourceforge.net>
Mon, 30 Jun 2008 20:02:10 +0000 (20:02 +0000)
committerjohanengelen <johanengelen@users.sourceforge.net>
Mon, 30 Jun 2008 20:02:10 +0000 (20:02 +0000)
src/display/curve.cpp

index 6c4baaa96560fc4a3ecf9c11d162a235394981b9..5dca3c00f9d5a178bbc62cfafbda59aa274f08c2 100644 (file)
@@ -1030,17 +1030,13 @@ SPCurve::penultimate_point() const
 
     NArtBpath *const bpath = _bpath + _end - 2;
     g_return_val_if_fail(bpath != NULL, NR::Point(0, 0));
-    
-    Geom::Point p(NR_HUGE, NR_HUGE);
-    Geom::Curve const& back = _pathv.back().back();
-    if (_pathv.back().closed()) {
-        p = back.finalPoint();
-    } else {
-        p = back.initialPoint();
-    }
 
-    debug_check("SPCurve::penultimate_point", bpath->c(3) == p );
-    return bpath->c(3);
+
+    Geom::Curve const& back = _pathv.back().back_default();
+    Geom::Point p = back.initialPoint();
+
+    debug_check("SPCurve::penultimate_point", bpath->c(3) == from_2geom(p) );
+    return from_2geom(p);
 }
 
 /**