Calculate a position of a point in 3D space knowing locations of 3 other points and distances beetwen them...











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.










share|improve this question






















  • 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
    2 days ago















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.










share|improve this question






















  • 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
    2 days ago













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.










share|improve this question













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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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
    2 days ago


















  • 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
    2 days ago
















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
2 days ago




There would be 2 solutions (mirrored over the 3-point plane). Probably, more than 3 point are needed.
– Egor Skriptunoff
2 days ago

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















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






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














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





















































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







Popular posts from this blog

Bressuire

Vorschmack

Quarantine