Log In  
Follow
Sysse
[ :: Read More :: ]

I've started up a new project and I'll be making extensive use of the trig-functions, so I started playing around with them. I soon found out about the input range and the inverted sin, but I still can not explain the behavior I'm seeing.

What you would expect from sin(x)cos(x) and what you can intuitively read from the graph is that first peak of sin(x)cos(x) should be negative, and the second positive. The actual behavior can be explained by the inverted sin-function, but with the inverted sin-function, I would expect the sin-graph to reflect the inversion, which it does not.

Code:

function _draw()
    cls()
    print("cos(x)",10)
    print("sin(x)",12)
    print("sin(x)*cos(x)",14)
    for x=1, 127 do
        pset(x, 64,3)
        pset(x, 64+32*cos(x/127),10)
        pset(x, 64+32*sin(x/127),12)
        pset(x, 64+32*sin(x/127)*cos(x/127),14)

    end
end

(Sorry, I don't know how to format code on the BBS)

P#140428 2024-01-22 10:51 ( Edited 2024-01-23 18:26)

[ :: Read More :: ]

Cart #kons-2 | 2024-01-21 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
6

Cart #kons-1 | 2024-01-20 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
6


First release of my first game (in any engine/platform).

It's basically Snake, but you grow automatically and have to consume healthy fruit and vitamins to stay short.

Version 1.0.1
Added a border to the screen to help see where the edges are

P#140365 2024-01-20 15:44 ( Edited 2024-01-21 18:30)