ofPath documentation?


I am currently working with paths but i really miss some information about it.
Step by step i get to understand basics but i still have some bad times finding how things work.

Generally speaking, classes names are evocative enough about their purpose, but for ofPath or ofPolyline i don’t understand their function. Maybe someone could explain as solutions to my problems may start with some of them !

What are the purpose of :

  • ofPath::flagShapeChanged()
  • ofPath::getMode() that is what are the differences between modes ?
  • ofPath::hasChanged()
  • ofPath::commands::cp1::cross()
  • ofPath::commands::cp1::one()
  • ofPath::commands::cp1::match()
  • ofPath::commands::cp1::dot()
  • flagShapeChanged can be used if you modify the comands manually to tell the path to generate again the internal polylines or mesh.

  • hasChanged returns true if the path has been flagged as changed and shouldn’t really be necesary from outside the path, it should probably be private but i need to check

  • getMode and setMode allow to set the path to directly store the polylines instead of the commands, that way it’s slightly faster but won’t allow to modify the primitives later or use it in renderers like cairo that are able to render the primitives directly without decomposing them into lines. it’s used mostly internally by OF for performance reasons when drawing some primitives in immediate mode

the rest of the functions you post are just methods of ofVec3f, like cross product, the identity vector… take a look at ofVec3f docs to see what each of them do

Ok thanks a lot.

does it mean that when i modify the shape (ofPath) commands using the mouse, if i fire flagShapeChanged() it will automatically regenerate the polyline outline ?

yeah, that’s it, i didn’t remember this was done like that but i’ll probably change it to work automatically whenever you access the commands as we do with ofMesh and other classes but by now you need to call flagShapeChanged if you modify the commands manually

great that’s a nice tip !

until now i used to make an updateOutline() function that i called after i update the shape using the commands. Great to know !

thanks a lot