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

Home » Public Forums » archive » Re: Object Graphics: multiple Views of same model
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: Object Graphics: multiple Views of same model [message #28546 is a reply to message #28544] Tue, 18 December 2001 15:26 Go to previous messageGo to previous message
Martin Downing is currently offline  Martin Downing
Messages: 136
Registered: September 1998
Senior Member
"David Fanning" <david@dfanning.com> wrote in message
news:MPG.16891b716012fe429897b1@news.frii.com...
> Martin Downing (martin.downing@ntlworld.com) writes:
>
>> I tried
>>
>> obj2 = OBJ_NEW('IDLgrPolygon', SHARE_DATA = obj1, col=[255,0,0])
>>
>>
>> but the connectivity and normals were junk, so I have just repeated
>> generation of the object.
>
> Really!? Do you have an example of this you
> could send me? I'm working on some, uh, "notes"
> on this topic and this would be interesting.
>
> Cheers,
Hi David,

Here is some code you may find useful. Im sure Im just not instantiating the
new object correctly when I use
share_data - still I'm sure that will give useful tutorial data !

Martin
================================
pro test_object_share_data
; Tests the fact that I do not know how to correctly use the
; object Share_Data creation method
; MRD 18/12/2001
obj = OG_Extrude( poly = circle3d(rad = .2,n=4), axis = [0,0,1], col =
[255,0,0])
obj2 = OBJ_NEW('IDLgrPolygon', SHARE_DATA = obj, col=[255,0,0])
xobjview, obj2
xobjview, obj
end

function Circle3d, rad=r, n=n
; Creates a disk in the z=0 plane, centre (0,0,0) as a 3d point array
; MRD 18/12/2001
pa = fltarr(3,n)
theta = indgen(n)*!dpi*2/n
pa[0,*] = r*cos(theta)
pa[1,*] = r*sin(theta)
pa[2,*] = 0
return, pa
end

function OG_Extrude, polygon=poly, axis=axis, color=color, OPEN=OPEN
; Extrudes the given planar polygon along axis to form a closed solid
; (if OPEN keyword set, then the ends are not closed)
; returned as a IDLgrPolygon object
; MRD 18/12/2001
pa1 = poly
pa1[0,*] = pa1[0,*] + axis[0]
pa1[1,*] = pa1[1,*] + axis[1]
pa1[2,*] = pa1[2,*] + axis[2]
pa1 = [[poly],[ pa1]]
n = n_elements(poly[0,*])
a = indgen(n)
con = lonarr(2*(n+1)+n*5+1)
con[0:n] = [n,a]
aa = [n,2*n-a-1]
con[n+1:2*n+1] = aa
i0 =2*(n+1)
for i = 0,n-1 do begin
con[ i0 + i*5:i0+i*5+4]= [4,i, (i+1) mod n,((i+1) mod n)+n, n+i]
endfor
con[2*(n+1)+n*5] = -1
if keyword_set(OPEN) then con = con[2*n+2:*]

oPoly = OBJ_NEW("IDLgrPolygon", data = pa1, poly = con, color = color)
return, oPoly
end

============================================================ ====
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: pixmap drawables in Object Graphics?
Next Topic: Re: Slider value triggers event only when released

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

Current Time: Wed Oct 08 20:11:15 PDT 2025

Total time taken to generate the page: 0.01215 seconds