I made a small app so I can visualise matrices, I have a triangle with all sides being 20 units.
I wanted to calculate how far back the triangle would have to be from the camera in order for it to just fit in the window and got some strange results.
I used the formula:
triangle height * distance to projection planedistance = ------------------------------------------------ desired height
the width and height of my viewport is 640x480
so I went with
distance = 20*distance to projection plane ------------------------------- 480
but that ended up making the triangle much smaller than the viewport
so I instead of using the height of the view I decided to use the width
distance = 20*distance to projection plane ------------------------------- 640
which worked
here is an image
I am a bit confused to why I had to use the width as I am trying to fit the triangle based on its height, I must be quite not understanding something, can someone help me and explain what I am missing?
regards
Fluxtah