0

I need the coordinates of E and have the coordinates of A, B, C and the distance to them from E. It should be possible, in 2D I got it like this with a rotation matrix. But in 3D the angles of the edges are not parallel to axis so I cant really use the same principle can I ?

See

metamorphy
  • 43,591

1 Answers1

1

Thanks to @amd and @Tavish !

The problem is often not to find a solution but to ask the right question. Indeed I was really just searching for the intersection of 3 spheres and wikipedia had the answer. https://en.wikipedia.org/wiki/True_range_multilateration#Three_Cartesian_dimensions,_three_measured_slant_ranges

Here is a simple implementation in python:

def calculate_position(distances):

# Find the intersections of the three spheres created with three radii
# Implementation based on https://en.wikipedia.org/wiki/True_range_multilateration

A = (0, 0, 0)
B = (10, 0, 0)
C = (5, 10, 0)
V_SQ = C[0] ** 2 + C[1] ** 2
r1, r2, r3 = distances

x = (r1 ** 2 - r2 ** 2 + B[0] ** 2) / (2 * B[0])
y = (r1 ** 2 - r3 ** 2 + V_SQ - 2 * C[0] * x) / (2 * C[1])
z1 = sqrt(r1 ** 2 - x ** 2 - y ** 2)
if z1 >= 0:
    return x, y, z1
return x, y, -z1