Информационный сервер для программистов: Исходники со всего света. Паскальные исходники со всего света
  Powered by Поисковый сервер Яndex: Найдется ВСЁ!
На Главную Исходники Форум Информер Страны мира
   Математика    >>    3ptpas
   
 
 Circle Finder  Jules H. Gilder 21.12.1992

Программа для вычисления центра и радиуса окружности, проходящей через три точки, не лежащие на одной прямой.
This program will find the center and radius of a circle that is formed by three points not in a straight line.



7k 
 

{================================================} { This program is taken from the book, } { "PASCAL programs in science and engineering" } { by Jules H. Gilder & J. Scott Barrus } { Published by, HAYDEN ISBN 0-8104-6265-6 } { } {================================================} { } { Title: Circle Finder } { } { Program Summary: Program will find the center } { and radius of a circle that is formed by three } { points not in a straight line. } { } {================================================} Program Circle_Finder; uses Crt; var answer, cont : Char; out : Text; X1,X2,X3, Y1,Y2,Y3, Part1, Part2, Part3, Part4, X,Y, Radius : Real; Procedure Title; begin Clrscr; Writeln; Writeln('Circle Finder'); Writeln;Writeln; Writeln('This program will find the center and'); Writeln('radius of a circle that is determined'); Writeln('by any three points in a plane that '); Writeln('does not form a straight line.'); Writeln; Writeln('Note: For all entries that require'); Writeln(' data entries (x,y); separate '); Writeln(' all data with a space.'); Writeln;Writeln; end; { Title } Procedure Input; begin Write('Enter first point (X,Y): '); Readln(X1,Y1); Write('Enter second point (X,Y): '); Readln(X2,Y2); Write('Enter third point (X,Y): '); Readln(X3,Y3); Writeln;Writeln;Writeln; end; Procedure Find; begin Part1 := ((X2-X1) * (X2+X1) + (Y2-Y1) * (Y2 + Y1)) / (2.0 * (X2-X1)); Part2 := ((X3-X1) * (X3+X1) + (Y3-Y1) * (Y3 + Y1)) / (2.0 * (X3-X1)); Part3 := (Y2 - Y1) / (X2 - X1); Part4 := (Y3 - Y1) / (X3 - X1); Y := (Part2 - Part1) / (Part4 - Part3); X := Part2 - Part4 * Y; Radius := SQRT (SQR (X3 - X) + SQR (Y3 - Y)); end; Procedure Print1; begin Writeln('The circle defined by the following'