Post

 Resources 

Console

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

 All Forums
 VBGamer
 VBGamer
 drawing a line old school (IE: doing it by hand)

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 - Aug 17 2003 : 03:48:33 AM
A word of caution ... I can't even under stand some of the stuff I am trying to say in this post, I've written too much to just delete it all and start from scratch, so you will have to muddle thru it just as I did ...

As per my prev posting http://www.vbgamer.com/msgboard/topic.asp?TOPIC_ID=56 the reason I was creating the ray rect function was this.

I am thinking about trying to make a doom clone for vb.net using directx9 and using quad BSP trees for the map etc.
I thought doing if I took the line and broke it down into blocks the size of a pixel, that It would be faster then calculating the path of a line. Here's what I mean ... (a basic premis for drawing the pixels that make up a line)

  
        DeltaX = point2.X - point1.X  
        DeltaY = point2.Y - point1.Y  
        Slope = DeltaY / DeltaX  
  
        YPos = point1.Y  
        For idx = point1.X To point2.X  
            ' draw pixel at idx, YPos  
            YPos += Slope  
        Next
  



... I realize that the code above is flawd but the basic math is there. Now from the code above, I had it in my head that doing it that way would be slower then calculating the hit boxes of a line etc.

My reasoning was that you could be transversing a line that is over 1000+ in length.

... heres my problem. I just wrote a sample app that draws a line manually using vb.net (Not asm not inline asm but slower than native VB.NET managed code!) and as it turns out drawing the line by hand in vb.net is instantaneous. I am running on a duel monitor rig and stretch the window to the max across both screens and draw a line as long as I could and still my timming code is saying that it's drawing it instantly with no delay. Let me re-iterate a line over 2500 in length does not in cure a speed penalty. That means that my managed code while still a debug build can execute a loop over 2500 times and not even flinch?

Mabe It's just because for most of my .. tech life ... I have been using a 486 and I am hoplessly brain drained to think that my athlon xp 1600 can't process a 2500+ loop without taking 5 seconds to do so...

I guess the whole point of this post was to vent my astonisment that my mid level system could handle 2500+ loop (plus code) and not even hickup .... Of course this means I have been wasting my time focusing on how to parse a line when I knew all along what the fasted way to do it was ... DOH! (In my best homer simpson impression)
1   L A T E S T    R E P L I E S    (Newest First)
Eric Coleman Posted - Aug 23 2003 : 08:03:06 AM
If you're only timing the draing of 1 line, then the resolutions of your timing code may be too small. Instead of drawing a line that you create with the mouse, hard code the start and end points of the line in your program, say (1,1), (1000,1000), then have another loop around the drawing code so that you can draw the line multiple times. Something like For intCounter = 1 to 10000 [...] Next. This should increase the drawing time for you, if not, then just increase the counter number and draw the line more.

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

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