On 2017-07-14 12:01, Richmond Mathewson via use-livecode wrote:
It does seem illogical that while one can set levels of transparency with interset an image can continue intersecting with another when it is, supposedly, invisible . . .
Originally intersect only worked on the rects of the objects - I don't think it ever took visibility into account (nor blendLevel, for that matter).
When we (I think it was me, actually) added the support for pixel-level intersection we just extended the rect approach - so, again, visibility (nor blendLevel) were considered.
The threshold parameter isn't really setting levels of transparency - it is telling intersect what level of transparency and above should be considered as being 'actually there' - which means you can have some control over what is considered 'the actual thing you want to intersect' and what is considered 'just background'.
Basically intersect works by generating a 'sharp' mask (i.e. which pixels are 'on' and which are 'off') by rendering the object offscreen and then taking any pixel with alpha > threshold as being 'on' and any pixel with alpha < threshold being 'off'. Two objects then intersect if when their masks are overlapped there is at least one pixel which is 'on' in both.
As Lagi pointed out one can imagine that there are use-cases where you want to know whether two things intersect regardless of whether they can be seen (i.e. visible false, or blendLevel 100). Indeed, I don't recall anyone ever commenting on this - so either it was too long ago and I have since forgotten, or it is useful the way it currently is.
Indeed, one could consider the current 'intersects' as a 'non-effective' form. i.e. It works with the pixels the object is composed of regardless of how they are rendered visually. This does suggest that an 'effective' form is missing - one which takes into account blendLevel and visible.
(There's even another point of variance here - you might not actually want blendLevel taken into account - imagine ghost sprites - you might want them very transparent when rendered, but to still intersect as if they had 0 blendLevel).
Warmest Regards, Mark. -- Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/ LiveCode: Everyone can create apps _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode