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

Home » Public Forums » archive » Bug in IDLgrPolygon ?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Bug in IDLgrPolygon ? [message #33205] Thu, 12 December 2002 02:18 Go to next message
Thomas Gutzler is currently offline  Thomas Gutzler
Messages: 44
Registered: November 2002
Member
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 ?
or: what did I wrong ?

Thanks,
Thomas
Re: Bug in IDLgrPolygon ? [message #33222 is a reply to message #33205] Mon, 16 December 2002 08:08 Go 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:3DFD6478.1B64C1D6@ee.uwa.edu.au...
> This leads me directly to my next question.
> Is it possible to select a single polygon of a IDLgrPolygon-Model with
> the mouse ?

The Select method can return object references to atomic graphic objects
like IDLgrPolygon. IDLgrPolygon objects can contain lists of independent
and/or "meshed" polygons. If any one of the polygons contained in an
IDLgrPolygon object is selected, Select returns the object reference for
that IDLgrPolygon object.

I think that you want to be able to determine which polygon within an
IDLgrPolygon object is selected?

After the call to Select, use the PickData method to get the location of the
selection point in model coordinates. You can then compare this point
against all of your polygons in that object to see which polygon contains
that point. Right now, there's no way for IDL to tell you directly.

> I found the 'SegmentLayout.pro' wich does something like this. But if I
> understood the program right it generates an own model for every segment
> and I don't want to generate 100000s of models (one for every polygon of
> the surface).

You don't need a model for each polygon. I think that there are two
reasonable choices:

1) Make an IDLgrPolygon object for each polygon (or segment, if I understand
your terminology). This makes selection easy, since Select will give you an
object that contains only one polygon (segment).

2) Put multiple polygons in IDLgrPolygon objects and use Select, followed by
PickData to determine the selected polygon (segment).

The first method is the easiest, but might take up a lot of space if there
are lot of segments. IDLgrPolygons aren't that expensive, so there would
have to be a LOT of them to make this method unreasonable.

If your "segments" form a mesh and you want to display them with smooth
shading so that shared vertices use averaged normals, you're forced to put
all the segments in a single IDLgrPolygon object. You could still make
another segment-per-object representation for selection use only if you
don't mind the duplication (see the SHARE_DATA property for some help in
this area).

> XObjView has a nice function (Select) that shows the type of a Model if
> klicked with the mouse. Perhaps this could be enhanced to return the
> koordinates (or better, their indexes) of a polygon of a polygon-model
> but unfortunately I couldn't find the code in xobjview.pro :(
>
> At last I want to view the model, select a polygon by mouse which won't
> be shown till it's selected again.
>
> ideas ?
>
> Thanks in advance,
> Tom
Re: Bug in IDLgrPolygon ? [message #33238 is a reply to message #33205] Sun, 15 December 2002 21:28 Go to previous message
Thomas Gutzler is currently offline  Thomas Gutzler
Messages: 44
Registered: November 2002
Member
Thomas Gutzler wrote:
>
> Karl Schultz wrote:
>>
>> If it were me, I'd think about just copying the disabled polygon out to
>> another data structure, along with its starting index. Then, I zap the poly
>> in the original list to zero. I copy the polygon back to the same place to
>> reenable it.
>
> I'm going to do this.

This leads me directly to my next question.
Is it possible to select a single polygon of a IDLgrPolygon-Model with
the mouse ?
I found the 'SegmentLayout.pro' wich does something like this. But if I
understood the program right it generates an own model for every segment
and I don't want to generate 100000s of models (one for every polygon of
the surface).
XObjView has a nice function (Select) that shows the type of a Model if
klicked with the mouse. Perhaps this could be enhanced to return the
koordinates (or better, their indexes) of a polygon of a polygon-model
but unfortunately I couldn't find the code in xobjview.pro :(

At last I want to view the model, select a polygon by mouse which won't
be shown till it's selected again.

ideas ?

Thanks in advance,
Tom
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Proper use of assoc
Next Topic: Re: RANDOM question

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

Current Time: Wed Oct 08 13:18:39 PDT 2025

Total time taken to generate the page: 0.00435 seconds