[GEM-dev] pix_hit

Davide Morelli davide.morelli at tin.it
Thu Dec 15 17:49:18 CET 2005


hi Chris, list,

points are there only because they were the first type of area I 
implemented.. (i agree that they are not that usefull!) then I suddently 
realized that I needed rectangles and I wrote them..
then wip asked me to implement lines which have a different behaviour:
  * rects only have 2 states: ON/OFF
  * lines return the normalized distance between the hit point and the first 
point, the idea is that they can be used as invisible "sliders" (that's how 
I use them)

so, I agree in taking points away but I'd leave lines.

your idea of using masks is great!

about code efficency: I wrote this external in a hurry (I needed it for an 
installation with just 8 test areas) so I contented myself... but obviously 
anyone is welcome to make the code better! I'd try myself but I don't have 
time ATM...

ciao,
Davide.

----- Original Message ----- 
From: "chris clepper" <cgc at humboldtblvd.com>
To: "IOhannes m zmoelnig" <zmoelnig at iem.at>
Cc: "davide" <davide.morelli at tin.it>; <gem-dev at iem.at>
Sent: Thursday, December 15, 2005 2:41 PM
Subject: Re: [GEM-dev] pix_hit


Someone was asking me about the possibility to do what this object
does in GEM just this week.

I only quickly looked at the code, but I think it would be more
efficient to test per pixel in a linear fashion especially for more
than a few test areas.  The current way is a true cache basher.  I
don't see the reason for points, lines and rects either.  A point is a
1x1 rect and a line is a rect with a really narrow x or y. Testing for
single pixel bounds is not very useful for motion detection in my
experience anyway.  Just having rects would make messaging simpler as
well.  Finally, there's no reason to do floating point computation
especially in an object that is essentially a 1 bit boolean test.

I see plans to incorporate shapes like a circle, but I would propose
adding the ability to test based on a mask which would cover more
intricate shapes.  The mask could be fed in live via an inlet or
loaded from a file. One could use pix_write to display the current
test areas on screen and write that out to a file.  Maybe that is a
different object though.

cgc





More information about the GEM-dev mailing list