View Full Version : Math perspective question
12-20-2001, 07:41 AM
Hi, I have a very simple math question I can't handle :
I specify my camera perspective by using
gluPerspective(fov, ratio, front, back) ;
I want to get the widht and height of my front plane using only fov, ratio, front and back, as you cans specify in a glFrustum call.
This is to perform view frustum culling using bounding spheres.
Thx in advance
Is this not a trigonometry question? I could be wrong but I thought I'd have a go cos I need the practice http://www.opengl.org/discussion_boards/ubb/smile.gif
I think height = sin(fov/2) * near
not so sure about the width, still thinking about it, but could someone confirm the height for me please?
width = aspect * height,
but I'm less confident of this one, so if someone could check it...
12-20-2001, 08:35 AM
I found by myself, here it is :
Width = Front * tan(Fov/2)
and Height = Width / Ratio
thx endo http://www.opengl.org/discussion_boards/ubb/smile.gif
Is that the same as mine? btw, I thought the fov was in the vertical axis, is that right?
12-20-2001, 09:05 AM
I consider it being in the X axis so that's why tan and no sin
12-20-2001, 09:06 AM
huh but you seem to be right, Red book says it's fovy... I need to change my code then http://www.opengl.org/discussion_boards/ubb/smile.gif
Maybe simply switching Height and Width would do I bet
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.