3d - Fitting rectangle among 4 spheres -
i wondering have idea how solve following task:
4 poles given in space each different height. base convex quad. each pole there rope connected object. coordinates in 3d poles defined. knowing position of object makes straight forward find rope lengths. task solving reverse problem - knowing lengths of 4 ropes find position in 3d space.
there 2 versions - easy , hard one. easy 1 when 4 ropes connected single point - problem can solved finding intersection of 4 spheres centers @ top of poles , radii 4 lengths of ropes. how gps works - intersection of 2 spheres circle. intersection of circle 3rd sphere gives me 2 points in result. use 4th sphere control 1 find of 2 lies inside working space.
the hard 1 when poles connected each different point form quad. given trying solve general quad tried rectangle sizes (d1, d2) plane should parallel floor(blue region below - xz plane) sides parallel x , z axes. simplifies task lot. knowing position(center) of rectangle makes again straight forward finding lengths of 4 ropes. want find position of rectangle knowing lengths a, b, c, d of 4 ropes.
what did using 3 spheres find position of 1 of rectangle's , 4th 1 control one. centers of 3 spheres line in plane change coordinate system in such way center of 1st(a) 1 origin o(0,0,0). 2nd one(b) on x axis @ distance d. 3rd one(d) @ coordinates (p,q,0). lower left point of rectangle lies on 1st sphere , has coordinates:
a(x,y,z) on 1st sphere r1^2 = x^2 + y^2 + z^2 b(x+d1,y,z) on 2nd sphere r2^2 = (x+d1-d)^2 + y^2 + z^2 c(x,y1+d,z) on 3rd sphere r3^2 = (x-p)^2 + (y+d1-q)^2 + z^2
lower right b of rectangle lies on 2nd sphere d1 units on right , c d2 units on 3rd sphere.
here have 3 unknowns (x,y,z) , 3 quadratic equations quite easy solve substitutions , find
the x coordinate x = 0.5 * (r2^2 - r1^2 - (d1 - d)^2) / (d1 - d) y coordinate y = 0.5 * (r4^2 - r1^2 - (d2 - q)^2 - p^2 + 2*p*x) / (d2 - q) z coordinate z1 = sqrt(r1^2 - x^2 - y^2) , z2 = -sqrt(r1^2 - x^2 - y^2)
using 4th sphere control eliminates z1 or z2. changing original coordinates system can find actual center of rectangle.
this turns out work when poles equal heights. changing them different gives wrong results. means either there error in calculation or wrong assumptions made. can not figure out. ideas?
Comments
Post a Comment