VLTIF
CS426FinalProject
|
Structure which stores relevant lane polygon information. More...
#include <Lane.h>
Public Member Functions | |
Lane () | |
bool | isInside (Point pt) const |
void | draw (Mat &img) const |
void | addVertex (Point pt) |
void | changeLast (Point pt) |
size_t | vertex_count () const |
const vector< Point > & | getVertices () const |
bool | finalize () |
void | clear () |
size_t | size () |
void | pop () |
Rect | bbox () const |
Public Attributes | |
Drawing Parameters | |
Scalar | color |
int | thickness |
int | lineType |
int | shift |
Private Attributes | |
vector< Point > | vertices |
model::polygon < model::d2::point_xy< int > > | poly |
Rect | m_bbox |
Lane::Lane | ( | ) |
void Lane::addVertex | ( | Point | pt | ) |
Add vertex to list
pt | new point |
Definition at line 41 of file Lane.cpp.
References vertices.
Referenced by draw_lanes(), and load_lanes().
{ vertices.push_back(pt); }
Rect Lane::bbox | ( | ) | const |
void Lane::changeLast | ( | Point | pt | ) |
Adjust the last point
pt |
Definition at line 50 of file Lane.cpp.
References vertices.
Referenced by draw_lanes().
{ vertices.back() = pt; }
void Lane::clear | ( | ) |
Clear the list of vertices
Definition at line 140 of file Lane.cpp.
References vertices.
Referenced by draw_lanes(), and load_lanes().
{ vertices.clear(); }
void Lane::draw | ( | Mat & | img | ) | const |
bool Lane::finalize | ( | ) |
Call when finished modifying
Convert the vertex list into a boost polygon
Definition at line 77 of file Lane.cpp.
References m_bbox, poly, and vertices.
{ if ( vertices.size() < 3 ) return false; using boost::assign::tuple_list_of; using boost::make_tuple; using boost::geometry::append; Point minP = vertices[0], maxP = vertices[0]; for( size_t i=1; i<vertices.size(); i++){ if( vertices[i].x < minP.x ) minP.x = vertices[i].x; if( vertices[i].y < minP.y ) minP.y = vertices[i].y; if( vertices[i].x > maxP.x ) maxP.x = vertices[i].x; if( vertices[i].y > maxP.y ) maxP.y = vertices[i].y; } m_bbox = Rect(minP.x, minP.y, maxP.x-minP.x, maxP.y-minP.y); //int* points = &(vertices[0]); for ( vector<Point>::iterator i = vertices.begin(); i != vertices.end(); ++i ) append(poly, tuple_list_of(i->x,i->y)); append(poly, tuple_list_of(vertices[0].x,vertices[0].y)); return true; }
const vector< Point > & Lane::getVertices | ( | ) | const |
bool Lane::isInside | ( | Point | pt | ) | const |
void Lane::pop | ( | ) |
size_t Lane::size | ( | ) |
size_t Lane::vertex_count | ( | ) | const |
Scalar Lane::color |
int Lane::lineType |
Rect Lane::m_bbox [private] |
Definition at line 75 of file Lane.h.
Referenced by bbox(), and finalize().
model::polygon<model::d2::point_xy<int> > Lane::poly [private] |
Definition at line 74 of file Lane.h.
Referenced by finalize(), and isInside().
int Lane::shift |
int Lane::thickness |
vector<Point> Lane::vertices [private] |
Definition at line 73 of file Lane.h.
Referenced by addVertex(), changeLast(), clear(), draw(), finalize(), getVertices(), pop(), size(), and vertex_count().