Being Daft with Sines and Cosines

A forum to share your demonstrations stacks, fun stacks, games, etc.
Post Reply
User avatar
richmond62
Posts: 2766
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Being Daft with Sines and Cosines

Post by richmond62 »

Monday being a holiday here in Bulgaria, and having fairly successfully b*ggered my shoulder in the garden yesterday, it was "quite obviously" time for me to be even more infantile than usual and do something fairly daft:
-
Screenshot 2024-03-04 at 11.45.04.png
Screenshot 2024-03-04 at 11.45.04.png (256.08 KiB) Viewed 193 times
-
If you have difficulty working out what this is, just drink about 3 glasses of the strongest alcoholic drink you can lay your hands on and then try to walk home. 8-)
Attachments
Silly Sines.oxtstack.zip
(2.64 KiB) Downloaded 16 times
https://richmondmathewson.owlstown.net/
User avatar
richmond62
Posts: 2766
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Being Daft with Sines and Cosines

Post by richmond62 »

Here's a faster version (more moonshine!):
-
Attachments
Silly Sines_2.oxtstack.zip
(2.65 KiB) Downloaded 13 times
https://richmondmathewson.owlstown.net/
xAction
Posts: 285
Joined: Thu Sep 16, 2021 1:40 pm
Contact:

Re: Being Daft with Sines and Cosines

Post by xAction »

Now with Golden Ratio and Radius variability.
Silly Sines_3_phi.oxtstack
(38.66 KiB) Downloaded 10 times
You know what move command slows the whole thing down?
I turned it off for a bit and it was like BOOM! Here's some graphics!
User avatar
richmond62
Posts: 2766
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Being Daft with Sines and Cosines

Post by richmond62 »

My first stack used "set the loc", and my second one used "move to" as was messing around (waiting for the pain killer to deb*gger my shoulder) with various 'parameters'.

The first stack would be jerky, regardless: I am sure that replacing 'move to' with 'set the loc' in the second would speed things up.

Never mind: as have been doing further work in the garden, my back is sufficiently sore that I don't notice the pain in my shoulder. 8-)

Very jazzy indeed:
-
Screenshot 2024-03-04 at 18.12.17.png
Screenshot 2024-03-04 at 18.12.17.png (33.94 KiB) Viewed 174 times
https://richmondmathewson.owlstown.net/
User avatar
richmond62
Posts: 2766
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Being Daft with Sines and Cosines

Post by richmond62 »

If I 'de-random' my script:

Code: Select all

on mouseUp
   set the moveSpeed to 1000
   put empty into fld "POYNTS"
   put 0.1 into STEPP
   put 1 into QOUNT
   repeat until STEPP > 7
      put (sin(STEPP)) into LRLOC
      put (cos(STEPP)) into UDLOC      
      put 25 into S1
      put 25 into S2
      put ((LRLOC * 300)+ 375 + S1) into LRLOC
      put ((UDLOC * 300)+ 375 + S2) into UDLOC
      put (LRLOC & "," & UDLOC) into line QOUNT of fld "POYNTS"
      set the points of grc "TRAK" to fld "POYNTS"
      move grc "BLOB" to line QOUNT of fld "POYNTS"
      add 0.1 to STEPP
      add 1 to QOUNT
   end repeat
end mouseUp
motion is fairly smooth regardless of whether one uses 'move to' or 'set the loc'.
-
Screenshot 2024-03-04 at 18.24.21.png
Screenshot 2024-03-04 at 18.24.21.png (248.12 KiB) Viewed 172 times
-
it would be lovely if one could keep to that level of smoothness when one plays "silly buggers" with the graphic. 8-)
https://richmondmathewson.owlstown.net/
User avatar
richmond62
Posts: 2766
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Being Daft with Sines and Cosines

Post by richmond62 »

Screenshot 2024-03-04 at 18.35.57.png
Screenshot 2024-03-04 at 18.35.57.png (329.54 KiB) Viewed 170 times
-
Screenshot 2024-03-04 at 18.36.37.png
Screenshot 2024-03-04 at 18.36.37.png (304.65 KiB) Viewed 170 times
-
Screenshot 2024-03-04 at 18.41.38.png
Screenshot 2024-03-04 at 18.41.38.png (309.01 KiB) Viewed 170 times
https://richmondmathewson.owlstown.net/
User avatar
richmond62
Posts: 2766
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Being Daft with Sines and Cosines

Post by richmond62 »

Screenshot 2024-03-04 at 18.46.22.png
Screenshot 2024-03-04 at 18.46.22.png (290.18 KiB) Viewed 170 times
Attachments
Silly Sines_4.oxtstack.zip
(11.43 KiB) Downloaded 13 times
https://richmondmathewson.owlstown.net/
xAction
Posts: 285
Joined: Thu Sep 16, 2021 1:40 pm
Contact:

Re: Being Daft with Sines and Cosines

Post by xAction »

Neato. Should move this to the fun section.
User avatar
tperry2x
Posts: 1533
Joined: Tue Dec 21, 2021 9:10 pm
Location: Britain (Previously known as Great Britain)
Contact:

Re: Being Daft with Sines and Cosines

Post by tperry2x »

(moved into xtalk fun and games)
Do you mind if I were to back these up Richmond, and add to the GitHub-esque (but not actually GitHub, but Mega instead) storage?
User avatar
richmond62
Posts: 2766
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Being Daft with Sines and Cosines

Post by richmond62 »

Why on earth should I mind: You have just tickled the ego of a chap with hubris the size of Mount Everest (Err: Chomolungma). 8-)

What IS frightening is that what is going on in that stack I learnt when I was about 13-14: but the 17 year olds I am in contact with, who go to the "specialist" Maths School cannot even explain what is going on . . .

This does NOT prove I am a genius (despite having a massive ego, I know I am NOT a genius), but it proves that "things have sunk".

FFS: Basic Sine & Cosine!
-
Screenshot 2024-02-02 at 12.20.06.jpg
Screenshot 2024-02-02 at 12.20.06.jpg (234.76 KiB) Viewed 157 times
https://richmondmathewson.owlstown.net/
User avatar
tperry2x
Posts: 1533
Joined: Tue Dec 21, 2021 9:10 pm
Location: Britain (Previously known as Great Britain)
Contact:

Re: Being Daft with Sines and Cosines

Post by tperry2x »

I did not do well at maths at school. I can't blame my teacher (some people have a natural ability for maths). I was quite inept at it.

Although, it didn't help that he put the fear of god into us - he would shout if someone didn't understand a concept. That was his teaching style. But all it did was make those who didn't dare ask, like myself and others, just keep quiet and let the students who could understand lead the class.

Unfortunately this meant we fell further and further behind. To this day, I have a complete mental block when it comes to maths. I just switch off.

Anyway, thank you for letting me add your examples. I'll put the link up again in a bit.
xAction
Posts: 285
Joined: Thu Sep 16, 2021 1:40 pm
Contact:

Re: Being Daft with Sines and Cosines

Post by xAction »

richmond62 wrote: Mon Mar 04, 2024 4:24 pm motion is fairly smooth regardless of whether one uses 'move to' or 'set the loc'.
Wasn't talking about motion, I was talking about the entire speed of the script.

18462 milliseconds to finish Action 1 with Move statement

1281 milliseconds to finish Action 1 with move statement commented and replaced with set the loc

That's a HUGE difference. Just think how much more time you could spend in the garden if you get things done with "Software at the speed of light" lol.

To smooth things out when doing weird random stuff, you have to add more points...how is that done?
Take point A add to point B and divided by 2 to get the halfway point.
Also probably not throwing everything into a field would help alot.
I stuck a field into my 3D thing to check some numbers and was like walking in wet cement.


Double the points, 2676 milliseconds to completion, no field because tying QUONT to the field line, ties it to the size of the graphic since add 1 to QUONT to hold each extra bit. Oh turn on, markers, that's a great way to see the complexity of the graphic.

Code: Select all

on mouseUp
   set the vis of grc "BLOB" to true
   set the moveSpeed to 1000
   put empty into fld "POYNTS"
   put 0.1 into STEPP
   put 1 into QOUNT
   put the milliseconds into ms
   repeat until STEPP > 63
      put the milliseconds -ms into field "TIME"
      put (sin(STEPP)) into LRLOC
      put (cos(STEPP)) into UDLOC
      put QOUNT/2 into XYZ
      put 25 into S1
      put 25 into S2
      put ((LRLOC * XYZ)+ 375 + S1) into LRLOC
      put ((UDLOC * XYZ)+ 375 + S2) into UDLOC
      
      if lastX is a number then
         put (lastX+LRLOC)/2 into midX
         put (lastY+UDLOC)/2 into midY
         put  cr & midx,midy after tPoints
         --add 1 to QOUNT
      end if
      put LRLOC into lastX
      put UDLOC into lastY
      
      put cr & (LRLOC & "," & UDLOC) after tPoints
      set the points of grc "TRAK" to tPoints
      set the loc of grc "BLOB" to (LRLOC & "," & UDLOC)
   
      add 0.1 to STEPP
      add 1 to QOUNT
   end repeat
   set the vis of grc "BLOB" to false
   set the layer of grc "TRAK" to bottom
end mouseUp


also there's so more you can do with silly sines... in 3D!
MagneticField.gif
MagneticField.gif (478.53 KiB) Viewed 142 times
This is just modifcation of example...3 from one of those stacks

Code: Select all

on DefineMagneticField
   put 0.1 into STEPP
   put 1 into N
   repeat until STEPP > 63
      put (sin(STEPP)) into X
      put ((cos(STEPP)) * (sin(STEPP))) into Y
      -- Generate a z-coordinate (depth) based on QOUNT
      put N/2 into Z
      put 60 into S1
      put 60 into S2
      --put ((X * (60 - Z)) + 60 + S1) into D
      --put ((Y * Z) + 60 + S2) into D
      put (X*(N/10)) into waveX
      put (Y*(N/10)) into waveY
      setXYZ "MagneticField","X",N,waveX*2
      setXYZ "MagneticField","Y",N,waveY*2
      setXYZ "MagneticField","Z",N,60+ Z*(sin(N)/10) ---(cos(N)*((waveX+waveY)/2))
      add 0.1 to STEPP
      add 1 to N
   end repeat
end DefineMagneticField

on setXYZ tobject,XYZ,n,tval
   put "xyz"&tObject&"Array" into tArrayName
   put the tArrayName of of stack (the mainStack of this stack) into tArray
   put tArray[xyz] into subArray
   put tVal into subArray[n]
   put subArray into tArray[xyz]
   set the tArrayName of of stack (the mainStack of this stack) to tArray
end setXYZ

function getXYZ tobject,xyz,n
   put "xyz"&tObject&"Array" into tArrayName
   put the tArrayName of of stack (the mainStack of this stack) into tArray
   put tArray[xyz] into subArray
   return subArray[n]
end getXYZ
The setXYZ handler will store your 3D data, and the getXYZ handler will retrieve it, obviously.
You'll need a bunch of stuff from my 3D stack to make it do things though...but those are handy handlers.
User avatar
richmond62
Posts: 2766
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Being Daft with Sines and Cosines

Post by richmond62 »

Indeed: there is NO need of a scrolling list field at all: just bung the values into a monster variable with some kind of delimiter.

The reason, as ever, that I used a field is so that chummy-the-new boy/girl/hijra does not start inhaling mud because it is over their head. 8-)
https://richmondmathewson.owlstown.net/
User avatar
tperry2x
Posts: 1533
Joined: Tue Dec 21, 2021 9:10 pm
Location: Britain (Previously known as Great Britain)
Contact:

Re: Being Daft with Sines and Cosines

Post by tperry2x »

tperry2x wrote: Mon Mar 04, 2024 8:01 pm ...I'll put the link up again in a bit.
As promised, in case anyone missed it, I've spent the last couple of days (on-and-off between other jobs) gathering all the related files for OpenXTalk Lite into a central repository, which is currently hosted in Mega.
Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests