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

Note: You must be registered in order to post a reply.

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List Spell Checker
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

   Insert an File
Check here to include your profile signature.
Check here to subscribe to this topic.
    

T O P I C    R E V I E W
cbx Posted - Jul 17 2003 : 02:08:35 AM
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
1   L A T E S T    R E P L I E S    (Newest First)
Eric Coleman Posted - Jul 17 2003 : 10:58:23 AM
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.

VBGamer © Go To Top Of Page
This page was generated in 0.19 seconds. Snitz Forums 2000

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