# Float precision problem not over

This topic is 4908 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi all, This is the continuation from my post in http://www.gamedev.net/community/forums/topic.asp?topic_id=330097 After changing my function to convert from geo-coordinate into cartesian into this:
public static Vector3 GetCartesian(AirPoint p)
{
Vector3 ret = new Vector3();

double lon = (p.m_Lng - m_upperleftlon) * m_deg2rad;

ret.Z = (float)(proj * Math.Sin(lon) - m_sclThreeQuarterRad);
ret.Y = (float)(proj * Math.Cos(lon) - m_sclThreeQuarterRad);

return ret;
}

My airplane can fly smoothly. But then I realize that this code works only in a certain area on earth (near the point specified by (0, m_sclThreeQuarterRad, m_sclThreeQuarterRad)). So I decided to change my reference coordinate based on the camera position, which is like this:
public static Vector3 GetCartesian(AirPoint p, VectorD translation)
{
Vector3 ret = new Vector3();

double lon = (p.m_Lng - m_upperleftlon) * m_deg2rad;

ret.Z = (float)(proj * Math.Sin(lon) + translation.Z);
ret.Y = (float)(proj * Math.Cos(lon) + translation.Y);

return ret;
}

With the translation is obtained based on the camera position. Using this way, my airplane is vibrating again. I wonder why. Is there any other idea of changing the world reference coordinate? Thanks a lot.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 13
• 9
• 15
• 14
• 46
• ### Forum Statistics

• Total Topics
634058
• Total Posts
3015290
×