distance - Maple Help

geom3d

 distance
 find the distance between two given objects

 Calling Sequence distance(A, B) distance(l1, l2) distance(p1, p2) distance(A, l1) distance(A, p1) distance(l1, p1)

Parameters

 A, B - points l1, l2 - lines p1, p2 - planes

Description

 • The routine computes the distance between two given objects: points, lines, and planes, or any combination of these.
 • The command with(geom3d,distance) allows the use of the abbreviated form of this command.

Examples

 > $\mathrm{with}\left(\mathrm{geom3d}\right):$

Distance from a point to a plane

 > $\mathrm{assume}\left(l\ne 0\right)$
 > $\mathrm{plane}\left(\mathrm{pp},lx+my+nz+p=0,\left[x,y,z\right]\right):$
 > $\mathrm{point}\left(A,\left[\mathrm{x1},\mathrm{y1},\mathrm{z1}\right]\right):$
 > $\mathrm{distance}\left(A,\mathrm{pp}\right)$
 $\frac{\left|{\mathrm{x1}}{}{\mathrm{l~}}{+}{\mathrm{y1}}{}{m}{+}{\mathrm{z1}}{}{n}{+}{p}\right|}{\sqrt{{{\mathrm{l~}}}^{{2}}{+}{{m}}^{{2}}{+}{{n}}^{{2}}}}$ (1)
 > $l≔'l':$

Find the distance from a point to a straight line

 > $\mathrm{point}\left(A,6,6,-1\right),\mathrm{line}\left(l,\left[2+t,1+2t,-3-t\right],t\right):$
 > $\mathrm{distance}\left(A,l\right)$
 $\frac{\sqrt{{14}}{}\sqrt{{6}}}{{2}}$ (2)

Find the two points on the line $x$=$2y$=$3z+6$ at a distance of 7 units from the plane $2x+y-2z$=5.

 > $\mathrm{point}\left(o,t,\frac{1}{2}t,-2+\frac{t}{3}\right):$
 > $\mathrm{plane}\left(p,2x+y-2z=5,\left[x,y,z\right]\right):$
 > $d≔\mathrm{distance}\left(o,p\right):$
 > $\mathrm{ans}≔\left[\mathrm{solve}\left(d=7,t\right)\right]:$
 > $\mathbf{for}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}i\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{to}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathrm{nops}\left(\mathrm{ans}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{do}\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\phantom{\rule[-0.0ex]{2.0em}{0.0ex}}\mathrm{ans}≔\mathrm{subsop}\left(i=\mathrm{subs}\left(t=\mathrm{op}\left(i,\mathrm{ans}\right),\mathrm{coordinates}\left(o\right)\right),\mathrm{ans}\right)\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\mathbf{end}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{do}:$

coordinates of the two points are

 > $\mathrm{ans}$
 $\left[\left[{12}{,}{6}{,}{2}\right]{,}\left[{-}\frac{{120}}{{11}}{,}{-}\frac{{60}}{{11}}{,}{-}\frac{{62}}{{11}}\right]\right]$ (3)