Create Vertical Sine wave

5.4k Views Asked by At

I am developing a game which uses sine wave. I made use of the horizontal sin wave with the following example http://www.roseindia.net/java/example/java/swing/create_sine_wave.shtml

How do create a similar kind of wave vertically?

3

There are 3 best solutions below

1
mbatchkarov On BEST ANSWER

Where it says

g.drawLine(x1, y1, x2, y2);

swap the order of x and y values.

0
das_weezul On

Try swapping the X and Y coordinates

0
Abhinav Singi On

You can easily swap the values of x and y. This will result in changing the graph coordinates hence if its horizontal before it'll become vertical and vice verse.