I have converted the Intersect_Line method to VB.NET. I got the method from the gamedev.net site http://www.gamedev.net/reference/articles/article423.asp
Can some one run the .net lineintersect.exe file I have attached, and report back the results. When the results are displayed do a CTRL+C to copy the text from the msgbox to the clipboard.
I am getting the fallowing results ...
---------------------------
LineIntersect
---------------------------
Calls in 10 Seconds: 38188866
Calls per Second: 3818886.6
Calls per mili Second: 3818.8866
Calls per 30 fps: 127296.22 (per frame)
---------------------------
OK
---------------------------
The numbers seem to be a little high. (I think there might be an error in the time calculations) So I was wondering what kind of numbers other people will get. I am running a Athlon XP 1600.
--------------------------
This is the VB.NET code that I am using to determin the numbers
Dim T1, idx As Long
Dim x1, y1, x2, y2, x3, y3, x4, y4, retX, retY As Single
Randomize(Now.Ticks)
x1 = Rnd() * Me.ClientSize.Width : y1 = Rnd() * Me.ClientSize.Height
x2 = Rnd() * Me.ClientSize.Width : y2 = Rnd() * Me.ClientSize.Height
x3 = Rnd() * Me.ClientSize.Width : y3 = Rnd() * Me.ClientSize.Height
x4 = Rnd() * Me.ClientSize.Width : y4 = Rnd() * Me.ClientSize.Height
MsgBox("Click OK to start ...", MsgBoxStyle.Information Or MsgBoxStyle.OKOnly)
idx = 0
T1 = Environment.TickCount
While Environment.TickCount < T1 + 10000
IntersectLines(L1P1.X, L1P1.Y, _
L1P2.X, L1P2.Y, _
L2P1.X, L2P1.Y, _
L2P2.X, L2P2.Y, _
retX, retY)
idx += 1
End While
MsgBox("Calls in 10 Seconds: " & idx.ToString & vbCrLf & _
"Calls per Second: " & (idx / 10).ToString & vbCrLf & _
"Calls per mili Second: " & ((idx / 10) / 1000).ToString & vbCrLf & _
"Calls per 30 fps: " & ((idx / 10) / 30).ToString & "(per frame)")
How to work the app.
----------------------
1: To start the speed test press "t" on your keyboard.
2: To position the red and blue lines ...
Space -> Toggle between positioning the begining/end of the line
Left Mouse Button -> Hold to position red Line
Right Mouse Button -> Hold to position blue Line
Download Attachment: LineIntersect.zip
5.12 KB