Planet MapGenerator: Risk of Division by 0?

Planet MapGenerator: Risk of Division by 0?

Return to topic list

Mon May 30 04:35:07 2022   by   Ron Vantreese
Hi Mr. Torben, there appears to be a risk of division by zero in the Mercator map.

  y = sin(lat);
  y = (1.0+y)/(1.0-y);

If user enters 90 degrees latitude, then y starts with value 1, the next line becomes y = 2 / 0.
 
Mon May 30 04:41:54 2022   by   Ron Vantreese
There appears to be another risk of Log of 0 if user enters -90.

  y = 0.5*log(y);

 
Mon May 30 11:48:16 2022   by   Torben
The Mercator projection is not defined for +/- 90 degrees, so an error is appropriate.  But it might be better to cap the latitude to, say, -89 to 89 degrees.
 

Return to topic list



New message:
Topic:
Posted by:

Type the values of the dice shown below:

Return to topic list