rem D_PTPL.CDL rem Copy Right by International Technology Transfer Corp. rem revision 1.0 7/30/99 rem Distance from Point to Plane clear defopt = 2 dspflg = 1 :start getpos "Indicate Point",defopt on (@key + 3) goto exit, start, start, defopt = @key x0 = @xworld y0 = @yworld z0 = @zworld getplane "Select Method For Plane Definition", dspflg on (@key + 3) goto exit, start, , a = @fltdat[10] b = @fltdat[11] c = @fltdat[12] d = @fltdat[13] bunbo = sqrt(a * a + b * b + c * c) dist = abs(a * x0 + b * y0 + c * z0 + d) / bunbo f = a / bunbo g = b / bunbo h = c / bunbo x = x0 - f * (a * x0 + b * y0 + c * z0 + d) / bunbo y = y0 - g * (a * x0 + b * y0 + c * z0 + d) / bunbo z = z0 - h * (a * x0 + b * y0 + c * z0 + d) / bunbo mode draw line x0, y0, z0, x, y, z, 15, ,2 mode normal pause "Distance from Point to Plane = %.3f",dist redraw goto start :exit