CGAL 6.3-dev - Kinetic Space Partition
Loading...
Searching...
No Matches
CGAL::Kinetic_space_partition_3< GeomTraits, IntersectionTraits > Class Template Reference

#include <CGAL/Kinetic_space_partition_3.h>

Definition

template<typename GeomTraits, typename IntersectionTraits = CGAL::Exact_predicates_exact_constructions_kernel>
class CGAL::Kinetic_space_partition_3< GeomTraits, IntersectionTraits >

creates the kinetic partition of the bounding box of the polygons given as input data.

The kinetic partition can either be initialized by using the default constructor Kinetic_space_partition_3(), insert() to provide input data and initialize() to prepare the partition or by using the constructor with input parameters.

Template Parameters
GeomTraitsmust be a model of KineticSpacePartitionTraits_3.
IntersectionTraitsmust be a model of Kernel using exact computations. Defaults to CGAL::Exact_predicates_exact_constructions_kernel.
Examples
Kinetic_space_partition/kinetic_partition.cpp.

Classes

class  Linear_cell_complex_min_items
 this class provides a minimal model of KineticLCCItems. More...

Public Types

enum  Face_support : int {
  ZMIN = -1 , YMIN = -2 , XMAX = -3 , YMAX = -4 ,
  XMIN = -5 , ZMAX = -6 , OCTREE_FACE = -7
}
 identifies the support of a face in the exported linear cell complex, which is either an input polygon, identified by a non-negative number, a side of the bounding box in the rotated coordinate system or a face of the octree used to partition the scene.
using Kernel = GeomTraits
using Intersection_kernel = IntersectionTraits
using Point_3 = typename Kernel::Point_3

Initialization

template<typename NamedParameters = parameters::Default_named_parameters>
 Kinetic_space_partition_3 (const NamedParameters &np=CGAL::parameters::default_values())
 constructs an empty kinetic space partition object.
template<typename PointRange, typename PolygonRange, typename NamedParameters = parameters::Default_named_parameters>
 Kinetic_space_partition_3 (const PointRange &points, const PolygonRange &polygons, const NamedParameters &np=CGAL::parameters::default_values())
 constructs a kinetic space partition object.
template<typename PointRange, typename PolygonRange, typename NamedParameters = parameters::Default_named_parameters>
void insert (const PointRange &points, const PolygonRange &polygons, const NamedParameters &np=CGAL::parameters::default_values())
 inserts polygons, requires initialize() or init_and_partition() afterwards to have effect.
template<typename ConcurrencyTag = Parallel_if_available_tag, typename NamedParameters = parameters::Default_named_parameters>
void initialize (const NamedParameters &np=CGAL::parameters::default_values())
 initializes the kinetic partition.
template<typename ConcurrencyTag = Parallel_if_available_tag>
void partition (std::size_t k)
 propagates the kinetic polygons in the initialized partition.
template<typename ConcurrencyTag = Parallel_if_available_tag, typename NamedParameters = parameters::Default_named_parameters>
void init_and_partition (std::size_t k, const NamedParameters &np=CGAL::parameters::default_values())
 initializes the kinetic partition and propagates the kinetic polygons.

Access

std::size_t number_of_volumes () const
 returns the number of volumes created by the kinetic partition.
const std::vector< typename Intersection_kernel::Plane_3 > & input_planes () const
 provides the planes of the input polygons.
const std::vector< std::size_t > & input_plane_indices () const
 provides the index of the plane of each input polygon into input_planes().
template<class LCC>
void get_linear_cell_complex (LCC &lcc) const
 exports the kinetic partition into a Linear_cell_complex_for_combinatorial_map<3, 3> using a model of KineticLCCItems as items, e.g., Kinetic_linear_cell_complex_min_items.

Constructor & Destructor Documentation

◆ Kinetic_space_partition_3() [1/2]

template<typename GeomTraits, typename IntersectionTraits = CGAL::Exact_predicates_exact_constructions_kernel>
template<typename NamedParameters = parameters::Default_named_parameters>
CGAL::Kinetic_space_partition_3< GeomTraits, IntersectionTraits >::Kinetic_space_partition_3 ( const NamedParameters & np = CGAL::parameters::default_values())

constructs an empty kinetic space partition object.

Use insert() afterwards to insert polygons into the partition and initialize() to initialize the partition.

Template Parameters
NamedParametersa sequence of Named Parameters
Parameters
npa sequence of Named Parameters among the ones listed below
Optional Named Parameters
  • Write timing and internal information to std::cout.
  • Type: bool
  • Default: false
  • Export of intermediate results.
  • Type: bool
  • Default: false

◆ Kinetic_space_partition_3() [2/2]

template<typename GeomTraits, typename IntersectionTraits = CGAL::Exact_predicates_exact_constructions_kernel>
template<typename PointRange, typename PolygonRange, typename NamedParameters = parameters::Default_named_parameters>
CGAL::Kinetic_space_partition_3< GeomTraits, IntersectionTraits >::Kinetic_space_partition_3 ( const PointRange & points,
const PolygonRange & polygons,
const NamedParameters & np = CGAL::parameters::default_values() )

constructs a kinetic space partition object.

Template Parameters
PointRangemust be a model of ConstRange whose iterator type is RandomAccessIterator and whose value type is Point_3.
PolygonRangecontains index ranges to form polygons by providing indices into PointRange
NamedParametersa sequence of Named Parameters
Parameters
pointsan instance of PointRange with 3D points and corresponding 3D normal vectors
polygonsa range of polygons defined by a range of indices into points
npa sequence of Named Parameters among the ones listed below
Optional Named Parameters
  • a property map associating points to the elements of the input range PointRange points.
  • Type: a model of ReadablePropertyMap whose key type is the value type of the iterator of PointRange and whose value type is GeomTraits::Point_3
  • Default: CGAL::Identity_property_map<GeomTraits::Point_3>
  • Export of intermediate results.
  • Type: bool
  • Default: false
  • Write timing and internal information to std::cout.
  • Type: bool
  • Default: false
  • Use the oriented bounding box instead of the axis-aligned bounding box. While the z direction is maintained, the x axis is aligned with the largest variation in the horizontal plane.
  • Type: bool
  • Default: false
  • Factor for extension of the bounding box of the input data to be used for the partition. Must be larger than 1.0.
  • Type: FT
  • Default: 1.1
  • The maximal depth of the octree for subdividing the kinetic partition before initialization.
  • Type: std::size_t
  • Default: 3
  • A node in the octree is only split if the contained number of primitives is larger and the maximal depth is not yet reached.
  • Type: std::size_t
  • Default: 40
Precondition
! points.empty() and ! polygons.empty()

Member Function Documentation

◆ get_linear_cell_complex()

template<typename GeomTraits, typename IntersectionTraits = CGAL::Exact_predicates_exact_constructions_kernel>
template<class LCC>
void CGAL::Kinetic_space_partition_3< GeomTraits, IntersectionTraits >::get_linear_cell_complex ( LCC & lcc) const

exports the kinetic partition into a Linear_cell_complex_for_combinatorial_map<3, 3> using a model of KineticLCCItems as items, e.g., Kinetic_linear_cell_complex_min_items.

Volume and face attributes defined in the model KineticLCCItems are filled. The volume index is in the range [0, number of volumes -1] The input polygon index of a face refers to the input polygon the face originates from. If the face originates from several coplanar input polygons, one of them is provided.

Template Parameters
LCCmust be a model of Linear_cell_complex_for_combinatorial_map<3, 3> using a model of KineticLCCItems.
Parameters
lccinstance of LCC to be filled with the kinetic partition. Any data contained in lcc will be cleared before.
Precondition
created partition

◆ init_and_partition()

template<typename GeomTraits, typename IntersectionTraits = CGAL::Exact_predicates_exact_constructions_kernel>
template<typename ConcurrencyTag = Parallel_if_available_tag, typename NamedParameters = parameters::Default_named_parameters>
void CGAL::Kinetic_space_partition_3< GeomTraits, IntersectionTraits >::init_and_partition ( std::size_t k,
const NamedParameters & np = CGAL::parameters::default_values() )

initializes the kinetic partition and propagates the kinetic polygons.

The input polygons are separated using an octree. Afterwards, the kinetic partition of each octree leaf is computed. Each leaf are computed independently and, if ConcurrencyTag is Parallel_tag, in parallel.

In contrast to calling initialize() and partition(), the kinetic data structure of each leaf is created right before its propagation and released after its finalization. Hence, the memory consumption is considerably lower. To compute another partition, e.g., with a different k, init_and_partition() has to be called again.

Note
In the parallel version, several kinetic data structures exist at the same time, one per running thread. Thus, the memory consumption is higher than in the sequential version.
Template Parameters
ConcurrencyTagenables sequential versus parallel algorithm. Possible values are Sequential_tag, Parallel_tag, and Parallel_if_available_tag.
NamedParametersa sequence of Named Parameters
Parameters
kmaximum number of allowed intersections for each vertex of the polygon before its expansion stops.
npa sequence of Named Parameters among the ones listed below
Optional Named Parameters
  • Use the oriented bounding box instead of the axis-aligned bounding box. While the z direction is maintained, the x axis is aligned with the largest variation in the horizontal plane.
  • Type: bool
  • Default: false
  • Factor for extension of the bounding box of the input data to be used for the partition. Must be larger than 1.0.
  • Type: FT
  • Default: 1.1
  • The maximal depth of the octree for subdividing the kinetic partition before initialization.
  • Type: std::size_t
  • Default: 3
  • A node in the octree is only split if the contained number of primitives is larger and the maximal depth is not yet reached.
  • Type: std::size_t
  • Default: 40
Precondition
input data has been provided via insert() and k != 0.

◆ initialize()

template<typename GeomTraits, typename IntersectionTraits = CGAL::Exact_predicates_exact_constructions_kernel>
template<typename ConcurrencyTag = Parallel_if_available_tag, typename NamedParameters = parameters::Default_named_parameters>
void CGAL::Kinetic_space_partition_3< GeomTraits, IntersectionTraits >::initialize ( const NamedParameters & np = CGAL::parameters::default_values())

initializes the kinetic partition.

The input polygons are separated using an octree. Afterwards, the kinetic data structure of each octree leaf is initialized. The leaves are initialized independently and, if ConcurrencyTag is Parallel_tag, in parallel.

The initialized kinetic data structures are kept. Hence, partition() can be called several times afterwards, e.g., with different values of k, without initializing again.

Note
The initialized kinetic data structures of all octree leaves exist at the same time. If only a single partition is needed, init_and_partition() has a considerably lower memory consumption.
Template Parameters
ConcurrencyTagenables sequential versus parallel algorithm. Possible values are Sequential_tag, Parallel_tag, and Parallel_if_available_tag.
NamedParametersa sequence of Named Parameters
Parameters
npa sequence of Named Parameters among the ones listed below
Optional Named Parameters
  • Use the oriented bounding box instead of the axis-aligned bounding box. While the z direction is maintained, the x axis is aligned with the largest variation in the horizontal plane.
  • Type: bool
  • Default: false
  • Factor for extension of the bounding box of the input data to be used for the partition. Must be larger than 1.0.
  • Type: FT
  • Default: 1.1
  • The maximal depth of the octree for subdividing the kinetic partition before initialization.
  • Type: std::size_t
  • Default: 3
  • A node in the octree is only split if the contained number of primitives is larger and the maximal depth is not yet reached.
  • Type: std::size_t
  • Default: 40
Precondition
input data has been provided via insert().

◆ input_plane_indices()

template<typename GeomTraits, typename IntersectionTraits = CGAL::Exact_predicates_exact_constructions_kernel>
const std::vector< std::size_t > & CGAL::Kinetic_space_partition_3< GeomTraits, IntersectionTraits >::input_plane_indices ( ) const

provides the index of the plane of each input polygon into input_planes().

Polygons that are coplanar up to a small tolerance share a plane and thus have the same index. Degenerate polygons, i.e., polygons with less than three vertices or with collinear vertices, are dropped when inserted. Their index is std::size_t(-1).

Returns
vector of plane indices, one for each inserted polygon.
Precondition
inserted polygons

◆ input_planes()

template<typename GeomTraits, typename IntersectionTraits = CGAL::Exact_predicates_exact_constructions_kernel>
const std::vector< typename Intersection_kernel::Plane_3 > & CGAL::Kinetic_space_partition_3< GeomTraits, IntersectionTraits >::input_planes ( ) const

provides the planes of the input polygons.

Polygons that are coplanar up to a small tolerance share a plane. Thus, each plane occurs only once. The planes are indexed by input_plane_indices() and by the input plane index stored in the face attributes of the linear cell complex, see get_linear_cell_complex().

Returns
vector of planes.
Precondition
inserted polygons

◆ insert()

template<typename GeomTraits, typename IntersectionTraits = CGAL::Exact_predicates_exact_constructions_kernel>
template<typename PointRange, typename PolygonRange, typename NamedParameters = parameters::Default_named_parameters>
void CGAL::Kinetic_space_partition_3< GeomTraits, IntersectionTraits >::insert ( const PointRange & points,
const PolygonRange & polygons,
const NamedParameters & np = CGAL::parameters::default_values() )

inserts polygons, requires initialize() or init_and_partition() afterwards to have effect.

A plane is fitted to the vertices of each polygon and the polygon is replaced by the convex hull of its vertices projected onto the plane. Polygons that are coplanar up to a small tolerance relative to their extent get the same plane, which is fitted to the vertices of all of them. This avoids very thin volumes between nearly coplanar polygons. Degenerate polygons, i.e., polygons with less than three vertices or with collinear vertices, are dropped.

Coplanar polygons share a support plane in the partition and expand separately. Pieces of several coplanar polygons that lie in the same face of the arrangement of the intersection lines within the support plane at the beginning are merged into their convex hull. A face of the partition originating from several coplanar polygons refers to one of them as its input polygon, see get_linear_cell_complex().

Template Parameters
PointRangemust be a model of ConstRange whose iterator type is RandomAccessIterator and whose value type is GeomTraits::Point_3.
PolygonRangecontains index ranges to form polygons by providing indices into PointRange
NamedParametersa sequence of Named Parameters
Parameters
pointsan instance of PointRange with 3D points
polygonsa range of polygons defined by a range of indices into points
npa sequence of Named Parameters among the ones listed below
Optional Named Parameters
  • a property map associating points to the elements of the points
  • Type: a model of ReadablePropertyMap whose key type is the value type of the iterator of PointRange and whose value type is GeomTraits::Point_3
  • Default: CGAL::Identity_property_map<GeomTraits::Point_3>

◆ number_of_volumes()

template<typename GeomTraits, typename IntersectionTraits = CGAL::Exact_predicates_exact_constructions_kernel>
std::size_t CGAL::Kinetic_space_partition_3< GeomTraits, IntersectionTraits >::number_of_volumes ( ) const

returns the number of volumes created by the kinetic partition.

Precondition
created partition

◆ partition()

template<typename GeomTraits, typename IntersectionTraits = CGAL::Exact_predicates_exact_constructions_kernel>
template<typename ConcurrencyTag = Parallel_if_available_tag>
void CGAL::Kinetic_space_partition_3< GeomTraits, IntersectionTraits >::partition ( std::size_t k)

propagates the kinetic polygons in the initialized partition.

The kinetic partitions of the octree leaves are computed independently and, if ConcurrencyTag is Parallel_tag, in parallel. The kinetic data structures initialized by initialize() are restored after the propagation of each leaf. Hence, partition() can be called several times with different values of k. The result of a previous call is replaced.

Note
In the parallel version, the state of several kinetic data structures is copied at the same time, one per running thread. Thus, the memory consumption is higher than in the sequential version.
Template Parameters
ConcurrencyTagenables sequential versus parallel algorithm. Possible values are Sequential_tag, Parallel_tag, and Parallel_if_available_tag.
Parameters
kmaximum number of allowed intersections for each vertex of the polygon before its expansion stops.
Precondition
initialize() has been called and k != 0