Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » (For mathematic coders) golden graphing (phi)
- Mandale_county_333
-
7 posts
(For mathematic coders) golden graphing (phi)
Hey everyone! How are you all?
I need help with a project. It's a calculator and graph for the golden ratio (phi). I'm trying to make it graph the golden spiral based on the calculated values of the Fibonacci sequence. I'm nearly there, but I need a bit of help. The graph is not constant at times. Can anyone help me? Here is the link on my alt acct https://scratch-mit-edu.ezproxyberklee.flo.org/projects/1137864214 . (Note: it is very much not finished.)
Thank you!
-Raiden
I need help with a project. It's a calculator and graph for the golden ratio (phi). I'm trying to make it graph the golden spiral based on the calculated values of the Fibonacci sequence. I'm nearly there, but I need a bit of help. The graph is not constant at times. Can anyone help me? Here is the link on my alt acct https://scratch-mit-edu.ezproxyberklee.flo.org/projects/1137864214 . (Note: it is very much not finished.)
Thank you!
-Raiden
- RokCoder
-
1000+ posts
(For mathematic coders) golden graphing (phi)
Without looking into this in-depth, is the issue occurring when the pen leaves the screen boundaries? If you increase the pen size, you'll see clearly where that causes problems - the X and Y values remain within the screen boundaries.
I would suggest carrying out the positional and rotational calculations using variables and plotting the the calculated values (rather than relying on the position and rotation of the pen)
I would suggest carrying out the positional and rotational calculations using variables and plotting the the calculated values (rather than relying on the position and rotation of the pen)
- ProfessorUelf
-
100+ posts
(For mathematic coders) golden graphing (phi)
I think it has to do with the maths not being entirely correct.
Here is a script that is 100% accurate:
Here is a script that is 100% accurate:
when green flag clicked
set [spiral size v] to [10]
set [draw accuracy v] to [9] //lowers drawspeed
set [i v] to [0]
set [x v] to [0]
set [y v] to [0]
point in direction (180 v)
go to x: (0) y: (() - (spiral size))
clear
pen down
repeat (length of [fibonacci sequence v] :: list)
change [i v] by (1)
repeat ((draw accuracy) * (item (i) of [fibonacci sequence v] :: list))
set x to ((x) + ((spiral size) * (([sin v] of (direction)::operators) * (item (i) of [fibonacci sequence v] :: list))))
set y to ((y) + ((spiral size) * (([cos v] of (direction)::operators) * (item (i) of [fibonacci sequence v] :: list))))
turn ccw ((draw accuracy) / (item (i) of [fibonacci sequence v] :: list)) degrees
end
if <(i) > [1]> then
change [x v] by ((spiral size) * (([sin v] of ((direction)-(180))::operators) * (item ((i)-(1)) of [fibonacci sequence v] :: list)))
change [y v] by ((spiral size) * (([cos v] of ((direction)-(180))::operators) * (item ((i)-(1)) of [fibonacci sequence v] :: list)))
end
end
- Mandale_county_333
-
7 posts
(For mathematic coders) golden graphing (phi)
Without looking into this in-depth, is the issue occurring when the pen leaves the screen boundaries? If you increase the pen size, you'll see clearly where that causes problems - the X and Y values remain within the screen boundaries.
I would suggest carrying out the positional and rotational calculations using variables and plotting the the calculated values (rather than relying on the position and rotation of the pen)
No, not quite. I have a var called “steps” that determines the growth factor. I have supervised the change in the variable in relation to the drawing. It’s a bit more visible at the beginning, but the distance between points start to shrink after a while.
- Discussion Forums
- » Help with Scripts
-
» (For mathematic coders) golden graphing (phi)