It wasn't inside out, but upside down due to Processing's coordinate system being... upside down. I don't remember if that's an OpenGL thing. It always confuses me. I'm used to seeing the origin at the center of the screen, not upside down and starting at the upper left corner. So to convert geo-coord angles to Cartesian coords, the formula is usually this: (simple sphere to cartesian)
float x= R * cos(lat) * cos(lon); float y= R * cos(lat) * sin(lon); float z= R * sin(lat);
But in Processing, invert z. Make R*sin(lat) this:
1 comment:
It wasn't inside out, but upside down due to Processing's coordinate system being... upside down. I don't remember if that's an OpenGL thing. It always confuses me. I'm used to seeing the origin at the center of the screen, not upside down and starting at the upper left corner.
So to convert geo-coord angles to Cartesian coords, the formula is usually this: (simple sphere to cartesian)
float x= R * cos(lat) * cos(lon);
float y= R * cos(lat) * sin(lon);
float z= R * sin(lat);
But in Processing, invert z. Make R*sin(lat) this:
float z= R * sin(-lat);
Post a Comment