dilevin / computer-graphics-meshes

Computer Graphics Assignment about Meshes
1 stars 5 forks source link

Strange Rotation of Earth and Inverted Mapping #36

Open melissa-pan opened 4 years ago

melissa-pan commented 4 years ago

Hi,

My earth has a strange looking 3D map as if the map is folded towards the screen and see through the map, i.e. flipped on the y-axis (if y is the horizontal axis of the screen). As the screen shot show, Europe in the middle, Africa is on the right and Asia is on the left.

Screen Shot 2020-02-23 at 11 44 39 AM

And north and south America is filpped in the second screen shot.

Screen Shot 2020-02-23 at 12 05 05 PM

Also when I try to drag to the left or the right, the earth rotates clockwise or counter-clockwise on the axis that points out of the screen instead of going to the right direction. Dragging up and down works as expected tho.

I am wondering what could be the problem? A side information is that when libigl opens up, it is always the Antartica that faces the screen. Does it means that the x,y,z axis are defined at a different order? or I need to invert the axis?

ezgif com-video-to-gif

amirhmk commented 4 years ago

I have the same issue, some insight would be appreciated 👍

AnqiGao98 commented 4 years ago

same problem here

dilevin commented 4 years ago

You might be defining x,y,z in the wrong order or you might be defining your texture coordinates in the wrong order.

AnqiGao98 commented 4 years ago

I fixed my issue by adding "-ve" sign in front of my original x,y,z. now it works

melissa-pan commented 4 years ago

Problem solved now.

Adding "-vs" sign flips the mapping correctly but the rotation problem still exists. The real problem is that the parametric equation for sphere draws circle on the xy plane whereas in graphics it draws circles on the yz plane. This is why North Pole or South Pole is facing out of the screen when libigl opens up, which we are essentially looking into the scene from the z direction.

To solve the problem: flip the y and z axis, and only add a negative sign to the x and y (previously calculated as z) axis.