We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Back again! This is for that project I mentioned earlier - creating a radar simulation on the battleship New Jersey museum ship. I'm moving along with Processing - now have a nice radar "screen" and a line sweeping round 360 degrees continuously.
I'd like to make the sweep-line have a trailing edge of random noise to simulate the return pattern a radar screen displays.
One idea I have is to create a thin triangle (vertex at center of radar screen) where the height is the sweep of the radar, and the hypotenuse line would be a thick line of varying transparency and random shaped edge. The fill of the triangle might be some noise pattern and blend into the hypotenuse side...
Just not strong enough with Processing yet to figger this one out - so a little guidance on how to code such a triangle would be a great help.
Answers
how are you drawing your sweep line? radius * cos and sin?
well, the one long edge of the triangle will be the exact same line and the other long edge will be a few degrees behind it.
use beginShape(TRIANGLES) and three calls to vertex(x, y). get that working and then add a texture using the vertex(x, y, u, v) version.
As koogs mentioned, you can position the triangle as three points, I'll call them A, B, and C:
A is positioned at the center
B is positioned using cos(theta) and sin(theta) where theta is some angle (in radians)
C is also positioned using trigonometry but behind B in terms of Polar Coordinates by subtracting some number from theta
Below is a simple sketch that places a triangle that is just filled in solidly. It will take some creativity to implement the noise effect you mentioned, maybe you could make an image (in Photoshop or something) to describe it?
Just as an option, maybe it is easier to create a trail of your moving line? You'll need to make an array and draw a couple of lines that would decrease their opacity in time. I could only find the examples with ellipses, however the principle is the same and you'll not need to mess with pixels. http://www.openprocessing.org/sketch/48961
Something like this, sorry for formatting.
Thanks to all for the helpful ideas. Currently I am rotating an arc and using pushMatrix and popMatrix to make changes. But your examples will def help me refine things. I was aware of Processing but only now took a look at it - what an awesome environment and tool!