Re: ellipsoid 3D [message #49544 is a reply to message #49542] |
Thu, 03 August 2006 12:58   |
adisn123
Messages: 44 Registered: July 2006
|
Member |
|
|
Could you answer
how the following arrow expression works in IDL?
->
Rick Towler wrote:
> You didn't say if you wanted to do this in Direct Graphics (DG) or
> Object Graphics (OG). You also don't give any details so I can't
> suggest one over the other. Given that:
>
> For either OG or DG you need to create a set of points that define the
> ellipsoid (the vertices) and an array that specifies how the points are
> connected (the polygon connectivity array). Then you pass these data to
> the appropriate function to "plot" your 3d ellipsoid.
>
> You could do this the hard way, by creating a function that would
> calculate the vertices and create the connectivity array give your major
> and minor axes and a position. Or you could do it the easy way :)
>
> IDL has the 'orb' object which creates a 3d sphere. Assuming you want
> to do this using OG, it is a simple as creating the sphere and scaling
> it asymmetrically.
>
> ; create the orb object
> IDL> orb = obj_new('orb', color=[240,0,0], style=1)
>
> ; since it is a subclass of IDLgrModel we can scale it.
> ; stretch the sphere out 2x it's original length along the z axis
> IDL> orb -> scale, 1, 1, 2
>
> ; view the result
> IDL> xobjview, orb
>
>
> If you need to do this in DG, you can still use the orb object:
>
> ; get the vertices, polygon connectivity, and transform matrix
> ; from the orb object. Even though you are looking at an ellipsoid
> ; the verts will still define a sphere. The orb's transform matrix
> ; holds the key to scaling the vertices such that they define an
> ; ellipsoid.
> IDL> orb -> getproperty, data=verts, polygons=polys, transform=xform
>
> ; apply the transform matrix to the spherical verts to make them
> ; ellipsoidal
> IDL> dgVerts = vert_t3d(verts, matrix=xform)
>
> ; display using DG
> IDL> scale3, xrange=[-2,2],yrange=[-2,2],zrange=[-2,2]
> IDL> image=polyshade(dgVerts,polys, /t3d)
> IDL> tv, image
>
> I am aware that this DG code displays a "solid" sphere. I never do 3d
> in DG so this is the best I care to do. Others might offer tips for
> displaying 3d objects in DG if you really want to suffer thru this in DG.
>
> HTH!
>
> -Rick
>
>
> adisn123@yahoo.com wrote:
>> Hi,
>>
>> I'm a begginer in IDL image processing, so if someone lends me some
>> help, that'd be great.
>>
>> I'm trying to make an ellipsoid in 3D.
>>
>> Not solid, but hollow ellipsoidal in 3D.
>>
>> Anybody help?
>>
|
|
|