Connecting Tech Pros Worldwide Help | Site Map

How to speed up a program that uses mouse points a lot?

  #1  
Old November 20th, 2008, 10:25 PM
raylopez99
Guest
 
Posts: n/a
I'm wondering, since my program uses a lot of mouse points when the
mouse is moving, but for resolution purposes doesn't really need to
collect so many mouse points, is it conventional to use a timer so
that mouse points are only collected every 100 or 500 ms--i.e. when
the timer fires-- rather than every 10ms (or whatever the default is
when the mouse is moving)?

It seems my program is bogging down with so many mouse points being
collected (though truth is, I have slow hardware).

Any thoughts appreciated.

RL
  #2  
Old November 21st, 2008, 01:45 AM
Family Tree Mike
Guest
 
Posts: n/a

re: How to speed up a program that uses mouse points a lot?


"raylopez99" <raylopez99@yahoo.comwrote in message
news:e86ad532-8d00-4117-919e-57964e57f3e5@v42g2000yqv.googlegroups.com...
Quote:
I'm wondering, since my program uses a lot of mouse points when the
mouse is moving, but for resolution purposes doesn't really need to
collect so many mouse points, is it conventional to use a timer so
that mouse points are only collected every 100 or 500 ms--i.e. when
the timer fires-- rather than every 10ms (or whatever the default is
when the mouse is moving)?
>
It seems my program is bogging down with so many mouse points being
collected (though truth is, I have slow hardware).
>
Any thoughts appreciated.
>
RL

Are you doing somthing allong these lines and finding it slow?

List<PointPoints = new List<Point>();
void Form1_MouseMove(object sender, MouseEventArgs e)
{
Points.Add(e.Location);
}


  #3  
Old November 21st, 2008, 09:45 PM
Family Tree Mike
Guest
 
Posts: n/a

re: How to speed up a program that uses mouse points a lot?


"RayLopez99" <raylopez88@gmail.comwrote in message
news:13a18f9f-d0e7-45b9-bf67-bafa40e72e0c@w22g2000yqd.googlegroups.com...
Quote:
Thanks FTM.
well this confirmed that standard practice for most conventional apps
is not to put a timer to limit the number of points collected by the
mouse. So it must be the extra logic I'm doing (which is
considerable). The lag is not too bad now, but if it gets worse I
might limit the number of points collected with a timer.
>
RL

If the time lag gets too bad, I don't think I would resort to a timer. I
would fall back to the logic used in geographic information systems (GIS)
for thinning complex line segments. One option would be to keep ever N-th
point. Another option is to keep points "significantly different" from the
last point. That would entail looking at the deltas between the last kept
X, Y to the new X, Y. The first option is more likely quicker, while the
second is likely more visually accurate.

Mike

  #4  
Old November 21st, 2008, 10:35 PM
RayLopez99
Guest
 
Posts: n/a

re: How to speed up a program that uses mouse points a lot?


On Nov 21, 1:35*pm, "Family Tree Mike"
<FamilyTreeM...@ThisOldHouse.comwrote:
Quote:
"RayLopez99" <raylope...@gmail.comwrote in message
>
news:13a18f9f-d0e7-45b9-bf67-bafa40e72e0c@w22g2000yqd.googlegroups.com...
>
Quote:
Thanks FTM.
well this confirmed that standard practice for most conventional apps
is not to put a timer to limit the number of points collected by the
mouse. So it must be the extra logic I'm doing (which is
considerable). *The lag is not too bad now, but if it gets worse I
might limit the number of points collected with a timer.
>
Quote:
RL
>
If the time lag gets too bad, I don't think I would resort to a timer. *I
would fall back to the logic used in geographic information systems (GIS)
for thinning complex line segments. *One option would be to keep ever N-th
point. *Another option is to keep points "significantly different" fromthe
last point. *That would entail looking at the deltas between the last kept
X, Y to the new X, Y. *The first option is more likely quicker, while the
second is likely more visually accurate.
>
Mike
Yeah thanks. I like that first option, just do a modulus %N operation
and take every Nth point. I'll keep that in mind. The delta's idea
is good too.

RL
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
comp.lang.c Answers to Frequently Asked Questions (FAQ List) Steve Summit answers 0 November 14th, 2005 08:57 PM
comp.lang.c Answers to Frequently Asked Questions (FAQ List) Steve Summit answers 0 November 14th, 2005 07:46 PM
comp.lang.c Answers to Frequently Asked Questions (FAQ List) Steve Summit answers 0 November 14th, 2005 03:55 PM
comp.lang.c Answers to Frequently Asked Questions (FAQ List) Steve Summit answers 5 November 14th, 2005 12:36 PM