Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Performance / February 2006

Tip: Looking for answers? Try searching our database.

Rectangle Intersect problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Xafier - 16 Feb 2006 14:25 GMT
Hi

I'm working on a custom control thats pretty graphics intensive, it can
at an extreme with current test data, have upto 60,000 lines (each with
upto around 4 or 5 points).

To improve speed I'm using a pretty slow checking procedure that tests
the start and end points and whether the line intersects the box I'm
giving it as my screen.

The problem is, is that its slow... and so far I'm unable to find a
built in procedure for this or any fast code anywhere to solve the
problem.

Surely the Rectangle.IntersectsWith() procedure uses line intersect
algorithm... but I can't figure how to get access to it... which I
probably can't...

so, any suggestions or advice?

GDI+ seems to be dirt slow at drawing thousands of lines, I'm trying to
optimize things as much as I can as when I originally wrote this I was
new to C#, but 6 months later I have made quite a few optimizations but
it's still terribly slow when I "zoom out" and need to render a lot
more lines with scaling.

Thanks
AMercer - 17 Feb 2006 16:30 GMT
> To improve speed I'm using a pretty slow checking procedure that tests
> the start and end points and whether the line intersects the box I'm
[quoted text clipped - 3 lines]
> built in procedure for this or any fast code anywhere to solve the
> problem.

Maybe you could speed things up as follows.  You have a rectangle for the
screen box.  For each line, make a new rectangle with the line on one or the
other diagonal.  Now use Rectangle.IntersectsWith on these two rectangles.  
If false, you do not have an intersection, and if true you might, so run your
slow routine.  If both (1) IntersectsWith is fast and (2) you have enough
lines that return false, you should speed things up.  I haven't tried it, no
guarantees, just a suggestion.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.