Talk:Project Compass
Faulx, the following is basically copied from your spreadsheet, with a few additional notes here and there.
This page discusses the math underlying the calculation of coordinates for Anoikis systems used by Project Compass, part of the Arek’Jaalan Project. The main project page describes the basic concept underlying the calculations, while this page documents the actual calculations used to derive coordinates for Anoikis systems from the data collected in the Project. All questions and comments regarding these calculations should be directed toward co-project lead Faulx.
To begin with, some basic definitions:
x, y, z = coordinates of Anoikis system xa, ya, za = coordinates of first reference point (first k-space system) xb, yb, zb = coordinates of second reference point xc, yc, zc = coordinates of third reference point xd, yd, zd = coordinates of fourth reference point da = distance from first reference point to Anoikis system (the actual data gathered from Anoikis) db = distance from second reference point to Anoikis system dc = distance from third reference point to Anoikis system dd = distance from fourth reference point to Anoikis system
Next, we start with the equation for 4 different spheres.
(x-xa)^2 + (y-ya)^2 + (z-za)^2 = da^2 (x-xb)^2 + (y-yb)^2 + (z-zb)^2 = db^2 (x-xc)^2 + (y-yc)^2 + (z-zc)^2 = dc^2 (x-xd)^2 + (y-yd)^2 + (z-zd)^2 = dd^2
Those equations are expanded to:
(x^2 - 2xa*x + xa^2) + (y^2 - 2ya*y + ya^2) + (z^2 - 2za*z + za^2) = da^2 (x^2 - 2xb*x + xb^2) + (y^2 - 2yb*y + yb^2) + (z^2 - 2zb*z + zb^2) = db^2 (x^2 - 2xc*x + xc^2) + (y^2 - 2yc*y + yc^2) + (z^2 - 2zc*z + zc^2) = dc^2 (x^2 - 2xd*x + xd^2) + (y^2 - 2yd*y + yd^2) + (z^2 - 2zd*z + zd^2) = dd^2
(x^2 - 2xa*x + xa^2) + (y^2 - 2ya*y + ya^2) + (z^2 - 2za*z + za^2) = da*da (x^2 - 2xb*x + xb^2) + (y^2 - 2yb*y + yb^2) + (z^2 - 2zb*z + zb^2) + (-x^2 + 2xa*x - xa^2) + (-y^2 + 2ya*y - ya^2) + (-z^2 + 2za*z - za^2) = db*db - da*da (x^2 - 2xc*x + xc^2) + (y^2 - 2yc*y + yc^2) + (z^2 - 2zc*z + zc^2) + (-x^2 + 2xa*x - xa^2) + (-y^2 + 2ya*y - ya^2) + (-z^2 + 2za*z - za^2) = dc*dc - da*da (x^2 - 2xd*x + xd^2) + (y^2 - 2yd*y + yd^2) + (z^2 - 2zd*z + zd^2) + (-x^2 + 2xa*x - xa^2) + (-y^2 + 2ya*y - ya^2) + (-z^2 + 2za*z - za^2) = dd*dd - da*da
Subtraction of the first row from the subsequent rows yields a 3x4 matrix:
(x^2 - 2xa*x + xa^2) + (y^2 - 2ya*y + ya^2) + (z^2 - 2za*z + za^2) = da*da (-2xb*x + xb*xb) + (-2yb*y + yb*yb) + (-2zb*z + zb*zb) + (2xa*x - xa*xa) + (2ya*y - ya*ya) + (2za*z - za*za) = db*db - da*da (-2xc*x + xc*xc) + (-2yc*y + yc*yc) + (-2zc*z + zc*zc) + (2xa*x - xa*xa) + (2ya*y - ya*ya) + (2za*z - za*za) = dc*dc - da*da (-2xd*x + xd*xd) + (-2yd*y + yd*yd) + (-2zd*z + zd*zd) + (2xa*x - xa*xa) + (2ya*y - ya*ya) + (2za*z - za*za) = dd*dd - da*da
The equations are then simplified in 3 steps:
x*x - 2xa*x + y*y - 2ya*y + z*z - 2za*z = da*da - xa*xa - ya*ya - za*za -2xb*x - 2yb*y - 2zb*z + 2xa*x + 2ya*y + 2za*z = db*db - da*da - xb*xb - yb*yb - zb*zb + xa*xa + ya*ya + za*za -2xc*x - 2yc*y - 2zc*z + 2xa*x + 2ya*y + 2za*z = dc*dc - da*da - xc*xc - yc*yc - zc*zc + xa*xa + ya*ya + za*za -2xd*x - 2yd*y - 2zd*z + 2xa*x + 2ya*y + 2za*z = dd*dd - da*da - xd*xd - yd*yd - zd*zd + xa*xa + ya*ya + za*za
x*x - 2xa*x + y*y - 2ya*y + z*z - 2za*z = da*da - xa*xa - ya*ya - za*za 2x*(xa - xb) + 2y*(ya - yb) + 2z*(za - zb) = db*db - da*da - xb*xb - yb*yb - zb*zb + xa*xa + ya*ya + za*za 2x*(xa - xc) + 2y*(ya - yc) + 2z*(za - zc) = dc*dc - da*da - xc*xc - yc*yc - zc*zc + xa*xa + ya*ya + za*za 2x*(xa - xd) + 2y*(ya - yd) + 2z*(za - zd) = dd*dd - da*da - xd*xd - yd*yd - zd*zd + xa*xa + ya*ya + za*za
x*x - 2xa*x + y*y - 2ya*y + z*z - 2za*z = da*da - xa*xa - ya*ya - za*za x*(xa - xb) + y*(ya - yb) + z*(za - zb) = (db*db - da*da - xb*xb - yb*yb - zb*zb + xa*xa + ya*ya + za*za)/2 x*(xa - xc) + y*(ya - yc) + z*(za - zc) = (dc*dc - da*da - xc*xc - yc*yc - zc*zc + xa*xa + ya*ya + za*za)/2 x*(xa - xd) + y*(ya - yd) + z*(za - zd) = (dd*dd - da*da - xd*xd - yd*yd - zd*zd + xa*xa + ya*ya + za*za)/2
The following are substituted to simplify matters:
e = (db*db - da*da - xb*xb - yb*yb - zb*zb + xa*xa + ya*ya + za*za)/2 f = (dc*dc - da*da - xc*xc - yc*yc - zc*zc + xa*xa + ya*ya + za*za)/2 g = (dd*dd - da*da - xd*xd - yd*yd - zd*zd + xa*xa + ya*ya + za*za)/2
Which leaves:
x*x - 2xa*x + y*y - 2ya*y + z*z - 2za*z = da*da - xa*xa - ya*ya - za*za x*(xa - xb) + y*(ya - yb) + z*(za - zb) = e x*(xa - xc) + y*(ya - yc) + z*(za - zc) = f x*(xa - xd) + y*(ya - yd) + z*(za - zd) = g
We then solve the matrix, which leaves:
x*x - 2xa*x + y*y - 2ya*y + z*z - 2za*z = da*da - xa*xa - ya*ya - za*za x + y*(ya - yb)/(xa - xb) + z*(za - zb)/(xa - xb) = e/(xa - xb) x + y*(ya - yc)/(xa - xc) + z*(za - zc)/(xa - xc) = f/(xa - xc) x + y*(ya - yd)/(xa - xd) + z*(za - zd)/(xa - xd) = g/(xa - xd)
x*x - 2xa*x + y*y - 2ya*y + z*z - 2za*z = da*da - xa*xa - ya*ya - za*za x + y*(ya - yb)/(xa - xb) + z*(za - zb)/(xa - xb) = e/(xa - xb) 0 + y*[ (ya - yc)/(xa - xc) - (ya - yb)/(xa - xb) ] + z*[ (za - zc)/(xa - xc) - (za - zb)/(xa - xb) ] = [ f/(xa - xc) - e/(xa - xb) ] 0 + y*[ (ya - yd)/(xa - xd) - (ya - yb)/(xa - xb) ] + z*[ (za - zd)/(xa - xd) - (za - zb)/(xa - xb) ] = [ g/(xa - xd) - e/(xa - xb) ]
More substitutions in order to simplify the equations:
i = [ (ya - yc)/(xa - xc) - (ya - yb)/(xa - xb) ] j = [ (za - zc)/(xa - xc) - (za - zb)/(xa - xb) ]
p = [ (ya - yd)/(xa - xd) - (ya - yb)/(xa - xb) ] q = [ (za - zd)/(xa - xd) - (za - zb)/(xa - xb) ]
Substituting those terms in and simplifying yields:
x*x - 2xa*x + y*y - 2ya*y + z*z - 2za*z = da*da - xa*xa - ya*ya - za*za x + y*(ya - yb)/(xa - xb) + z*(za - zb)/(xa - xb) = e/(xa - xb) 0 + y*i + z*j = [ f/(xa - xc) - e/(xa - xb) ] 0 + y*p + z*q = [ g/(xa - xd) - e/(xa - xb) ]
x*x - 2xa*x + y*y - 2ya*y + z*z - 2za*z = da*da - xa*xa - ya*ya - za*za x + y*(ya - yb)/(xa - xb) + z*(za - zb)/(xa - xb) = e/(xa - xb) 0 + y + z*j/i = [ f/(xa - xc) - e/(xa - xb) ]/i 0 + y + z*q/p = [ g/(xa - xd) - e/(xa - xb) ]/p
x*x - 2xa*x + y*y - 2ya*y + z*z - 2za*z = da*da - xa*xa - ya*ya - za*za x + y*(ya - yb)/(xa - xb) + z*(za - zb)/(xa - xb) = e/(xa - xb) 0 + y + z*j/i = [ f/(xa - xc) - e/(xa - xb) ]/i 0 + 0 + z*(q/p - j/i) = { [ g/(xa - xd) - e/(xa - xb) ]/p - [ f/(xa - xc) - e/(xa - xb) ]/i }
These equations are then able to be solved for z:
x*x - 2xa*x + y*y - 2ya*y + z*z - 2za*z = da*da - xa*xa - ya*ya - za*za x + y*(ya - yb)/(xa - xb) + z*(za - zb)/(xa - xb) = e/(xa - xb) 0 + y + z*j/i = [ f/(xa - xc) - e/(xa - xb) ]/i 0 + 0 + z = { [ g/(xa - xd) - e/(xa - xb) ]/p - [ f/(xa - xc) - e/(xa - xb) ]/i }/(q/p - j/i)
Some final tweaks to the substitutions to allow for showing of where the distance data is necessary yields:
x*x - 2xa*x + y*y - 2ya*y + z*z - 2za*z = da*da - xa*xa - ya*ya - za*za x + y*(ya - yb)/(xa - xb) + z*(za - zb)/(xa - xb) = (0.5*db*db - 0.5*da*da + e2)/(xa - xb) 0 + y + z*j/i = [ (0.5*dc*dc - 0.5*da*da + f2)/(xa - xc) - (0.5*db*db - 0.5*da*da + e2)/(xa - xb) ]/i 0 + 0 + z = { [ (0.5*dd*dd - 0.5*da*da + g2)/(xa - xd) - (0.5*db*db - 0.5*da*da + e2)/(xa - xb) ]/p - [ (0.5*dc*dc - 0.5*da*da + f2)/(xa - xc) - (0.5*db*db - 0.5*da*da + e2)/(xa - xb) ]/i }/(q/p - j/i)
Where:
e2 = (- xb*xb - yb*yb - zb*zb + xa*xa + ya*ya + za*za)/2 f2 = (- xc*xc - yc*yc - zc*zc + xa*xa + ya*ya + za*za)/2 g2 = (- xd*xd - yd*yd - zd*zd + xa*xa + ya*ya + za*za)/2