Code

No more NRMatrix or NRPoint.
[inkscape.git] / src / libnr / nr-point.h
index f67a66800b22aae5ad044be0a4980756d011b6b1..c1ec3adc9230fa534cb73db2dce412c7b5a11187 100644 (file)
 //#include "round.h"
 #include "decimal-round.h"
 
-/// A NRPoint consists of x and y coodinates.
-/// \todo
-/// This class appears to be obsoleted out in favour of NR::Point.
-struct NRPoint {
-    NR::Coord x, y;
-};
+#include <2geom/point.h>
 
 namespace NR {
 
@@ -38,17 +33,17 @@ public:
         _pt[Y] = y;
     }
 
-    inline Point(NRPoint const &p) {
-        _pt[X] = p.x;
-        _pt[Y] = p.y;
-    }
-
     inline Point(Point const &p) {
         for (unsigned i = 0; i < 2; ++i) {
             _pt[i] = p._pt[i];
         }
     }
 
+    inline Point(Geom::Point const &p) {
+        _pt[X] = p[Geom::X];
+        _pt[Y] = p[Geom::Y];
+    }
+
     inline Point &operator=(Point const &p) {
         for (unsigned i = 0; i < 2; ++i) {
             _pt[i] = p._pt[i];
@@ -132,6 +127,10 @@ public:
 
     friend inline std::ostream &operator<< (std::ostream &out_file, const NR::Point &in_pnt);
 
+    inline Geom::Point to_2geom() const {
+        return Geom::Point(_pt[X], _pt[Y]);
+    }
+
 private:
     Coord _pt[2];
 };