How to hit test 3d rectangles

I have a few buttons that I display on screen that are rotated around in 3d a bit using the transform methods like ofRotateY. I want to detect when the user clicks on them.

I figure I need to get the four corners of the button after they have projected into screen space, but I am not sure how to do that. I saw this post: hit-testing that mentions using ofWorldToScreen, that seems cool, but that method doesn’t to be part of openframeworks (I am using v0.8.3)

Whats the best / simplest / elegant way to solve this? I should mention that I am not using an ofCamera because the view is relatively static

In way of an example I want the Red and White circles to be drawn at the same location in the code below

ofVec2f worldPoint(300, 300);
ofVec2f screenPoint;

ofPushMatrix();
ofRotateY(70);
ofSetHexColor(0xFF0000); //Red
ofEllipse(worldPoint, 100, 100);

//TODO: get worldPoint final location on screen

ofPopMatrix();

ofSetHexColor(0xFFFFFF); //White
ofEllipse(screenPoint, 50, 50);

Taking a look at ofCamera::WorldToScreen, you could reproduce that by calling ofGetCurrentMatrix to get the modelview and projection matrices. Even if you don’t use an ofCamera you can still manually compute world to screen coordinates.

Might be simpler to just use an ofCamera.

Using ofCamera does sort out the issue, and I have gone that direction now. I had avoided it because it messes with all of my existing drawing code (vertical flipping, scaling, 0,0 at screen center instead of top left).