# Calculate Radius for Apparent Diameter

## Background

Animate approaching planets, as per a journey though the Solar System. At a distance of 2 Blender units, a sphere fills the entire height of the camera's view port:

This generates the following image:

## Units, Measures, and Distances

The sphere is 4879.4 km in diameter, or 1 Blender unit.

The camera's final position is 9758.8 km from the planet, or 2 Blender units.

The camera's start position is 45999102.0 km from the planet, which is too many Blender units (9427.2).

## Problem

Scale the planet's radius to simulate how it would appear at a given distance from the camera.

## Progress

The angular diameter of the object can be calculated using:

$δ = 2 \times arctan( r / D )$

Where:

• δ is the angular diameter;
• r is the radius; and
• D is the distance.

Plugging the numbers:

δ = 2 arctan( 2439.70 / 45999102 )


## Update #1

I think I can use the following:

The distance to the camera (adjacent side) is 9758.8 km.

Since $tan(δ) = opposite \over adjacent$, then $opposite = adjacent \times tan(δ)$. Thus

o = 9758.8 km tan( δ )
= 9758.8 km tan( 0.0001060759 )
= 1.035 km


## Update #2

So at a distance of 45999102 km, the apparent size of a sphere with a 2439.70 km diameter would be 1.035 km at a distance of 9758.8 km.

Since 1 Blender unit = 4879.4 km, it follows that the sphere should have a radius of 0.000212116 Blender units, which is completely invisible.

## Questions

1. Have I gone astray?
2. What would be the best approach to calculate the appropriate scaling factor for the sphere's radius (in Blender units)?

## Solution

• Planet radius, $r_p = 2439.7 km$
• Planet distance, $D_p = 45999102 km$
• Blender distance, $D_b = r_p \times 4 = 9758.8 km$
• Apparent diameter: $2r \sqrt{ 1 - r^2 / D^2 }$
• Apparent distance: $D − r^2 / D$
• Scale factor: $Simulated\space apparent\space diameter \over Simulated\space apparent\space distance$ $\div$ $Blender\space apparent\space diameter \over Blender\space apparent\space distance$

Simulated apparent diameter = $2 \times 2439.7 \times \sqrt{ 1 - 2439.7^2 \over 45999102^2 }$ = $4879.40 km$

Simulated apparent distance = $45999102 - 2439.7^2 \over 45999102$ = $45999101.87 km$

Blender apparent diameter = $2 \times 2439.7 \times \sqrt{ 1 - 2439.7^2 \over 9758.8^2 }$ = $4724.46 km$

Blender apparent distance = $9758.8 - 2439.7^2 \over 9758.8$ = $3659.55 km$

$\therefore$ Scale factor = $4879.40 \over 45999101.87$ $\div$ $4724.46 \over 3659.55$ $\approx .0000821660$

Thank you!

-

I would have thought you should have δ = 2 arcsin( r / D ) which would mean that as the camera approaches the surface of the planet, $\delta$ would approach $\pi$.
I assume you know how to draw a circular disk of diameter $2r$ a distance $D$ away in your animation system. As the camera gets closer to the (centre of the) planet, the apparent disk will seem to have a diameter of 2 r cos( δ / 2 ) and be a distance away of D - r sin( δ / 2 ).
You can avoid the trigonometric functions by using an apparent diameter of $2 r \sqrt{1-r^2/D^2}$ and an apparent distance of $D - r^2/D$.
@dave: When the camera is 45999102 km from the sphere, the sphere will appear like a disk of diameter about 4879.399993 km a distance about 45999101.87 km away, as you should expect. When the camera is 4879.4 km from the centre of the sphere, the sphere will appear like a disk of diameter about 4225.68 km a distance about 3659.55 km away. If you regard the latter as filling the view port side-to-side, then presumably the former fills $\frac{4879.399993}{45999101.87} \div \frac{4225.68}{3659.55} \approx 0.000092$ of the view port. –  Henry Jul 16 '11 at 12:30
@dave: ... or if you would prefer to see the view port as an angle, then the angle when close to the planet is about $1.047$ radians or $60$ degrees and when far away $0.000106$ radians or $0.0061$ degrees, so the faraway angle is about $0.000101$ times the near angle, close to the previous result. –  Henry Jul 16 '11 at 12:42