In my environment, i have some points that should check their positions. So i have written a function to simulate the above OpenGL transformations:
void PosConvertor(float x,float y, float z)
{

The function posConvertor is like the OpenGL transformations that i have used in my code. I can check the position of my objects with the function posConvertor. But now i want to create a binding box and check that if i’m inside this binding box. But now i don’t know that how i should use from my posConvertor function to check the boundries of my binding box. Any suggestion?
-Ehsan-

I guess you meant bounding box, not binding box. Didn’t you ?

A bounding box is a box that surrounds all the object. I don’t know what a binding box could be.

Simply draw your bounding box without the transformations, and them apply the same transformations to your bounding box than your object, that turns out. But maybe I didn’t really understood what you meant.

Also, I don’t understand your ‘360 - x’ you use. Almost when used inside sine and cosines functions. Did you rewrite those functions for them expecting degrees instead of radians ?

This can get complex, because you’re talking about a bounding box which can presumably have a completely arbitrary value of rotation.

You first need to write a function which actually calculates the coordinates of your bounding box from the object’s list of vertices (i.e., take the smallest and largest x, y, z values in your list of vertices and construct the boundaries of your box from these).

You then need to work out where your box will be after any rotations you’re applying to it, using the routine you posted above.

And finally, you then need to test if your own position resides within the boundaries of this box - which is the tricky part.

I suggest you post on the Advanced Forum for that part, as it’s not that straightforward.

Yes Jide. I mean bounding box :rolleyes: I want to detect that if i’m inside a specified bounding box. I’ll write this question in the advanced forum.
-Ehsan-