c# - How i can calculate 2d bounding box with 3d transformation -


i'm working on opengl project. set perspective projection , render transformed rectangle (rotated, scaled)

how can calculate rectangle's bounding box (rectangle position,size)

thank you

you'd run rectangle through same matrices opengl transform 3d points 2d screen-space ones. input vectors, multiply them want apply object, modelview matrix, projection matrix, have screen-space coords. check whether resulting coordinates on-screen, can calculate minimum/maximum x , y coordinates, , have bounding rectangle.

see here (9.100), if you've got glu utility library functions available:

http://www.opengl.org/resources/faq/technical/transformations.htm

hope helps.


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -