lm-trilateration3d

1.0.7 • Public • Published

3D trilateration

NPM version npm download

Simple computation of trilateration using matlab's Levenberg Marquardt curve-fitting algorithm. Using to locate objects in a 3D coordinate system by at least 4 known points and approximate radii around these fixed points.

Installation

$ npm i lm-trilateration3d

Usage

// import library
const trilat = require('lm-trilateration3d');
 
// 3D
// At least 4 beacons position and distance to locate 3D, if have only 3 beacons, z can not calculate then replace by undefined
var input3D = { data: [
//         X       Y       Z       R
    [      0,      0,      0,   8.84],
    [   8.84,    4.57, 12.59,   8.84],
    [      0,   -8.84,  8.84,   8.84],
    [  10.72,   -8.96,  8.84,   8.84]
]};
 
var output3D = trilat.locate3D(input3D);
/* {
        x: [ 5.2 ],
        y: [ -1.2 ],
        z: [ 7.7 ]
*/
 
// 2D
// At least 3 beacons position and distance to locate 3D
var input2D = { data: [
//      X     Y     R
    [ 0.0,  0.0, 10.0],
    [10.0, 10.0, 10.0],
    [10.0,  0.0, 14.142135]
]};
 
var output2D = trilat.locate2D(input2D);
/* {
        x: [ 2.205170988086251e-7 ],
        y: [ 9.999999779478834 ]
*/
 

License

MIT

Package Sidebar

Install

npm i lm-trilateration3d

Weekly Downloads

15

Version

1.0.7

License

MIT

Unpacked Size

32.7 kB

Total Files

5

Last publish

Collaborators

  • lai_nectec