In-Polyhedron Test

August 14, 2009 by Luigi Giaccari 
Filed under: CAD, Computational Geometry, Graphics 
2 Comments
VN:F [1.8.1_1037]
Rating: 0 (from 0 votes)
VN:F [1.8.1_1037]
Rating: 0.0/10 (0 votes cast)

INPOlyedron2

InPolyedron detects points inside a manifold closed surface (even non convex ones). The normal orientation is assumed to be outwards. Warning there is no check for closed surface or normal orientation, open surfaces will give nonsense results.

In the limit of numerical accuracy, points lying on the surface will be considered in.

Usage

Input:

  • p:  points of the surface npx3 array
  • t: triangles indexes, first points flagged as one, ntx3 array
  • tnorm:  outward normals of traingles, ntx3 array
  • qp:  points to be queried, nqx3 array

Output:

  • in: nqx1 logical vector, true for in, false for out

Author: Giaccari Luigi
Created: 15/05/2009
e-mail: giaccariluigi@msn.com

Download Now

VN:F [1.8.1_1037]
Rating: 0.0/10 (0 votes cast)
VN:F [1.8.1_1037]
Rating: 0 (from 0 votes)

Popularity: 69% [?]

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay
  • Live
  • PDF
  • Technorati
  • Twitter
  • Yahoo! Bookmarks
  • Add to favorites
  • email
  • MySpace
  • RSS

Related Posts

Comments

2 Comments on In-Polyhedron Test

  1. tolga on Fri, 16th Oct 2009 19:23
  2. hello.. this looks like a quite useful code…

    but there is a problem i cannot figure out.

    i have the parameters for a surface : triangles, points and normals.

    my problem starts here: the normals are not normals for triangles but they are normals at the points.

    however your function requires the normals for triangles. Is there a way to estimate the normals for triangles from the normals of the points, so that I can use your function?

    i will be so glad to hear your any possible solution for this.

    thank you in advance.

    UN:F [1.8.1_1037]
    Rating: 0.0/5 (0 votes cast)
    UN:F [1.8.1_1037]
    Rating: 0 (from 0 votes)

    [Reply]


    Luigi Giaccari Reply:

    To get the normals of triangles you don’t need to have normals in points.

    If you have Matlab R2009a you can use the computational geometry toolbox to get a conform outward normal for each triangle. There is a built in function.

    To get your own code you need to compute the nomral for one triangle (use cross product) and then perform a propagation on the neighborhood triangles keeping the orientation of normals. It is not the easiest thing but not even the most diffucult, try it and let me know.

    Luigi

    UA:F [1.8.1_1037]
    Rating: 0.0/5 (0 votes cast)
    UA:F [1.8.1_1037]
    Rating: 0 (from 0 votes)

    [Reply]

Tell me what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!


Include MATLAB code in your comment by doing the following:

<pre lang="MATLAB">

%insert code here

</pre>