A pretty simple question – I’d like a function that takes a geom::Source
and then can tell me which type the function takes in (geom::Sphere
, geom::Cube
, geom::Cylinder
, etc.). However, I’m not sure of the right way to do this!
void function(ci::geom::Source& source) {
if source.type() is ci::geom::Sphere()
then print("This is a sphere")
else if source.type() is ci::geom::Cube()
then print("This is a cube")
}
It looks like there’s some primitive enums in GeomIo.h
, but they’re all OpenGL primitives like triangle strips and fans, not actual geometric primitives.
If there was a clever way to overload the ==
operator that’d work too. I basically just want to have a single function that can take any functioning source, and then perform different behaviors based on which geometric shape is input.
Any suggestions? This feels like it should be pretty simple, but I haven’t figured out a good way to do it…
thanks!