Skip to content

Commit

Permalink
Reverted feed_rate changes after chatting with Dan Heeks. We will att…
Browse files Browse the repository at this point in the history
…ach feed rate info to individual curve elements in a different way.
  • Loading branch information
ddfalck2002@yahoo.com committed May 12, 2011
1 parent 03c1d4e commit f8bd751
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 32 deletions.
42 changes: 17 additions & 25 deletions Curve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
}

Expand Down Expand Up @@ -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<CVertex>::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<CVertex>::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
Expand Down Expand Up @@ -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);
}
}
7 changes: 3 additions & 4 deletions Curve.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions PythonStuff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,11 @@ BOOST_PYTHON_MODULE(area) {
.def(bp::init<CVertex>())
.def(bp::init<int, Point, Point>())
.def(bp::init<Point>())
.def(bp::init<int, Point, Point, int, float>())
.def(bp::init<int, Point, Point, int>())
.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>("Span")
Expand Down

0 comments on commit f8bd751

Please sign in to comment.