Skip to content

Commit 64f2403

Browse files
Update sphere.cmd
1 parent 0ec2563 commit 64f2403

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

sphere/sphere.cmd

+15-13
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
@echo off & setlocal enableDelayedExpansion
22

33
rem this script work on 1x2 char ratio. it duoble the width.
4-
call :Set_Font "Lucida Console" 8 nomax %1 || exit
4+
call :Set_Font "Lucida Console" 2 nomax %1 || exit
55

66
rem For Fast PC you can increase number of point or radius
7-
set /a "point=15, rad=40, wid=(rad*2+rad*2),hei=rad*2"
7+
set /a "point=15, rad=160, wid=(rad*2+rad*2),hei=rad*2"
88

99
mode %wid%,%hei%
1010
chcp 65001
@@ -13,18 +13,20 @@ for /f %%a in ('echo prompt $E^| cmd') do set "\e=%%a"
1313
rem you can try different type of point
1414
%= *Φ•○♥øo█♦ =%
1515
REM set "ball=%\e%[D███%\e%[A%\e%[3D/█\%\e%[2B%\e%[3D\█/"
16-
REM set "ball=██"
17-
set "ball="
16+
set "ball=██"
1817

19-
set "sin=(a=((x*31416/180)%%62832)+(((x*31416/180)%%62832)>>31&62832), b=(a-15708^a-47124)>>31,a=(-a&b)+(a&~b)+(31416&b)+(-62832&(47123-a>>31)),a-a*a/1875*a/320000+a*a/1875*a/15625*a/16000*a/2560000-a*a/1875*a/15360*a/15625*a/15625*a/16000*a/44800000)"
20-
set "cos=(a=((15708-x*31416/180)%%62832)+(((15708-x*31416/180)%%62832)>>31&62832), b=(a-15708^a-47124)>>31,a=(-a&b)+(a&~b)+(31416&b)+(-62832&(47123-a>>31)),a-a*a/1875*a/320000+a*a/1875*a/15625*a/16000*a/2560000-a*a/1875*a/15360*a/15625*a/15625*a/16000*a/44800000)"
2118

19+
set /a "PI=(35500000/113+5)/10, HALF_PI=(35500000/113/2+5)/10, TAU=TWO_PI=2*PI, PI32=PI+HALF_PI"
20+
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"
21+
set "sin=(a=(x)%%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!)"
22+
set "cos=(a=(15708 - x)%%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!)"
23+
set "_sin="
2224
rem Hide cursor
2325
echo %\e%[?25l
2426

2527
rem precompute
26-
set /a step=360/point
27-
for /l %%i in (0,%step%,360) do (
28+
set /a step=tau/point
29+
for /l %%i in (0,%step%,%tau%) do (
2830
set /a "ci=!cos:x=%%i!, si=!sin:x=%%i!"
2931
set "PRE=!PRE!"!ci! !si!" "
3032
)
@@ -43,9 +45,9 @@ rem Step 4: Empty env
4345

4446
for /f "tokens=1-4 delims=:.," %%a in ("!time: =0!") do set /a "t2=((((10%%a-1000)*60+(10%%b-1000))*60+(10%%c-1000))*100)+(10%%d-1000)"
4547
set /a "dt=(t2 - t1)*10000/%%#, FPS=1000000/dt"
46-
title dt=!dt! FPS=!FPS!
48+
title %%# dt=!dt! FPS=!FPS! angle:!angle!
4749

48-
set /a "dt=t2 - t1, angle=dt/3 %% 360" & set "dt=" & set "t2=" & set "FPS=" & rem step 5 keep env empty
50+
set /a "dt=t2 - t1, angle=dt * 60" & set "dt=" & set "t2=" & set "FPS=" & rem step 5 keep env empty
4951

5052
set /a "ca=!cos:x=angle!, sa=!sin:x=angle!"
5153

@@ -58,10 +60,10 @@ rem Step 4: Empty env
5860
cy=%rad% * %%u/10000 * %%a/10000 * ca/10000 - %rad% * %%u/10000 * %%b/10000 * sa/10000 + %hei% / 2
5961

6062
if !new_z! lss 0 (
61-
set "circle=!circle!%\e%[!cy!;!cx!H%Ball%%\e%[0m"
62-
) else set "circle=!circle!%\e%[!cy!;!cx!H."
63+
set "circle=!circle!%\e%[!cy!;!cx!H%Ball%"
64+
) else set "circle=!circle!%\e%[!cy!;!cx!Ho"
6365
))
64-
echo=%\e%[2J!circle!
66+
echo=%\e%[2J!circle!%\e%[0m
6567
set "circle="
6668

6769
)

0 commit comments

Comments
 (0)