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

Home » Public Forums » archive » Re: 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 #76653 is a reply to message #76510] Sat, 18 June 2011 11:34 Go to previous message
Junum is currently offline  Junum
Messages: 13
Registered: May 2010
Junior Member
On Jun 17, 2:47 pm, Karl <karl.w.schu...@gmail.com> wrote:
> On Jun 17, 9:45 am, Junum <junshi...@gmail.com> wrote:
>
>> On Jun 17, 6:43 am, Wox <s...@nomail.com> wrote:
>
>>> On Fri, 17 Jun 2011 11:21:15 +0200, Wox <s...@nomail.com> wrote:
>>>> ; Close tetrahedron
>>>> v=v[*,[0,1,2,3,1,2,3]]
>
>>> Sorry, this part should be deleted. I was checking whether it could
>>> have something to do with "closing the tetrahedron" (rotate the object
>>> and notice that the bottom triangle is not filled).
>
>> Thanks Wox.
>> It seems that IDLanROI works for 2D polygons only.
>> In case of 3D object, region of interest (i.e., object) is not defined
>> properly.
>> I think points should be in a same plane.
>
> I'm not sure you'd want to draw a tet with an ROI.  A tet can be drawn
> with a grPolygon.  You would supply the 4 verts and then the
> connectivity list which would be something like:
>
> [3,0,1,2, 3,1,0,3, 3,2,1,3, 3,0,2,3]
>
> The order is important to make all the faces facing "out".  If any of
> these are wrong, reverse the order.  E.g., if the last tri is facing
> the wrong way, change 3,0,2,3 to 3,3,2,0.
>
> One way to determine if a point is in the tet, or any closed object
> created out of triangles, would be to define a line between the point
> in question and any arbitrary point outside of the bounding box of the
> object.  For each triangle in the object, determine if this line
> intersects the triangle.  If the number of total intersections is odd,
> then the point is in the object.  Note that this works for non-convex
> objects as well, as long as they are closed.  You'll have to be
> careful about intersecting the object on a boundary between two or
> more triangles.
>
> There may be a better way, but this is the basic brute-force approach.
>
> If your object is just a tet, you can leverage that for a simpler
> solution.  If the point is on the same inward-facing side of EVERY tri
> in the tet, then it is in the tet.  Put another way, if the point is
> in the same inward-facing half-space of each triangle, it is inside.
> Think of the interior of the tet as the intersection of these half-
> spaces.  I think thathttp://steve.hollasch.net/cgindex/geometry/ptintet.html
> describes the same idea mathematically.
>
> Karl

Thanks Karl.
I wanted know whether IDLanROI::ContainsPoints can be applied to 3D
case.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Object graphics and runtime mode
Next Topic: The good way to use cdfid's

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

Current Time: Wed Oct 08 19:33:19 PDT 2025

Total time taken to generate the page: 0.00407 seconds