Application Center - Maplesoft

App Preview:

Finding the point on a line equidistant to two 3-D points

You can switch back to the summary page by clicking here.

Learn about Maple
Download Application


 

equaldistanceIn3D.mws

Finding the point on a line equidistant to two 3-D points

by: Yufang Hao

Purpose: Find a point in a straight line x = 2+t, y = t, z = -3+2*t , with the same distance of the points A(1,2,3) and B(3,0,1).

>

General Approach to the Question, solving manually

> restart;

let P(x,y,z) be a point on the line that has equal distance from both A and B, thus x=2+t, y=t, z=-3+2*t for some t and AP=BP, then

> x := t->2+t; y := t->t; z := t->-3+2*t;

x := proc (t) options operator, arrow; 2+t end proc...

y := proc (t) options operator, arrow; t end proc

z := proc (t) options operator, arrow; -3+2*t end p...

> A := [1,2,3]; B := [3,0,1];

A := [1, 2, 3]

B := [3, 0, 1]

> AP := sqrt( (x(t)-A[1])^2 + (y(t)-A[2])^2 + (z(t)-A[3])^2 );
BP := sqrt( (x(t)-B[1])^2 + (y(t)-B[2])^2 + (z(t)-B[3])^2 );

AP := sqrt(41-26*t+6*t^2)

BP := sqrt(17-18*t+6*t^2)

> eqn := AP=BP;

eqn := sqrt(41-26*t+6*t^2) = sqrt(17-18*t+6*t^2)

Solve the equation using Maple's solve() command.

> t_sol := solve(eqn,t);

t_sol := 3

substituting t back to P(x,y,z) will give you the wanted P

> P := [x(t_sol),y(t_sol),z(t_sol)];

P := [5, 3, 3]

Plotting the points and lines in 3D using pointplot3d() and plot3d() commands. Please refers to HELP.

> with(plots):

Warning, the name changecoords has been redefined

> points_AB := pointplot3d({A,B}, color=red, symbolsize=20, symbol=circle):

> point_P := pointplot3d({P}, color=blue, symbolsize=30, symbol=cross):

> t1:=-10: t2:=10:
line_end1:=[x(t1),y(t1),z(t1)]:
line_end2:=[x(t2),y(t2),z(t2)]:
line_t := pointplot3d({line_end1,line_end2}, connect=true, color=red, thickness=2 ):

> line_AP := pointplot3d({A,P}, connect=true, color=green, thickness=3):

> line_BP := pointplot3d({B,P}, connect=true, color=green, thickness=3):

> display3d({point_P,points_AB,line_AP,line_BP,line_t}, axes=normal, labels=['x','y','z'], orientation=[-60,60]);

[Maple Plot]

> line_t_option := plot3d([x(t),y(t),z(t)], t=-10..10, s=-10..10, thickness=3):

> display3d({point_P,points_AB,line_AP,line_BP,line_t_option}, axes=normal, labels=['x','y','z'], orientation=[-60,60]);

[Maple Plot]

>