如何进行2D图片绘制 [英] How to perform 2D picture plotting
问题描述
嗨
当我模拟 Kelvin Shipe Wake [ ^ ]我需要绘制结果。
我想要的如下图所示:
https://skydrive.live.com/?cid=31C12AA3E3EE0DCB&id=31C12AA3E3EE0DCB!505 [ ^ ]
我使用的代码是(在每个矩形上):
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
'Red color
Return New SolidColorBrush(Color.FromRgb(255, bt, bt))
ElseIf Value < 0 Then
'Blue color
Return New SolidColorBrush(Color.FromRgb(bt, bt, 255))
Else
'White color
Return New SolidColorBrush(Colors.White)
End If
End Function
这些情节叫做什么?如果我不知道这个名字,我不知道该搜索什么...
(可能你知道任何文章的表现比我粗略的版本好吗?)
编辑:
Kelvin Wake代码如下所示:
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?)
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
这是一份直接副本:
http://demonstrations.wolfram.com/KelvinShipWavePattern/ [ ^ ]
(点击预览查看代码)
And it is a direct copy from :
http://demonstrations.wolfram.com/KelvinShipWavePattern/[^]
(Click preview to see the code)
推荐答案
也许这是视错觉(可能不是,见下面看,但看起来像大图片的外部计数器是弯曲的,这不适合马赫锥体描述的物理模型。
请参阅:
http://en.wikipedia.org/wiki/Cherenkov_radiation [ ^ ]。
是的,船上波浪的数学与切伦科夫的辐射相同;我之所以引用这个页面只是因为目前缺少Mach''s cone上的英文维基百科页面。还有一个动画图片,我在相关的英文维基百科页面上也找不到:
http://upload.wikimedia.org/wikipedia/commons/8/87/Cherenkov_radiation-animation.gif [ ^ ](点击查看动画)。 />
您引用的第一个图像为 https: //skydrive.live.com/?cid=31C12AA3E3EE0DCB&id=31C12AA3E3EE0DCB!505 5.5 [ ^ ]当然不适合物理模型。如果你真的想描绘船上的波浪,你使用你所展示的波浪图片是不正确的。
如果你模仿别的东西,请解释。
-SA
Maybe this is optical illusion (probably not, see below), but it looks like outer counters of a big pictures are curved, which would not fit a physical model which is described by the Mach cone.
Please see:
http://en.wikipedia.org/wiki/Cherenkov_radiation[^].
Yes, the mathematics of the wave from a boat is identical to the Cherenkov''s radiation; I''ve referenced this page just because the English Wikipedia page on Mach''s cone is presently missing. There is also an animated picture, which I also could not find on related English Wikipedia pages:
http://upload.wikimedia.org/wikipedia/commons/8/87/Cherenkov_radiation-animation.gif[^] (click to see the animation).
Your very first image you referenced as https://skydrive.live.com/?cid=31C12AA3E3EE0DCB&id=31C12AA3E3EE0DCB!505[^] certainly does not fit the physical model. If you really want to depict the wave from a boat, you the use of the wave picture you show would not be correct.
If you model something else, please explain.
—SA
这篇关于如何进行2D图片绘制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!