So if we're going to allow data with 2 decimals (from the HUD) then we need to be more careful to pick the best reference systems to calculate from.
Not necessarily. The important thing to keep in mind is the whole 1/32 grid thing. For example, let's say you have 4 distances that are 2 decimal, or even 1 decimal accuracy. You can use those distances to get a good idea of where the star is - but you likely won't get the exact coordinate. *But* you can get more data to further refine the estimate.
The best way to think about it, imo, is to use trilateration to get an estimated coordinate, and then you can search the grid points around that estimated coordinate and see if there are multiple such points that match the data you have. The discrete nature of star placement makes this quite easy.
So the initial trilateration only uses 4 distances, but then you can use however many distances as you have for the second step, and as you add more distances, you'll rule out more and more grid points, until you get The One True Coordinate.
algorithm/pseudo-code:
Code:
est_coord = trilaterate(system1, system2, system3, system4)
matchingCoords = 0
for coord in generateNearCoordinates(est_coord): # generate, e.g. a 5x5x5 grid centered on est_coord
matches = True
for (star, distance, accuracy) in getAllDistances(): # gets all the distances to this star that we know of
if round(distanceBetween(coord, coordinateOf(star)), accuracy) != distance: # rounds the distance to N decimal places, based on the accuracy of this particular distance
matches = False
break
if matches:
matchingCoords++
After that, if matchingCoords is exactly one, then you know you have the correct coordinate, assuming your input data is correct, and that the grid generated by generateNearCoordinates is big enough to encompass the largest "error" that the trilaterate function can generate. Some math (and/or experiments) would be needed to determine if a 5x5x5 grid would be sufficient. I suspect it would be, but an even larger areas could be searched if needed. That would be a .15625LY cube, which is at least larger than the +/- .05 error from a 1 decimal place distance.
The second step can also be used as a form of input validation - if no grid point matches all the data you have, then you know one of your data points is bad. Although, it's a bit harder to figure out which one is bad.
Last edited: