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

Home » Public Forums » archive » point inside/outside of 3D object.
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: point inside/outside of 3D object. [message #76626 is a reply to message #76567] Tue, 21 June 2011 02:24 Go to previous messageGo to previous message
Wout De Nolf is currently offline  Wout De Nolf
Messages: 194
Registered: October 2008
Senior Member
On Sat, 18 Jun 2011 11:34:42 -0700 (PDT), Junum <junshikum@gmail.com>
wrote:

> Thanks Karl.
> I wanted know whether IDLanROI::ContainsPoints can be applied to 3D
> case.

I'd guess the answer is no. You should implement this yourself (as
Karl suggested) or you could do something like below. I'm not sure
whether this is the best way, but it seems to work.


; Generate vertices
v=TetrahedronVertices(r=10,phideg=-20)

; Connectivity list: [n,i[0],...,i[n-1],n,j[0],...,j[n-1],...]
; n: number of vertices for each face
; i[0],...,i[n-1]: vertices for face 1, ordered so that the normal
; points outwards (right-hand rule)
; j[0],...,j[n-1]: vertices for face 2, ordered so that the normal
; points outwards (right-hand rule)
conn=[3,0,3,1, 3,0,1,2, 3,0,2,3, 3,1,3,2]

; Remark: if the number of vertices > 4 then you could generate
; the list like this:
;Qhull, v, tr, /delaunay
;conn=tetra_surface(v, tr)

; Point
p=[0,0,0.]

; Volume of the polyhedron
volume=tetra_volume(v,conn)

; Expanded polyhedron (including your point)
; vertices and connectivity list
v2=[[v],[p]]
Qhull, v2, tr, /delaunay
conn2=tetra_surface(v2, tr)

; Volume of the expanded polyhedron
volumeexp=tetra_volume(v2,conn2)

; If the "expanded volume" is larger, the point lies outside
if volumeexp gt volume then print,'Exterior' else print,'Interior'
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: plotting a sub field image..
Next Topic: ENVI: Overlay in 3D SurfaceView

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

Current Time: Fri Oct 10 23:15:42 PDT 2025

Total time taken to generate the page: 2.61062 seconds