# Float precision problem not over

This topic is 4848 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.

1. 1
Rutin
38
2. 2
3. 3
4. 4
5. 5

• 12
• 15
• 12
• 14
• 9
• ### Forum Statistics

• Total Topics
633354
• Total Posts
3011494
• ### Who's Online (See full list)

There are no registered users currently online

×