Скачать LineJoin - Find the Intersection of 2 Lines

23.02.1995
Скачать файл (15,86 Кб)




Program LineJoin;
Uses Crt;
Var X1,Y1,X2,Y2,X3,Y3,X4,Y4,Slope1,Slope2,B,C,
    InterceptX,InterceptY: Real;
    S1,S2,IX,IY,Xa,Ya,Xb,Yb,Xc,Yc,Xd,Yd: String;
Begin
  ClrScr;
  Writeln;
  Writeln('      *** Intersection of 2 Lines by F1 Computing ***');
  Writeln;
  Writeln('Input the X and Y Coordinate Endpoints'+
          ' of 2 Different Lines.');
  Writeln;
  Writeln('Do Not Input Parallel or Vertical Lines.');
  Writeln;
  Write('Press ''Enter'' to Begin...'); Readln;
  ClrScr;
  Writeln('Line One');
  Writeln('--------');
  Write('Input X1: '); Readln(X1);
  Write('Input Y1: '); Readln(Y1);
  Writeln;
  Write('Input X2: '); Readln(X2);
  Write('Input Y2: '); Readln(Y2);
  ClrScr;
  Writeln;
  Writeln('Line Two');
  Writeln('--------');
  Write('Input X3: '); Readln(X3);
  Write('Input Y3: '); Readln(Y3);
  Writeln;
  Write('Input X4: '); Readln(X4);
  Write('Input Y4: '); Readln(Y4);
  Writeln;
  If (X2-X1=0.0) then
  Begin
    Write('Line 1 is Vertical, you must not use a Vertical line!');
    { This would cause a division by zero error }
    Readln;
    Halt;
  End;
  If (X4-X3=0.0) then
  Begin
    Write('Line 2 is Vertical, you must not use a Vertical line!');
    { This would cause a division by zero error }
    Readln;
    Halt;
  End;
  Slope1  := (Y2-Y1)/(X