[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: IDLgrWindow Pickdata on an IDLexObjView Obect.
- Subject: Re: IDLgrWindow Pickdata on an IDLexObjView Obect.
- From: m.hadfield(at)niwa.cri.nz (Mark Hadfield)
- Date: Mon, 11 Jun 2001 21:41:15 +0000 (UTC)
- Mail-From: <email@example.com> from clam.niwa.cri.nz [126.96.36.199]
- Newsgroups: comp.lang.idl-pvwave
- Organization: Mailgate.ORG Server - http://www.Mailgate.ORG
- References: <firstname.lastname@example.org>
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:25305
> Does anyone have any suggestions on how to get the correct 3-D position
> using the Pickdata method for an IDLgrWindow object which is displaying an
> IDLexObjView. Pickdata correctly finds the objects but returns incorrect
> x,y,z values. I am trying to modify xplot3d.pro to return the x,y, and z
> coordinates of a IDLgrPolyline displayed using Orbs for each datapoint.
How are they incorrect?
I've never used an IDLexObjView before but I just coded up a short (and very
crude!) test program and the PickData method seemed to give the right
answers. The test program is below.
One odd thing that I noticed about IDLexObjView is that the Get method has
been overridden (subverted?) so that it returns a reference to the atom it's
displaying. I would expect a view's Get method to return the view's child
model(s). Overriding a superclass's key method like this so it does
something completely different is bad practice IMHO. The preferable way
would have been to add another method, called something like GetAtom. (This
may or may not be relevant to your problem. I wanted to look at the
transformation matrices of the models in the IDLexObjView.To get at them I
had to "Get" the atom then work up through the graphics tree. It turns out
there are 4 models and all have an identity transformation matrix. This
would change if the atom is manipulated by the mouse.)
Perhaps your problem is related to the fact that your 3D objects are
attached to a polyline as symbols?
National Institute for Water and Atmospheric Research
; Create a view object
oview = obj_new('IDLexObjview')
; Create vertex & connectivity data for a sphere of unit radius
n_vertices = 30
mesh_obj, 4, vert, conn, replicate(1, n_vertices+1, n_vertices)
; Scale vertices & create spheroid object
vert[0,*] = 0.5 * vert[0,*]
vert[1,*] = 0.9 * vert[1,*]
oatom = obj_new('IDLgrPolygon', DATA=vert, POLY=conn)
; Add object to view
owin = obj_new('IDLgrWindow', UNITS=0, DIMENSIONS=[500,500], RETAIN=2,
; Pick data
if owin->Pickdata(oview, oatom, [200,200], xyz) then $
print, 'Picked data at', xyz
; Skip remainder of code.
; Check that atoms, [X,Y,Z]RANGE properties are as expected.
oatom->GetProperty, XRANGE=xrange, YRANGE=yrange, ZRANGE=zrange
; Get all of the atom's parent models and print their transformation
while obj_isa(omodel, 'IDLgrModel') do begin
print, omodel, transform
Posted from clam.niwa.cri.nz [188.8.131.52]
via Mailgate.ORG Server - http://www.Mailgate.ORG