Distance_LP - compute distance between point and line
Delphi & Pascal (česká wiki)
Category: Homework in Pascal
Program: Poilinp.pas, Poilinu.pas
File exe: Poilinp.exe, Poilinu.tpu
need: Angeom02.tpu, Uninout.tpu, Egavga.bgi
flow: Poilin.doc, Amater.txt
Example: Angeom02.pas, Uninout.pas
Program: Poilinp.pas, Poilinu.pas
File exe: Poilinp.exe, Poilinu.tpu
need: Angeom02.tpu, Uninout.tpu, Egavga.bgi
flow: Poilin.doc, Amater.txt
Example: Angeom02.pas, Uninout.pas
For units AnGeom02 (algebraics geometry) make function Distance_LP. This function compute distance between point and line.
FUNCTION Distance_LP(Line1:TLine; bodA:TPoint): Real;
FUNCTION Distance_LP(Line1:TLine; bodA:TPoint): Real;
UNIT UnInOut; { UNINOUT.PAS A Unix like basic input/output } { Borsuk Pi 95/12/01 09:05 V001 } INTERFACE USES Crt; VAR stdin, stdout, stderr: Text; PROCEDURE UnOpen; PROCEDURE UnClose; PROCEDURE Wait; PROCEDURE Wayt; IMPLEMENTATION PROCEDURE Wait; VAR w: Char; BEGIN w := ReadKey; IF (w = #$1B) THEN Halt; IF (w = #$0D) THEN WriteLn( stderr ); END; { Wait } PROCEDURE Wayt; VAR w: Char; BEGIN Write( stderr, #15 ); { Velka hviezdica ako prompt } w := ReadKey; Write( stderr, #8#32#8 ); IF (w = #$1B) THEN Halt; IF (w = #$0D) THEN WriteLn( stderr ); END; { Wayt } PROCEDURE UnOpen; BEGIN Assign( stdin, '' ); ReSet( stdin ); Assign( stdout, '' ); ReWrite( stdout ); AssignCrt( stderr ); ReWrite( stderr ); END; { UnOpen } PROCEDURE UnClose; BEGIN WriteLn( stdout ); Close( stdout ); Close( stdin ); Close( stderr ); END; { UnClose } BEGIN { main() = UNINOUT.PAS } UnOpen; END. { main() = UNINOUT.PAS }