An instance of data type Nef_polyhedron_S2<Traits> is a subset of the sphere $$S_{2} that is the result of forming complements and intersections starting from a finite set H of halfspaces bounded by a plane containing the origin. Halfspaces correspond to hemispheres of $$S_{2} and are therefore modeled by oriented great circles of type Sphere_circle. Nef_polyhedron_S2 is closed under all binary set operations intersection, union, difference, complement and under the topological operations boundary, closure, and interior.
#include <CGAL/Nef_polyhedron_S2.h>
template <  class Nef_polyhedronTraits_S2, 
class Nef_polyhedronItems_S2 = CGAL::SM_items,  
class Nef_polyhedronMarks = bool  
class Nef_polyhedron_S2; 
The first parameter requires one of the following exact kernels: Homogeneous, Simple_homogeneous parametrized with Gmpz, leda_integer or any other number type modeling , or Cartesian, Simple_cartesian parametrized with Gmpq, leda_rational,Quotient<Gmpz> or any other number type modeling .
The second parameter and the third parameter are for future considerations. Neither Nef_polyhedronItems_S2 nor Nef_polyhedronMarks is specifed, yet. Do not use other than the default types for these two template parameters.
 
points in the sphere surface.
 
 
segments in the sphere surface.
 
 
oriented great circles modeling spatial
halfspaces.
 
 
nonmutable handle to svertex.
 
 
nonmutable handle to shalfedge.
 
 
nonmutable handle to shalfloop.
 
 
nonmutable handle to sface.
 
 
nonmutable iterator over all svertices.
 
 
nonmutable iterator over all shalfedges.
 
 
nonmutable iterator over all shalfloops.
 
 
nonmutable iterator over all sfaces.
 
 
circulating the
adjacency list of an svertex v.
 
 
circulating the
sface cycle of an sface f.
 
 
iterating all sface cycles of
an sface f. The iterator has method bool is_svertex(),
bool is_shalfedge(), bool is_shalfloop(), and can be
converted to the corresponding handles SVertex_const_handle,
SHalfedge_const_handle, or SHalfloop_const_handle.
 
 
attributes of objects (vertices, edges, faces).
 
 
size type
 
 
construction selection.
 
 
construction selection.

 
creates
an instance N of type Nef_polyhedron_S2<K> and
initializes it to the empty set if sphere == EMPTY and to the
whole sphere if sphere == COMPLETE.
 
 
creates a Nef polyhedron N containing the
halfsphere left of c including c if
circle==INCLUDED, excluding c if circle==EXCLUDED.
 
 
 
creates a Nef polyhedron N
from the set of sphere segments in the iterator range
[first,beyond). If the set of sphere segments is a simple
polygon that separates the sphere surface into two regions, then the
polygonal region that is left of the segment *first is
selected. The polygonal region includes its boundary if b = INCLUDED and excludes the boundary otherwise.
Forward_iterator has to be an iterator with value type
Sphere_segment.


 
makes N the empty set if plane == EMPTY and the full plane if plane == COMPLETE.  

 returns true if N is empty, false otherwise. 

 returns true if N is the whole sphere, false otherwise. 
 
 returns the complement of N in the plane.  
 
 returns the interior of N.  
 
 returns the closure of N.  
 
 returns the boundary of N.  
 
 
returns the regularized polyhedron (closure of interior).  
 
 
returns N $$ N1.  
 
 
returns N $$ N1.  
 
 
returns N $$ N1.  
 
 
returns the symmectric difference N  T $$ T  N. 
Additionally there are operators *,+,,^,! which implement the binary operations intersection, union, difference, symmetric difference, and the unary operation complement respectively. There are also the corresponding modification operations *=,+=,=,^=.
There are also comparison operations like <,<=,>,>=,==,!= which implement the relations subset, subset or equal, superset, superset or equal, equality, inequality, respectively.
 
a generic handle to an object of the
underlying plane map. The kind of object (vertex, halfedge, face) can be determined and the object can be assigned to a
corresponding
handle by the three functions: bool assign(Vertex_const_handle& h, Object_handle) bool assign(Halfedge_const_handle& h, Object_handle) bool assign(Face_const_handle& h, Object_handle) where each function returns true iff the assignment to h was done.


 
returns true iff the object h is contained in the set represented by N.  

 
returns true iff the object h is contained in the $$1skeleton of N.  

 
returns a generic handle h to an object (face, halfedge, vertex) of the underlying plane map that contains the point p in its relative interior. The point p is contained in the set represented by N if N.contains(h) is true. The location mode flag m allows one to choose between different point location strategies.  

 
returns a handle h with N.contains(h) that can be converted to a Vertex_/Halfedge_/Face_const_handle as described above. The object returned is intersected by the ray starting in p with direction d and has minimal distance to p. The operation returns the null handle NULL if the ray shoot along d does not hit any object h of N with N.contains(h).  

 
returns a handle h that can be converted to a Vertex_/Halfedge_const_handle as described above. The object returned is part of the $$1skeleton of N, intersected by the ray starting in p with direction d and has minimal distance to p. The operation returns the null handle NULL if the ray shoot along d does not hit any $$1skeleton object h of N. The location mode flag m allows one to choose between different point location strategies. 

 returns true iff there is a shalfloop. 
 
 returns access to the sloop. 
The list of all objects can be accessed via iterator ranges.
For comfortable iteration we also provide iterations macros.
The iterator range access operations are of the following kind:
SVertex_iterator svertices_begin()/svertices_end()
SHalfedge_iterator shalfedges_begin()/shalfedges_end()
SHalfloop_iterator shalfloops_begin()/shalfloops_end()
SFace_iterator sfaces_begin()/sfaces_end()
The macros are then CGAL_forall_svertices(v,M), CGAL_forall_shalfedges(e,M), CGAL_forall_sfaces(f,M), CGAL_forall_sface_cycles_of(fc,F) where M is a sphere map and F is a sface.
Nef polyhedra are implemented on top of a halfedge data structure and use linear space in the number of vertices, edges and facets. Operations like empty take constant time. The operations clear, complement, interior, closure, boundary, regularization, input and output take linear time. All binary set operations and comparison operations take time $$O(n log$$n) where $$n is the size of the output plus the size of the input.
The point location and ray shooting operations are implemented in the naive way. The operations run in linear query time without any preprocessing.
Nef polyhedra are parameterized by a standard CGAL kernel. The example computes the intersection of two Nef polyhedra N1 and N2.
// examples/Nef_S2/simple.C #include <CGAL/Gmpz.h> #include <CGAL/Homogeneous.h> #include <CGAL/Nef_polyhedron_S2.h> typedef CGAL::Gmpz RT; typedef CGAL::Homogeneous<RT> Kernel; typedef CGAL::Nef_polyhedron_S2<Kernel> Nef_polyhedron; typedef Nef_polyhedron::Sphere_circle Sphere_circle; int main() { Nef_polyhedron N1(Sphere_circle(1,0,0)); Nef_polyhedron N2(Sphere_circle(0,1,0), Nef_polyhedron::EXCLUDED); Nef_polyhedron N3 = N1 * N2; return 0; }