Python CGAL 立方体的面积和体积不正确

Python CGAL cube has incorrect area and volume

有一个示例显示了创建表示单位立方体的 CGAL Polyhedron_3 对象的方法(https://github.com/cgal/cgal-swig-bindings/wiki/BindingsExamples#polyhedron_prog_cubepy) based on a C++ example from the user manual (https://doc.cgal.org/latest/Polyhedron/index.html#title9,第 3.7 节):

from CGAL.CGAL_Polyhedron_3 import Polyhedron_3
from CGAL.CGAL_Polyhedron_3 import Polyhedron_3_Halfedge_handle
from CGAL.CGAL_Kernel import Point_3

def make_cube_3(P):
  # appends a cube of size [0,1]^3 to the polyhedron P.
  assert P.is_valid()
  h = P.make_tetrahedron(Point_3( 1, 0, 0),Point_3( 0, 0, 1),Point_3( 0, 0, 0),Point_3( 0, 1, 0))
  g = h.next().opposite().next()
  P.split_edge( h.next() )
  P.split_edge( g.next() )
  P.split_edge( g )
  h.next().vertex().set_point( Point_3( 1, 0, 1) )
  g.next().vertex().set_point( Point_3( 0, 1, 1) )
  g.opposite().vertex().set_point( Point_3( 1, 1, 0) )
  f = P.split_facet(g.next(),g.next().next().next())
  e = P.split_edge(f)
  e.vertex().set_point( Point_3( 1, 1, 1) )
  P.split_facet( e, f.next().next())
  assert P.is_valid()
  return h

P = Polyhedron_3()
h = make_cube_3(P)
assert not P.is_tetrahedron(h)

但是,当我尝试计算立方体的面积和体积时,结果是正确值的一半:

from CGAL.CGAL_Polygon_mesh_processing import area, volume
print('Area:', area(P))
print('Volume:', volume(P))
>>> Area: 3.0
>>> Volume: 0.5

请说明原因。

这些函数需要对网格进行三角剖分。将代码更新为:

from CGAL.CGAL_Polygon_mesh_processing import area, volume, triangulate_faces
triangulate_faces(P)

给出了预期的结果。