home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / CNC11TP.ZIP / DELCANG.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1988-11-04  |  1.2 KB  |  40 lines

  1. { Copyright (C) 1988 Adam Fritz, 133 Main St., Afton, N.Y. 13730 }
  2.  
  3. program DeltaCircularAngle (output) ;
  4.  
  5.      { DelCAng - Compute number of chord segments required }
  6.      {           by chord-tangent difference equal to one. }
  7.  
  8. var
  9.    r,irs : integer ;
  10.    da,dad,dade,dada : single ;
  11.    cosdad2,sindad2 : single ;
  12.    nda,ndae : integer ;
  13.  
  14. begin
  15.                                 { for radii 1-512 }
  16.    for irs := 0 to 10 do begin
  17.       r := 1 shl irs ;
  18.                                 { exact increment angle }
  19.       cosdad2 := (r-0.5)/r ;
  20.       sindad2 := sqrt(1.0-sqr(cosdad2)) ;
  21.       if cosdad2 > 0.0 then
  22.          da := 2.0*arctan(sindad2/cosdad2)
  23.       else
  24.          da := Pi / 2.0 ;
  25.       dad := da / Pi * 180 ;
  26.       nda := round(2.0*Pi/da) ;
  27.                                 { approximate increment angle }
  28.       da := 2.0*sqrt(1.0/r) ;
  29.       dade := da / Pi * 180 ;
  30.       ndae := round(2.0*Pi/da) ;
  31.                                 { adjusted increment angle }
  32.       dada := 360.0/ndae ;
  33.       writeln (output,r:5,' ',dad:10:5,' ',nda:5,
  34.                            ' ',dade:10:5,' ',ndae:5,
  35.                            ' ',dada:10:5)
  36.    end
  37. end.
  38.  
  39. { Copyright (C) 1988 Adam Fritz, 133 Main St., Afton, N.Y. 13730 }
  40.