Hard Light Productions Forums

Off-Topic Discussion => General Discussion => Topic started by: Retsof on March 20, 2010, 06:50:17 pm

Title: Can any of you math guys give me a hand?
Post by: Retsof on March 20, 2010, 06:50:17 pm
Well, I was looking for a equation to help me with space scapes and such.  Basically, I wanted to plug in the distance and size of  planet and get back how many degrees of your view it takes up.  I found this in Wikipedia:
Quote
The angular diameter of an object can be calculated using the formula: δ=2arctan(1/2d/D) in which δ is the angular diameter, and d and D are the visual diameter of and the distance to the object, expressed in the same units. When D is much larger than d, δ may be approximated by the formula δ = d / D, in which the result is in radians.
Now, I just can't quite wrap my head around what that all means.  Could someone please clarify it?
Title: Re: Can any of you math guys give me a hand?
Post by: Kopachris on March 20, 2010, 06:57:36 pm
Okay, let's say you have a planet that is 25,000 km in diameter, and you're 50,000 km away from it (values chosen for simplicity).  In a calculator, you'd plug in "2*tan-1(0.5*25000/50000)".  The "-1" part will likely be superscript on the key.  Simplifying, you could rewrite that as 2*tan-1(0.25) because 25000/50000 is one half, and a half times a half is a quarter.
Title: Re: Can any of you math guys give me a hand?
Post by: Dark RevenantX on March 20, 2010, 07:09:54 pm
Sometimes it's easier just to make your own equations using fundamental ones.  It's what I do.  In this case, we don't know the field of view, so it's awfully hard to figure out how much is blocked off.
Title: Re: Can any of you math guys give me a hand?
Post by: Retsof on March 20, 2010, 07:32:59 pm
Sometimes it's easier just to make your own equations using fundamental ones.  It's what I do.  In this case, we don't know the field of view, so it's awfully hard to figure out how much is blocked off.
*Brings up terragen, dosen't help much, makes a guess*  I'd say at the default its 35 degres.
Title: Re: Can any of you math guys give me a hand?
Post by: watsisname on March 20, 2010, 07:39:39 pm
Here's a walkthrough of another example using a real object:  The moon.

Moon's distance = ~400,000km
Moon's diameter = ~3500km
What's the apparent angular size?

delta = 2arctan(.5d/D)
delta = 2arctan(.5*3500/400000)
delta = 2arctan(0.004375)
the argument for the arctan function is small, thus arctan(x) is approximately equal to x, thus
delta = 0.00875 radians.

Convert to degrees by multiplying by 180/pi.  This yeilds an angular diameter of 0.501°, which is in close agreement with the true value.
Title: Re: Can any of you math guys give me a hand?
Post by: Retsof on March 20, 2010, 07:59:25 pm
thanks
Title: Re: Can any of you math guys give me a hand?
Post by: Aardwolf on March 20, 2010, 08:16:32 pm
Don't they teach you anything useful in school?
Title: Re: Can any of you math guys give me a hand?
Post by: Retsof on March 20, 2010, 09:01:19 pm
I forgot it all, and I nearly failed Algebra II.
Title: Re: Can any of you math guys give me a hand?
Post by: Goober5000 on March 21, 2010, 01:28:49 am
/me reads thread title

/me applauds

/me leaves thread
Title: Re: Can any of you math guys give me a hand?
Post by: Herra Tohtori on March 21, 2010, 03:33:53 am
At small apparent diameter angles (large relative distances), you can use the diameter as an approximation to the equation. It won't be exactly correct, but close.

However, as you get closer to the large body, you won't be seeing the actual diameter of the object but instead you will start to see a horizon, and you will have to calculate the field of view based on tangential lines:

(http://img411.imageshack.us/img411/2123/tangentialfieldofview.png)


...Like this.

r is the radius of the object, h is distance to the surface of the object. This method will also give you exact results regardless of the distance, so I would prefer to use this one.

Incidentally, this is the reason why it is very, very hard to make skyboxes that fill more than 90 degrees of the sky while preserving the correct geometry of a spherical body... As you see, you have to put the camera very close to the surface of the planet or moon, which very easily results in blurry or pixellated textures... :p