Jump to content

Math Magic


CoePSX
 Share

Recommended Posts

Well I will try to explain what I think is the math behind this. Its actually pretty simple if you think about it. The main functions that describe the drawing are basically the parametric equations.

x( R ) = sin(R*inumber)*(picsize) + constant

and

y( R ) = cos(R*inumber)*(picsize) + constant

The equations of a circle in parametric style is

x(t) = sin(t) and y(t) = cos(t)

The difference between these functions is a matter of multiples and constants.

The pic size value increases with every iteration and accounts for the increasing radius of the drawing.

(The spiral effect)

The @desktopwidth/2 and @desktophieght/2 account for centering the image on the screen.

The only reason every one does not look look like a circle is because the step value is very large. If you changed the step to an infintecimal number than it would make a spiral or at least part of arc every time.

The reason for the odd shapes is that since your facts R and t are not factors of pi (3.14...) the points are always offset.

The number of degrees between the points of the line segmant traverses every step is found witht he conversion, (if stepsize is over 180 then subtract as many 360's as needed until you get a number between -180 and 180).

Stepsize = (R*180)/pi

i.e.

for R=2

2*180/pi = 114 degrees step size

for R=3

171 deg

R=4

229 deg, however effectivly this is -131 deg

R=5

286 deg (effectively -76 deg)

Now we get to the "spiral one"

R=6

344 deg (effectivly -16 degrees)

Well this is the small step value that we want, and it produces a fairly good semblance of a smooth curve especially with the picsize incremenet added in.

A few quick calculations how that R = 19 would most likely be a good spiral too. (8 deg step)

Well that about does the explanation.

I assume the writer of this understood most of this.

If anyone has anymore q's id be happy to try to answer them, I like math and stuff like this intrigues me.

EDIT: Made the paren R paren into ® and I fixed it.

Good Explaination! :whistle:

2015 - Still no flying cars, instead blankets with sleeves.

Link to comment
Share on other sites

  • Replies 45
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

-= Code updated =-

Now the number on the upleft corner of the screen is the number of degrees of the offset.

Thanks to Wus it's now correct.

[quote name='Valik' post='301213' date='Jan 31 2007, 10:36 PM']You seem to have a habit of putting things in the wrong place. I feel sorry for any female you attempt to have sex with.[/quote][font="Lucida Sans Unicode"][/font]

Link to comment
Share on other sites

Thanks to Wus clarifing it to me, I was able to calculate the number of

rendered spirals and (on most cases) color each one with a diferent color.

And thanks to Lakes the drawing isn't flicky anymore.

The code is posted on a new topic called MathMagic Screensaver.

http://www.autoitscript.com/forum/index.php?showtopic=30976

[quote name='Valik' post='301213' date='Jan 31 2007, 10:36 PM']You seem to have a habit of putting things in the wrong place. I feel sorry for any female you attempt to have sex with.[/quote][font="Lucida Sans Unicode"][/font]

Link to comment
Share on other sites

  • 8 months later...

I was playing around with Sin and Cos, and i started to get patterns of mousemoves when changing

the value multiplied by the number before calculate Sin and Cos.

I'm not sure why this happens, I only know it's fun!.

Just test it and you'll see the magic of this. I even made it draw in CorelDraw and the details were

amazing.

Compiled .SCR file with source code in the zip file.

Its so good, i suggest you submit it to downloads.

It would be good if it was possible to have the gui to mess with the settings while seeing the cool screensaver

Link to comment
Share on other sites

Wow, older thread.

I never saw this thread it's first time around, almost wish I had, it would have made writing my own screensaver a little easier I think. I created this using sin and cos and a bunch of randomness. Compiled script (as .scr) along with full source and everything in the .zip. If you just extract everything to the same dir, and run Scribbler_Draw.au3 you should get a good idea of what it does.

http://www.therks.com/autoit/Scribbler.zip

Edited by Saunders
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...