I have searched for the web with google but I have not found anything...
![Sad :(](./images/smilies/icon_sad.gif)
I do not mean wsh/hta or high-level. Neither utility in assembler/c/etc.
Does anyone know the previous works in this context?
Regards
Einstein1969
Moderator: DosItHelp
Code: Select all
@echo off & setlocal & title Sphere 3D & set /a cols=62, lines=62 & goto :Init_system
:: By einstein1969. Dedicated to jeb, dbenham, penpen, carlos, aGerman, Aacini, EdDyreen,
:: npocmaka_, Liviu, Sponge Belly, Magialisk, the users and the staff of Dostips forum.
:: Use raster font 8x8.
:Main
set /a ar=100, rt=0, ds=0, cx=cols/2, cz=4000, cY=lines/2
(
set SIN=
set _PLOT$_=
set _$PLOT_=
set _empty=
set lines=
set cols=
for /L %%\ in (1000,-1,0) do (
set /a "rt+=31416/60"
if !ds! lss 1000 set /a ds+=10
setlocal
set /a "a=(15708-rt) %% 62832, c=(a>>31|1)*a"
if !c! gtr 47124 (set /a "a=a-(a>>31|1)*62832, b=%SIN%, a=rt %% 62832, c=(a>>31|1)*a") else (if !c! gtr 15708 (set /a "a=(a>>31|1)*31416-a, b=%SIN%, a=rt %% 62832, c=(a>>31|1)*a") else set /a "b=%SIN%, a=rt %% 62832, c=(a>>31|1)*a")
if !c! gtr 47124 (set /a "a=a-(a>>31|1)*62832, a=%SIN%") else (if !c! gtr 15708 (set /a "a=(a>>31|1)*31416-a, a=%SIN%") else set /a "a=%SIN%")
for %%f in ("0 9999" "-5000 8661" "-8661 5000" "-9999 0" "-8661 -5000" "-5000 -8661" "0 -9999" "5000 -8661" "8661 -5000" "9999 0" "8661 5000" "5000 8661") do for /f "tokens=1,2" %%g in (%%f) do (
for %%t in ("3827 9239" "7071 7071" "9239 3827" "9999 0" "9239 -3827" "7071 -7071" "3827 -9239") do for /f "tokens=1,2" %%u in (%%t) do (
set /a "ax=ar*%%h/10000*%%u/10000, az=ar*%%g/10000*%%u/10000, ay=ar*%%v/10000, aax=(ax*b/10000-(ay*a/10000+az*b/10000)*a/10000)*b/10000-(ay*b/10000-az*a/10000)*a/10000, aay=(ax*b/10000-(ay*a/10000+az*b/10000)*a/10000)*a/10000+(ay*b/10000-az*a/10000)*b/10000, e=ax*a/10000+(ay*a/10000+az*b/10000)*b/10000, c=ds*aax/(e-cz)+cx, d=ds*aay/(e-cz)+cy"
if not defined L!d! set L!d!=%_empty%
if !e! lss 0 (%_$PLOT_% !c! !d! 1 %_PLOT$_%) else %_$PLOT_% !c! !d! 4 %_PLOT$_%
)
)
if not "!OT!"=="!time:~-1!" (
cls & (For /L %%l in (1,1,%lines%) do if not defined L%%l (echo() else echo( !L%%l!)>CON
if "!OT!"=="0" title Sphere 3D [%%\]
endlocal
set OT=!time:~-1!
) else endlocal
)
)
goto :eof
:Init_system
setlocal DisableDelayedExpansion
set /a cc=cols+2, ll=lines+2
(
mode %cc%,%ll% & cls
for /F "Tokens=1 delims==" %%v in ('set') do set "%%v="
set /a cols=%cols%, lines=%lines%
)
set "_$PLOT_=For /F usebackq^ tokens^=1-3 %%x in ('"
set "_PLOT$_=') do set /a f=%%x+1 & For %%w in (!f!) do set L%%y=!L%%y:~0,%%x!!g:~%%z,1!!L%%y:~%%w!"
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)"
setlocal EnableDelayedExpansion
For /L %%l in (1,1,%cols%) do set "_empty=!_empty! "
set g= .±²@"
Goto :Main
einstein1969 wrote:I started and the first I chose to draw a 3D sphere which is the base of all animations .
Squashman wrote:einstein1969 wrote:I started and the first I chose to draw a 3D sphere which is the base of all animations .
I thought polygons were?
Regardless what you did so far is pretty cool.
Ed Dyreen wrote:that's amazing
einstein1969 wrote:I think that is more beauty if I add input control for move the sphere (pan,rotate,zoom) and change focal lenght. Is more istructive...
I will do!
Squashman wrote:And it will be super awesome when you figure out color and shading.
einstein1969 wrote:Does anyone know the previous works in this context?
Dragokas wrote:einstein1969 wrote:Does anyone know the previous works in this context?
Look here: http://www.cyberforum.ru/beta-testing/thread375694.html
There are some code without assembler in archieve.
Best wishes, Alex.
Code: Select all
@echo off & setlocal EnableDelayedExpansion
rem use font raster 8x8 for better aspect ratio.
:: Sphere radius
set R=15
For /L %%y in (-%R%,1,%R%) do (
For /L %%x in (-%R%,1,%R%) do (
:: calculate sphere equation
set /a S=%%x*%%x+%%y*%%y-R*R
:: draw the sphere
if !S! leq 0 (set/p".=*"<nul) else set/p".=."<nul
)
echo(
)
Code: Select all
:: v 0.0.2 passed from 16.6 FPS to ~20.0 FPS
Code: Select all
@echo off & setlocal EnableDelayedExpansion & title Sphere 3D & set /a cols=62, lines=58 & goto :Init_system
:: By einstein1969. Dedicated to jeb, dbenham, penpen, carlos, aGerman, Aacini, EdDyreen,
:: npocmaka_, Sponge Belly, Magialisk, the users and the staff of Dostips forum.
:: Use raster font 8x8
:: v 0.0.2 passed from 16.6 FPS to ~20.0 FPS
:: Variables enigma:
:: ? = Sphere radius
:: rt = Rotation angle
:: ds = Distance Z of sphere
:: _dx,_dy = Offset x,y of projecting coordinates in 2D plane.
:: a,b = Sine, cosine of rotation angle
:: ax,ay,az = Rotation coordinate 3D, now a, b, c
:: c,d = X,Y coordinate of projecting 3D to 2D, now a,b
:: e = Z coordinate, now c
:Main
set /a ?=100, rt=0, ds=0, _dx=cols/2, _dy=lines/2, _dz=4000, _1=10000
:loop
(setlocal
for /F "Tokens=1 delims==" %%v in ('set _') do set "%%v="
set lines=
set cols=
rem giro completo (120)*31416/60 o multipli di 120
for /L %%\ in (0,1,1199) do (
set /a "rt+=31416/60"
if !ds! lss 1000 (set /a ds+=10) else %_FPS%
setlocal
set /a "a=(15708-rt) %% 62832, c=(a>>31|1)*a"
if !c! gtr 47124 (set /a "a=a-(a>>31|1)*62832, b=%_SIN%, a=rt %% 62832, c=(a>>31|1)*a") else (if !c! gtr 15708 (set /a "a=(a>>31|1)*31416-a, b=%_SIN%, a=rt %% 62832, c=(a>>31|1)*a") else set /a "b=%_SIN%, a=rt %% 62832, c=(a>>31|1)*a")
if !c! gtr 47124 (set /a "a=a-(a>>31|1)*62832, a=%_SIN%") else (if !c! gtr 15708 (set /a "a=(a>>31|1)*31416-a, a=%_SIN%") else set /a "a=%_SIN%")
For /f "tokens=1,2" %%a in ("!a! !b!") do for %%f in ("0 9999" "-5000 8661" "-8661 5000" "-9999 0" "-8661 -5000" "-5000 -8661" "0 -9999" "5000 -8661" "8661 -5000" "9999 0" "8661 5000" "5000 8661") do for /f "tokens=1,2" %%g in (%%f) do (
for %%t in ("3827 9239" "7071 7071" "9239 3827" "9999 0" "9239 -3827" "7071 -7071" "3827 -9239") do for /f "tokens=1,2" %%u in (%%t) do (
set /a "a=?*%%h/10000*%%u/10000, c=?*%%g/10000*%%u/10000, b=?*%%v/10000, a=(a*%%b/10000-(b*%%a+c*%%b)/10000*%%a/10000)*%%b/10000-(b*%%b-c*%%a)/10000*%%a/10000, b=(?*%%h/10000*%%u/10000*%%b/10000-(b*%%a+c*%%b)/10000*%%a/10000)*%%a/10000+(b*%%b-c*%%a)/10000*%%b/10000, c=?*%%h/10000*%%u/10000*%%a/10000+(?*%%v/10000*%%a+c*%%b)/10000*%%b/10000, a=ds*a/(c-%_dz%)+%_dx%, b=ds*b/(c-%_dz%)+%_dy%"
if not defined L!b! set L!b!=%_empty%
if !c! lss 0 (%_$PLOT_% !a! !b! 1 %_PLOT$_%) else %_$PLOT_% !a! !b! 2 %_PLOT$_%
)
)
if not "!OT!"=="!time:~-1!" (
cls & (For /L %%l in (1,1,%lines%) do if not defined L%%l (echo() else echo( !L%%l!)>CON
endlocal
set OT=!time:~-1!
) else endlocal
)
endlocal)
set /a ds=1000, rt=1200*31416/60
goto :loop
:Init_system
set /a cc=cols+2, ll=lines+2
mode %cc%,%ll% & cls
(
for /F "Tokens=1 delims==" %%v in ('set') do set "%%v="
set /a cols=%cols%, lines=%lines%
)
setlocal DisableDelayedExpansion
set "_$PLOT_=For /F usebackq^ tokens^=1-3 %%x in ('"
set "_PLOT$_=') do set c=!L%%y:~%%x!& set L%%y=!L%%y:~0,%%x!!g:~%%z,1!!c:~1!"
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)"
set _FPS=if %%\ geq !_FPS_NC! (set /a "_FPS_NC=1!time:~-5,-3!!time:~-2!, _dt_F=_FPS_NC-t0_F, t0_F=_FPS_NC, mFPS=_dt_F-1>>31, _FPS_NC=_dt_F/(_dt_F+(mFPS&1)), _dt_F=(%%\-oFPS)*10000/(_dt_F+(mFPS&6000)), _FPS_NC=%%\+8*_dt_F/100+(1-_FPS_NC)*100, oFPS=%%\, mFPS=1000000000/(_dt_F+(_dt_F-1>>31&1))" ^&title Sphere 3D - FPS=!_dt_F:~0,-2!.!_dt_F:~-2! [!mFPS:~0,-1!.!mFPS:~-1! æs] [#%%\]^& set mFPS=^& set _dt_F=)
setlocal EnableDelayedExpansion
For /L %%l in (1,1,%cols%) do set "_empty=!_empty! "
set g= .@"
Goto :Main
Code: Select all
up
zoom in ^
\ | counterclockwise <- E R -> clockwise
Q W
left <- A S D -> right
Z |
/ v X = exit
zoom out down
Code: Select all
@echo off
setlocal EnableDelayedExpansion
REM APA mod
if "%1" neq "" goto %1
title Sphere 3D
:: By einstein1969. Dedicated to jeb, dbenham, penpen, carlos, aGerman, Aacini, EdDyreen,
:: npocmaka_, Sponge Belly, Magialisk, the users and the staff of Dostips forum.
:: Use raster font 8x8
:: v 0.0.2 passed from 16.6 FPS to ~20.0 FPS
:: Variables enigma:
:: ? = Sphere radius
:: rt = Rotation angle
:: ds = Distance Z of sphere
:: _dx,_dy = Offset x,y of projecting coordinates in 2D plane.
:: a,b = Sine, cosine of rotation angle
:: ax,ay,az = Rotation coordinate 3D, now a, b, c
:: c,d = X,Y coordinate of projecting 3D to 2D, now a,b
:: e = Z coordinate, now c
:Init_system
set /a cols=62, lines=58
set /a cc=cols+2, ll=lines+2
mode %cc%,%ll% & cls
(
for /F "Tokens=1 delims==" %%v in ('set') do set "%%v="
set /a cols=%cols%, lines=%lines%
REM APA mod
set "ComSpec=%ComSpec%"
)
setlocal DisableDelayedExpansion
set "_$PLOT_=For /F usebackq^ tokens^=1-3 %%x in ('"
set "_PLOT$_=') do set c=!L%%y:~%%x!& set L%%y=!L%%y:~0,%%x!!g:~%%z,1!!c:~1!"
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)"
setlocal EnableDelayedExpansion
For /L %%l in (1,1,%cols%) do set "_empty=!_empty! "
set g= .@"
set /a ?=100, rt=0, ds=800, _dx=cols/2, _dy=lines/2, _dz=4000, _1=10000
REM APA mod
cd . > pipeFile.txt
"%~F0" Input >> pipeFile.txt | "%~F0" Main < pipeFile.txt
del pipeFile.txt
goto :EOF
REM Get control keys and send the corresponding command to Main part
:Input
set Drt=0
set ds=800
set exit=0
set "letter= ADQZX"
set "com[A]=Drt-=31416/180" & set "var[A]=Drt"
set "com[D]=Drt+=31416/180" & set "var[D]=Drt"
set "com[Q]=ds+=100" & set "var[Q]=ds"
set "com[Z]=ds-=100" & set "var[Z]=ds"
set "com[X]=exit=1" & set "var[X]=exit"
title Rotating Sphere - Speed=%Drt%, Zoom=%ds:~0,-1%%%
:getKey
C:\Windows\System32\choice /C %letter% /N
set "option=!letter:~%errorlevel%,1!"
set /A "!com[%option%]!"
set "var=!var[%option%]!"
echo %var%=!%var%!
title Rotating Sphere - Speed=%Drt%, Zoom=%ds:~0,-1%%%
if %option% neq X goto getKey
C:\Windows\System32\ping localhost -n 3 > NUL
exit
:Main
(setlocal
for /F "Tokens=1 delims==" %%v in ('set _') do set "%%v="
set lines=
set cols=
rem giro completo (120)*31416/60 o multipli di 120
for /L %%\ in () do (
REM APA mod
set /P "command="
if defined command (
set /A "!command!"
set "command="
if !exit! neq 0 exit
)
REM Instead of: if !ds! lss 1000 (set /a ds+=10) else %_FPS%
set /a "rt+=Drt"
setlocal
set /a "a=(15708-rt) %% 62832, c=(a>>31|1)*a"
if !c! gtr 47124 (
set /a "a=a-(a>>31|1)*62832, b=%_SIN%, a=rt %% 62832, c=(a>>31|1)*a"
) else if !c! gtr 15708 (
set /a "a=(a>>31|1)*31416-a, b=%_SIN%, a=rt %% 62832, c=(a>>31|1)*a"
) else (
set /a "b=%_SIN%, a=rt %% 62832, c=(a>>31|1)*a"
)
if !c! gtr 47124 (
set /a "a=a-(a>>31|1)*62832, a=%_SIN%"
) else if !c! gtr 15708 (
set /a "a=(a>>31|1)*31416-a, a=%_SIN%"
) else (
set /a "a=%_SIN%"
)
For /f "tokens=1,2" %%a in ("!a! !b!") do for %%f in ("0 9999" "-5000 8661" "-8661 5000" "-9999 0" "-8661 -5000" "-5000 -8661" "0 -9999" "5000 -8661" "8661 -5000" "9999 0" "8661 5000" "5000 8661") do for /f "tokens=1,2" %%g in (%%f) do (
for %%t in ("3827 9239" "7071 7071" "9239 3827" "9999 0" "9239 -3827" "7071 -7071" "3827 -9239") do for /f "tokens=1,2" %%u in (%%t) do (
set /a "a=?*%%h/10000*%%u/10000, c=?*%%g/10000*%%u/10000, b=?*%%v/10000, a=(a*%%b/10000-(b*%%a+c*%%b)/10000*%%a/10000)*%%b/10000-(b*%%b-c*%%a)/10000*%%a/10000, b=(?*%%h/10000*%%u/10000*%%b/10000-(b*%%a+c*%%b)/10000*%%a/10000)*%%a/10000+(b*%%b-c*%%a)/10000*%%b/10000, c=?*%%h/10000*%%u/10000*%%a/10000+(?*%%v/10000*%%a+c*%%b)/10000*%%b/10000, a=ds*a/(c-%_dz%)+%_dx%, b=ds*b/(c-%_dz%)+%_dy%"
if not defined L!b! set L!b!=%_empty%
if !c! lss 0 (%_$PLOT_% !a! !b! 1 %_PLOT$_%) else %_$PLOT_% !a! !b! 2 %_PLOT$_%
)
)
if not "!OT!"=="!time:~-1!" (
cls & (For /L %%l in (1,1,%lines%) do if not defined L%%l (echo() else echo( !L%%l!)>CON
endlocal
set OT=!time:~-1!
) else endlocal
)
endlocal)