CGAL第三方库(5.5.1)
立即下载
资源介绍:
CGAL第三方库(5.5.1)
// Copyright (c) 2005,2006,2007,2008,2009,2010,2011,2012,2013 Tel-Aviv University (Israel).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
//
// $URL: https://github.com/CGAL/cgal/blob/v5.5.1/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_impl.h $
// $Id: Arrangement_on_surface_2_impl.h 30da4eb 2021-03-22T13:35:23+02:00 Efi Fogel
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
//
// Author(s): Ron Wein
// Efi Fogel
// Eric Berberich
// (based on old version by: Iddo Hanniel,
// Eyal Flato,
// Oren Nechushtan,
// Ester Ezra,
// Shai Hirsch,
// and Eugene Lipovetsky)
#ifndef CGAL_ARRANGEMENT_ON_SURFACE_2_IMPL_H
#define CGAL_ARRANGEMENT_ON_SURFACE_2_IMPL_H
#include
#ifndef CGAL_ARRANGEMENT_ON_SURFACE_INSERT_VERBOSE
#define CGAL_ARRANGEMENT_ON_SURFACE_INSERT_VERBOSE 0
#endif
/*! \file
* Member-function definitions for the Arrangement_2
* class-template.
*/
#include
#include
#include
namespace CGAL {
//-----------------------------------------------------------------------------
// Default constructor.
//
template
Arrangement_on_surface_2::Arrangement_on_surface_2() :
m_topol_traits()
{
typedef has_Left_side_category Cond_left;
typedef internal::Validate_left_side_category
Validate_left_side_category;
void (Validate_left_side_category::*pleft)(void) =
&Validate_left_side_category::template missing__Left_side_category;
(void)pleft;
typedef has_Bottom_side_category Cond_bottom;
typedef internal::Validate_bottom_side_category
Validate_bottom_side_category;
void (Validate_bottom_side_category::*pbottom)(void) =
&Validate_bottom_side_category::template missing__Bottom_side_category;
(void)pbottom;
typedef has_Top_side_category Cond_top;
typedef internal::Validate_top_side_category
Validate_top_side_category;
void (Validate_top_side_category::*ptop)(void) =
&Validate_top_side_category::template missing__Top_side_category;
(void)ptop;
typedef has_Right_side_category Cond_right;
typedef internal::Validate_right_side_category
Validate_right_side_category;
void (Validate_right_side_category::*pright)(void) =
&Validate_right_side_category::template missing__Right_side_category;
(void)pright;
// Initialize the DCEL structure to represent an empty arrangement.
m_topol_traits.init_dcel();
// Allocate the traits.
m_geom_traits = new Traits_adaptor_2;
m_own_traits = true;
}
//-----------------------------------------------------------------------------
// Copy constructor.
//
template
Arrangement_on_surface_2::
Arrangement_on_surface_2(const Self& arr) :
m_geom_traits(nullptr),
m_own_traits(false)
{ assign(arr); }
//-----------------------------------------------------------------------------
// Constructor given a traits object.
//
template
Arrangement_on_surface_2::
Arrangement_on_surface_2(const Geometry_traits_2* geom_traits) :
m_topol_traits(geom_traits)
{
typedef has_Left_side_category Cond_left;
typedef internal::Validate_left_side_category
Validate_left_side_category;
void (Validate_left_side_category::*pleft)(void) =
&Validate_left_side_category::template missing__Left_side_category;
(void)pleft;
typedef has_Bottom_side_category Cond_bottom;
typedef internal::Validate_bottom_side_category
Validate_bottom_side_category;
void (Validate_bottom_side_category::*pbottom)(void) =
&Validate_bottom_side_category::template missing__Bottom_side_category;
(void)pbottom;
typedef has_Top_side_category Cond_top;
typedef internal::Validate_top_side_category
Validate_top_side_category;
void (Validate_top_side_category::*ptop)(void) =
&Validate_top_side_category::template missing__Top_side_category;
(void)ptop;
typedef has_Right_side_category Cond_right;
typedef internal::Validate_right_side_category
Validate_right_side_category;
void (Validate_right_side_category::*pright)(void) =
&Validate_right_side_category::template missing__Right_side_category;
(void)pright;
// Initialize the DCEL structure to represent an empty arrangement.
m_topol_traits.init_dcel();
// Set the traits.
m_geom_traits = static_cast(geom_traits);
m_own_traits = false;
}
//-----------------------------------------------------------------------------
// Assignment operator.
//
template
Arrangement_on_surface_2&
Arrangement_on_surface_2::operator=(const Self& arr)
{
if (this == &arr) return (*this); // handle self-assignment
assign(arr);
return (*this);
}
//-----------------------------------------------------------------------------
// Assign an arrangement.
//
template
void Arrangement_on_surface_2::assign(const Self& arr)
{
// Clear the current contents of the arrangement.
clear();
// Notify the observers that an assignment is to take place.
_notify_before_assign(arr);
// Assign the topology-traits object.
m_topol_traits.assign(arr.m_topol_traits);
// Go over the vertices and create duplicates of the stored points.
typename Dcel::Vertex_iterator vit;
for (vit = _dcel().vertices_begin(); vit != _dcel().vertices_end(); ++vit) {
DVertex* p_v = &(*vit);
if (! p_v->has_null_point()) {
// Create the duplicate point and store it in the points container.
Point_2* dup_p = _new_point(p_v->point());
// Associate the vertex with the duplicated point.
p_v->set_point(dup_p);
}
}
// Go over the edge and create duplicates of the stored curves.
typename Dcel::Edge_iterator eit;
for (eit = _dcel().edges_begin(); eit != _dcel().edges_end(); ++eit) {
DHalfedge* p_e = &(*eit);
if (! p_e->has_null_curve()) {
// Create the duplicate curve and store it in the curves container.
X_monotone_curve_2* dup_cv = _new_curve(p_e->curve());
// Associate the halfedge (and its twin) with the duplicated curve.
p_e->set_curve(dup_cv);
}
}
// Take care of the traits object.
if (m_own_traits && (m_geom_traits != nullptr)) {
delete m_geom_traits;
m_geom_traits = nullptr;
}
m_geom_traits = (arr.m_own_traits) ? new Traits_adaptor_2 : arr.m_geom_traits;
m_own_traits = arr.m_own_traits;
// Notify the observers that the assignment has been performed.
_notify_after_assign();
}
//-----------------------------------------------------------------------------
// Destructor.
//
template
Arrangement_on_surface_2::~Arrangement_on_surface_2()
{
// Free all stored points.
typename Dcel::Vertex_iterator vit;
for (vit = _dcel().vertices_begin(); vit != _dcel().vertices_end(); ++vit)
if (! vit->has_null_point())
_delete_point(vit->
资源文件列表:
CGAL5.zip 大约有4083个文件