Post

 Resources 

Console

Home | Profile | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 VBGamer
 VBGamer
 Finding 2D Line intersections
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

cbx
Swordmaster

Canada
296 Posts

Posted - Jul 17 2003 :  02:08:35 AM  Show Profile  Visit cbx's Homepage  Send cbx an ICQ Message  Click to see cbx's MSN Messenger address  Send cbx a Yahoo! Message  Reply with Quote
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

Created by: X
http://www.createdbyx.com/

Edited by - cbx on Jul 17 2003 02:14:58 AM

Eric Coleman
Gladiator

USA
811 Posts

Posted - Jul 17 2003 :  10:58:23 AM  Show Profile  Visit Eric Coleman's Homepage  Reply with Quote
These are the results I get. And I never knew you could use Ctrl+C to copy the text from a message box. I've always retyped the stuff by hand whenever I needed to get the info. Thanks a lot for that tip! I have a 600 Mhz Pentium 3.
---------------------------
LineIntersect
---------------------------
Calls in 10 Seconds: 26889953
Calls per Second: 2688995.3
Calls per mili Second: 2688.9953
Calls per 30 fps: 89633.1766666667(per frame)
---------------------------

The timing code you have is correct, but the "calls per 30 fps" doesn't really mean much. I would be more interested in "time per call," because FPS measurements are not linear.

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
VBGamer © Go To Top Of Page
This page was generated in 0.2 seconds. Snitz Forums 2000

Copyright © 2002 - 2004 Eric Coleman, Peter Kuchnio , et. al.