lemmingapex / trilateration

Solves a formulation of n-D space trilateration problem using a nonlinear least squares optimizer
MIT License
398 stars 106 forks source link

Input as cartesians? #1

Closed JulianSchuette closed 8 years ago

JulianSchuette commented 8 years ago

Hi,

just to make sure, I assume TrilaterationFunction expects the position argument to be in cartesian coordinates, not in lat/lon or anything else?

Cheers, Julian

lemmingapex commented 8 years ago

Julian,

Yes, you are correct. Positions should be valid cartesian coordinates. In full: Inputs identified as tuples (lists) of n real numbers should exist in a euclidean space of dimension n.

If you are using lat/lon, you will need to convert to a cartesian coordinate system. Depending on the range of latitudes and longitudes inputs, and the desired accuracy, you will want to be cognisant of this conversion.

If accuracy is not a concern, you can model the earth as a sphere: http://stackoverflow.com/questions/1185408/converting-from-longitude-latitude-to-cartesian-coordinates/1185413#1185413

If you have large lat/lon ranges or you are using an ellipsoid model of the earth (like WGS-84), you will want to look into solutions that account for this.

Does this answer your question?

JulianSchuette commented 8 years ago

Perfect, Scott. Thanks a lot. I am using pretty small lat/lon scales (<100m) and can accept minor conversion errors, so I will go the simple route first.

Cheers.

kliewkliew commented 8 years ago

Using the linked SO equations, the input positions would be composed of x and y (throwing away z)?

lemmingapex commented 8 years ago

Why would you throw away z?

kliewkliew commented 8 years ago

The positions are arrays of two doubles but there are three axes in the SO answer. I don't understand how to coerce the SO answer into the required input positions.

lemmingapex commented 8 years ago

@kliewkliew https://github.com/lemmingapex/Trilateration/blob/master/src/test/java/com/lemmingapex/trilateration/TrilaterationTest.java#L255-L267

kliewkliew commented 8 years ago

Thanks! Much appreciated