Fourier Series Animation - Page 1
Forum section: electronics / general

author: @rt
author_rank: Super Contributor
timestamp: June 16, 2018, 03:53:18 pm
content: Hi GuysMy first video was quite a success, but software was only written for the purpose of the animation, was never neat,and I ruined the source adjusting it to make other variations. It’s still ruined, but works, and is linked in the description of this one.Source compiles for Sony PSP, but is still plain vanilla C.Original animation, a couple of years old now. This is screen captured running on iPhone Simulator in Xcode.

author: @rt
author_rank: Super Contributor
timestamp: June 16, 2018, 03:55:25 pm
content: To complicate things further, here’s a pretty neat version written in OPL, an interpreted “BASIC like” language.This runs on PSION 5mx. On the bad side, I had this done before figuring out you could comment with REM.The latest, and most messy version I have not yet shared, can create and iterate through as many circles asit takes to bog a platform down with all of the point rotation. Still working on cleaning that up.Code:REM FOURIER SERIES ANIMATION - BREK MARTIN 2018PROC graphics:LOCAL winid%LOCAL bmpid%LOCAL procnt%LOCAL rotationLOCAL rotatiobLOCAL thetaLOCAL thetabLOCAL bthetabLOCAL xnewLOCAL ynewLOCAL bxnewLOCAL bynewLOCAL cxnewLOCAL cynewLOCAL dxnewLOCAL dynewLOCAL exnewLOCAL eynewLOCAL fxnewLOCAL fynewLOCAL gxnewLOCAL gynewLOCAL hxnewLOCAL hynewLOCAL ixnewLOCAL iynewLOCAL jxnewLOCAL jynewLOCAL xLOCAL yLOCAL xxLOCAL yyLOCAL pntcnt%LOCAL apntswp%LOCAL bpntswp%LOCAL apnts%(761)LOCAL bpnts%(761)LOCAL apadd%LOCAL bpadd%LOCAL horpos%LOCAL pidivLOCAL costhLOCAL costhbLOCAL sinthLOCAL sinthbbmpid% = gCREATEBIT(640,240)winid% = gCREATE(0,0,640,240,1)pidiv = 0.01745329251994rotation = 0rotatiob = 0pntcnt% = 0apadd%=ADDR(apnts%())bpadd%=ADDR(bpnts%())WHILE pntcnt% < 761POKEB apadd%+pntcnt%,120POKEB bpadd%+pntcnt%,120pntcnt% = pntcnt% + 1ENDWHWHILE 1procnt% = procnt% + 1theta = rotationthetab = pidiv*thetatheta = rotatiobbthetab = pidiv*thetacosth = COS(thetab)costhb = COS(bthetab)sinth = SIN(thetab)sinthb = SIN(bthetab)x = 60xnew = costh*x - sinthynew = sinth*x + costhxnew = xnew + 120ynew = ynew + 120x = 80bxnew = costh*x - sinthbynew = sinth*x + costhx = bxnew + 120 - xnewy = bynew + 120 - ynewcxnew = costhb*x - sinthb*ycynew = sinthb*x + costhb*ycxnew = cxnew + xnewcynew = cynew + ynewx = 92dxnew = costh*x - sinthdynew = sinth*x + costhx = dxnew + 120 - xnewy = dynew + 120 - ynewexnew = costhb*x - sinthb*yeynew = sinthb*x + costhb*yx = exnew + xnew - cxnewy = eynew + ynew - cynewfxnew = costhb*x - sinthb*yfynew = sinthb*x + costhb*yfxnew = fxnew + cxnewfynew = fynew + cynewx = 100.57142855gxnew = costh*x - sinthgynew = sinth*x + costhx = gxnew + 120 - xnewy = gynew + 120 - ynewhxnew = costhb*x - sinthb*yhynew = sinthb*x + costhb*yx = hxnew + xnew - cxnewy = hynew + ynew - cynewixnew = costhb*x - sinthb*yiynew = sinthb*x + costhb*yx = ixnew + cxnew - fxnewy = iynew + cynew - fynewjxnew = costhb*x - sinthb*yjynew = sinthb*x + costhb*yjxnew = jxnew + fxnewjynew = jynew + fynewrotation = rotation - 1IF rotation < 0rotation = 359ENDIFrotatiob = rotatiob - 2IF rotatiob < 0rotatiob = 358ENDIFPOKEB apadd%,ynewPOKEB bpadd%,jynewpntcnt% = 760WHILE pntcnt% > 0apntswp% = PEEKB (apadd%+pntcnt%-1)POKEB apadd%+pntcnt%,apntswp%bpntswp% = PEEKB (bpadd%+pntcnt%-1)POKEB bpadd%+pntcnt%,bpntswp%pntcnt% = pntcnt% - 1ENDWHgAT 120,120gCIRCLE 60gLINETO xnew,ynewgCIRCLE 20gLINETO cxnew,cynewgCIRCLE 12gLINETO fxnew,fynewgCIRCLE 8.57142855gLINETO jxnew,jynewhorpos% = 0apntswp% = PEEKB (apadd%)gAT 220,apntswp%pntcnt% = 0WHILE pntcnt% < 761apntswp% = PEEKB (apadd%+pntcnt%)gLINETO horpos%+220,apntswp%pntcnt% = pntcnt% + 3horpos% = horpos% + 1ENDWHhorpos% = 0bpntswp% = PEEKB (bpadd%)gAT 220,bpntswp%pntcnt% = 0WHILE pntcnt% < 761bpntswp% = PEEKB (bpadd%+pntcnt%)gLINETO horpos%+220,bpntswp%pntcnt% = pntcnt% + 3horpos% = horpos% + 1ENDWHgAT jxnew,jynewgLINETO 220,jynewgAT xnew,ynewgLINETO 220,ynewgAT 0,39gUSE winid%gCOPY bmpid%,0,39,580,201,3gUSE bmpid%gCLSIF procnt% = 65361BREAKENDIFENDWHENDP

author: JohnnyMalaria
author_rank: Super Contributor
timestamp: June 16, 2018, 04:08:15 pm
content: Very cool. The stuff in the complex plane (XY) in the PlayStation video looks like the crazy stuff I get on my analog scope when I feed the IQ pair of demodulated arb. waveforms from my FeelTech generator.

author: @rt
author_rank: Super Contributor
timestamp: June 16, 2018, 04:25:43 pm
content: If you’re talking about pixel graphics, the iOS devices do the scaling and antialias, but PSP just draws pixels.It’s a cute thing. I started on the PSP again to have it on the ready for file manipulation and things, so as not to rely on Xcode for the same.My PSP SDK compiled in 2008 will always be the same, and a PSP will be cheap, and easy to get for a long time.For Xcode, calls will be depreciated, a new Xcode version won’t run unless Mac OS is also updated, some feature will cost $99 per year,and I’ll be getting screwed in the ass and pissed on in the face simultaneously (the real magic of Apple) and be expected to smile about it.

author: JohnnyMalaria
author_rank: Super Contributor
timestamp: June 16, 2018, 05:57:10 pm
content: I meant crazy as in remarkable and quite mesmerizing. I posted a couple of clips somewhere.