From f8bd751dda2e83514469c507a0d10d8bf25d75c7 Mon Sep 17 00:00:00 2001 From: "ddfalck2002@yahoo.com" Date: Thu, 12 May 2011 17:41:40 +0000 Subject: [PATCH] Reverted feed_rate changes after chatting with Dan Heeks. We will attach feed rate info to individual curve elements in a different way. --- Curve.cpp | 42 +++++++++++++++++------------------------- Curve.h | 7 +++---- PythonStuff.cpp | 4 +--- 3 files changed, 21 insertions(+), 32 deletions(-) diff --git a/Curve.cpp b/Curve.cpp index d6e359e..4e0a728 100644 --- a/Curve.cpp +++ b/Curve.cpp @@ -41,11 +41,11 @@ double Line::Dist(const Point& p)const return pn.dist(p); } -CVertex::CVertex(int type, const Point& p, const Point& c, int user_data,float feed_rate):m_type(type), m_p(p), m_c(c), m_user_data(user_data),m_feed_rate(feed_rate) +CVertex::CVertex(int type, const Point& p, const Point& c, int user_data):m_type(type), m_p(p), m_c(c), m_user_data(user_data) { } -CVertex::CVertex(const Point& p, int user_data, float feed_rate):m_type(0), m_p(p), m_c(0.0, 0.0), m_user_data(user_data),m_feed_rate(0.0) +CVertex::CVertex(const Point& p, int user_data):m_type(0), m_p(p), m_c(0.0, 0.0), m_user_data(user_data) { } @@ -414,28 +414,20 @@ void CCurve::Reverse() double CCurve::GetArea()const { - double area = 0.0; - - Point prev_p = Point(0, 0); - - bool prev_p_valid = false; - - for(std::list::const_iterator It = m_vertices.begin(); It != m_vertices.end(); It++) - - { - const CVertex& vertex = *It; - - if(prev_p_valid) -{ -area += Span(prev_p, vertex).GetArea();} - - prev_p = vertex.m_p; - - prev_p_valid = true; - - } - - return area; + double area = 0.0; + Point prev_p = Point(0, 0); + bool prev_p_valid = false; + for(std::list::const_iterator It = m_vertices.begin(); It != m_vertices.end(); It++) + { + const CVertex& vertex = *It; + if(prev_p_valid) + { + area += Span(prev_p, vertex).GetArea(); + } + prev_p = vertex.m_p; + prev_p_valid = true; + } + return area; } bool CCurve::IsClosed()const @@ -1126,4 +1118,4 @@ void tangential_arc(const Point &p0, const Point &p1, const Point &v0, Point &c, geoff_geometry::Point gc; geoff_geometry::tangential_arc(gp0, gp1, gv0, gc, dir); c = Point(gc.x, gc.y); -} \ No newline at end of file +} diff --git a/Curve.h b/Curve.h index 3219c60..3d609db 100644 --- a/Curve.h +++ b/Curve.h @@ -30,11 +30,10 @@ class CVertex Point m_p; // end point Point m_c; // centre point in absolute coordinates int m_user_data; - float m_feed_rate; - CVertex():m_type(0), m_p(Point(0, 0)), m_c(Point(0,0)), m_user_data(0),m_feed_rate(0){} - CVertex(int type, const Point& p, const Point& c, int user_data = 0, float feed_rate = 0); - CVertex(const Point& p, int user_data = 0, float feed_rate = 0); + CVertex():m_type(0), m_p(Point(0, 0)), m_c(Point(0,0)), m_user_data(0){} + CVertex(int type, const Point& p, const Point& c, int user_data = 0); + CVertex(const Point& p, int user_data = 0); }; class Span diff --git a/PythonStuff.cpp b/PythonStuff.cpp index f8098d6..72ffb03 100644 --- a/PythonStuff.cpp +++ b/PythonStuff.cpp @@ -225,13 +225,11 @@ BOOST_PYTHON_MODULE(area) { .def(bp::init()) .def(bp::init()) .def(bp::init()) - .def(bp::init()) + .def(bp::init()) .def_readwrite("type", &CVertex::m_type) .def_readwrite("p", &CVertex::m_p) .def_readwrite("c", &CVertex::m_c) .def_readwrite("user_data", &CVertex::m_user_data) - .def_readwrite("feed_rate", &CVertex::m_feed_rate) - ; bp::class_("Span")