weird behavior

Alex Tweedly alex at tweedly.net
Mon Jul 19 13:06:54 EDT 2004


At 17:05 19/07/2004 +0200, Wouter wrote:

>>I'm not convinced. The description above requires that a polygon must meet
>>one or other of the two conditions - and many "obvious" polygons will not
>>satisfy either condition. No need to invoke the opacity of the polygon.
>>Your original example had a non-blank last line containing a point which
>>was not a duplicate of the first point - therefore was neither an open nor
>>a closed polygon.
>
>This is the difference in looking at things.
>Is it the engine that should be conform to the description or is it the 
>description that should be conform to the engine?

Or should both conform to what it/they *should* do ?

>The Transcript Dictionary is a reworked, updated and elaborated version of 
>the metatalk reference. It is a wonderful piece of work, but is it infallible?
>Anyway, the engine acts in this way.
>If you call it to draw a polygon and if the opaque property is set, it 
>will consider it as a <closed> one and will check if point 1 = last point, 
>if not then add that point.

Not true if you add the polygon in the IDE. You can create a polygon with 3 
vertices, leaving it to default to opaque. (click at 100,100 - click at 
200,100 - double-click at 200,200)
The result is that two edges are drawn (i.e. NOT the third closing edge), 
there is no additional (duplicate) point not added to the point list. If 
you give it a fill colour, you will see that it is filled as though the 
third closing edge were there - but the edge itself is not drawn.

(Though the point, and the drawn edge, will be added when you do certain 
edits to the polygon.)
And if you do the same thing in a script, you get the last point duplicated 
for you.

>Your so called "welformed <open> polygons" are in fact <closed> ones if 
>the opaque property is set.and the engine gets his way.
>Have a look at the points.
>  Draw a so called open polygon and add 2 returns for welformed-ness sake. 
> Deselect the polygon and reselect it and have a look at the points: the 
> so called open polygon is closed now, the first point is added.

See my counter-example above :-)
btw - after creating the polygon, I deselected the polygon, saved the 
stack, and quit Revolution, then restarted it - all to make sure I was not 
being misled by the Property Inspector lagging the stack contents.

In any case, it is not a requirement that all edges exist on an opaque 
polygon. You can draw an opaque polygon with blank lines in the middle of 
the point list. This results in those edges being left undrawn, and the 
fill behaviour is straightforward (though hard to describe in words). It 
produces a set of non-contiguous shapes; the series of edges between any 
two blank lines (or the start->blank line, and blank line->end) produces a 
filled shape, with an implicit edge being used in the fill but not drawn.

Easier seen than described : in the IDE, create a polygon and set the 
points as follows
50,192
322,192
320,240
260,296
178,296
160,262
116,288
76,260
42,294

(deselect, reselect, note the first point did not get replicated as the 
last point, and the implicit last edge did not get drawn).
Give it a fill colour - you see a nice simple shape.

Now insert a blank line after the 3rd point, and again after the 7th, to get
50,192
322,192
320,240

260,296
178,296
160,262
116,288

76,260
42,294

Note : The first point is now duplicated - you may need to switch the 
Property Inspector to another object and back again to update the points 
window. (I saved and re-opened the stack at each stage of this, just to be 
sure I was viewing up-to-date info in Property Inspector).

You now have three dis-contiguous filled regions.
Each of those three regions has one un-drawn edge needed to close the 
region for fill purposes.

To me, this implies that the engine is capable of filling (i.e. opaque-ing) 
non-closed regions, and it is an anomaly that it refuses to do so when the 
blank line happens to be the last one.


>I agree that the interaction of closed-ness with the opacity is awkward, 
>but  I cannot consider it a real bug.
>The improvement would be to add another property that governs open- or 
>closed-ness.
>And use the opacity for the enclosed regions of the polygon to be filled 
>or not.

I see it as a real bug. If I create a 20-sided opaque polygon, with the 
first point not being duplicated at the end, that produces a filled shape, 
with the last edge not drawn. Then I add a blank line at the other side 
(i.e. between points 10 and 11) of the polygon, and suddenly the last edge 
becomes drawn.  Surely that's a bug ?

But I see no need to add a new property - the existence or non-existence of 
blank lines already provides enough expressive power to describe everything 
needed. Unfortunately, both the engine and the documentation would need to 
change.


-- Alex.
-------------- next part --------------

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.719 / Virus Database: 475 - Release Date: 12/07/2004


More information about the use-livecode mailing list