3D square using sin/cos ?

STOS programming section.
User avatar
sandord
Trusted Guru
Trusted Guru
Posts: 463
Joined: Mon Aug 13, 2018 10:08 pm
Location: The Netherlands
Contact:

Re: 3D square using sin/cos ?

Post by sandord » Mon Aug 27, 2018 9:22 pm

It's funny how the two shifted squares give the illusion of 3D, never looked at it that way.

Are looking for doing 'real' 3D? And what is TML?

User avatar
exxos
Site Admin
Site Admin
Posts: 4528
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

Re: 3D square using sin/cos ?

Post by exxos » Mon Aug 27, 2018 9:37 pm

sandord wrote:
Mon Aug 27, 2018 9:22 pm
It's funny how the two shifted squares give the illusion of 3D, never looked at it that way.
Yeah, only way my simple mind can think of doing it :)

sandord wrote:
Mon Aug 27, 2018 9:22 pm
Are looking for doing 'real' 3D?
Wasn't really a aim to anything, just trying to do some cool 3D'ish stuff in STOS. I may add the cube as a test in GB6 one day...

I think what demo coders do with the 3D square which then blends into a hex type shape is cool... I guess if I drew the hex shapes at size 0, it would give the appearance of the square as you see it now.. but larger scale the corners become hex shapes... to complicated for me :P

sandord wrote:
Mon Aug 27, 2018 9:22 pm
And what is TML?
TML = The Missing Link.. using it for faster screen clear..

New code calculates 1000 moves and stores them in a array now.
4MB STFM 1.44 FD- VELOCE+ 020 STE - 4MB STE 32MHz - STFM 16MHz - STM - MEGA ST - Falcon 030 CT60 - Atari 2600 - Atari 7800 - Gigafile - SD Floppy Emulator - PeST - HxC - CosmosEx - Ultrasatan - various clutter

https://www.exxoshost.co.uk/atari/ All my hardware guides - mods - games - STOS
https://www.exxoshost.co.uk/atari/last/storenew/ - All my hardware mods for sale - Please help support by making a purchase.

miggymog
Posts: 6
Joined: Sun Sep 09, 2018 6:37 pm

Re: 3D square using sin/cos ?

Post by miggymog » Tue Sep 11, 2018 11:11 pm

My bad attempt at Random 3d shapes from the 90's.

Code: Select all

10 key off : curs off : hide on : click off : mode 1 : auto back off : update off : mouseoff 
20 mode 0
30 rem
40 rem
50 palette 0,$111,$222,$333,$444,$555,$666,$777,$770
60 set stars 100,1,0,0,319,199,0,7
1000 rem ********************************************************
1001 ink 8
1005 SCREEN_WIDTH=128 : HALF_SCREEN_WIDTH=SCREEN_WIDTH/2
1007 SCREEN_HEIGHT=128 : HALF_SCREEN_HEIGHT=SCREEN_HEIGHT/2
1009 dim SX(720),SY(720),SZ#(720)
1010 for CALC_SINUS=0 to 359
1020 SX(CNT)=sin(rad(CALC_SINUS))*HALF_SCREEN_WIDTH+159
1030 SY(CNT)=cos(rad(CALC_SINUS))*HALF_SCREEN_HEIGHT+99
1050 SZ#(CNT)=1.0/((((sin(rad(CALC_SINUS)*2)+cos(rad(CALC_SINUS))/2)*20+20)/SCREEN_WIDTH)+1.0)
1051 SX(CNT+360)=SX(CNT)
1052 SY(CNT+360)=SY(CNT)
1053 SZ#(CNT+360)=SZ#(CNT)
1060 inc CNT
1080 doke $FF8240,not(deek($FF8240)) : next CALC_SINUS
10000 rem***************************************
10005 logic=back : SIDS=rnd(20)+1 : SIDCAL=360/SIDS : if SIDCAL mod 2<>0 then goto 10005
10006 for XCV=0 to 100
10010 for CNT=0 to 359 step SIDCAL
10011 TMP=(CNT2 mod 360)
10012 TMP2=(CNT3 mod 360)
10020 X=SX(CNT+TMP)*SZ#(TMP2+44) : Y=SY(CNT+TMP)*SZ#(TMP2+44)
10030 X2=X*SZ#(TMP2)+XXX
10035 Y2=Y*SZ#(TMP2)+YYY
10036 draw X,Y to OX,OY
10037 draw X2,Y2 to OX2,OY2
10040 draw X,Y to X2,Y2 : OX=X : OY=Y : OX2=X2 : OY2=Y2
10042 inc CNT2 : inc CNT3
10050 next CNT
10060 screen swap : wait vbl : wipe logic : go stars 1,0,physic :  : next XCV : goto 10005

User avatar
exxos
Site Admin
Site Admin
Posts: 4528
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

Re: 3D square using sin/cos ?

Post by exxos » Tue Sep 11, 2018 11:24 pm

miggymog wrote:
Tue Sep 11, 2018 11:11 pm
My bad attempt at Random 3d shapes from the 90's.
I removed the stars and mouse off bit, would that break it (just being lazy in finding the extensions) though it flashes the screen white really fast then says "for without next" on the last line :shrug:
4MB STFM 1.44 FD- VELOCE+ 020 STE - 4MB STE 32MHz - STFM 16MHz - STM - MEGA ST - Falcon 030 CT60 - Atari 2600 - Atari 7800 - Gigafile - SD Floppy Emulator - PeST - HxC - CosmosEx - Ultrasatan - various clutter

https://www.exxoshost.co.uk/atari/ All my hardware guides - mods - games - STOS
https://www.exxoshost.co.uk/atari/last/storenew/ - All my hardware mods for sale - Please help support by making a purchase.

User avatar
exxos
Site Admin
Site Admin
Posts: 4528
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

Re: 3D square using sin/cos ?

Post by exxos » Tue Sep 11, 2018 11:29 pm

ah nevermind, the last line did not import into STOS...

looks pretty cool, bit out on one part, but still cool :)
Blank_00026.png
Blank_00026.png (1.49 KiB) Viewed 221 times
4MB STFM 1.44 FD- VELOCE+ 020 STE - 4MB STE 32MHz - STFM 16MHz - STM - MEGA ST - Falcon 030 CT60 - Atari 2600 - Atari 7800 - Gigafile - SD Floppy Emulator - PeST - HxC - CosmosEx - Ultrasatan - various clutter

https://www.exxoshost.co.uk/atari/ All my hardware guides - mods - games - STOS
https://www.exxoshost.co.uk/atari/last/storenew/ - All my hardware mods for sale - Please help support by making a purchase.

User avatar
Smonson
Posts: 165
Joined: Sat Oct 28, 2017 10:21 am

Re: 3D square using sin/cos ?

Post by Smonson » Wed Sep 12, 2018 9:25 am

I tried to run some of these listings tonight, but I couldn't figure out how to type some of the keystrokes in Hatari :lol:

miggymog
Posts: 6
Joined: Sun Sep 09, 2018 6:37 pm

Re: 3D square using sin/cos ?

Post by miggymog » Fri Sep 14, 2018 7:45 pm

The extension stuff just speeds it up a bit. I really should fix it to join the start and end up :D

Post Reply