How to turn a sphere into a hemisphere, smoothly

I use a third-party “rotator” that provides smooth, random rotation along the surface of the sphere. The rotator is used to control the camera (see Rotator.h / c in the source code for xscreensaver ).

The rotator output is latitude and longitude. I want the camera to stay above the "equator" - so it was limited to the hemisphere.

I would rather not change the rotator itself. So I could use the latitude output and use its absolute value. However, the smooth movement of the rotator along the equator will not lead to a smooth movement of the camera: it will bounce.

I suppose I can scale the output latitude from the rotator from its current range to my target range: for example, f (lat) = (lat + 1) / 2 will display the range (0, 1) to (0.5, 1). That is, map the entire “globe” to the northern hemisphere. The movement will still be smooth. But what would be intended for the "south pole" by the rotator will become the "equator" for my camera. Wouldn't that lead to a strange movement? Maybe breaks? I'm not sure.

Is there another way to smoothly hide a sphere (latitude and longitude) to a hemisphere?

Update:

Thank you for your attention and answers. Several people asked for clarification about the smooth. I don't mean jerky: a small change in rotator speed should be displayed on a small change in camera speed. If I just took the absolute latitude, then a zero change in the speed of the rotator as it crosses the equator would translate into a sharp jump in camera speed (aka rebound).

IIRC is equivalent to requiring the first derivative of speed to be continuous. The continuous second derivative may be nice, but I don't think it matters.

+3
source share
4 answers

- . "" lat, "" . , , ( ) , 1- 0 .

tom10 lat '(lat) = (lat) ^ 2 . , lat '(90deg) = 90deg. , :

lat '(lat) = 90 * (lat/90) ^ 2

sin() . , , , "" , , :

lat '(lat) = 90 * (| lat |/90) ^ K

+4

, , .

+1

- , (latitiude) 2.

+1

, , :

You want to be able to convert any point (given in latitude and longitude) and convert it to a point in the hemisphere so that the "movement is smooth" (that is, a small movement on the sphere translates into a small movement on the hemisphere)

In this case, I believe that you can simply “roll the sphere back” (for example, take the Modulo latitude around the equator).

0
source

Source: https://habr.com/ru/post/1768355/


All Articles