[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[游戏娱乐] 3D 环涡 torus vortex

本帖最后由 aa77dd@163.com 于 2016-9-27 22:00 编辑



运行代码时, 请将窗口设置成 点阵 3 X 5 像素字体

20160927_214945 修正画法

  1. @echo off & setlocal enabledelayedexpansion & chcp 936 & title 3D Torus Vortex
  2. set "Path=%SystemRoot%\system32" & for /f "delims==" %%a in ('set') do if /i "%%a" neq "Path" set "%%a="
  3. set "SIN=(t-t*t/1875*t/320000+t*t/1875*t/15625*t/16000*t/2560000-t*t/1875*t/15360*t/15625*t/15625*t/16000*t/44800000)"
  4. set "COS=(10000-t*t/20000+t*t/1875*t/15625*t/819200-t*t/1875*t/15360*t/15625*t/15625*t/10240000+t*t/1875*t/15360*t/15625*t/15625*t/16000*t/15625*t/229376000)"
  5. set /a "ZM=10000, p=31416, p2=62832, pn2=-62832, p#2=15708, p3#2=47124, p3#2_=p3#2-1, DEG=31416/180"
  6. set /a "Cols=wid=330, lines=hei=130, lines_plus_1=lines+1"
  7. mode !Cols!,!lines_plus_1!
  8. set "TAB= " & for /F %%a in ('"prompt $h&for %%b in (1) do rem"')do Set "BS=%%a"
  9. set /a "buffwid = wid, linesWantBackAbove = hei - 1 + 1, cntBS = 2 + (buffwid + 7) / 8 * linesWantBackAbove"
  10. set "BSs=" & for /L %%a in (1 1 !cntBS!) do set "BSs=!BSs!%BS%"
  11. set "aLineBS=" & for /L %%a in (1 1 !wid!) do set "aLineBS=!aLineBS!%BS%"
  12. set "LN0=" & for /L %%C in (1 1 !Cols!) do set "LN0= !LN0!"
  13. for /L %%L in (1 1 !lines!) do set "LN%%L=!LN0!"
  14. set /a "pixel_h=5, pixel_w=3" & rem 字体像素高宽比
  15. rem zscr 屏幕 Z 轴坐标, zeye 视点 Z 轴坐标
  16. set /a "XC = Cols/2, YC = lines/2, zscr = 128, zeye = 400, zs2e=zscr-zeye"
  17. set /a "R1 = 68, r2 = 60, TH1 = 0, th2 = 0, cntRings=120, cntRings_1=cntRings-1, cntDotPerRing=20, cntDotPerRing_1=cntDotPerRing-1"
  18. set /a "sumDots=cntDotPerRing*cntRings"
  19. set /a "dth2base=(P2+P2/cntRings)/cntDotPerRing, offsClose=p2-(dth2base*cntDotPerRing-p2)*cntRings"
  20. set "offsClose=!offsClose!/!sumDots!"
  21. set /a "dTH1base=p2/cntRings, offsCloseBigCircle=p2-dTH1base*cntRings"
  22. set "offsCloseBigCircle=!offsCloseBigCircle!/!cntRings!"
  23. set /a "Z_cut_ZM=999*ZM" & rem 与 xoy 平面平行的切割平面, 将前部切去, 此值足够大时无切割效果
  24. for /l %%i in (0 1 !cntRings_1!) do (
  25.     for /l %%j in (0 1 !cntDotPerRing_1!) do (
  26.         set /a "TH1=%%i*dTH1base+ %%i * %offsCloseBigCircle%, TH1 %%= p2, TH1 += TH1>>31&p2, t=TH1, s1=(t-p#2^t-p3#2)>>31, s3=p3#2_-t>>31, t=(-t&s1)+(t&~s1)+(p&s1)+(pn2&s3), SIN_TH1=%SIN%, t=%COS%, COS_TH1=(-t&s1)+(t&~s1)"
  27.         set /a "t=%%i*cntDotPerRing+%%j,th2=t*dth2base+t*%offsClose%, th2 %%= p2, th2 += th2>>31&p2, t=th2, s1=(t-p#2^t-p3#2)>>31, s3=p3#2_-t>>31, t=(-t&s1)+(t&~s1)+(p&s1)+(pn2&s3), SIN_th2=%SIN%, t=%COS%, COS_th2=(-t&s1)+(t&~s1)"
  28.         title 3D Torus Vortex  %%i/!cntRings_1! %%j/!cntDotPerRing_1!  TH1: !TH1! th2: !th2!
  29.         set /a "z_ZM=(R1*ZM + r2*COS_th2)/ZM * SIN_TH1, z_t2eye_ZM=z_ZM -zeye*ZM, x=XC + (R1*ZM + r2*COS_th2)/ZM * COS_TH1 *zs2e* pixel_h /(z_t2eye_ZM * pixel_w), y=YC + r2 * SIN_th2 *zs2e/z_t2eye_ZM, inScr=(x-0^x-wid)&(y-0^y-hei)"
  30.         set /a "inner=(th2-p#2^th2-p3#2)" & rem 到 y 轴距离 < 大圆半径 R
  31.         if !z_ZM! LSS !Z_cut_ZM! (
  32.             set /a "ind=x+1, lenL=ind-1"
  33.             for /f "tokens=1-3" %%a in ("!lenL! !ind! !y!") do (
  34.                 if !TH1! LSS !p! (
  35.                     if !inner! LSS 0 (  set "LN%%c=!LN%%c:~0,%%a!#!LN%%c:~%%b!"
  36.                     ) else (            set "LN%%c=!LN%%c:~0,%%a!o!LN%%c:~%%b!"
  37.                     )
  38.                 ) else (
  39.                     if !inner! LSS 0 (  rem set "LN%%c=!LN%%c:~0,%%a!*!LN%%c:~%%b!" & 消隐内孔后半部分
  40.                     ) else (            set "LN%%c=!LN%%c:~0,%%a!.!LN%%c:~%%b!"
  41.                     )
  42.                 )
  43.             )
  44.         )
  45.         <nul set /p "=!aLineBS!" & (2>nul echo;%TAB%!BSs!) & <nul set /p "=%BS%"
  46.         for /L %%d in (1 1 !lines!) do <nul set /p "=%BS%!LN%%d!"
  47.     )
  48. )
  49. >nul pause
  50. exit
复制代码
523066680 的画法

  1. @echo off & setlocal enabledelayedexpansion & chcp 936 & title 3D Torus Vortex
  2. set "Path=%SystemRoot%\system32" & for /f "delims==" %%a in ('set') do if /i "%%a" neq "Path" set "%%a="
  3. set "SIN=(t-t*t/1875*t/320000+t*t/1875*t/15625*t/16000*t/2560000-t*t/1875*t/15360*t/15625*t/15625*t/16000*t/44800000)"
  4. set "COS=(10000-t*t/20000+t*t/1875*t/15625*t/819200-t*t/1875*t/15360*t/15625*t/15625*t/10240000+t*t/1875*t/15360*t/15625*t/15625*t/16000*t/15625*t/229376000)"
  5. set /a "ZM=10000, p=31416, p2=62832, pn2=-62832, p#2=15708, p3#2=47124, p3#2_=p3#2-1, DEG=31416/180"
  6. set /a "Cols=wid=330, lines=hei=130, lines_plus_1=lines+1"
  7. mode !Cols!,!lines_plus_1!
  8. set "TAB= " & for /F %%a in ('"prompt $h&for %%b in (1) do rem"')do Set "BS=%%a"
  9. set /a "buffwid = wid, linesWantBackAbove = hei - 1 + 1, cntBS = 2 + (buffwid + 7) / 8 * linesWantBackAbove"
  10. set "BSs=" & for /L %%a in (1 1 !cntBS!) do set "BSs=!BSs!%BS%"
  11. set "aLineBS=" & for /L %%a in (1 1 !wid!) do set "aLineBS=!aLineBS!%BS%"
  12. set "LN0=" & for /L %%C in (1 1 !Cols!) do set "LN0= !LN0!"
  13. for /L %%L in (1 1 !lines!) do set "LN%%L=!LN0!"
  14. set /a "pixel_h=5, pixel_w=3" & rem 字体像素高宽比
  15. REM zscr 屏幕 Z 轴坐标, zeye 视点 Z 轴坐标
  16. set /a "XC = Cols/2, YC = lines/2, zscr = 108, zeye = 400, zs2e=zscr-zeye"
  17. set /a "R1 = 64, r2 = 44, mp = 10, np = 90, Z_cut_ZM=999*ZM"  & rem Z_cut_ZM 是 平行于 xOy 平面的切割平面, 值够大时不会切割
  18. for /l %%m in (1 1 !mp!) do (
  19.     for /l %%n in (1 1 !np!) do (
  20.             set /a "TH1=p2* %%m /mp+p2*%%n/np, TH1 %%= p2, TH1 += TH1>>31&p2, t=TH1, s1=(t-p#2^t-p3#2)>>31, s3=p3#2_-t>>31, t=(-t&s1)+(t&~s1)+(p&s1)+(pn2&s3), SIN_TH1=%SIN%, t=%COS%, COS_TH1=(-t&s1)+(t&~s1)"
  21.             set /a "th2=p2*%%n/np, th2 %%= p2, th2 += th2>>31&p2, t=th2, s1=(t-p#2^t-p3#2)>>31, s3=p3#2_-t>>31, t=(-t&s1)+(t&~s1)+(p&s1)+(pn2&s3), SIN_th2=%SIN%, t=%COS%, COS_th2=(-t&s1)+(t&~s1)"
  22.             title 3D Torus Vortex  %%m / !mp! TH1:!TH1! th2:!th2!
  23.             set /a "z_ZM=(R1*ZM + r2*COS_th2)/ZM * SIN_TH1, z_t2eye_ZM=z_ZM -zeye*ZM, x=XC + (R1*ZM + r2*COS_th2)/ZM * COS_TH1 *zs2e* pixel_h /(z_t2eye_ZM * pixel_w), y=YC + r2 * SIN_th2 *zs2e/z_t2eye_ZM"
  24.             set /a "inner=(th2-p#2^th2-p3#2)" & rem 到 y 轴距离 < 大圆半径 R
  25.             if !z_ZM! LSS !Z_cut_ZM! (
  26.                     set /a "ind=x+1, lenL=ind-1" & rem  lenR=Cols-ind"
  27.                     for /f "tokens=1-3" %%a in ("!lenL! !ind! !y!") do (
  28.                         if !TH1! LSS !p! (
  29.                             if !inner! LSS 0 (  set "LN%%c=!LN%%c:~0,%%a!#!LN%%c:~%%b!"
  30.                             ) else (            set "LN%%c=!LN%%c:~0,%%a!o!LN%%c:~%%b!"
  31.                             )
  32.                         ) else (
  33.                             if !inner! LSS 0 (  set "LN%%c=!LN%%c:~0,%%a!*!LN%%c:~%%b!"
  34.                             ) else (            set "LN%%c=!LN%%c:~0,%%a!.!LN%%c:~%%b!"
  35.                             )
  36.                         )
  37.                     )
  38.             )
  39.             <nul set /p "=!aLineBS!" & (2>nul echo;%TAB%!BSs!) & <nul set /p "=%BS%"
  40.             for /L %%d in (1 1 !lines!) do <nul set /p "=%BS%!LN%%d!"
  41.     )
  42. )
  43. >nul pause
  44. exit
复制代码
3

评分人数

我去,牛逼

TOP

少年,批处理的明天靠你了!

TOP

可以透漏下什么样的学习路径能有机会到这个境界?

TOP

返回列表