i'm developing in codeblocks and I have the following:
struct intersectionData_t
{
unsigned int idxOfBlob;
unsigned int idxOfRoad;
ofPoint xPt; //interesection (cross) point
};
typedef vector<intersectionData_t> plineXD_t;
vector<plineXD_t> plinesXData;
basically, each polyline has a vector of intersections registered in plineXD_t
. Then plinesXData
is just the vector of all the polylines.
in my implementation:
plineXD_t xData = findIntersectionData( trackedBlob , origRoads[i] );
if ( !xData.empty() )
plinesXData.push_back( xData );
I get some weird values from plinesXData[i]
later on in the code so I am trying to see what is generated here in xData
.
when the watch in codeblocks returns xData[0] : Could not find operator[].
same if I try plinesXData[i][0].
EDIT: xData.size()
does not return a number (the watch field is empty).
EDIT2: findInterestionData fills in the vector intersectionData_t with the all intersection points xPt
found between 2 polylines. It also stores the indices idxOfRoad & idxOfBlob
of the points just before an intersection for each polyline for quick access.
path::plineXD_t path::findIntersectionData( \
const ofPolyline& trackedBlob , const ofPolyline& road)
{
plineXD_t xD;
//for all line segments of path...
for (unsigned int i = 0 ; i < road.size()-1 ; i++)
{
//...test all line segs of trackedBlob for intersections
for (unsigned int j = 0 ; j < trackedBlob.size()-1 ; j++)
{
ofPoint intersectionPoint = ofPoint(0,0);
if (ofLineSegmentIntersection(road[i] , road[i+1] , trackedBlob[j] , trackedBlob[j+1] , intersectionPoint ))
{
struct intersectionData_t id;
id.idxOfRoad = i;
id.idxOfBlob = j;
id.xPt = intersectionPoint;
xD.push_back( id );
}
}
}
return xD;
}
what is this ? how can I see the values of the xData vector?