Calculate a position of a point in 3D space knowing locations of 3 other points and distances beetwen them and the 1st point in lua
up vote
0
down vote
favorite
I am looking for a way to calculate a position of any point in 3D space (X, Y, Z where X is width, Y is height and Z is depth) based on the knowledge of location of 3 or more other points and their distance to the point I want to know the position of. Example data:
X: 414, Y: 71, Z: -963, Distance: 87 (rounded down)
X: 612, Y: 72, Z: -935, Distance: 120 (rounded up)
X: 500, Y: 66, Z: -974, Distance: 2 (rounded down)
I already tried porting the following javascript library: trilateration.js as it was suggested by other SO answers looking for a simmilar thing but the results generated by that port of library are highly inaccurate no matter what sort of sorting tricks I do.
Sidenote: I usually have more than 3 points, perhaps I could sort them based on the distance and use those with shortest distance, that would increase the accuracy.
My programming environment for lua (minecraft OpenComputers) doesn't allow C code loading so any solutions using native libraries are out of the question.
lua
add a comment |
up vote
0
down vote
favorite
I am looking for a way to calculate a position of any point in 3D space (X, Y, Z where X is width, Y is height and Z is depth) based on the knowledge of location of 3 or more other points and their distance to the point I want to know the position of. Example data:
X: 414, Y: 71, Z: -963, Distance: 87 (rounded down)
X: 612, Y: 72, Z: -935, Distance: 120 (rounded up)
X: 500, Y: 66, Z: -974, Distance: 2 (rounded down)
I already tried porting the following javascript library: trilateration.js as it was suggested by other SO answers looking for a simmilar thing but the results generated by that port of library are highly inaccurate no matter what sort of sorting tricks I do.
Sidenote: I usually have more than 3 points, perhaps I could sort them based on the distance and use those with shortest distance, that would increase the accuracy.
My programming environment for lua (minecraft OpenComputers) doesn't allow C code loading so any solutions using native libraries are out of the question.
lua
How could you ask for an accurate solution while your input data is "rounded down" (not exact)?
– Egor Skriptunoff
Nov 12 at 7:24
Right, I will update the question with non-rounded data (keep in mind the positions are integers)
– Rph
Nov 13 at 18:41
There would be 2 solutions (mirrored over the 3-point plane). Probably, more than 3 point are needed.
– Egor Skriptunoff
Nov 14 at 7:26
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am looking for a way to calculate a position of any point in 3D space (X, Y, Z where X is width, Y is height and Z is depth) based on the knowledge of location of 3 or more other points and their distance to the point I want to know the position of. Example data:
X: 414, Y: 71, Z: -963, Distance: 87 (rounded down)
X: 612, Y: 72, Z: -935, Distance: 120 (rounded up)
X: 500, Y: 66, Z: -974, Distance: 2 (rounded down)
I already tried porting the following javascript library: trilateration.js as it was suggested by other SO answers looking for a simmilar thing but the results generated by that port of library are highly inaccurate no matter what sort of sorting tricks I do.
Sidenote: I usually have more than 3 points, perhaps I could sort them based on the distance and use those with shortest distance, that would increase the accuracy.
My programming environment for lua (minecraft OpenComputers) doesn't allow C code loading so any solutions using native libraries are out of the question.
lua
I am looking for a way to calculate a position of any point in 3D space (X, Y, Z where X is width, Y is height and Z is depth) based on the knowledge of location of 3 or more other points and their distance to the point I want to know the position of. Example data:
X: 414, Y: 71, Z: -963, Distance: 87 (rounded down)
X: 612, Y: 72, Z: -935, Distance: 120 (rounded up)
X: 500, Y: 66, Z: -974, Distance: 2 (rounded down)
I already tried porting the following javascript library: trilateration.js as it was suggested by other SO answers looking for a simmilar thing but the results generated by that port of library are highly inaccurate no matter what sort of sorting tricks I do.
Sidenote: I usually have more than 3 points, perhaps I could sort them based on the distance and use those with shortest distance, that would increase the accuracy.
My programming environment for lua (minecraft OpenComputers) doesn't allow C code loading so any solutions using native libraries are out of the question.
lua
lua
asked Nov 10 at 19:06
Rph
206
206
How could you ask for an accurate solution while your input data is "rounded down" (not exact)?
– Egor Skriptunoff
Nov 12 at 7:24
Right, I will update the question with non-rounded data (keep in mind the positions are integers)
– Rph
Nov 13 at 18:41
There would be 2 solutions (mirrored over the 3-point plane). Probably, more than 3 point are needed.
– Egor Skriptunoff
Nov 14 at 7:26
add a comment |
How could you ask for an accurate solution while your input data is "rounded down" (not exact)?
– Egor Skriptunoff
Nov 12 at 7:24
Right, I will update the question with non-rounded data (keep in mind the positions are integers)
– Rph
Nov 13 at 18:41
There would be 2 solutions (mirrored over the 3-point plane). Probably, more than 3 point are needed.
– Egor Skriptunoff
Nov 14 at 7:26
How could you ask for an accurate solution while your input data is "rounded down" (not exact)?
– Egor Skriptunoff
Nov 12 at 7:24
How could you ask for an accurate solution while your input data is "rounded down" (not exact)?
– Egor Skriptunoff
Nov 12 at 7:24
Right, I will update the question with non-rounded data (keep in mind the positions are integers)
– Rph
Nov 13 at 18:41
Right, I will update the question with non-rounded data (keep in mind the positions are integers)
– Rph
Nov 13 at 18:41
There would be 2 solutions (mirrored over the 3-point plane). Probably, more than 3 point are needed.
– Egor Skriptunoff
Nov 14 at 7:26
There would be 2 solutions (mirrored over the 3-point plane). Probably, more than 3 point are needed.
– Egor Skriptunoff
Nov 14 at 7:26
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53242455%2fcalculate-a-position-of-a-point-in-3d-space-knowing-locations-of-3-other-points%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
How could you ask for an accurate solution while your input data is "rounded down" (not exact)?
– Egor Skriptunoff
Nov 12 at 7:24
Right, I will update the question with non-rounded data (keep in mind the positions are integers)
– Rph
Nov 13 at 18:41
There would be 2 solutions (mirrored over the 3-point plane). Probably, more than 3 point are needed.
– Egor Skriptunoff
Nov 14 at 7:26