kill(all)$

maxima : interaction between two areoplanes (L1 & L2),version  1.0
peter.vlasschaert@gmail.com,22/09/2020

ref :youtube 'Professor Leonard'

calculus 3 Lecture 11.5: Lines and Planes in 3-D
======================================
see also (easy to understand,back ground )
--------------
Calculus 3 Lecture 11.1 →Calculus 3 Lecture 11.4 
---------------------------------------------------------------------
intro : vector analysis

load packages , option.
---------------------------------

load(lrats)$ ratprint:false$

mathematical interaction
=========================
between aeroplanes ( L1 & L2),(parameter =t1,t2)

given : first areoplane , line 3d, start  point  ( = "x1,y1,z1",point on that line =L1)
→    L1:(x-x1)/a1=(y-y1)/b1=(z-z1)/c1=t1,  ( L1a & L1b)

L1a:(x-x1)/a1=(y-y1)/b1;
L1b:(y-y1)/b1=(z-z1)/c1;

find :parametric equations of the  line : L1
--------------------------------------------------------

m1a:lhs(L1a)=t1$ 
m1a:solve(m1a,x)[1];
m1b:rhs(L1a)=t1$ 
m1b:solve(m1b,y)[1];
m1c:rhs(L1b)=t1$ 
m1c:solve(m1c,z)[1];

then  , direction vectot of the line  L1:  v1:< a1,b1,c1 >

v1:[a1,b1,c1];

given : second areoplane , line 3d, start  point  ( = "x2,y2,z2",point on that line=L2)
→    L2:(x-x2)/a2=(y-y2)/b2=(z-z2)/c2=t2 , ( L2a & L2b)

L2a:(x-x2)/a2=(y-y2)/b2;
L2b:(y-y2)/b2=(z-z2)/c2;

find :parametric equations of the  line : L2
---------------------------------------------------------

m2a:lhs(L2a)=t2$ 
m2a:solve(m2a,x)[1];
m2b:rhs(L2a)=t2$ 
m2b:solve(m2b,y)[1];
m2c:rhs(L2b)=t2$ 
m2c:solve(m2c,z)[1];

then  , direction vectot of the line  L2:  v2:< a2,b2,c2 >

v2:[a2,b2,c2];

interaction (  L1 & L2)
=================

r1:rhs(m1a)=rhs(m2a);
r2:rhs(m1b)=rhs(m2b);
r3:rhs(m1c)=rhs(m2c);

sort(listofvars(r1));

find :intersection (L1 & L2), Li = line 'i'

r3a:flatten(solve([r1,r2],[t1,t2]));

r4a:lhs(r3a[1])=factorsum(rhs(r3a[1]));
r4b:lhs(r3a[2])=factorsum(rhs(r3a[2]));

point : interaction(L1 & L2); (xi,yi,zi),general solution
===========================

→solution 1: ( use :t1)  & {m1a,m1b,m1c}

r5a:xi=lratsubst([r4a],rhs(m1a)),ratsimp;
r5b:yi=lratsubst([r4a],rhs(m1b)),ratsimp;
r5c:zi=lratsubst([r4a],rhs(m1c)),expand;

rem :a1*b2-a2*b1 ∥ 0

→solution 2:(use t2) & {m2a,m2b,m2c}

r6a:xi=lratsubst([r4b],rhs(m2a)),ratsimp;
r6b:yi=lratsubst([r4b],rhs(m2b)),ratsimp;
r6c:zi=lratsubst([r4b],rhs(m2c)),expand;

check solution (solution  1 ? solution 2)
--------------------

is(rhs(r5a)=rhs(r6a));/*because : we use them,'t1,t2'*/
is(rhs(r5b)=rhs(r6b));/*because : we use them,'t1,t2'*/

rem :a1*b2-a2*b1 ∥ 0,r5c =r6c . then we have collision between the two planes.
→  z1+c1*t1=z2+c2*t2  ,?  true ' intersect',not exact same =skew lines (first : check no interaction :'a)')

a)  no interaction:when v1// v2     ' =  { v1 = λ*v2}  ',special solution'
-------------------------------------------------------------------------------------------
direction vectors are different from scalar value = λ

v3a:v1=λ*v2;

v3b:makelist(lhs(v3a)[i]=rhs(v3a)[i],i,1,length(v1));

use :solution 1,2 & v3b,denominator =0

use : r5a & v3b

v3c:denom(rhs(r5a));

v3c1:lratsubst(v3b,v3c);

result a) :    v1//v2 → L1//L2 

b) acute angle between (L1 &  L2) = θ

v4a0:v1.v2;/*dot product :a.b ,a,b = vectors */

v4a1:norm(v1)=sqrt(a1^2+b1^2+c1^2); /* L2_norm =distance 'norm' */
v4a2:norm(v2)=sqrt(a2^2+b2^2+c2^2); /* L2_norm =distance 'norm' */

→ cos(θ)

va3:cos(θ)=v4a0/(rhs(v4a1)*rhs(v4a2));

→  θ:

va4:acos(va3);

va5:θ = abs(rhs(va4));

info : point xy plane → z=0 ( cross xy plane),find that point
         point yz plane → x=0 ( cross yz plane),find that point
         point xz plane → y=0 ( cross xz plane),find that point

info : plane : ' =areoplane'

example : find out intersect ? ' between two areoplanes '
========================
areoplane 1:L1:(x-x1)/a1=(y-y1)/b1=(z-z1)/c1=t1
--------------------------------------------------
x1=1,a1=-1,y1=3,b1=-2,z1=0,c1=1
============================
areoplane 2:L2:(x-x2)/a2=(y-y2)/b2=(z-z2)/c2=t2
--------------------------------------------------
x2=2,a2=3,y2=3,b2=2,z2=1,c2=1

areoplane 1:

s1:[x1=1,a1=-1,y1=3,b1=-2,z1=0,c1=1];
s1a:[lratsubst(s1,r4a)];
s1b:append(s1,s1a);

areoplane 2:

s2:[x2=2,a2=3,y2=3,b2=2,z2=1,c2=1];
s2a:[lratsubst(s2,r4b)];
s2b:append(s2,s2a);

combination :s1 & s2

s3:append(s1,s2);

s3a:lratsubst(s3,s1a);
s3b:lratsubst(s3,s2a);

s3c:append(s3a,s3b);

use : r1,r2,r3,see above , theoretical analysis

s4a:append(s3,s3c);
s4b1:lratsubst(s4a,r1);
s4b2:lratsubst(s4a,r2);
s4b3:lratsubst(s4a,r3);

intersection point :(xi,yi,zi) ' for two areoplanes'
------------------------------------------------------------

s4c:[xi=lhs(s4b1),yi=lhs(s4b2),zi=lhs(s4b3)];

result :the crash of both areoplanes.

intesection :angle= θ, 'acute angle of intersection',between two areoplanes
------------------------------------------------------------------------------------------------------
use :equation va5 , above

s5a:va5; /*absolute value: acute angle */

→angle radian

s5b:lratsubst(s3,s5a);

→ angle degree (°)

s5c:float(s5b); /*radians : π =3.14159 */

fpprintprec : 5$ /*see :menu 'numeric'*/

s5d: print(lhs(s5c)=180*rhs(s5c)/3.14159,"°")$ /*degree : π=180° */