3D Objects [message #65249] |
Wed, 18 February 2009 09:10  |
JayDog
Messages: 3 Registered: February 2009
|
Junior Member |
|
|
Hi,
I'm trying to represent my 3D data and I guess using some form of
object graphics would be appropriate. I got Ronn Kling's book on this,
but the examples are really of 2D data represented in 3D (such that
the image intensity values might represent heights say). In my case I
have a form of ellipsoid mesh with arrays of points in the x, y, z
directions and would like to construct a surface upon this mesh of
points. Would anyone know of a way to do this, or other resource I
might check out?
Thanks,
Jason.
|
|
|
Re: 3D Objects [message #65954 is a reply to message #65249] |
Mon, 30 March 2009 12:03   |
rtowler
Messages: 28 Registered: June 2006
|
Junior Member |
|
|
On Mar 30, 7:52 am, JayDog wrote:
> Cheers Rick,
> What I actually have is a set of 2D points (x,y) which define an
> ellipse, then stacking many ellipses of varying size in the z-
> direction gives me what appears to be a 3D structure outlining a type
> of ellipsoid. What I would like to do is fill-in the structure so that
> I can make it a surface which I can then perform different operations
> on, such as taking measurements of widths etc. or doing some form of
> illumination with objects light source or other.
Flashback... I used to do this with fish. You have a couple of
options. The easiest is to use MESH_OBJ to construct your stacked
ellipsoid object by extruding your x,y ellipsoids in z and them
assembling your individual IDLgrPolygons. If your ellipsoid vertices
are regular(ish) and share the same number of verts between them you
can mesh the entire set. (you can of course mesh the object if the
number of vertices differ between ellipsoids but this is more
difficult.)
Attached is an excerpt from my meshing code. It generates the vertex
and polygon connectivity array that you can then pass to
IDLgrPolygon. It is simple, but it works. If you're going to use the
MESH_VOLUME or MESH_SURFACEAREA functions you will want to verify that
the polygons are wound correctly (I believe they are, but have not
verified this).
-Rick
xyz = struct containing arrays of X,Y, and Z vertex data in the form
[nEllipsoids, mVertsPerEllipsoid]
numcyl = the number of ellipsoids in your vertex array (same as
nEllipsoids)
nRollPts = the number of x,y vertices in your ellipsoid (same as
mVertsPerEllipsoid).
; Create the vertices and mesh connectivity arrays
vertices = FLTARR(3,nRollPts * numcyl, /nozero)
polygons =LONARR(5 * nRollPts * (numcyl-1), /nozero)
for icyl=0, numcyl-1 do begin
vertices[0,icyl * nRollPts:(icyl+1) * nRollPts-1]= xyz.z
[icyl,*] / 2.
vertices[1,icyl * nRollPts:(icyl+1) * nRollPts-1]= xyz.y
[icyl,*]
vertices[2,icyl * nRollPts:(icyl+1) * nRollPts-1]= xyz.x
[icyl,*]
if (icyl lt (numcyl-1)) then begin
roll_ids = LINDGEN(nRollPts)
conn_off = nRollPts * icyl * 5
count_ids = (roll_ids * 5) + conn_off
cyl0_off = nRollPts * icyl
cyl1_off = nRollPts * (icyl+1)
polygons[count_ids] = 4
polygons[count_ids+1] = roll_ids + cyl0_off
polygons[count_ids+2] = (roll_ids+1) MOD nRollPts +
cyl0_off
polygons[count_ids+3] = (roll_ids+1) MOD nRollPts +
cyl1_off
polygons[count_ids+4] = roll_ids + cyl1_off
endif
endfor
|
|
|
|
Re: 3D Objects [message #66166 is a reply to message #65954] |
Wed, 15 April 2009 03:36  |
JayDog
Messages: 3 Registered: February 2009
|
Junior Member |
|
|
Thanks for your help guys. I might be able to work something out -
turns out it's trickier than I first explained since each ellipse
slice (the 2D ellipses in x,y) can be tilted with regard to the rest
so stacking in the z-dir isn't as straightforward.
|
|
|