Check if vertex is inside any triangle of a mesh

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Check if vertex is inside any triangle of a mesh

Juan Jose Casafranca
I am trying to find the triangle of a SurfaceMesh in which a triangle lays. For
that, I am using a CGAL::SurfaceMesh<K::Point_3> mesh and the
Polygon_mesh_processing package.

I compute a Face_location using the Polygon_mesh_processing::locate() method,
but for points outside the SurfaceMesh, I always get a valid Face_location and
if I ask Polygon_mesh_processing::is_in_face(), it always return true.
PMP::is_on_mesh_border() returns true for those points, but this is not
exclusive. I need to Face_location result anyway because I need to barycentric
coordinates of the points inside the SurfaceMesh.

So is there anyway to actually check if the point is inside the surface or
not?
Thanks



--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: Check if vertex is inside any triangle of a mesh

Sebastien Loriot (GeometryFactory)
I wonder if what you are looking for is Side_of_triangle_mesh?
https://doc.cgal.org/latest/Polygon_mesh_processing/classCGAL_1_1Side__of__triangle__mesh.html

locate is used to locate a point on a surface.

Sebastien.

On 4/3/20 6:07 PM, [hidden email] wrote:

> I am trying to find the triangle of a SurfaceMesh in which a triangle lays. For
> that, I am using a CGAL::SurfaceMesh<K::Point_3> mesh and the
> Polygon_mesh_processing package.
>
> I compute a Face_location using the Polygon_mesh_processing::locate() method,
> but for points outside the SurfaceMesh, I always get a valid Face_location and
> if I ask Polygon_mesh_processing::is_in_face(), it always return true.
> PMP::is_on_mesh_border() returns true for those points, but this is not
> exclusive. I need to Face_location result anyway because I need to barycentric
> coordinates of the points inside the SurfaceMesh.
>
> So is there anyway to actually check if the point is inside the surface or
> not?
> Thanks
>
>
>

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: Check if vertex is inside any triangle of a mesh

Juan Jose Casafranca
I am not sure how this works. When it says that a precondition is CGAL::is_closed(tmesh), does it means that the mesh must enclose a volume? In my case, the mesh is a single plane, so I guess it wouldnt meet this precondition. What I want to do is to find the barycentric coordinates of a point in 2D wrt a the triangle in which it lays, if any, of a mesh in 2D. The mesh and the point are actually 3D, but the PMP locate method apparently projects them to 2D by removing the z coordinate, which in my case is 0 anyway.  

El lun., 6 abr. 2020 a las 8:44, Sebastien Loriot (GeometryFactory) (<[hidden email]>) escribió:
I wonder if what you are looking for is Side_of_triangle_mesh?
https://doc.cgal.org/latest/Polygon_mesh_processing/classCGAL_1_1Side__of__triangle__mesh.html

locate is used to locate a point on a surface.

Sebastien.

On 4/3/20 6:07 PM, [hidden email] wrote:
> I am trying to find the triangle of a SurfaceMesh in which a triangle lays. For
> that, I am using a CGAL::SurfaceMesh<K::Point_3> mesh and the
> Polygon_mesh_processing package.
>
> I compute a Face_location using the Polygon_mesh_processing::locate() method,
> but for points outside the SurfaceMesh, I always get a valid Face_location and
> if I ask Polygon_mesh_processing::is_in_face(), it always return true.
> PMP::is_on_mesh_border() returns true for those points, but this is not
> exclusive. I need to Face_location result anyway because I need to barycentric
> coordinates of the points inside the SurfaceMesh.
>
> So is there anyway to actually check if the point is inside the surface or
> not?
> Thanks
>
>
>

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss