I am very new to OF and coding in general.
I am trying to write a program that draws polygons using ofPoints.
I manage to draw lines by each clicks and I want to close the polygon if the last click is closer to the first one.
I created a vector of ofPoint vector myPoints; and then I thought that I could test
//close the path
I also tried to use distance= ofDist(myPoints[k],myPoints);
but I get back an error that says no matching function for call to ‘ofDist’
However it looks like there is no way to compare the 2 vectors… How is that?
Any help will be much appreciated!
ofPoint is an alias (aka a “typedef”) for
ofVec3f. You can use the
Thanks! that helped.
I was trying with ofDist() but I didn’t get result.
I am exploring other ways to create these polygons. Probably there are better ways to do it.
you can always do
ofDist(myPoints[k].x, myPoints[k].y, myPoints.x, myPoints.y) if you are looking at 2d distance between ofPoints. (ofDist is written for 2d)
So I can call x and y on the vectors in this simple way.
I sorted out with distance() but this is definitely good to know.