lon/lat distance

computerex

Addon Developer
Addon Developer
Joined
Oct 16, 2007
Messages
1,282
Reaction score
17
Points
0
Location
Florida
If you know the longitude and latitude of two objects, is there a way to get the distance between them?
 
Yes, quite a bit easier, unfortunately I can't use that for dynamic calculations within an Orbiter module. :P
 
Thats C# code, not C++. But they are fairly similar. It's the math I am interested in anyway. :lol:
 
1 degree lat is about 111.12 km if on the same lon. I can probably whip up a formula for you if you want that can work out the distance between two points though it would get complicated (very).
 
1 degree lat is about 111.12 km if on the same lon. I can probably whip up a formula for you if you want that can work out the distance between two points though it would get complicated (very).

Well, it's not as simple as that, as you are dealing with coordinates on a curved surface, and not a 2D flat plane. You also have to take in accounts variables like the Earth's "squash" coefficient.

Anyway, in any case, I have already got the answer to my problem, the link I have posted above. Thanks anyway though. :cheers:
 
Well, it's not as simple as that, as you are dealing with coordinates on a curved surface, and not a 2D flat plane. You also have to take in accounts variables like the Earth's "squash" coefficient.

Anyway, in any case, I have already got the answer to my problem, the link I have posted above. Thanks anyway though. :cheers:

What was the problem?
 
To calculate the distance of two objects when given their lat/long.
 
A dynamic traffic generator. I seriously wish I had better mathematics skills... I know how to write autopilots to control the different aircraft using the PID algorithm: http://en.wikipedia.org/wiki/PID_controller

Yet I don't know how to calculate the glideslope of an aircraft to land at a point on the runway. So after I clear up these little snags, I should be able to write a system like that quite easily.
 
I was just playing around with this concept, and created a small simple prototype for the actual module:

dm.png


The idea is to replace the ShuttlePB with an asteroid or something. Right now, it's kind of like a loop. The shuttlePB comes from the front of the glider, and gets destroyed when 1 km away, and a new one is created in the front.
 
I was just playing around with this concept, and created a small simple prototype for the actual module:

dm.png


The idea is to replace the ShuttlePB with an asteroid or something. Right now, it's kind of like a loop. The shuttlePB comes from the front of the glider, and gets destroyed when 1 km away, and a new one is created in the front.

so all its doing is playing 'tag' ?
 
No, not really. This is done with only 12 lines of code. The actual module will obviously have to have a far more complex algorithm. I already have the design complete. Creating scenery is easy. But making traffic is difficult. Perhaps I'll start out easy, and just create a dynamic scenery generator. Not like orulex, this one will generate user defined vessels to simulate scenery.
 
Not like orulex, this one will generate user defined vessels to simulate scenery.


Oh, so you will make static images for bases like at cape or britan moon base

that would look cool :speakcool:

Make it look like a garage,;)

if that happens (spacecraft parked like cars) we would be in the year 5000 :lol:
 
Not exactly. The vessels themselves will be the scenery. So for example, if I want to load a tree, I could load a tree mesh on a vessel I place in the FOV of the user.
 
Not exactly. The vessels themselves will be the scenery. So for example, if I want to load a tree, I could load a tree mesh on a vessel I place in the FOV of the user.

load a tree?

why would placing a tree on a vessel be of any use?
 
I meant that I could have a generic vessel class, "Dynamic object", create a vessel of that class on the ground, in the focus vessel's FOV, and load a tree mesh for it, so that vessel simulates a tree scenery.
 
Back
Top