2

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?

Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
Jana
  • 2,890
  • 5
  • 35
  • 45

3 Answers3

4

Where it says

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

swap the order of x and y values.

mbatchkarov
  • 15,487
  • 9
  • 60
  • 79
3

Try swapping the X and Y coordinates

das_weezul
  • 6,082
  • 2
  • 28
  • 33
2

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.

Abhinav Singi
  • 3,379
  • 1
  • 20
  • 27