Documentation ¶
Overview ¶
The package 'trilateration' provides utilities to perform trilateration (also known as true range multilateration), to determine the location in a 3D space of a target point, given the distances from "station" points whose location is already known.
Index ¶
- func Distance(p1, p2 Point) float64
- func SumOfResidualSquares(observations []Range, current_guess Point) (sum_of_squares float64)
- type Point
- func GaussNetwonIteration(observations []Range, current_guess Point) Point
- func SelectRandomPointInCubicRange(center Point, distance float64) Point
- func SelectRandomPointOnSphere(center Point, radius float64) Point
- func Trilaterate(observations []Range, initial_guess Point, max_iterations int, ...) (Point, error)
- type Range
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SumOfResidualSquares ¶
Returns the sum of the squares of the residuals.
Types ¶
type Point ¶
Cartesian coordinates of a Point in a 3D space.
func GaussNetwonIteration ¶
Implements one iteration of the Gauss–Newton algorithm (https://en.wikipedia.org/wiki/Gauss%E2%80%93Newton_algorithm), as applied to true range multilateration. Returns the new guess.
func SelectRandomPointInCubicRange ¶
Select a random point from the cubic space identified by these properties: * its center is the provided Point * its edges are parallel to the 3d coordinate axes; * its edges are 2*distance units long.
Please note that this function re-seeds the global random pool at each invocation.
func SelectRandomPointOnSphere ¶
Select a random point on the sphere whose center and radius are provided.
Please note that this function re-seeds the global random pool at each invocation.
func Trilaterate ¶
func Trilaterate(observations []Range, initial_guess Point, max_iterations int, min_sum_of_residual_squares float64) (Point, error)
Performs trilateration on the provides observations, using initial_guess as the starting point of the algorithm. The algoritm will run iteratively, until either the maximum number of iterations has been reached, or the sum of the squares of the residuals fell under the provided value. Provide max_iterations=0 or a negative min_sum_of_residual_squares to disable either check.
Returns the result of the algorithm, that matches the best estimate of the solution when the algorithm converged. Please note that, for some combinations of the input parameters, the algorithm might not converge; in that case, the returned error is non-nil.
The choice of the initial guess is very important for the convergence of the algorithm. Some choices might render the problem ill-conditioned. As such, this library provides some helper APIs that can help randomize the choice of the initial guess; please refer to space.go for more details.