rem L_2LN.CDL rem Copy Right by International Technology Transfer Corp. rem revision 1.0-7/30/99 rem Intersection between 2 planes clear dspflg = 1 acc = 0.00001 :start getplane "Select First Plane", dspflg on (@key + 3) goto exit,,, a1 = @fltdat[10] b1 = @fltdat[11] c1 = @fltdat[12] d1 = @fltdat[13] getplane "Select Second Plane", dspflg on (@key + 3) goto exit, start, , a2 = @fltdat[10] b2 = @fltdat[11] c2 = @fltdat[12] d2 = @fltdat[13] f = b1 * c2 - b2 * c1 g = c1 * a2 - c2 * a1 h = a1 * b2 - a2 * b1 bunbo = f * f + g * g + h * h if (bunbo>acc) goto next pause "Two Planes Are Parallel (Press Return)" goto start :next f = f / sqrt(bunbo) g = g / sqrt(bunbo) h = h / sqrt(bunbo) dc = d1 * c2 - d2 * c1 db = d1 * b2 - d2 * b1 da = d1 * a2 - d2 * a1 x0 = (g * dc - h * db) / bunbo y0 = (h * da - f * dc) / bunbo z0 = (f * db - g * da) / bunbo vx1 = @xmax vy1 = @ymax vx2 = @xmin vy2 = @ymin dist = sqrt((vx1 - vx2) * (vx1 - vx2) + (vy1 - vy2) * (vy1 - vy2)) vx = (vx1 + vx2) / 2.0 vy = (vy1 + vy2) / 2.0 call xfvw, vx, vy, 0, wx, wy, wz t = (f * (wx - x0) + g * (wy - y0) + h * (wz - z0)) / bunbo x0 = x0 + f * t y0 = y0 + g * t z0 = z0 + h * t x1 = x0 + f * dist /2.0 y1 = y0 + g * dist /2.0 z1 = z0 + h * dist /2.0 x2 = x0 - f * dist /2.0 y2 = y0 - g * dist /2.0 z2 = z0 - h * dist /2.0 line x1, y1, z1, x2, y2, z2 redraw goto start :exit