Advertisement
IcarusLives

New Rose Petal Demonstration

Aug 13th, 2017
440
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.26 KB | None | 0 0
  1. @echo off & setlocal enableDelayedExpansion
  2.  
  3. set ^"LF=^
  4.  
  5. ^" Above empty line is required - do not remove
  6. set ^"\n=^^^%LF%%LF%^%LF%%LF%^^"
  7.  
  8. set /a "hei=50", "wid=50", "heiXwid=hei * wid"
  9. for /l %%a in (1,1,%heiXwid%) do set "canvas=!canvas! "
  10. mode con: cols=%wid% lines=%hei%
  11.  
  12. set "_SIN=a-a*a/1920*a/312500+a*a/1920*a/15625*a/15625*a/2560000-a*a/1875*a/15360*a/15625*a/15625*a/16000*a/44800000"
  13. set "SIN(x)=(a=(x * 31416 / 180)%%62832, c=(a>>31|1)*a, a-=(((c-47125)>>31)+1)*((a>>31|1)*62832)  +  (-((c-47125)>>31))*( (((c-15709)>>31)+1)*(-(a>>31|1)*31416+2*a)  ), %_SIN%) / 10000"
  14. set "COS(x)=(a=(15708 - x * 31416 / 180)%%62832, c=(a>>31|1)*a, a-=(((c-47125)>>31)+1)*((a>>31|1)*62832)  +  (-((c-47125)>>31))*( (((c-15709)>>31)+1)*(-(a>>31|1)*31416+2*a)  ), %_SIN%) / 10000"
  15.    
  16. set plot=for %%# in (1 2) do if %%#==2 ( for /f "tokens=1-3" %%1 in ("^!args^!") do (%\n%
  17.     set /a "_x=%%~1 + (%%~2 * wid)", "_y=1 + %%~1 + (%%~2 * wid)"%\n%
  18.     for /f "tokens=1-3" %%a in ("^!_x^! ^!_y^! ^!heiXwid^!") do set "canvas=^!canvas:~0,%%a^!%%~3^!canvas:~%%b,%%c^!"%\n%
  19. )) else set args=
  20.  
  21. for /l %%e in () do (
  22.  
  23.     set /a "angle+=1", "x=20 * !cos(x):x=5 * angle! * !sin(x):x=angle! + wid / 2", "y=20 * !cos(x):x=5 * angle! * !cos(x):x=angle! + hei / 2"
  24.  
  25.     %plot% x y x
  26.     echo=!canvas!
  27. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement