Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] What does negative CGAL::Polygon_mesh_processing::volume mean?

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] What does negative CGAL::Polygon_mesh_processing::volume mean?


Chronological Thread 
  • From: Pádraig Ó Conbhuí <>
  • To:
  • Subject: Re: [cgal-discuss] What does negative CGAL::Polygon_mesh_processing::volume mean?
  • Date: Wed, 27 Sep 2017 13:54:18 +0100
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=Pass ; spf=None
  • Ironport-phdr: 9a23:a/XwuxfGUSXQ8UcB9FULDp4/lGMj4u6mDksu8pMizoh2WeGdxc67Yx7h7PlgxGXEQZ/co6odzbGJ4+a9ASQp2tWojjMrSNR0TRgLiMEbzUQLIfWuLgnFFsPsdDEwB89YVVVorDmROElRH9viNRWJ+iXhpW1aJxPkKAAgJvjpApWAyIOsxuWq8tvSZR9JjXyze/RpPRCupELQsMcRxoBtI6J0xhrSqWZTYLdqwjZjKluX2hr9/cyt54VL8iJKuvtn+dQTf7/9evEAxLBCBTUpe9t9z8rtvxneyEPb/nwXVWMckgdJKwfA5RD+GJz2t32p5aJGxCCGMJiuHvgPUjO44vIzRQ==

The sign of the volume depends on the orientation of the triangles.

If you take the order the triangle vertices are stored in, say v1 v2 v3, if you "connect the dots" while looking at them from the outside of the material, it will always be either clockwise or anti-clockwise.

If you swap two vertices in every triangle, say v1 v3 v2, the mesh will be the same, but the volume will change sign.

If you don't really care about that, you can safely ignore the sign of the volume.

On Wed, Sep 27, 2017 at 10:51 AM, Iasonm <> wrote:
I found the following:
volume(const TriangleMesh& tmesh, const CGAL_PMP_NP_CLASS& np)
{
   ......

  typename GetGeomTraits<TriangleMesh, CGAL_PMP_NP_CLASS>::type::FT volume =
0.;
  typename CGAL::Kernel_traits<typename property_map_value<TriangleMesh,
    CGAL::vertex_point_t>::type>::Kernel::Compute_volume_3 cv3;

*  BOOST_FOREACH(face_descriptor f, faces(tmesh))
  {
    volume += cv3(origin,
      get(vpm, target(halfedge(f, tmesh), tmesh)),
      get(vpm, target(next(halfedge(f, tmesh), tmesh), tmesh)),
      get(vpm, target(prev(halfedge(f, tmesh), tmesh), tmesh)));
    exact(volume);
  }
  return volume;*
}

and about cv3:

class Compute_volume_3
  {
    ....
    result_type
 *   operator()(const Point_3& p0, const Point_3& p1,
               const Point_3& p2, const Point_3& p3) const
    {
      return determinant<FT>(p1.x()-p0.x(), p1.y()-p0.y(), p1.z()-p0.z(),
                             p2.x()-p0.x(), p2.y()-p0.y(), p2.z()-p0.z(),
                             p3.x()-p0.x(), p3.y()-p0.y(), p3.z()-p0.z())/6;
    }
*
    ...
};

The above determinant compute the volume of a tetrahedron with vertices
p0,p1,p2,p3.
So if I get it right the volume of the mesh is the sum of all its pyramids
formed by every face and the origin.
I don't understand what the negative sign of the above determinant means
geometrically though..



--
Sent from: http://cgal-discuss.949826.n4.nabble.com/

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






Archive powered by MHonArc 2.6.18.

Top of Page