lisp2arx
Visual Programming for AutoLisp Mathématiques en programmation Lisp.. doc2cpp,doc2lsp, sld2lsp, bmp2dcl, free__GifCcapture for all-CAD'platforms..
Lista Forumurilor Pe Tematici
lisp2arx | Reguli | Inregistrare | Login

POZE LISP2ARX

Nu sunteti logat.
Nou pe simpatie:
Lolo
Femeie
25 ani
Galati
cauta Barbat
25 - 52 ani
lisp2arx / Delphi , InnoPascal / Delphi32 - FastSin and FastCos inside TMainForm  
Autor
Mesaj Pagini: 1
admin
Administrator

Din: Bucharest
Inregistrat: acum 13 ani
Postari: 515
{ GOAL      : Source code of the main unit                               }
{ VERSION   : 1.1e (e)English comments                                   }
{ REVISIONS : added fast trigo calculations                              }
{           : added TurtleBox (Color) for demo purposes                  }
{ AUTHOR    : P.Pollet INSA   12/12/92                                   }

Code:

const kProjectionCodeSinus:array[0..359] of Integer=(
     0,   175,   349,   523,   698,   872,  1045,  1219,  1392,  1564,
  1736,  1908,  2079,  2250,  2419,  2588,  2756,  2924,  3090,  3256,
  3420,  3584,  3746,  3907,  4067,  4226,  4384,  4540,  4695,  4848,
  5000,  5150,  5299,  5446,  5592,  5736,  5878,  6018,  6157,  6293,
  6428,  6561,  6691,  6820,  6947,  7071,  7193,  7314,  7431,  7547,
  7660,  7771,  7880,  7986,  8090,  8192,  8290,  8387,  8480,  8572,
  8660,  8746,  8829,  8910,  8988,  9063,  9135,  9205,  9272,  9336,
  9397,  9455,  9511,  9563,  9613,  9659,  9703,  9744,  9781,  9816,
  9848,  9877,  9903,  9925,  9945,  9962,  9976,  9986,  9994,  9998,
 10000,  9998,  9994,  9986,  9976,  9962,  9945,  9925,  9903,  9877,
  9848,  9816,  9781,  9744,  9703,  9659,  9613,  9563,  9511,  9455,
  9397,  9336,  9272,  9205,  9135,  9063,  8988,  8910,  8829,  8746,
  8660,  8572,  8480,  8387,  8290,  8192,  8090,  7986,  7880,  7771,
  7660,  7547,  7431,  7314,  7193,  7071,  6947,  6820,  6691,  6561,
  6428,  6293,  6157,  6018,  5878,  5736,  5592,  5446,  5299,  5150,
  5000,  4848,  4695,  4540,  4384,  4226,  4067,  3907,  3746,  3584,
  3420,  3256,  3090,  2924,  2756,  2588,  2419,  2250,  2079,  1908,
  1736,  1564,  1392,  1219,  1045,   872,   698,   523,   349,   175,
     0,  -175,  -349,  -523,  -698,  -872, -1045, -1219, -1392, -1564,
 -1736, -1908, -2079, -2250, -2419, -2588, -2756, -2924, -3090, -3256,
 -3420, -3584, -3746, -3907, -4067, -4226, -4384, -4540, -4695, -4848,
 -5000, -5150, -5299, -5446, -5592, -5736, -5878, -6018, -6157, -6293,
 -6428, -6561, -6691, -6820, -6947, -7071, -7193, -7314, -7431, -7547,
 -7660, -7771, -7880, -7986, -8090, -8192, -8290, -8387, -8480, -8572,
 -8660, -8746, -8829, -8910, -8988, -9063, -9135, -9205, -9272, -9336,
 -9397, -9455, -9511, -9563, -9613, -9659, -9703, -9744, -9781, -9816,
 -9848, -9877, -9903, -9925, -9945, -9962, -9976, -9986, -9994, -9998,
-10000, -9998, -9994, -9986, -9976, -9962, -9945, -9925, -9903, -9877,
 -9848, -9816, -9781, -9744, -9703, -9659, -9613, -9563, -9511, -9455,
 -9397, -9336, -9272, -9205, -9135, -9063, -8988, -8910, -8829, -8746,
 -8660, -8572, -8480, -8387, -8290, -8192, -8090, -7986, -7880, -7771,
 -7660, -7547, -7431, -7314, -7193, -7071, -6947, -6820, -6691, -6561,
 -6428, -6293, -6157, -6018, -5878, -5736, -5592, -5446, -5299, -5150,
 -5000, -4848, -4695, -4540, -4384, -4226, -4067, -3907, -3746, -3584,
 -3420, -3256, -3090, -2924, -2756, -2588, -2419, -2250, -2079, -1908,
 -1736, -1564, -1392, -1219, -1045,  -872,  -698,  -523,  -349,  -175);

How to Call?

Code:

Function FastSin (A:integer):Longint;
begin
 If A>=0 then FastSin:=kProjectionCodeSinus[A mod 360]   
       else FastSin:=-kProjectionCodeSinus[-A mod 360];
end;
{--}
Function FastCos (A:integer):LongInt;begin  FastCos:=FastSin(A+90)end;
 Function SlowSin(A:Integer):LongInt;
   begin
      FastSin:=Round(sin(A*pi/180)*10000);
   end;

   Function SlowCos(A:Integer):LongInt;
   begin
     FastCos:=Round(Cos(A*pi/180)*10000);
   end;



Code:

procedure DrawTriangle (Xc,Yc,Angle:Integer);
    Const L=15;
    var Xt,Yt,X,Y:integer;
    begin
      Xt:=Xc+ (LongInt(L)*FastCos(Angle) div 10000);
      Yt:=Yc+ (LongInt(L)*FastSin(Angle) div 10000);
      Xt:=ToScreenX(Xt);
      Yt:=ToScreenY(Yt);
      { Watch out for infinite loops if Graph. is omitted   }
      { MoveTo of the unit is redefined to call _HideTurtle }
      { that will call DrawTurtle(false)......              }
      Graph.MoveTo(Xt,Yt);
      X:=Xc+ (LongInt(L)*FastCos(Angle+120) div 10000);
      Y:=Yc+ (LongInt(L)*FastSin(Angle+120) div 10000);
      Graph.LineTo(ToScreenX(X),ToScreenY(Y));
      Graph.LineTo(ToScreenX(Xc),ToScreenY(Yc));
      X:=Xc+ (LongInt(L)*FastCos(Angle-120) div 10000);
      Y:=Yc+ (LongInt(L)*FastSin(Angle-120) div 10000);
      Graph.LineTo(ToScreenX(X),ToScreenY(Y));
      Graph.LineTo(Xt,Yt);
      Graph.MoveTo(ToScreenX(Xc),ToScreenY(Yc));
    end;



_______________________________________


pus acum 3 ani
   
admin
Administrator

Din: Bucharest
Inregistrat: acum 13 ani
Postari: 515
Q1:=How to compile the source bellow to C#. and .net?

Code:

(setq acad_iso11w100-extmin 1558 acad_iso11w100-extmax 59089)
 (setq acad_isoQsortTime 00:00.00)
 (setq runiftry35w100 (List (cons "0xD3B1" "pp_rolisonfelipe.vlax")
 (cons "4C28"  "start_list");;County.xml=8
 (cons "96CB"  "end_list");;County.xml=8
 (cons "066C"  "read");;County.xml=5
 (cons "6E00"  "alert");;County.xml=2
 (cons "0B26"  "dfn_dcl_i_save");;County.xml=1
 (cons "DC7E"  "load_dialog");;County.xml=1
 (cons "46CA"  "wcmatch");;County.xml=1
 (cons "28FD"  "vl-prin1-to-string");;County.xml=1
 (cons "0616"  "assert_cxx");;County.xml=1
 (cons "E6D1"  "dfn_getx_readkey");;County.xml=1
 (cons "624B"  "strcase");;County.xml=1
 (cons "3A50"  "open");;County.xml=1
 (cons "D518"  "set_tile");;County.xml=1
 (cons "B118"  "cadr");;County.xml=1
 (cons "D364"  "new_dialog");;County.xml=1
 (cons "1322"  "close");;County.xml=1
 (cons "4CDB"  "write-line");;County.xml=1
 (cons "9E77"  "grread");;County.xml=1
 (cons "D016"  "vl-filename-mktemp");;County.xml=1
))
(setq getmypid 0 setmypid (list "\n~pp_rolisonfelipe.vlax~"))
(defun jc_dup35(mypid loopwne / rom subf ansi.sys)
   (setq subf (cdr (assoc (substr mypid 3 4) runiftry35w100)))
   (setq ansi.sys (strcat (chr 126) (substr mypid 8) (chr 126)))
   (if (/= ansi.sys (car setmypid)) (setq setmypid (cons setmypid)) (setq ansi.sys nil))
   (setq getmypid (1+ getmypid))
   (setq rom (apply (read subf) loopwne))
   (if ansi.sys (setq setmypid (cdr setmypid)))
rom)



delphi32 fastsin and fastcos inside tmainform q1:=how compile the source bellow c#. and 1558 59089)

29.7KB


_______________________________________


pus acum 3 ani
   
Pagini: 1  

Mergi la