Polygon's share of its rectangle inconsistent?

Dar Scott dsc at swcp.com
Thu Jun 6 20:39:15 EDT 2013


A couple other thoughts:

If it is not the lineSize, then maybe you can get a clue by comparing the the rect to the extent of the points that are within().  

When fine tuning how I look at pixels, I tend to think of them as between the lines in the coordinate grid, little squares.  However, I sometimes think of coordinate points as in the middle of pixels.  The concepts of rect, within(), and clickable might have different notions there.  

There might be another edge effect.  Points along the edge have to be assigned as being within the click region or not.  It might be related to how much area of a square pixel is in the region, that is, the color.  If the threshold for clicking is not at 50%, then that might affect this.  

Dar

On Jun 6, 2013, at 5:39 PM, David Epstein wrote:

> In order to properly adjust the relative area of two dissimilar polygons, I thought I would use a function to determine the fraction of each polygon's rectangle that is covered by the polygon.
> 
> function coverage obLID
>   set the filled of obLID to true
>   put the rect of obLID into r
>   repeat with x = (item 1 of r) to (item 3 of r)
>      repeat with y = (item 2 of r) to (item 4 of r)
>         put x,y into pt
>         if within(obLID,pt) then add 1 to isIn
>         add 1 to all
>      end repeat
>   end repeat
>   return isIn/all
> end coverage
> 
> This seems to work as expected, but I am perplexed by the fact that when I resize an object keeping its proportions constant (drag a corner with the shift key down; or script this) I get a surprising variation in the result.  E.g., a fairly simple shape I tried went from 0.48 coverage up to 0.59 coverage when I shrank its dimensions by about two-thirds.  With tens or hundreds of thousands of pixels being sampled in the calculation, I would not expect this variation.
> 
> Many thanks for any insights or suggestions.
> 
> David Epstein
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list