Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在开发一个使用正弦波的游戏。我通过以下示例使用了水平正弦波 http://www.roseindia.net/java/example/java/swing/create_sine_wave.shtml
如何垂直创建类似的波浪?
它说的地方
g.drawLine(x1, y1, x2, y2);
交换 x 和 y 值的顺序。
尝试交换 X 和 Y 坐标
您可以轻松交换 x 和 y 的值。这将导致更改图形坐标,因此如果它在变为垂直之前是水平的,反之亦然。