distance - Maple Help

geometry

 distance
 find the distance between two points, or a point and a line

 Calling Sequence distance(P1, P2) distance(P1, l)

Parameters

 P1, P2 - points l - line

Description

 • The routine computes the distance between two points P1 and P2 or between a point P1 and a line l.
 • The command with(geometry,distance) allows the use of the abbreviated form of this command.

Examples

 > $\mathrm{with}\left(\mathrm{geometry}\right):$
 > $\mathrm{point}\left(A,a,b\right),\mathrm{point}\left(B,c,d\right):$
 > $\mathrm{distance}\left(A,B\right)$
 $\sqrt{{\left({a}{-}{c}\right)}^{{2}}{+}{\left({b}{-}{d}\right)}^{{2}}}$ (1)
 > $\mathrm{assume}\left(m\ne 0\right):$
 > $\mathrm{line}\left(l,mx+ny=w,\left[x,y\right]\right):$
 > $\mathrm{distance}\left(A,l\right)$
 $\frac{\left|{a}{}{\mathrm{m~}}{+}{b}{}{n}{-}{w}\right|}{\sqrt{{{\mathrm{m~}}}^{{2}}{+}{{n}}^{{2}}}}$ (2)
 > $\mathrm{distance}\left(B,l\right)$
 $\frac{\left|{c}{}{\mathrm{m~}}{+}{d}{}{n}{-}{w}\right|}{\sqrt{{{\mathrm{m~}}}^{{2}}{+}{{n}}^{{2}}}}$ (3)