CGAL 6.1 - Sphere Packing
Loading...
Searching...
No Matches

Functions

template<typename TriangleMesh , typename OutputIterator , typename NamedParameters = parameters::Default_named_parameters>
OutputIterator CGAL::pack_spheres (const TriangleMesh &tm, OutputIterator out, const NamedParameters &np=parameters::default_values())
 Packs spheres into a closed mesh.
 

Function Documentation

◆ pack_spheres()

template<typename TriangleMesh , typename OutputIterator , typename NamedParameters = parameters::Default_named_parameters>
OutputIterator CGAL::pack_spheres ( const TriangleMesh &  tm,
OutputIterator  out,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/Sphere_packing.h>

Packs spheres into a closed mesh.

Computes a packing of spheres into a closed and self-intersection free triangle mesh. The possible range of radii of spheres can be chosen; large spheres are preferred during the packing. The optimal solution is not guaranteed as it has NP-hard complexity.

Note that the precision of the method is limited by the precision of the GPU, i.e., non-exact arithmetic with 32-bit floating point numbers is used.

Template Parameters
TriangleMesha model of HalfedgeListGraph, FaceListGraph, and MutableFaceGraph
OutputIteratormust be an output iterator accepting variables of type geom_traits::Sphere_3.
NamedParametersa sequence of Named Parameters
Parameters
tmthe input tm to pack spheres into. It has to be a closed triangle mesh and may not have self-intersections.
outoutput iterator into which the packed spheres are written.
npan optional sequence of Named Parameters among the ones listed below
Optional Named Parameters
  • target number of spheres to be packed into tm.
  • Type: unsigned int
  • Default: 10,000

  • minimum radius of packed spheres
  • Type: float
  • Default: 0

  • maximum radius of packed spheres
  • Type: float
  • Default: std::numeric_limits<float>::max()

  • a functor that is called before each split to decide whether the packing should continue.
  • Type: an instance of std::function<bool(unsigned int iteration, unsigned int performed_splits, unsigned int number_of_spheres, float sphere_volume, float object_volume, const float4 *)>.
  • Default: No functor is used. Packing continues until number_of_target_spheres or maximum_splits are met.
  • Extra: float4 is a CUDA data type and has 4 members: float x, y, z, w.

  • number of grid cells for the longest side of the bounding box. Grid cells are cubes.
  • Type: unsigned int
  • Default: 4

  • how often the grid is subdivided at most.
  • Type: unsigned int
  • Default: 6

  • iterations of placing spheres between splitting the grid into a higher resolution.
  • Type: unsigned int
  • Default: 30

  • a property map associating points to the vertices of tm
  • Type: a class model of ReadablePropertyMap with boost::graph_traits<TriangleMesh>::vertex_descriptor as key type and Point_3 as value type
  • Default: boost::get(CGAL::vertex_point, tm)
  • Extra: If this parameter is omitted, an internal property map for CGAL::vertex_point_t must be available in TriangleMesh.

  • an instance of a geometric traits class
  • Type: a class model of Kernel
  • Default: a CGAL Kernel deduced from the point type of TriangleMesh, using CGAL::Kernel_traits
  • Extra: The geometric traits class must be compatible with the vertex point type.

Returns
out, the output iterator