Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I have a 3d triangle ABC. Lengths AB, BC, and AC are known. Coordinates of points A and B are known. Point C only the y value of the coordinate is known.

I believe there are 2 points that can satisfy the above constraints, I just can't find a method to derive them. If it simplifies calculations, either A or B can be located at (0,0,0).

I do not care how it can be solved, as long as I can implement it in Ruby.

Any guidance will be greatly appreciated.

share|improve this question

2 Answers 2

If you have the points $A$ and $B$ and the distance from $C$ to them, that is $AC$ and $BC$, for sure your point $C$ must belong on the intersection of two spheres, centered at $A$ and $B$, with radius $AC$ and $BC$, respectively. But this intersection should be a circle. Then you have to use other information about $C$ to determine it (its $y$-coordinates, for example).

Edit: as observed by Zev Chonoles, this does not work if the circle of intersection is contained on the $xz$-plane.

share|improve this answer
1  
I think you should mention explicitly that if the circle lies in the $xz$-plane (i.e. the $y$-coordinate of every point on the circle is the same) then knowing the $y$-coordinate provides no information and there will be infinitely many points meeting the constraints, and also that it is possible there is only one point meeting the constraints. –  Zev Chonoles Jan 2 '13 at 22:06
    
my reply was too long for a comment, I had to post it as a separate answer. –  Scott Jan 5 '13 at 20:18
up vote 0 down vote accepted

Okay, using Sigurs advice, I can solve for x and z of point C. The code below seems to work correctly in my application. I verified the output of a few points with my CAD software.

Is there a cleaner method, maybe using Matrix or Vector math? The equations are extremely long. I broke the equation for c.z up into a few parts to try and reduce typos.

(c.x - a.x)^2 + (c.y - a.y)^2 + (c.z - a.z)^2 = ac^2
a = [0, 0, 0]
x^2 + y^2 + z^2 = AC^2

(c.x - b.x)^2 + (c.y - b.y)^2 + (c.z - b.z)^2 = bc^2

known variables

b.x, b.y, b.z, c.y, ab, ac, bc

find c.x and c.z

below is my equations coded in ruby that has passed my unit tests so far.

c.x = ( ac**2 - bc**2 + b.x**2 + b.y**2 - 2*c.y*b.y + b.z**2 - 2*c.z*b.z ) / (2*b.x)

aa = 4*ac**2*b.z - 4*bc**2*b.z + 4*b.x**2*b.z + 4*b.y**2*b.z - 8*c.y*b.y*b.z + 4*b.z**3
bb = 2*ac**2*bc**2 - ac**4 + 2*ac**2*b.x**2 - 2*ac**2*b.y**2 + 4*ac**2*b.y*c.y + 2*ac**2*b.z**2 - bc**4 + 2*bc**2*b.x**2 + 2*bc**2*b.y**2 - 4*bc**2*b.y*c.y + 2*bc**2*b.z**2 - b.x**4 - 2*b.x**2*b.y**2 + 4*b.x**2*b.y*c.y - 2*b.x**2*b.z**2 - 4*b.x**2*c.y**2 - b.y**4 + 4*b.y**3*c.y - 2*b.y**2*b.z**2 - 4*b.y**2*c.y**2 + 4*b.y*b.z**2*c.y - b.z**4 - 4*b.z**2*c.y**2
c.z = 4*b.x**2 * ( ((aa) / 8*b.x**2) + (Math.sqrt(bb) / (2*b.x)) ) / (4*b.x**2 + 4*b.z**2)
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.