Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Finding a shorter form for coplanar point in 3D space

  • To: mathgroup at smc.vnet.net
  • Subject: [mg65135] Finding a shorter form for coplanar point in 3D space
  • From: János <janos.lobb at yale.edu>
  • Date: Wed, 15 Mar 2006 06:29:38 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

Let say I have a Line in 3D with points A(xa,ya,0) and B(xb,yb,zb)  
and the distance between the two points in space is "l"  -small "L".   
Then I move this line into another position where the end points will  
be C(xc,yc,0) and D(xd,yd,zd).  The move is such that A,B and D are  
collinear, A and C remain in the xy-plane and A,B,C and D are  
coplanar.   The distance between C and D are also "l".  Let's say I  
know the coordinates of  A, B, and C and I am looking for D(xd,yd,zd).

 From the condition of collinearity of A,B,C is coming that the  
determinant of the matrix created from the coordinates has to vanish  
so my first equation eqn1:

In[1]:=
m = {{xa, ya, 0}, {xb, yb,
     zb}, {xd, yd, zd}}

In[2]:=
eqn1 = Det[m] == 0
Out[2]=
xd*ya*zb - xa*yd*zb -
    xb*ya*zd + xa*yb*zd == 0

The second equation is coming from the fact that the distance between  
C and D is "l":

In[11]:=
eqn2 = (xc - xd)^2 +
     (yc - yd)^2 + zd^2 == l^2

The third equation is given by similar triangles.  Let say if the  
vertical projection of D down to the xy-plane is Dxy and the same for  
B is Bxy, then BBxy:BxyA == DDxy:DxyA.  In coordinates:

eqn3 = zb/Sqrt[(xa - xb)^2 +
       (ya - yb)^2] ==
    zd/Sqrt[(xa - xd)^2 +
       (ya - yd)^2]

Well, if I put all three into Solve, like this innocent looking  
sol=Solve[{eqn1,eqn2,eqn3},{xd,yd,zd}], Solve will take my G5 duo  
into the bushes forever.  It looks to me that I should have up to max  
16 solutions for {xd,yd,zd}.

If I try to be cleaver and solve eqn3 for zd:

In[22]:=
solzd = Solve[eqn3, zd]
Out[22]=
{{zd -> (Sqrt[(xa - xd)^2 +
         (ya - yd)^2]*zb)/
      Sqrt[(xa - xb)^2 +
        (ya - yb)^2]}}

and punch it back to eqn1 and eqn2 then I get

In[8]:=
eqn1
Out[8]=
xd*ya*zb -
    (xb*ya*Sqrt[(xa - xd)^2 +
        (ya - yd)^2]*zb)/
     Sqrt[(xa - xb)^2 +
       (ya - yb)^2] +
    (xa*yb*Sqrt[(xa - xd)^2 +
        (ya - yd)^2]*zb)/
     Sqrt[(xa - xb)^2 +
       (ya - yb)^2] -
    xa*yd*zb == 0

and

In[13]:=
eqn2
Out[13]=
(xc - xd)^2 + (yc - yd)^2 +
    (((xa - xd)^2 + (ya - yd)^
        2)*zb^2)/
     ((xa - xb)^2 + (ya - yb)^
       2) == l^2

Now these two still take my G5 Duo to the laundry if I try Solve 
[{eqn1,eqn2},{xd,yd}].
The next step to do is to solve eqn1 for yd:

In[22]:=
solyd = Flatten[Solve[eqn1,
     yd]]
Out[22]=
{yd -> ((-xb)*ya + xd*ya +
      xa*yb - xd*yb)/
     (xa - xb), yd ->
    (xa^2*xb*ya + xa^2*xd*ya -
      2*xa*xb*xd*ya +
      xb*ya^3 + xd*ya^3 -
      xa^3*yb + xa^2*xd*yb -
      xa*ya^2*yb - xd*ya^2*yb)/
     (xa^3 - xa^2*xb +
      xa*ya^2 + xb*ya^2 -
      2*xa*ya*yb)}

and punch it back to eqn2.  Eqn2 will become two equations, eqn21 and  
eqn22.

In[28]:=
eqn21 = eqn2 /. yd ->
     solyd[[1,2]]
Out[28]=
(xc - xd)^2 +
    (-(((-xb)*ya + xd*ya +
         xa*yb - xd*yb)/
        (xa - xb)) + yc)^2 +
    (((xa - xd)^2 +
       (ya - ((-xb)*ya +
           xd*ya + xa*yb -
           xd*yb)/(xa - xb))^
        2)*zb^2)/
     ((xa - xb)^2 + (ya - yb)^
       2) == l^2

and

In[33]:=
eqn22 = eqn2 /. yd ->
     solyd[[2,2]]
Out[33]=
(xc - xd)^2 +
    (-((xa^2*xb*ya + xa^2*xd*
          ya - 2*xa*xb*xd*ya +
         xb*ya^3 + xd*ya^3 -
         xa^3*yb + xa^2*xd*
          yb - xa*ya^2*yb -
         xd*ya^2*yb)/(xa^3 -
         xa^2*xb + xa*ya^2 +
         xb*ya^2 - 2*xa*ya*
          yb)) + yc)^2 +
    (((xa - xd)^2 +
       (ya - (xa^2*xb*ya +
           xa^2*xd*ya -
           2*xa*xb*xd*ya +
           xb*ya^3 + xd*ya^3 -
           xa^3*yb + xa^2*xd*
           yb - xa*ya^2*yb -
           xd*ya^2*yb)/
          (xa^3 - xa^2*xb +
           xa*ya^2 + xb*ya^2 -
           2*xa*ya*yb))^2)*
      zb^2)/((xa - xb)^2 +
      (ya - yb)^2) == l^2


Solving these two is now a breeze for the G5 duo and both give two  
solutions.  The third and fourth solutions for xd are quite a few  
pages long.

I am wondering if there is another way - like using cylindrical  
coordinate system or using Reduce - to get shorter looking  
solutions.  Does Solve do a FullSimplify on its findings ?

Thanks ahead,

János


----------------------------------------------
Trying to argue with a politician is like lifting up the head of a  
corpse.
(S. Lem: His Master Voice)


  • Prev by Date: Re: Total Derivative and Output Display Question
  • Next by Date: RE: Re: Re: Mathematica and Education
  • Previous by thread: Re: Question: DiracDelta simplifies/integrates incorrectly?
  • Next by thread: Re: Finding a shorter form for coplanar point in 3D space