Hi
When I simulated a
Kelvin Shipe Wake[
^] I had a need of plotting the result.
And I wanted something like the picture below:
https://skydrive.live.com/?cid=31C12AA3E3EE0DCB&id=31C12AA3E3EE0DCB!505[
^]
The code I used was (on each rectangle):
Public Function ColorGradient(ByVal Value As Single) As Brush
Dim val As Single
Dim bt As Byte
Val = 1 - Math.Abs(Value) * 10 / 3
If Val() > 1 Then Val = 1
If Val() < 0 Then Val = 0
bt = Val() * 255
If Value > 0 Then
Return New SolidColorBrush(Color.FromRgb(255, bt, bt))
ElseIf Value < 0 Then
Return New SolidColorBrush(Color.FromRgb(bt, bt, 255))
Else
Return New SolidColorBrush(Colors.White)
End If
End Function
What are these kind of plots called? If I dont know the name I dont know what to search for...
(and possibly Do you know any articles that performs better versions than my crude example?)
Edit:
The Kelvin Wake code looks like this:
Private Function MidPointKelvin(ByVal x As Double, ByVal y As Double)
Dim m As Double = 80
Dim h As Double = Math.PI / (2 * m)
Dim p As Double = 0.001
Dim pheda, t1, t2, sum, g1, gp1, cg1, sg1, sgp1 As Double
sum = 0
For i As Integer = 1 To m
pheda = -(Math.PI / 2) + (2 * i - 1) * h
g1 = g0(x, y, pheda)
gp1 = gp(x, y, pheda)
cg1 = Math.Sin(gp1 * h)
sg1 = Math.Sin(g1)
sgp1 = Math.Sin(gp1 * h)
t1 = p * 2 * h * cg1
t2 = 2 * gp1 * cg1 * sgp1
sum = sum + (t1 + t2) / (p + gp1 ^ 2)
Next
Return sum
End Function
Private Function g0(ByVal x As Double, ByVal y As Double, ByVal p As Double) As Double
Return (x - y * Math.Tan(p)) / Math.Cos(p)
End Function
Private Function gp(ByVal x As Double, ByVal y As Double, ByVal p As Double) As Double
Return -(1 / Math.Cos(p)) ^ 3 + (1 / Math.Cos(p)) * Math.Tan(p) * (x - y * Math.Tan(p))
End Function
And it is a direct copy from :
http://demonstrations.wolfram.com/KelvinShipWavePattern/[
^]
(Click preview to see the code)