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

Home » Public Forums » archive » 3d polygon mesh for 3 indpendent variables, x,y,z
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
3d polygon mesh for 3 indpendent variables, x,y,z [message #90631] Thu, 19 March 2015 03:23 Go to next message
Guneshwar Thangjam is currently offline  Guneshwar Thangjam
Messages: 9
Registered: March 2015
Junior Member
Hi,
I am a new in IDL. And I need some help.
I have 3 independent variables. I plotted 3d polygon in MATLAB using 'convhull' and then 'trimesh' precedures. But I have to do in IDL. I already plotted a 3d scatter plot using 'plot3d' and then I go for 'qhull' for the delaunay triangulation. However, I am not able to plot the (bound) polygon mesh in my 3d plot. Or, is this triangulation not the way I should look for?
If anyone can help how to plot such a 3d-polygon, that will be a nice pleasure.

---------
;3 indpendent variables
x=randomu(seed,100)
y=randomu(seed,100)
z=randomu(seed,100)
;3d scatter plot
p = PLOT3D(x, y, z, 'o' ,/SYM_FILLED,AXIS_STYLE=2,/PERSPECTIVE)
;construct 3d triangulation
qhull,x,y,z,triangle,/delaunay,VDIAGRAM=vdiagram,$ VVERTICES=vvertices,connectivity=connectivity
;how to plot the polygon using the returned variables from qhull procedure
?
----------

Thanks in advance,
Guni
Re: 3d polygon mesh for 3 indpendent variables, x,y,z [message #90636 is a reply to message #90631] Thu, 19 March 2015 11:35 Go to previous messageGo to next message
Jeremy Bailin is currently offline  Jeremy Bailin
Messages: 618
Registered: April 2008
Senior Member
On Thursday, March 19, 2015 at 6:23:54 AM UTC-4, guni wrote:
> Hi,
> I am a new in IDL. And I need some help.
> I have 3 independent variables. I plotted 3d polygon in MATLAB using 'convhull' and then 'trimesh' precedures. But I have to do in IDL. I already plotted a 3d scatter plot using 'plot3d' and then I go for 'qhull' for the delaunay triangulation. However, I am not able to plot the (bound) polygon mesh in my 3d plot. Or, is this triangulation not the way I should look for?
> If anyone can help how to plot such a 3d-polygon, that will be a nice pleasure.
>
> ---------
> ;3 indpendent variables
> x=randomu(seed,100)
> y=randomu(seed,100)
> z=randomu(seed,100)
> ;3d scatter plot
> p = PLOT3D(x, y, z, 'o' ,/SYM_FILLED,AXIS_STYLE=2,/PERSPECTIVE)
> ;construct 3d triangulation
> qhull,x,y,z,triangle,/delaunay,VDIAGRAM=vdiagram,$ VVERTICES=vvertices,connectivity=connectivity
> ;how to plot the polygon using the returned variables from qhull procedure
> ?
> ----------
>
> Thanks in advance,
> Guni

Maybe you want to use SURFACE instead?

-Jeremy.
Re: 3d polygon mesh for 3 indpendent variables, x,y,z [message #90667 is a reply to message #90636] Sun, 22 March 2015 04:12 Go to previous messageGo to next message
Guneshwar Thangjam is currently offline  Guneshwar Thangjam
Messages: 9
Registered: March 2015
Junior Member
On Thursday, 19 March 2015 19:35:24 UTC+1, Jeremy Bailin wrote:
> On Thursday, March 19, 2015 at 6:23:54 AM UTC-4, guni wrote:
>> Hi,
>> I am a new in IDL. And I need some help.
>> I have 3 independent variables. I plotted 3d polygon in MATLAB using 'convhull' and then 'trimesh' precedures. But I have to do in IDL. I already plotted a 3d scatter plot using 'plot3d' and then I go for 'qhull' for the delaunay triangulation. However, I am not able to plot the (bound) polygon mesh in my 3d plot. Or, is this triangulation not the way I should look for?
>> If anyone can help how to plot such a 3d-polygon, that will be a nice pleasure.
>>
>> ---------
>> ;3 indpendent variables
>> x=randomu(seed,100)
>> y=randomu(seed,100)
>> z=randomu(seed,100)
>> ;3d scatter plot
>> p = PLOT3D(x, y, z, 'o' ,/SYM_FILLED,AXIS_STYLE=2,/PERSPECTIVE)
>> ;construct 3d triangulation
>> qhull,x,y,z,triangle,/delaunay,VDIAGRAM=vdiagram,$ VVERTICES=vvertices,connectivity=connectivity
>> ;how to plot the polygon using the returned variables from qhull procedure
>> ?
>> ----------
>>
>> Thanks in advance,
>> Guni
>
> Maybe you want to use SURFACE instead?
>
> -Jeremy.

Hi Jeremy,
Thanks for the suggestion, but it doesnot create the polygon.
I tried using 'idlgrpolygon', and it draws the polygon, but still I have problems. Anyway, thanks.
Guni
Re: 3d polygon mesh for 3 indpendent variables, x,y,z [message #90671 is a reply to message #90631] Mon, 23 March 2015 13:04 Go to previous messageGo to next message
Dick Jackson is currently offline  Dick Jackson
Messages: 347
Registered: August 1998
Senior Member
On Thursday, 19 March 2015 03:23:54 UTC-7, guni wrote:
> Hi,
> I am a new in IDL. And I need some help.
> I have 3 independent variables. I plotted 3d polygon in MATLAB using 'convhull' and then 'trimesh' precedures. But I have to do in IDL. I already plotted a 3d scatter plot using 'plot3d' and then I go for 'qhull' for the delaunay triangulation. However, I am not able to plot the (bound) polygon mesh in my 3d plot. Or, is this triangulation not the way I should look for?
> If anyone can help how to plot such a 3d-polygon, that will be a nice pleasure.

Hi Guni,

This sounded familiar to me, and I see I wrote something like this a few years ago, before Function Graphics (search the archive for QHullTetra).

I'm not certain exactly what you are looking for as a final result. Here is how you can add the convex hull and the Delaunay triangulation (actually "tetrahedralization" in 3-D), which is a little trickier:

PRO QHullTetra2

;3 indpendent variables
nPts = 10
x=randomu(seed,nPts)
y=randomu(seed,nPts)
z=randomu(seed,nPts)
xyz = [Transpose(x), Transpose(y), Transpose(z)]

;3d scatter plot
pch = PLOT3D(x, y, z, 'o' ,/SYM_FILLED,AXIS_STYLE=2,/PERSPECTIVE, $
Aspect_Ratio=1, Aspect_Z=1, WINDOW_TITLE='Convex Hull')

; Convex Hull:
qhull,x,y,z,triVerts
convexHull = Polygon(x, y, z, /Data, $
Connectivity=[Replicate(3, [1, N_Elements(triVerts)/3]), triVerts], $
Target=pch, Transparency=80)

;3d scatter plot
pdt = PLOT3D(x, y, z, 'o' ,/SYM_FILLED,AXIS_STYLE=2,/PERSPECTIVE, $
Aspect_Ratio=1, Aspect_Z=1, WINDOW_TITLE='Delaunay Tetrahedralization')

; Delaunay tetrahedralization:
qhull,xyz,tetraVerts,/delaunay
nTetra = N_Elements(tetraVerts)/4
; Make four triangles from each tetrahedron
tetraConn = tetraVerts[[0, 1, 2, 0, 2, 3, 0, 3, 1, 1, 3, 2], *]
tetraConn = [Replicate(3, [1, nTetra*4]), Reform(tetraConn, [3, nTetra*4])]
delaunayTri = Polygon(x, y, z, /Data, $
Fill_Background=0, Linestyle=0, $
Connectivity=tetraConn, Target=pdt)

END

The Voronoi diagram is much trickier (see QHULL docs for VVERTICES in particular), and I don't have a final answer for that. You would start with this call to get all the data:
qhull,x,y,z,triangle,/delaunay,VDIAGRAM=vdiagram,$
VVERTICES=vvertices,connectivity=connectivity

Then much work remains!

Hope this is helpful.
Re: 3d polygon mesh for 3 indpendent variables, x,y,z [message #90675 is a reply to message #90631] Tue, 24 March 2015 15:15 Go to previous message
Guneshwar Thangjam is currently offline  Guneshwar Thangjam
Messages: 9
Registered: March 2015
Junior Member
On Thursday, 19 March 2015 11:23:54 UTC+1, guni wrote:
> Hi,
> I am a new in IDL. And I need some help.
> I have 3 independent variables. I plotted 3d polygon in MATLAB using 'convhull' and then 'trimesh' precedures. But I have to do in IDL. I already plotted a 3d scatter plot using 'plot3d' and then I go for 'qhull' for the delaunay triangulation. However, I am not able to plot the (bound) polygon mesh in my 3d plot. Or, is this triangulation not the way I should look for?
> If anyone can help how to plot such a 3d-polygon, that will be a nice pleasure.
>
> ---------
> ;3 indpendent variables
> x=randomu(seed,100)
> y=randomu(seed,100)
> z=randomu(seed,100)
> ;3d scatter plot
> p = PLOT3D(x, y, z, 'o' ,/SYM_FILLED,AXIS_STYLE=2,/PERSPECTIVE)
> ;construct 3d triangulation
> qhull,x,y,z,triangle,/delaunay,VDIAGRAM=vdiagram,$ VVERTICES=vvertices,connectivity=connectivity
> ;how to plot the polygon using the returned variables from qhull procedure
> ?
> ----------
>
> Thanks in advance,
> Guni

Dear Dick,
Thank you so much. It really helps me a lot.
Guni
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Help with data gaps and interpolation
Next Topic: Widget_windows, scrolling and refreshing

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

Current Time: Wed Oct 08 07:17:39 PDT 2025

Total time taken to generate the page: 0.00450 seconds