comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Bug in IDLgrPolygon ?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Bug in IDLgrPolygon ? [message #33195 is a reply to message #33185] Thu, 12 December 2002 11:19 Go to previous messageGo to previous message
Karl Schultz is currently offline  Karl Schultz
Messages: 341
Registered: October 1999
Senior Member
"Thomas Gutzler" <tgutzler@ee.uwa.edu.au> wrote in message
news:3DF86288.D1D90638@ee.uwa.edu.au...
> Hi,
>
> I just detected some weird behaviour in IDLgrPolygon. I generated an
> Object with this data:
> arr = Transpose([[-1, 1,-1, 1,-1, 1,-1, 1], $
> [-1,-1,-1,-1, 1, 1, 1, 1], $
> [-1,-1, 1, 1,-1,-1, 1, 1]])
> ;vertex: 1 2 3 4 5 6 7 8
> arr_colors = Transpose([[255,255, 0, 0,255,127, 0,127], $
> [190, 0, 65,255, 0, 0,255,255], $
> [ 0,190,255, 65, 0,255,255, 0]])
> arr_polys = [[4, 0, 1, 3, 2], $ ; vertices 1243
> [4, 0, 2, 6, 4], $ ; vertices 1375
> [4, 2, 3, 7, 6], $ ; vertices 3487
> [4, 1, 3, 7, 5], $ ; vertices 2486
> [4, 0, 1, 5, 4], $ ; vertices 1265
> [4, 4, 5, 7, 6]] ; vertices 5687
> poly = OBJ_NEW('IDLgrPolygon', arr, polygons=arr_polys,
> vert_color=arr_colors, SHADING=1)
>
> which is a colored cube.
>
> The onlinehelp to IDLgrPolygon sais:
>
> POLYGONS (Get, Set)
> [...] To ignore an entry in the POLYGONS array, set the vertex count,
> n, to 0.
>
> Fine - I set Element 25 (the first of the last line) from 4 to 0 an
> looked forward to see an "open cube" beacuse the last polygon shouldn't
> be drawn.
> What I saw was an open cube ... and an error:
>
> % OBJ_NEW: Error, invalid connectivity list detected (invalid final
> polygon).
>
> If I just leave the last (or any other) line away there's no error and
> the result is, what I expeced, an open cube. But this can't be the
> solution, because I want to interactively permit polygons being drawn.
>
> My question is: Is this a bug ?

The docs are misleading.

> or: what did I wrong ?

What you want to do is replace:

[4, 4, 5, 7, 6]] ; vertices 5687

with:

[0, 0, 0, 0, 0]] ; vertices 5687

If you try:

[0, 4, 5, 7, 6]] ; vertices 5687

then IDL skips over the 0 and thinks that the 4 is the vertex count for the
next polygon.
If you replace the just count with 0, there is no way for IDL to know how
far to skip to get to the next polygon. The 0 in the POLYGONS list is a
special value, which really just means "skip over me". It is really only
useful when wanting to rub out a complete [n,v0,v1,...,v(n-1)] polygon
definition without moving data around. -1 is the other special value which
means "stop here, even if there is more data after me" and really only makes
sense to put in a list after a polygon definition.

The docs should say:

To ignore an entry in the POLYGONS array, set the entry to 0. (and maybe
some of the discussion above)


Karl
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Clean your PC properly - wk u10 i32dq3 87idq2iw71
Next Topic: Re: Serial I/O

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 18:44:27 PDT 2025

Total time taken to generate the page: 0.00413 seconds