mirror of https://github.com/CGAL/cgal
Merge remote-tracking branch 'cgal/master'
This commit is contained in:
commit
e80f869147
|
|
@ -806,7 +806,6 @@ void Scene::build_facet_tree()
|
|||
timer.start();
|
||||
std::cout << "Construct Facet AABB tree...";
|
||||
m_facet_tree.rebuild(faces(*m_pPolyhedron).first, faces(*m_pPolyhedron).second,*m_pPolyhedron);
|
||||
m_facet_tree.accelerate_distance_queries();
|
||||
std::cout << "done (" << timer.time() << " s)" << std::endl;
|
||||
}
|
||||
|
||||
|
|
@ -826,7 +825,6 @@ void Scene::build_edge_tree()
|
|||
timer.start();
|
||||
std::cout << "Construct Edge AABB tree...";
|
||||
m_edge_tree.rebuild(edges(*m_pPolyhedron).first,edges(*m_pPolyhedron).second,*m_pPolyhedron);
|
||||
m_edge_tree.accelerate_distance_queries();
|
||||
std::cout << "done (" << timer.time() << " s)" << std::endl;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,6 @@ void Scene::benchmark_distances(const double duration)
|
|||
timer.start();
|
||||
std::cout << "Construct AABB tree and internal KD tree...";
|
||||
Facet_tree tree(faces(*m_pPolyhedron).first, faces(*m_pPolyhedron).second,*m_pPolyhedron);
|
||||
tree.accelerate_distance_queries();
|
||||
std::cout << "done (" << timer.time() << " s)" << std::endl;
|
||||
|
||||
// benchmark
|
||||
|
|
@ -123,7 +122,7 @@ void Scene::bench_memory()
|
|||
typedef CGAL::Memory_sizer::size_type size_type;
|
||||
size_type before = CGAL::Memory_sizer().virtual_size();
|
||||
Facet_tree tree(faces(*m_pPolyhedron).first, faces(*m_pPolyhedron).second,*m_pPolyhedron);
|
||||
// tree.accelerate_distance_queries(); // 150 vs 61 bytes per primitive!
|
||||
tree.do_not_accelerate_distance_queries(); // 150 vs 61 bytes per primitive!
|
||||
|
||||
size_type after = CGAL::Memory_sizer().virtual_size();
|
||||
size_type bytes = after - before; // in Bytes
|
||||
|
|
@ -165,7 +164,6 @@ void Scene::bench_construction()
|
|||
CGAL::Timer time2;
|
||||
time2.start();
|
||||
Facet_tree tree2(faces(*m_pPolyhedron).first, faces(*m_pPolyhedron).second,*m_pPolyhedron);
|
||||
tree2.accelerate_distance_queries();
|
||||
double duration_construction_and_kdtree = time2.time();
|
||||
|
||||
std::cout << m_pPolyhedron->size_of_facets() << "\t"
|
||||
|
|
@ -248,7 +246,6 @@ void Scene::bench_distances_vs_nbt()
|
|||
|
||||
// constructs tree (out of timing)
|
||||
Facet_tree tree(faces(*m_pPolyhedron).first, faces(*m_pPolyhedron).second, *m_pPolyhedron);
|
||||
tree.accelerate_distance_queries();
|
||||
|
||||
// calls queries
|
||||
CGAL::Timer timer;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ void run(const FaceGraph& graph){
|
|||
// constructs the AABB tree and the internal search tree for
|
||||
// efficient distance queries.
|
||||
Tree tree( faces(graph).first, faces(graph).second, graph);
|
||||
tree.accelerate_distance_queries();
|
||||
|
||||
// counts #intersections with a triangle query
|
||||
Segment segment_query(p,q);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ void run(const HalfedgeGraph& graph){
|
|||
// efficient distance queries.
|
||||
Tree tree( CGAL::edges(graph).first,
|
||||
CGAL::edges(graph).second, graph);
|
||||
tree.accelerate_distance_queries();
|
||||
|
||||
// counts #intersections with a triangle query
|
||||
Triangle triangle_query(p,q,r);
|
||||
|
|
|
|||
|
|
@ -37,8 +37,6 @@ int main()
|
|||
// data structure to accelerate distance queries
|
||||
Tree tree(faces(polyhedron1).first, faces(polyhedron1).second, polyhedron1);
|
||||
|
||||
tree.accelerate_distance_queries();
|
||||
|
||||
tree.insert(faces(polyhedron2).first, faces(polyhedron2).second, polyhedron2);
|
||||
|
||||
// query point
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ int main()
|
|||
Tree tree( CGAL::edges(polyhedron).first,
|
||||
CGAL::edges(polyhedron).second,
|
||||
polyhedron);
|
||||
tree.accelerate_distance_queries();
|
||||
|
||||
// counts #intersections with a triangle query
|
||||
Triangle triangle_query(p,q,r);
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ int main()
|
|||
// constructs AABB tree and computes internal KD-tree
|
||||
// data structure to accelerate distance queries
|
||||
Tree tree(faces(polyhedron).first, faces(polyhedron).second, polyhedron);
|
||||
tree.accelerate_distance_queries();
|
||||
|
||||
// query point
|
||||
Point query(0.0, 0.0, 3.0);
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ int main()
|
|||
// constructs the AABB tree and the internal search tree for
|
||||
// efficient distance computations.
|
||||
Tree tree(segments.begin(),segments.end());
|
||||
tree.accelerate_distance_queries();
|
||||
|
||||
// counts #intersections with a plane query
|
||||
Plane plane_query(a,b,d);
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ namespace CGAL {
|
|||
*\tparam FaceGraph is a model of the face graph concept.
|
||||
*\tparam VertexPointPMap is a property map with `boost::graph_traits<FaceGraph>::%vertex_descriptor`
|
||||
* as key type and a \cgal Kernel `Point_3` as value type.
|
||||
* The default is `typename boost::property_map< FaceGraph,vertex_point_t>::%type`.
|
||||
* The default is `typename boost::property_map< FaceGraph,vertex_point_t>::%const_type`.
|
||||
*\tparam OneFaceGraphPerTree is either `CGAL::Tag_true` or `CGAL::Tag_false`.
|
||||
* In the former case, we guarantee that all the primitives will be from a
|
||||
* common `FaceGraph` and some data will be factorized so that the size of
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ namespace CGAL {
|
|||
* \tparam HalfedgeGraph is a model of the halfedge graph concept.
|
||||
* as key type and a \cgal Kernel `Point_3` as value type.
|
||||
* \tparam VertexPointPMap is a property map with `boost::graph_traits<HalfedgeGraph>::%vertex_descriptor`.
|
||||
* The default is `typename boost::property_map< HalfedgeGraph,vertex_point_t>::%type`.
|
||||
* The default is `typename boost::property_map< HalfedgeGraph,vertex_point_t>::%const_type`.
|
||||
* \tparam OneHalfedgeGraphPerTree is either `CGAL::Tag_true` or `CGAL::Tag_false`.
|
||||
* In the former case, we guarantee that all the primitives will be from a
|
||||
* common `HalfedgeGraph` and some data will be factorized so that the size of
|
||||
|
|
@ -77,17 +77,17 @@ class AABB_halfedge_graph_segment_primitive
|
|||
HalfedgeGraph,
|
||||
typename Default::Get<VertexPointPMap,
|
||||
typename boost::property_map< HalfedgeGraph,
|
||||
vertex_point_t>::type >::type >,
|
||||
vertex_point_t>::const_type >::type >,
|
||||
Source_point_from_edge_descriptor_map<
|
||||
HalfedgeGraph,
|
||||
typename Default::Get<VertexPointPMap,
|
||||
typename boost::property_map< HalfedgeGraph,
|
||||
vertex_point_t>::type >::type >,
|
||||
vertex_point_t>::const_type >::type >,
|
||||
OneHalfedgeGraphPerTree,
|
||||
CacheDatum >
|
||||
#endif
|
||||
{
|
||||
typedef typename Default::Get<VertexPointPMap,typename boost::property_map< HalfedgeGraph,vertex_point_t>::type >::type VertexPointPMap_;
|
||||
typedef typename Default::Get<VertexPointPMap,typename boost::property_map< HalfedgeGraph,vertex_point_t>::const_type >::type VertexPointPMap_;
|
||||
typedef typename boost::graph_traits<HalfedgeGraph>::edge_descriptor ED;
|
||||
typedef typename boost::mpl::if_<OneHalfedgeGraphPerTree, ED, std::pair<ED, const HalfedgeGraph*> >::type Id_;
|
||||
|
||||
|
|
@ -118,7 +118,7 @@ public:
|
|||
/*!
|
||||
The point type.
|
||||
*/
|
||||
typedef boost::property_traits< boost::property_map< HalfedgeGraph, vertex_point_t>::type >::value_type Point;
|
||||
typedef boost::property_traits< boost::property_map< HalfedgeGraph, vertex_point_t>::const_type >::value_type Point;
|
||||
/*!
|
||||
Geometric data type.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ namespace CGAL {
|
|||
clear_nodes();
|
||||
m_primitives.clear();
|
||||
clear_search_tree();
|
||||
m_default_search_tree_constructed = false;
|
||||
m_default_search_tree_constructed = true;
|
||||
}
|
||||
|
||||
/// Returns the axis-aligned bounding box of the whole tree.
|
||||
|
|
@ -430,6 +430,8 @@ public:
|
|||
/// a point set taken on the internal primitives
|
||||
/// returns `true` iff successful memory allocation
|
||||
bool accelerate_distance_queries() const;
|
||||
///Turns off the lazy construction of the internal search tree.
|
||||
void do_not_accelerate_distance_queries() const;
|
||||
|
||||
/// Constructs an internal KD-tree containing the specified point
|
||||
/// set, to be used as the set of potential hints for accelerating
|
||||
|
|
@ -601,7 +603,7 @@ public:
|
|||
, m_p_root_node(nullptr)
|
||||
, m_p_search_tree(nullptr)
|
||||
, m_search_tree_constructed(false)
|
||||
, m_default_search_tree_constructed(false)
|
||||
, m_default_search_tree_constructed(true)
|
||||
, m_need_build(false)
|
||||
{}
|
||||
|
||||
|
|
@ -615,7 +617,7 @@ public:
|
|||
, m_p_root_node(nullptr)
|
||||
, m_p_search_tree(nullptr)
|
||||
, m_search_tree_constructed(false)
|
||||
, m_default_search_tree_constructed(false)
|
||||
, m_default_search_tree_constructed(true)
|
||||
, m_need_build(false)
|
||||
{
|
||||
// Insert each primitive into tree
|
||||
|
|
@ -673,7 +675,6 @@ public:
|
|||
void AABB_tree<Tr>::build()
|
||||
{
|
||||
clear_nodes();
|
||||
|
||||
if(m_primitives.size() > 1) {
|
||||
|
||||
// allocates tree nodes
|
||||
|
|
@ -695,8 +696,9 @@ public:
|
|||
// In case the users has switched on the accelerated distance query
|
||||
// data structure with the default arguments, then it has to be
|
||||
// /built/rebuilt.
|
||||
if(m_default_search_tree_constructed)
|
||||
if(m_default_search_tree_constructed && !empty()){
|
||||
build_kd_tree();
|
||||
}
|
||||
m_need_build = false;
|
||||
}
|
||||
// constructs the search KD tree from given points
|
||||
|
|
@ -741,6 +743,14 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
template<typename Tr>
|
||||
void AABB_tree<Tr>::do_not_accelerate_distance_queries()const
|
||||
{
|
||||
clear_search_tree();
|
||||
m_default_search_tree_constructed = false;
|
||||
}
|
||||
|
||||
|
||||
// constructs the search KD tree from internal primitives
|
||||
template<typename Tr>
|
||||
bool AABB_tree<Tr>::accelerate_distance_queries() const
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ BGL
|
|||
Cartesian_kernel
|
||||
Circulator
|
||||
Distance_2
|
||||
Distance_3
|
||||
Installation
|
||||
Intersections_2
|
||||
Intersections_3
|
||||
|
|
@ -16,4 +17,3 @@ Property_map
|
|||
STL_Extension
|
||||
Spatial_searching
|
||||
Stream_support
|
||||
Distance_3
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ int main()
|
|||
// Test calls to all functions but those who have `!empty()` as
|
||||
// precondition.
|
||||
CGAL::Emptyset_iterator devnull;
|
||||
tree.accelerate_distance_queries();
|
||||
tree.all_intersections(triangle_query, devnull);
|
||||
tree.all_intersected_primitives(triangle_query, devnull);
|
||||
assert(!tree.any_intersected_primitive(triangle_query));
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ int main()
|
|||
|
||||
// Test calls to all functions
|
||||
CGAL::Emptyset_iterator devnull;
|
||||
tree.accelerate_distance_queries();
|
||||
tree.all_intersections(triangle_query, devnull);
|
||||
tree.all_intersected_primitives(triangle_query, devnull);
|
||||
assert(tree.any_intersected_primitive(triangle_query));
|
||||
|
|
|
|||
|
|
@ -1996,6 +1996,7 @@ namespace CGAL {
|
|||
{
|
||||
// initilisation de la variable globale K: qualite d'echantillonnage requise
|
||||
K = K_init; // valeur d'initialisation de K pour commencer prudemment...
|
||||
coord_type K_prev = K;
|
||||
|
||||
Vertex_handle v1, v2;
|
||||
if (_ordered_border.empty()){
|
||||
|
|
@ -2060,12 +2061,12 @@ namespace CGAL {
|
|||
}
|
||||
while((!_ordered_border.empty())&&
|
||||
(_ordered_border.begin()->first < STANDBY_CANDIDATE_BIS));
|
||||
|
||||
K_prev = K;
|
||||
K += (std::max)(K_step, min_K - K + eps);
|
||||
// on augmente progressivement le K mais on a deja rempli sans
|
||||
// faire des betises auparavant...
|
||||
}
|
||||
while((!_ordered_border.empty())&&(K <= K)&&(min_K != infinity()));
|
||||
while((!_ordered_border.empty())&&(K <= K)&&(min_K != infinity())&&(K!=K_prev));
|
||||
|
||||
#ifdef VERBOSE
|
||||
if ((min_K < infinity())&&(!_ordered_border.empty())) {
|
||||
|
|
|
|||
|
|
@ -119,8 +119,8 @@ typedef unspecified_type FT;
|
|||
/*!
|
||||
The point type.
|
||||
|
||||
For basic alpha shapes, `Point` will be equal to `Gt::Point_2`. For weighted alpha
|
||||
shapes, `Point` will be equal to `Gt::Weighted_point_2`.
|
||||
For basic alpha shapes, `Point` will be equal to `Gt::Point_3`. For weighted alpha
|
||||
shapes, `Point` will be equal to `Gt::Weighted_point_3`.
|
||||
*/
|
||||
typedef Dt::Point Point;
|
||||
|
||||
|
|
|
|||
|
|
@ -66,9 +66,9 @@ public:
|
|||
return int(CGAL::sqrt(CGAL::to_double(tt) / 2));
|
||||
}
|
||||
|
||||
void generate_points(std::vector<Point_2>& p) const
|
||||
void generate_points(std::vector<Point_2>& p,
|
||||
const FT STEP = FT(2)) const
|
||||
{
|
||||
const FT STEP(2);
|
||||
FT s0, s1;
|
||||
|
||||
s0 = t(p1);
|
||||
|
|
|
|||
|
|
@ -459,7 +459,8 @@ public:
|
|||
|
||||
if (! cv.is_vertical()) {
|
||||
// Compare p with the segment's supporting line.
|
||||
return (kernel.compare_y_at_x_2_object()(p, cv.line()));
|
||||
CGAL_assertion( kernel.compare_x_2_object()(cv.left(), cv.right()) == SMALLER );
|
||||
return kernel.orientation_2_object()(cv.left(), cv.right(), p);
|
||||
}
|
||||
else {
|
||||
// Compare with the vertical segment's end-points.
|
||||
|
|
|
|||
|
|
@ -733,11 +733,12 @@ make_icosahedron(Graph& g,
|
|||
* If `triangulated` is `true`, the diagonal of each cell is oriented from (0,0) to (1,1)
|
||||
* in the cell coordinates.
|
||||
*
|
||||
*\tparam CoordinateFunctor a function object providing `Point_3 operator()(size_type I, size_type J)` with `Point_3` being
|
||||
* the value_type of the internal property_map for `CGAL::vertex_point_t`.
|
||||
* and outputs a `boost::property_traits<boost::property_map<Graph,CGAL::vertex_point_t>::%type>::%value_type`.
|
||||
* It will be called with arguments (`w`, `h`), with `w` in [0..`i`] and `h` in [0..`j`].
|
||||
* <p>%Default: a point with positive integer coordinates (`w`, `h`, 0), with `w` in [0..`i`] and `h` in [0..`j`]
|
||||
*\tparam CoordinateFunctor a function object providing:
|
||||
* `%Point_3 operator()(size_type I, size_type J)`, with `%Point_3` being the value_type
|
||||
* of the internal property_map for `CGAL::vertex_point_t` and outputs an object of type
|
||||
* `boost::property_traits<boost::property_map<Graph,CGAL::vertex_point_t>::%type>::%value_type`.
|
||||
* It will be called with arguments (`w`, `h`), with `w` in [0..`i`] and `h` in [0..`j`].<br>
|
||||
* %Default: a point with positive integer coordinates (`w`, `h`, 0), with `w` in [0..`i`] and `h` in [0..`j`]
|
||||
*
|
||||
* \returns the non-border non-diagonal halfedge that has the target vertex associated with the first point of the grid (default is (0,0,0) ).
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ static void addimgtag(byte *dptr, int xsize, int ysize)
|
|||
/*****************************************************/
|
||||
static unsigned short getshort( const _image *im)
|
||||
{
|
||||
byte buf[2];
|
||||
byte buf[2] = { '\0', '\0' };
|
||||
ImageIO_read( im, buf, (size_t) 2);
|
||||
return (unsigned short)((buf[0]<<8)+(buf[1]<<0));
|
||||
}
|
||||
|
|
@ -209,7 +209,7 @@ static unsigned short getshort( const _image *im)
|
|||
/*****************************************************/
|
||||
static unsigned long getlong( const _image *im )
|
||||
{
|
||||
byte buf[4];
|
||||
byte buf[4] = { '\0', '\0', '\0', '\0' };
|
||||
ImageIO_read( im, buf, (size_t) 4);
|
||||
return (((unsigned long) buf[0])<<24) + (((unsigned long) buf[1])<<16)
|
||||
+ (((unsigned long) buf[2])<<8) + buf[3];
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ public:
|
|||
/// \cond SKIP_IN_MANUAL
|
||||
virtual float value (std::size_t pt_index)
|
||||
{
|
||||
cpp11::array<double, 3> c = get(color_map, *(input.begin()+pt_index)).to_hsv();
|
||||
std::array<double, 3> c = get(color_map, *(input.begin()+pt_index)).to_hsv();
|
||||
return float(c[std::size_t(m_channel)]);
|
||||
}
|
||||
/// \endcond
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ class Point_set_neighborhood
|
|||
typedef Search_traits_adapter <boost::uint32_t, My_point_property_map, SearchTraits_3> Search_traits;
|
||||
typedef Sliding_midpoint<Search_traits> Splitter;
|
||||
typedef Distance_adapter<boost::uint32_t, My_point_property_map, Euclidean_distance<SearchTraits_3> > Distance;
|
||||
typedef Kd_tree<Search_traits, Splitter, Tag_true> Tree;
|
||||
typedef Kd_tree<Search_traits, Splitter, Tag_true, Tag_true> Tree;
|
||||
typedef Fuzzy_sphere<Search_traits> Sphere;
|
||||
typedef Orthogonal_k_neighbor_search<Search_traits, Distance, Splitter, Tree> Knn;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ Kernel_23
|
|||
Modular_arithmetic
|
||||
Number_types
|
||||
Profiling_tools
|
||||
Property_map
|
||||
STL_Extension
|
||||
Stream_support
|
||||
Property_map
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ Algebraic_foundations
|
|||
Circulator
|
||||
Convex_hull_d
|
||||
Distance_2
|
||||
Distance_3
|
||||
Hash_map
|
||||
Installation
|
||||
Intersections_2
|
||||
|
|
@ -14,4 +15,3 @@ Number_types
|
|||
Profiling_tools
|
||||
STL_Extension
|
||||
Stream_support
|
||||
Distance_3
|
||||
|
|
|
|||
|
|
@ -390,6 +390,20 @@ squared_distance(const Triangle_3<K> & t,
|
|||
}
|
||||
|
||||
|
||||
template <class K>
|
||||
inline
|
||||
typename K::FT
|
||||
squared_distance(const Plane_3<K> & p1,
|
||||
const Plane_3<K> & p2) {
|
||||
K k;
|
||||
typename K::Construct_orthogonal_vector_3 ortho_vec =
|
||||
k.construct_orthogonal_vector_3_object();
|
||||
if (!internal::is_null(internal::wcross(ortho_vec(p1), ortho_vec(p2), k), k))
|
||||
return typename K::FT(0);
|
||||
else
|
||||
return internal::squared_distance(p1.point(), p2, k);
|
||||
}
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -221,6 +221,17 @@ struct Test {
|
|||
check_squared_distance (L(p(2, -4, 3), p( 3,-8, 4)), Pl(0, 1, 0, 0), 0);
|
||||
}
|
||||
|
||||
void Pl_Pl()
|
||||
{
|
||||
std::cout << "Plane - Plane\n";
|
||||
Pl p1(0, 1, 0, 0);
|
||||
typename K::Vector_3 v = -p1.orthogonal_vector();
|
||||
v /= CGAL::sqrt(v.squared_length());
|
||||
Pl p2 = Pl(0,-1,0,6);
|
||||
check_squared_distance (p1,p2, 36);
|
||||
check_squared_distance (Pl(-2, 1, 1, 0), Pl(2, 1, 3, 0), 0);
|
||||
}
|
||||
|
||||
void run()
|
||||
{
|
||||
std::cout << "3D Distance tests\n";
|
||||
|
|
@ -239,6 +250,7 @@ struct Test {
|
|||
S_Pl();
|
||||
R_Pl();
|
||||
L_Pl();
|
||||
Pl_Pl();
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -253,10 +253,15 @@ if (NOT CGAL_CREATED_VERSION_NUM)
|
|||
set(CGAL_CREATED_VERSION_NUM "${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}")
|
||||
endif()
|
||||
else()
|
||||
#read version.h and get the line with CGAL_VERSION
|
||||
file(STRINGS "${CGAL_ROOT}/include/CGAL/version.h" CGAL_VERSION_LINE REGEX "CGAL_VERSION ")
|
||||
#extract release id
|
||||
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.?[0-9]*" CGAL_CREATED_VERSION_NUM "${CGAL_VERSION_LINE}")
|
||||
if(EXISTS "${CGAL_ROOT}/doc/public_release_name")
|
||||
file(STRINGS "${CGAL_ROOT}/doc/public_release_name" CGAL_VERSION_LINE)
|
||||
string(REGEX REPLACE "CGAL-" "" CGAL_CREATED_VERSION_NUM "${CGAL_VERSION_LINE}")
|
||||
else()
|
||||
#read version.h and get the line with CGAL_VERSION
|
||||
file(STRINGS "${CGAL_ROOT}/include/CGAL/version.h" CGAL_VERSION_LINE REGEX "CGAL_VERSION ")
|
||||
#extract release id
|
||||
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.?[0-9]*" CGAL_CREATED_VERSION_NUM "${CGAL_VERSION_LINE}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
|
|||
|
|
@ -315,11 +315,8 @@ identification of the file. The file header contains:
|
|||
<UL>
|
||||
<LI>a copyright notice, specifying all the years during which the file has
|
||||
been written or modified, as well as the owner(s) (typically the institutions
|
||||
employing the authors) of this work,
|
||||
<LI>the corresponding license (at the moment, only LGPLv3+ and GPLv3+
|
||||
are allowed in \cgal), and a pointer to the file containing its text in the
|
||||
employing the authors) of this work, a pointer to the file containing its text in the
|
||||
\cgal distribution,
|
||||
<LI>a disclaimer notice,
|
||||
<LI>then, there are 2 keywords, which are automatically expanded at the creation of a new release:
|
||||
<UL>
|
||||
<LI>\$URL\$ : canonical path to the file on github,
|
||||
|
|
@ -331,6 +328,9 @@ and `SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial` for L
|
|||
optional affiliation or e-mail address.
|
||||
</UL>
|
||||
|
||||
Note that since \cgal 5.0 the license text is not present in headers anymore,
|
||||
only SPDX tags are present.
|
||||
|
||||
For example and demo programs, the inclusion of the copyright notice is not
|
||||
necessary as this will get in the way if the program is included in the
|
||||
documentation. However, these files should always contain the name of
|
||||
|
|
@ -371,9 +371,6 @@ Here follows what this gives for a file under the LGPL :
|
|||
// Max-Planck-Institute Saarbruecken (Germany),
|
||||
// and Tel-Aviv University (Israel). All rights reserved.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org)
|
||||
//
|
||||
// $URL$
|
||||
|
|
|
|||
|
|
@ -236,8 +236,8 @@ operating system and compiler that is defined as follows.
|
|||
quite compiler specific).
|
||||
</DL>
|
||||
|
||||
Examples are <TT>mips_IRIX64-6.5_CC-n32-7.30</TT> or <TT>sparc_SunOS-5.6_g++-2.95</TT>. For more information, see the \cgal
|
||||
\link installation installation guide \endlink.
|
||||
Examples are <TT>mips_IRIX64-6.5_CC-n32-7.30</TT> or <TT>sparc_SunOS-5.6_g++-2.95</TT>.
|
||||
For more information, see the \cgal \link usage usage guide \endlink.
|
||||
|
||||
This platform-specific configuration file is created during
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
/*!
|
||||
|
||||
\page devman_create_cgal_CMakeLists Creating a CMake Script for a Program Using %CGAL
|
||||
|
||||
To compile a program that is not shipped with \cgal, it is recommended to also rely on a CMake-supported
|
||||
configuration using a `CMakeLists.txt`. The Bourne-shell script `cgal_create_CMakeLists.txt`
|
||||
can be used to create such `CMakeLists.txt` files.
|
||||
This script resides in the `scripts` directory of \cgal (e.g. `CGAL-\cgalReleaseNumber``/scripts`
|
||||
directory if you have downloaded a tarball).
|
||||
Executing `cgal_create_CMakeLists.txt` in an application directory creates a
|
||||
`CMakeLists.txt` containing rules to build the contained
|
||||
application(s). Three command line options determine details of the
|
||||
configuration.
|
||||
|
||||
<DL>
|
||||
<DT><B>`-s source`</B><DD> If this parameter is given the script will
|
||||
create <B>a single executable</B> for 'source' linked with
|
||||
compilations of all other source files
|
||||
(`*.cc`, `*.cp`, `*.cxx`, `*.cpp`, `*.CPP`, `*.c++`, or `*.C`).
|
||||
This behaviour is usually needed for (graphical) demos.
|
||||
|
||||
If the parameter is not given, the script creates <B>one executable for each given
|
||||
source file</B>.
|
||||
<DT><B>`-c com1:com2:...`</B><DD> Lists components ("com1",
|
||||
"com2") of \cgal to which the executable(s) should be linked. Valid components are \cgal's
|
||||
libraries (i.e.\ "Core", "ImageIO", and "Qt5"). An example is `-c Core`.
|
||||
|
||||
<DT><B>`-b boost1:boost2:...`</B><DD> Lists components ("boost1",
|
||||
"boost2") of \sc{Boost} to which the executable(s) should be
|
||||
linked. Valid options are, for instance, "filesystem" or "program_options".
|
||||
|
||||
</DL>
|
||||
|
||||
This options should suffice to create `CMakeLists.txt` script
|
||||
for most directories containing programs. However, in some special
|
||||
cases, it might still be required to create the script manually, for
|
||||
instance, if some source files/executables need a different linking than
|
||||
other source files.
|
||||
|
||||
*/
|
||||
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
\page dev_manual Developer Manual
|
||||
|
||||
The developer manual is primarly aimed at \cgal developers, but may also be interesting to any \cgal user.
|
||||
|
||||
- \subpage devman_intro
|
||||
- \subpage devman_code_format
|
||||
- \subpage devman_kernels
|
||||
|
|
@ -19,6 +21,6 @@
|
|||
- \subpage devman_testing
|
||||
- \subpage devman_submission
|
||||
- \subpage devman_info
|
||||
- \subpage devman_create_cgal_CMakeLists
|
||||
- \subpage deprecated
|
||||
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,13 +1,30 @@
|
|||
/*!
|
||||
\page general_intro Getting Started
|
||||
\page general_intro Getting Started with %CGAL
|
||||
|
||||
- \subpage installation describes how to install %CGAL, and lists the third party libraries on which %CGAL depends, or for which %CGAL provides interfaces.
|
||||
The following pages describe how to use \cgal on different environments
|
||||
|
||||
- \subpage manual gives an idea where you should look for documentation.
|
||||
The documentation for a class, may be spread over manual pages of
|
||||
base classes, and reference manual pages of concepts the class is a model of.
|
||||
|
||||
- \subpage usage
|
||||
|
||||
- \subpage preliminaries lists the licenses under which the %CGAL datastructures and algorithms are distributed, how to control inlining, thread safety, code deprecation, checking of pre- and postconditions, and how to alter the failure behavior.
|
||||
- \subpage windows
|
||||
|
||||
- \subpage thirdparty gives information (supported versions, download links) of the required and optional third party libraries.
|
||||
|
||||
The following pages cover advanced installation options
|
||||
|
||||
- \subpage configurationvariables gives information about which CMake variables can be used to help
|
||||
resolve missing dependencies while using the cmake command line tool.
|
||||
|
||||
- \subpage installation describes the deprecated process of configuring and building \cgal.
|
||||
|
||||
The following pages cover the structure of the manual and general information about \cgal
|
||||
|
||||
- \subpage manual gives an idea of where you should look for documentation.
|
||||
|
||||
- \subpage preliminaries lists how to control inlining, thread safety, code deprecation, checking
|
||||
of pre- and postconditions, and how to alter the failure behavior.
|
||||
|
||||
Once you are familiar with building your programs with \cgal and how the documentation is structured,
|
||||
you can head over to the \ref tutorials for a gentle introduction to \cgal, or directly to the package(s)
|
||||
that interest you the \ref packages. Each package contains simple examples of the various functionalities of the package.
|
||||
|
||||
*/
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,104 @@
|
|||
/*!
|
||||
\page license License
|
||||
\cgalAutoToc
|
||||
|
||||
\cgal is distributed under a dual license scheme, that is under the
|
||||
\sc{Gpl}/\sc{Lgpl} open source license, as well as under commercial licenses.
|
||||
|
||||
\cgal consists of different parts covered by different open source licenses.
|
||||
In this section we explain the essence of the different licenses, as well as
|
||||
the rationale why we have chosen them.
|
||||
|
||||
The fact that \cgal is Open Source software does not mean that users are free
|
||||
to do whatever they want with the software. Using the software means to accept
|
||||
the license, which has the status of a contract between the user and the owner
|
||||
of the \cgal software.
|
||||
|
||||
\section licensesGPL GPL
|
||||
|
||||
The \sc{Gpl} is an Open Source license that, if you distribute your software
|
||||
based on \sc{Gpl}ed \cgal data structures, obliges you to distribute the
|
||||
source code of your software under the \sc{Gpl}.
|
||||
|
||||
The exact license terms can be found at the Free Software Foundation
|
||||
web site: http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
\section licensesLGPL LGPL
|
||||
|
||||
The \sc{Lgpl} is an Open Source license that obliges you to distribute
|
||||
modifications you make on \cgal software accessible to the users.
|
||||
In contrast to the \sc{Gpl}, there is no obligation to make the source
|
||||
code of software you build on top of \sc{Lgpl}ed \cgal data structures.
|
||||
|
||||
The exact license terms can be found at the Free Software Foundation web site:
|
||||
http://www.gnu.org/copyleft/lesser.html.
|
||||
|
||||
\section licensesRationale Rationale of the License Choice
|
||||
|
||||
We have chosen the \sc{Gpl} and the \sc{Lgpl} as they are well-known
|
||||
and well-understood open source licenses. The former restricts
|
||||
commercial use, and the latter allows to promote software as de facto standard
|
||||
so that people can build new higher level data structures on top.
|
||||
|
||||
Therefore, the packages forming a foundation layer are distributed under
|
||||
the \sc{Lgpl}, and the higher level packages under the \sc{Gpl}.
|
||||
The package overview states for each package under which license it is distributed.
|
||||
|
||||
\section licensesCommercial Commercial Licenses
|
||||
|
||||
Users who cannot comply with the Open Source license terms can buy individual
|
||||
data structures under various commercial licenses from GeometryFactory:
|
||||
http://www.geometryfactory.com/. License fees paid by commercial
|
||||
customers are reinvested in R\&D performed by the \cgal project partners,
|
||||
as well as in evolutive maintenance.
|
||||
|
||||
\section licenseCheck License Checking
|
||||
|
||||
Users who have a commercial license for specific packages can check that
|
||||
they do not accidentally use packages for which they do not have a commercial
|
||||
license. The same holds for users who want to be sure that they only
|
||||
use packages of \cgal released under the \sc{Lgpl}.
|
||||
|
||||
To enable checking, users have to define one of the following macros:
|
||||
|
||||
| Macro Name | Effect |
|
||||
| :--------- | :------ |
|
||||
| `CGAL_LICENSE_WARNING` | get a warning during the compilation |
|
||||
| `CGAL_LICENSE_ERROR` | get an error during the compilation |
|
||||
|
||||
The license checking is not a mean to control users as no information
|
||||
is collected or transmitted.
|
||||
|
||||
\section seccgal_version Identifying the Version of CGAL
|
||||
|
||||
Every release of \cgal defines the following preprocessor macros:
|
||||
|
||||
<DL>
|
||||
<DT>`CGAL_VERSION_STR`</DT>
|
||||
<DD>a textual description of the current release (e.g., or 3.3 or 3.2.1 or 3.2.1-I-15) as a string literal</DD>
|
||||
<DT>`CGAL_VERSION_NR`</DT>
|
||||
<DD>a numerical description of the current release such that more recent
|
||||
releases have higher number.
|
||||
|
||||
More precisely, it is defined as `1MMmmbiiii`, where `MM` is
|
||||
the major release number (e.g. 03), `mm` is the minor release
|
||||
number (e.g. 02), `b` is the bug-fix release number (e.g. 0),
|
||||
and `iiii` is the internal release number (e.g. 0001). For
|
||||
public releases, the latter is defined as 1000. Examples: for the
|
||||
public release 3.2.4 this number is 1030241000; for internal release
|
||||
3.2-I-1, it is 1030200001. Note that this scheme was modified around
|
||||
3.2-I-30.
|
||||
</DD>
|
||||
<DT>`CGAL_VERSION_NUMBER(M,m,b)`</DT>
|
||||
<DD>
|
||||
a function macro computing the version number macro from the
|
||||
M.m.b release version. Note that the internal release number is
|
||||
dropped here. Example: `CGAL_VERSION_NUMBER(3,2,4)` is equal to
|
||||
1030241000.
|
||||
</DD>
|
||||
</DL>
|
||||
|
||||
The macro `CGAL_VERSION` is deprecated. It is the same as
|
||||
`CGAL_VERSION_STR`, but not as a string literal.
|
||||
|
||||
*/
|
||||
|
|
@ -1,130 +1,12 @@
|
|||
/*!
|
||||
|
||||
\page preliminaries Preliminaries
|
||||
\page preliminaries General Information
|
||||
\cgalAutoToc
|
||||
\author %CGAL Editorial Board
|
||||
|
||||
This chapter lists the licenses
|
||||
under which the \cgal datastructures and algorithms are distributed.
|
||||
The chapter further explains how to control inlining, thread safety,
|
||||
code deprecation, checking of pre- and postconditions,
|
||||
and how to alter the failure behavior.
|
||||
The chapter explains some basic features of \cgal such as thread safety, code deprecation,
|
||||
checking of pre- and postconditions and altering the failure behavior, and how to control inlining.
|
||||
|
||||
\section licenseIssues License Issues
|
||||
|
||||
\cgal is distributed under a dual license scheme, that is under the
|
||||
\sc{Gpl}/\sc{Lgpl} open source license, as well as under commercial licenses.
|
||||
|
||||
\cgal consists of different parts covered by different open source licenses.
|
||||
In this section we explain the essence of the different licenses, as well as
|
||||
the rationale why we have chosen them.
|
||||
|
||||
The fact that \cgal is Open Source software does not mean that users are free
|
||||
to do whatever they want with the software. Using the software means to accept
|
||||
the license, which has the status of a contract between the user and the owner
|
||||
of the \cgal software.
|
||||
|
||||
\subsection licensesGPL GPL
|
||||
|
||||
The \sc{Gpl} is an Open Source license that, if you distribute your software
|
||||
based on \sc{Gpl}ed \cgal data structures,you are obliged to distribute the
|
||||
source code of your software under the \sc{Gpl}.
|
||||
|
||||
The exact license terms can be found at the Free Software Foundation
|
||||
web site: http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
\subsection licensesLGPL LGPL
|
||||
|
||||
The \sc{Lgpl} is an Open Source license that obliges you to distribute
|
||||
modifications you make on \cgal software accessible to the users.
|
||||
In contrast to the \sc{Gpl}, there is no obligation to make the source
|
||||
code of software you build on top of \sc{Lgpl}ed \cgal data structures
|
||||
|
||||
The exact license terms can be found at the Free Software Foundation web site:
|
||||
http://www.gnu.org/copyleft/lesser.html.
|
||||
|
||||
\subsection licensesRationale Rationale of the License Choice
|
||||
|
||||
We have chosen the \sc{Gpl} and the \sc{Lgpl} as they are well known
|
||||
and well understood open source licenses. The former restricts
|
||||
commercial use, and the latter allows to promote software as de facto standard
|
||||
so that people can build new higher level data structures on top.
|
||||
|
||||
Therefore, the packages forming a foundation layer are distributed under
|
||||
the \sc{Lgpl}, and the higher level packages under the \sc{Gpl}.
|
||||
The package overview states for each package under which license
|
||||
it is distributed.
|
||||
|
||||
\subsection licensesCommercial Commercial Licenses
|
||||
|
||||
Users who cannot comply with the Open Source license terms can buy individual
|
||||
data structures under various commercial licenses from GeometryFactory:
|
||||
http://www.geometryfactory.com/. License fees paid by commercial
|
||||
customers are reinvested in R\&D performed by the \cgal project partners,
|
||||
as well as in evolutive maintenance.
|
||||
|
||||
\subsection licenseCheck License Checking
|
||||
|
||||
Users who have a commercial license for specific packages can check that
|
||||
they do not accidentally use packages for which they do not have a commercial
|
||||
license. The same holds for users who want to be sure that they only
|
||||
use packages of \cgal released under the \sc{Lgpl}.
|
||||
|
||||
To enable checking, users have to define one of the following macros:
|
||||
|
||||
| Macro Name | Effect |
|
||||
| :--------- | :------ |
|
||||
| `CGAL_LICENSE_WARNING` | get a warning during the compilation |
|
||||
| `CGAL_LICENSE_ERROR` | get an error during the compilation |
|
||||
|
||||
|
||||
The license checking is not a mean to control users as no information
|
||||
is collected or transmitted.
|
||||
|
||||
|
||||
|
||||
\section markingSpecialFunctionality Marking of Special Functionality
|
||||
|
||||
In this manual you will encounter sections marked as follows.
|
||||
|
||||
|
||||
\subsection advanced_features Advanced Features
|
||||
|
||||
Some functionality is considered more advanced, for example because it is
|
||||
relatively low-level, or requires special care to be properly used.
|
||||
|
||||
\cgalAdvancedBegin
|
||||
Such functionality is identified this way in the manual.
|
||||
\cgalAdvancedEnd
|
||||
|
||||
\subsection debugging_support Debugging Support Features
|
||||
|
||||
Usually related to advanced features that for example may not guarantee
|
||||
class invariants, some functionality is provided that helps debugging,
|
||||
for example by performing invariants checks on demand.
|
||||
|
||||
\cgalDebugBegin
|
||||
Such functionality is identified this way in the manual.
|
||||
\cgalDebugEnd
|
||||
|
||||
\subsection deprecated_code Deprecated Code
|
||||
|
||||
Sometimes, the \cgal project decides that a feature is deprecated. This means
|
||||
that it still works in the current release, but it will be removed in the next,
|
||||
or a subsequent release. This can happen when we have found a better way to do
|
||||
something, and we would like to reduce the maintenance cost of \cgal at some
|
||||
point in the future. There is a trade-off between maintaining backward
|
||||
compatibility and implementing new features more easily.
|
||||
|
||||
In order to help users manage the changes to apply to their code, we attempt
|
||||
to make \cgal code emit warnings when deprecated code is used. This can be
|
||||
done using some compiler specific features. Those warnings can be disabled
|
||||
by defining the macro `CGAL_NO_DEPRECATION_WARNINGS`. On top of this, we
|
||||
also provide a macro, `CGAL_NO_DEPRECATED_CODE`, which, when defined,
|
||||
disables all deprecated features. This allows users to easily test if their
|
||||
code relies on deprecated features.
|
||||
|
||||
\deprecated Such functionality is identified this way in the manual.
|
||||
These concepts are further developed in the \ref dev_manual.
|
||||
|
||||
\section Preliminaries_namespace Namespace CGAL
|
||||
|
||||
|
|
@ -154,19 +36,10 @@ defined, unless `BOOST_HAS_THREADS` or `_OPENMP` is defined. It is possible
|
|||
to force its definition on the command line, and it is possible to prevent its default
|
||||
definition by setting `CGAL_HAS_NO_THREADS` from the command line.
|
||||
|
||||
\section Preliminaries_cc0x C++14 Support
|
||||
|
||||
\section Preliminaries_cc0x C++11 Support
|
||||
|
||||
\cgal is based on the \CC standard released in 1998 (and later refined in 2003).
|
||||
A new major version of this standard has been released, and is refered to as \cpp11.
|
||||
Some compilers and standard library implementations already provide some of the
|
||||
functionality of this new standard, as a preview. For example, \gcc provides
|
||||
a command-line switch (`-std=c++0x` or or `-std=c++11` depending on the compiler version)
|
||||
which enables some of those features.
|
||||
|
||||
\cgal attempts to support this mode progressively, and already makes use of
|
||||
some of these features if they are available, although no extensive support has
|
||||
been implemented yet.
|
||||
After being based on the \CC standard released in 1998 (and later refined in 2003) for a long time,
|
||||
\cgal is now based on a newer major version of the standard, <a href="https://isocpp.org/wiki/faq/cpp14">C++14</a>.
|
||||
|
||||
\section Preliminaries_functor Functor Return Types
|
||||
|
||||
|
|
@ -182,43 +55,9 @@ return type of calling the functor with an argument of type
|
|||
|
||||
Much of the \cgal code contains assert statements for preconditions, and postconditions of functions
|
||||
as well as in the code. These assertions can be switched on and off per package
|
||||
and the user can change the error behaviour. For details see Section \ref secchecks
|
||||
and the user can change the error behaviour. For details see Section \ref secchecks
|
||||
of Chapter \ref Chapter_STL_Extensions_for_CGAL.
|
||||
|
||||
\section seccgal_version Identifying the Version of CGAL
|
||||
|
||||
`<CGAL/config.h>`
|
||||
|
||||
Every release of \cgal defines the following preprocessor macros:
|
||||
|
||||
<DL>
|
||||
<DT>`CGAL_VERSION_STR`</DT>
|
||||
<DD>a textual description of the current release (e.g., or 3.3 or 3.2.1 or 3.2.1-I-15) as a string literal</DD>
|
||||
<DT>`CGAL_VERSION_NR`</DT>
|
||||
<DD>a numerical description of the current release such that more recent
|
||||
releases have higher number.
|
||||
|
||||
More precisely, it is defined as `1MMmmbiiii`, where `MM` is
|
||||
the major release number (e.g. 03), `mm` is the minor release
|
||||
number (e.g. 02), `b` is the bug-fix release number (e.g. 0),
|
||||
and `iiii` is the internal release number (e.g. 0001). For
|
||||
public releases, the latter is defined as 1000. Examples: for the
|
||||
public release 3.2.4 this number is 1030241000; for internal release
|
||||
3.2-I-1, it is 1030200001. Note that this scheme was modified around
|
||||
3.2-I-30.
|
||||
</DD>
|
||||
<DT>`CGAL_VERSION_NUMBER(M,m,b)`</DT>
|
||||
<DD>
|
||||
a function macro computing the version number macro from the
|
||||
M.m.b release version. Note that the internal release number is
|
||||
dropped here. Example: `CGAL_VERSION_NUMBER(3,2,4)` is equal to
|
||||
1030241000.
|
||||
</DD>
|
||||
</DL>
|
||||
|
||||
The macro `CGAL_VERSION` is deprecated. It is the same as
|
||||
`CGAL_VERSION_STR`, but not as a string literal.
|
||||
|
||||
\section Preliminaries_flags Compile-time Flags to Control Inlining
|
||||
|
||||
Making functions inlined can, at times, improve the efficiency of your code.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,289 @@
|
|||
/*!
|
||||
|
||||
\page thirdparty Essential and Optional Third Party Dependencies
|
||||
\cgalAutoToc
|
||||
|
||||
\section seccompilers Supported Compilers
|
||||
|
||||
In order to build a program using \cgal, you need a \cpp compiler
|
||||
supporting <a href="https://isocpp.org/wiki/faq/cpp14">C++14</a> or later.
|
||||
\cgal \cgalReleaseNumber is supported (continuously tested) for the following compilers/operating systems:
|
||||
|
||||
| Operating System | Compiler |
|
||||
| :------- | :--------------- |
|
||||
| Linux | \sc{Gnu} `g++` 6.3 or later\cgalFootnote{<A HREF="http://gcc.gnu.org/">`http://gcc.gnu.org/`</A>} |
|
||||
| | `Clang` \cgalFootnote{<A HREF="http://clang.llvm.org/">`http://clang.llvm.org/`</A>} compiler version 8.0.0 |
|
||||
| \sc{MS} Windows | \sc{Gnu} `g++` 6.3 or later\cgalFootnote{<A HREF="http://gcc.gnu.org/">`http://gcc.gnu.org/`</A>} |
|
||||
| | \sc{MS} Visual `C++` 14.0, 15.9, 16.0 (\sc{Visual Studio} 2015, 2017, and 2019)\cgalFootnote{<A HREF="https://visualstudio.microsoft.com/">`https://visualstudio.microsoft.com/`</A>} |
|
||||
| MacOS X | \sc{Gnu} `g++` 6.3 or later\cgalFootnote{<A HREF="http://gcc.gnu.org/">`http://gcc.gnu.org/`</A>} |
|
||||
| | Apple `Clang` compiler versions 7.0.2 and 10.0.1 |
|
||||
|
||||
<!-- Windows supported version are also listed on windows.html (must change both) -->
|
||||
|
||||
Older versions of the above listed compilers might work, but no guarantee is provided.
|
||||
|
||||
\section seccmake CMake
|
||||
<b>Version 3.1 or later</b>
|
||||
|
||||
In order to configure and build the \cgal examples, demos, or libraries,
|
||||
you need <a href="https://cmake.org/">CMake</a>, a cross-platform "makefile generator".
|
||||
|
||||
This manual explains only the features of CMake which are needed in order to build \cgal.
|
||||
Please refer to the <a href="https://cmake.org/documentation/">CMake documentation</a>
|
||||
for further details.
|
||||
|
||||
\attention Recent versions of CMake are needed for the most recent versions of MS Visual C++.
|
||||
Please refer to CMake's documentation for further information, for example
|
||||
<a href="https://cmake.org/cmake/help/latest/generator/Visual%20Studio%2016%202019.html">here</a>
|
||||
for Visual Studio 16 2019.
|
||||
|
||||
\section secessential3rdpartysoftware Essential Third Party Libraries
|
||||
|
||||
The focus of \cgal is on geometry, and we rely on other
|
||||
highly specialized libraries and software for non-geometric issues,
|
||||
for instance for numeric solvers or visualization. We first list software
|
||||
that is essential to most of \cgal, and must therefore be found during the configuration of \cgal.
|
||||
The page \ref configurationvariables lists CMake and environment variables which can be used to specify
|
||||
the location of third-party software during configuration.
|
||||
|
||||
\subsection thirdpartystl Standard Template Library (STL)
|
||||
|
||||
\cgal heavily uses the \stl, and in particular adopted many of its design ideas. You can find online
|
||||
documentation for the \stl at various web sites, for instance,
|
||||
<A HREF="https://en.cppreference.com/w/">`https://en.cppreference.com `</A>,
|
||||
or <A HREF="https://msdn.microsoft.com/en-us/library/1fe2x6kt(v=vs.140).aspx">`https://msdn.microsoft.com`</A>.
|
||||
|
||||
The \stl comes with the compiler, and as such no installation is required.
|
||||
|
||||
\subsection thirdpartyBoost Boost
|
||||
<b>Version 1.57 or later</b>
|
||||
|
||||
The \sc{Boost} libraries are a set of portable C++ source libraries.
|
||||
Most of \sc{Boost} libraries are header-only, but a few of them need to be compiled or
|
||||
installed as binaries.
|
||||
|
||||
\cgal only requires the headers of the \sc{Boost} libraries, but some demos and examples
|
||||
depend on the binary library `Boost.Program_options`.
|
||||
As an exception and because of a bug in the \gcc compiler about the \cpp 11
|
||||
keyword `thread_local`, the `CGAL_Core` library always requires
|
||||
the binary library `Boost.Thread` if the \gcc compiler version 9.0 or
|
||||
earlier is used.
|
||||
|
||||
In case the \sc{Boost} libraries are not installed on your system already, you
|
||||
can obtain them from <A HREF="https://www.boost.org">`https://www.boost.org/`</A>.
|
||||
For Visual C++ you can download precompiled libraries
|
||||
from <A HREF="https://sourceforge.net/projects/boost/files/boost-binaries/">`https://sourceforge.net/projects/boost/files/boost-binaries/`</A>.
|
||||
|
||||
As there is no canonical directory for where to find \sc{Boost} on Windows,
|
||||
we recommend that you define the environment variable
|
||||
`BOOST_ROOT` and set it to where you have installed \sc{Boost}, e.g., `C:\boost\boost_1_69_0`.
|
||||
|
||||
\subsection thirdpartyMPFR GNU Multiple Precision Arithmetic (GMP) and GNU Multiple Precision Floating-Point Reliably (MPFR) Libraries
|
||||
<b>GMP Version 4.2 or later, MPFR Version 2.2.1 or later</b>
|
||||
|
||||
The components `libCGAL`, `libCGAL_Core`, and `libCGAL_Qt5` require
|
||||
\sc{Gmp} and \sc{Mpfr} which are libraries for multi precision integers and rational numbers,
|
||||
and for multi precision floating point numbers.
|
||||
|
||||
\cgal combines floating point arithmetic with exact arithmetic
|
||||
in order to be efficient and reliable. \cgal has a built-in
|
||||
number type for that, but \sc{Gmp} and \sc{Mpfr} provide a faster
|
||||
solution, and we recommend to use them.
|
||||
|
||||
These libraries can be obtained from <A HREF="https://gmplib.org/">`https://gmplib.org/`</A>
|
||||
and <A HREF="https://www.mpfr.org/">`https://www.mpfr.org/`</A>.
|
||||
Since Visual \cpp is not properly supported by the \sc{Gmp} and \sc{Mpfr} projects,
|
||||
we provide precompiled versions of \sc{Gmp} and \sc{Mpfr}, which can be downloaded with the installer
|
||||
<a href="https://github.com/CGAL/cgal/releases">`CGAL-\cgalReleaseNumber``-Setup.exe`</a>.
|
||||
|
||||
\section secoptional3rdpartysoftware Optional Third Party Libraries
|
||||
|
||||
Optional 3rd party software can be used by \cgal for various reasons:
|
||||
certain optional libraries might be required to build examples and
|
||||
demos shipped with \cgal or to build your own project using \cgal;
|
||||
another reason is to speed up basic tasks where specialized libraries can be faster than the default
|
||||
version shipped with \cgal.
|
||||
The page \ref configurationvariables lists CMake and environment variables which can be used to specify
|
||||
the location of third-party software during configuration.
|
||||
|
||||
\subsection thirdpartyQt Qt5
|
||||
<b>Version 5.9.0 or later</b>
|
||||
|
||||
Qt is a cross-platform application and UI framework.
|
||||
|
||||
The component libCGAL_Qt5 is essential to run the \cgal demos and basic viewers.
|
||||
It requires \sc{Qt}5 installed on your system.
|
||||
In case \sc{Qt} is not yet installed on your system, you can download
|
||||
it from <A HREF="https://www.qt-project.org/">`https://www.qt-project.org/`</A>.
|
||||
|
||||
The exhaustive list of \sc{Qt}5 components used in demos is:
|
||||
`Core`, `Gui`, `Help`, `OpenGL`, `Script`, `ScriptTools`, `Svg`, `Widgets`,
|
||||
`qcollectiongenerator` (with `sqlite` driver plugin), and `Xml`.
|
||||
|
||||
\subsection thirdpartyEigen Eigen
|
||||
<b>Version 3.1 or later</b>
|
||||
|
||||
\sc{Eigen} is a `C++` template library for linear algebra. \sc{Eigen} supports all
|
||||
matrix sizes, various matrix decomposition methods and sparse linear solvers.
|
||||
|
||||
In \cgal, \sc{Eigen} is used in many packages such as \ref PkgPoissonSurfaceReconstruction3
|
||||
or \ref PkgJetFitting3, providing sparse linear solvers and singular value decompositions.
|
||||
A package dependency over \sc{Eigen} is marked on the
|
||||
<a href="https://doc.cgal.org/latest/Manual/packages.html">Package Overview</a> page.
|
||||
|
||||
The \sc{Eigen} web site is <A HREF="http://eigen.tuxfamily.org/index.php?title=Main_Page">`http://eigen.tuxfamily.org`</A>.
|
||||
|
||||
\subsection thirdpartyLeda LEDA
|
||||
<b>Version 6.2 or later</b>
|
||||
|
||||
\leda is a library of efficient data structures and
|
||||
algorithms. Like \sc{Core}, \leda offers a real number data type.
|
||||
|
||||
In \cgal this library is optional, and its number types can
|
||||
be used as an alternative to \sc{Gmp}, \sc{Mpfr}, and \sc{Core}.
|
||||
|
||||
Free and commercial editions of \leda are available from <A HREF="https://www.algorithmic-solutions.com">`https://www.algorithmic-solutions.com`</A>.
|
||||
|
||||
\subsection thirdpartyMPFI Multiple Precision Floating-point Interval (MPFI)
|
||||
<b>Version 1.4 or later</b>
|
||||
|
||||
\sc{Mpfi} provides arbitrary precision interval arithmetic with intervals
|
||||
represented using \sc{Mpfr} reliable floating-point numbers.
|
||||
It is based on the libraries \sc{Gmp} and \sc{Mpfr}.
|
||||
In the setting of \cgal, this library is
|
||||
optional: it is used by some models of the
|
||||
\ref PkgAlgebraicKernelD "Algebraic Kernel".
|
||||
|
||||
\sc{Mpfi} can be downloaded from <A HREF="https://mpfi.gforge.inria.fr/">`https://mpfi.gforge.inria.fr/`</A>.
|
||||
|
||||
\subsection thirdpartyRS3 RS and RS3
|
||||
|
||||
\sc{Rs} (Real Solutions) is devoted to the study of the real roots of
|
||||
polynomial systems with a finite number of complex roots (including
|
||||
univariate polynomials). In \cgal, \sc{Rs} is used by one model of the
|
||||
\ref PkgAlgebraicKernelD "Algebraic Kernel".
|
||||
|
||||
\sc{Rs} is freely distributable for non-commercial use. You can download it
|
||||
from <a href="http://vegas.loria.fr/rs/">`http://vegas.loria.fr/rs/`</a>. Actually, the \sc{Rs} package also includes \sc{Rs3}, the
|
||||
successor of \sc{Rs}, which is used in conjunction with it.
|
||||
|
||||
The libraries \sc{Rs} and \sc{Rs3} need \sc{Mpfi}, which can be downloaded from
|
||||
<A HREF="https://mpfi.gforge.inria.fr/">`https://mpfi.gforge.inria.fr/`</A>.
|
||||
|
||||
\subsection thirdpartyNTL NTL
|
||||
<b>Version 5.1 or later</b>
|
||||
|
||||
\sc{Ntl} provides data structures and algorithms for signed, arbitrary
|
||||
length integers, and for vectors, matrices, and polynomials over the
|
||||
integers and over finite fields. The optional library \sc{Ntl} is used by \cgal
|
||||
to speed up operations of the Polynomial package, such as GCDs. It is recommended to install \sc{Ntl} with support from \sc{Gmp}.
|
||||
|
||||
\sc{Ntl} can be downloaded from <A HREF="https://www.shoup.net/ntl/">`https://www.shoup.net/ntl/`</A>.
|
||||
|
||||
\subsection thirdpartyESBTL ESBTL
|
||||
|
||||
The \sc{Esbtl} (Easy Structural Biology Template Library) is a library that allows
|
||||
the handling of \sc{Pdb} data.
|
||||
|
||||
In \cgal, the \sc{Esbtl} is used in an example of the \ref PkgSkinSurface3 package.
|
||||
|
||||
It can be downloaded from <A HREF="http://esbtl.sourceforge.net/">`http://esbtl.sourceforge.net/`</A>.
|
||||
|
||||
\subsection thirdpartyTBB Intel TBB
|
||||
|
||||
\sc{Tbb} (Threading Building Blocks) is a library developed by Intel Corporation for writing software
|
||||
programs that take advantage of multi-core processors.
|
||||
|
||||
In \cgal, \sc{Tbb} is used by the packages that offer parallel code.
|
||||
|
||||
The \sc{Tbb} web site is <A HREF="https://www.threadingbuildingblocks.org">`https://www.threadingbuildingblocks.org`</A>.
|
||||
|
||||
\subsection thirdpartyLASlib LASlib
|
||||
|
||||
\sc{LASlib} is a `C++` library for handling LIDAR data sets stored in
|
||||
the LAS format (or the compressed LAZ format).
|
||||
|
||||
In \cgal, \sc{LASlib} is used to provide input and output functions in
|
||||
the \ref PkgPointSetProcessing3 package.
|
||||
|
||||
The \sc{LASlib} web site is <a
|
||||
href="https://rapidlasso.com/lastools/">`https://rapidlasso.com/lastools/`</a>. \sc{LASlib}
|
||||
is usually distributed along with LAStools: for simplicity, \cgal
|
||||
provides <a href="https://github.com/CGAL/LAStools">a fork with a
|
||||
CMake based install procedure</a>.
|
||||
|
||||
\subsection thirdpartyOpenCV OpenCV
|
||||
|
||||
\sc{OpenCV} (Open Computer Vision) is a library designed for computer
|
||||
vision, computer graphics and machine learning.
|
||||
|
||||
In \cgal, \sc{OpenCV} is used by the \ref PkgClassification package.
|
||||
|
||||
The \sc{OpenCV} web site is <A HREF="https://opencv.org/">`https://opencv.org/`</A>.
|
||||
|
||||
\subsection thirdpartyTensorFlow TensorFlow
|
||||
|
||||
\sc{TensorFlow} is a library designed for machine learning and deep learning.
|
||||
|
||||
In \cgal, the C++ API of \sc{TensorFlow} is used by the \ref
|
||||
PkgClassification package for neural network. The C++ API can be
|
||||
compiled using CMake: it is distributed as part of the official
|
||||
package and is located in `tensorflow/contrib/cmake`. Be sure to
|
||||
enable and compile the following targets:
|
||||
|
||||
- `tensorflow_BUILD_ALL_KERNELS`
|
||||
- `tensorflow_BUILD_PYTHON_BINDINGS`
|
||||
- `tensorflow_BUILD_SHARED_LIB`.
|
||||
|
||||
The \sc{TensorFlow} web site is <A HREF="https://www.tensorflow.org/">`https://www.tensorflow.org/`</A>.
|
||||
|
||||
\subsection thirdpartyMETIS METIS
|
||||
<b>Version 5.1 or later</b>
|
||||
|
||||
\sc{METIS} is a library developed by the <A HREF="http://glaros.dtc.umn.edu/gkhome/">Karypis Lab</A>
|
||||
and designed to partition graphs and produce fill-reducing matrix orderings.
|
||||
|
||||
\cgal offers wrappers around some of the methods of the \sc{METIS} library
|
||||
to allow the partitioning of graphs that are models of the concepts of the
|
||||
<A HREF="https://www.boost.org/libs/graph/doc/index.html">Boost Graph Library</A>,
|
||||
and, by extension, of surface meshes (see Section \ref BGLPartitioning of the package \ref PkgBGL).
|
||||
|
||||
More information is available on the METIS library
|
||||
at <A HREF="http://glaros.dtc.umn.edu/gkhome/metis/metis/overview">`http://glaros.dtc.umn.edu/gkhome/metis/metis/overview`</A>.
|
||||
|
||||
\subsection thirdpartyzlib zlib
|
||||
|
||||
\sc{zlib} is a data compression library, and is essential for the component libCGAL_ImageIO.
|
||||
|
||||
In \cgal, this library is used in the examples of the \ref PkgSurfaceMesher3 package.
|
||||
|
||||
If it is not already on your system,
|
||||
for instance, on Windows, you can download it from <A HREF="https://www.zlib.net/">`https://www.zlib.net/`</A>.
|
||||
|
||||
\subsection thirdpartyCeres Ceres Solver
|
||||
|
||||
\sc{Ceres} is an open source C++ library for modeling and solving large, complicated optimization problems.
|
||||
|
||||
In \cgal, \sc{Ceres} is used by the \ref PkgPolygonMeshProcessingRef package for mesh smoothing, which
|
||||
requires solving complex non-linear least squares problems.
|
||||
|
||||
Visit the official website of the library at <A HREF="http://ceres-solver.org/index.html">`ceres-solver.org`</A>
|
||||
for more information.
|
||||
|
||||
\subsection thirdpartyGLPK GLPK
|
||||
|
||||
\sc{GLPK} (GNU Linear Programming Kit) is a library for solving linear programming (LP), mixed integer programming (MIP), and other related problems.
|
||||
|
||||
In \cgal, \sc{GLPK} provides an optional linear integer program solver in the \ref PkgPolygonalSurfaceReconstruction package.
|
||||
|
||||
The \sc{GLPK} web site is <A HREF="https://www.gnu.org/software/glpk/">`https://www.gnu.org/software/glpk/`</A>.
|
||||
|
||||
\subsection thirdpartySCIP SCIP
|
||||
|
||||
\sc{SCIP} (Solving Constraint Integer Programs) is currently one of the fastest open source solvers for mixed integer programming (MIP) and mixed integer nonlinear programming (MINLP).
|
||||
|
||||
In \cgal, \sc{SCIP} provides an optional linear integer program solver in the \ref PkgPolygonalSurfaceReconstruction package.
|
||||
|
||||
The \sc{SCIP} web site is <A HREF="http://scip.zib.de/">`http://scip.zib.de/`</A>.
|
||||
|
||||
*/
|
||||
|
|
@ -15,24 +15,23 @@ namespace CGAL {
|
|||
\cgalAutoToc
|
||||
\author %CGAL Editorial Board
|
||||
|
||||
This tutorial is for the %CGAL newbie, who knows C++ and has
|
||||
This tutorial is for the %CGAL newbie, who knows \CC and has
|
||||
a basic knowledge of geometric algorithms. The first section
|
||||
shows how to define a point and segment class, and how to
|
||||
apply geometric predicates on them. The section further raises
|
||||
the awareness that that there are serious issues when using
|
||||
floating point numbers for coordinates. In the second section
|
||||
you see how the 2D convex hull function gets its input
|
||||
and where it puts the result. The third section shows what
|
||||
we mean with a \em Traits class, and the fourth section explains
|
||||
the notion of \em concept and \em model.
|
||||
floating point numbers for coordinates. In the second section,
|
||||
you will meet a typical \cgal function, which computes a 2D convex hull.
|
||||
The third section shows what we mean with a \em Traits class,
|
||||
and the fourth section explains the notion of \em concept and \em model.
|
||||
|
||||
\section intro_Three Three Points and One Segment
|
||||
|
||||
In this first example we see how to construct some points
|
||||
and a segment, and we perform some basic operations on them.
|
||||
|
||||
All \cgal header files are in the subdirectory `include/CGAL`. All \cgal
|
||||
classes and functions are in the namespace `CGAL`.
|
||||
In this first example, we demonstrate how to construct some points
|
||||
and a segment, and perform some basic operations on them.
|
||||
|
||||
All \cgal header files are in the subdirectory `include/CGAL`. All \cgal
|
||||
classes and functions are in the namespace `CGAL`.
|
||||
Classes start with a capital letter, global
|
||||
function with a lowercase letter, and constants are all uppercase.
|
||||
The dimension of an object is expressed with a suffix.
|
||||
|
|
@ -42,24 +41,20 @@ The kernel we have chosen for this first example uses `double`
|
|||
precision floating point numbers for the %Cartesian coordinates of the point.
|
||||
|
||||
Besides the types we see \em predicates like the orientation test for
|
||||
three points, and \em constructions like the distance and midpoint
|
||||
three points, and \em constructions like the distance and midpoint
|
||||
computation. A predicate has a discrete set of possible results,
|
||||
whereas a construction produces either a number, or another
|
||||
geometric entity.
|
||||
|
||||
|
||||
|
||||
\cgalExample{Kernel_23/points_and_segment.cpp}
|
||||
|
||||
|
||||
|
||||
To do geometry with floating point numbers can be surprising
|
||||
as the next example shows.
|
||||
|
||||
\cgalExample{Kernel_23/surprising.cpp}
|
||||
|
||||
When reading the code, we would assume that it prints three times "collinear".
|
||||
However we obtain:
|
||||
Reading the code, we could assume that it would print three times "collinear".
|
||||
However the actual output is the following:
|
||||
|
||||
\verbatim
|
||||
not collinear
|
||||
|
|
@ -67,19 +62,18 @@ not collinear
|
|||
collinear
|
||||
\endverbatim
|
||||
|
||||
|
||||
As the fractions are not representable as double precision number
|
||||
the collinearity test will internally compute a determinant of a 3x3 matrix
|
||||
This is because these fractions are not representable as double-precision numbers,
|
||||
and the collinearity test will internally compute a determinant of a 3x3 matrix
|
||||
which is close but not equal to zero, and hence the non collinearity for the
|
||||
first two tests.
|
||||
first two tests.
|
||||
|
||||
Something similar can happen with points that perform a left turn,
|
||||
but due to rounding errors during the determinant computation, it
|
||||
seems that the points are collinear, or perform a right turn.
|
||||
|
||||
If you need that the numbers get interpreted at their full precision
|
||||
you can use a \cgal kernel that performs exact predicates and
|
||||
extract constructions.
|
||||
If you must ensure that your numbers get interpreted at their full precision
|
||||
you can use a \cgal kernel that performs exact predicates and
|
||||
extract constructions.
|
||||
|
||||
\cgalExample{Kernel_23/exact.cpp}
|
||||
|
||||
|
|
@ -95,7 +89,7 @@ In the first block the points are still not collinear,
|
|||
for the simple reason that the coordinates you see as text
|
||||
get turned into floating point numbers. When they are then
|
||||
turned into arbitrary precision rationals, they exactly
|
||||
represent the floating point number, but not the text.
|
||||
represent the floating point number, but not the text!
|
||||
|
||||
This is different in the second block, which corresponds
|
||||
to reading numbers from a file. The arbitrary precision
|
||||
|
|
@ -106,67 +100,63 @@ In the third block you see that constructions as
|
|||
midpoint constructions are exact, just as the name
|
||||
of the kernel type suggests.
|
||||
|
||||
|
||||
In many cases you will have floating point numbers that are "exact",
|
||||
In many cases, you will have floating point numbers that are "exact",
|
||||
in the sense that they were computed by some application or obtained
|
||||
from a sensor. They are not the string "0.1" or computed on the
|
||||
from a sensor. They are not the string "0.1" or computed on the
|
||||
fly as "1.0/10.0", but a full precision floating point number.
|
||||
If they are input to an algorithm that makes no constructions
|
||||
you can use a kernel that provides exact predicates, but inexact
|
||||
constructions. An example for that is the convex hull algorithm
|
||||
If they are input to an algorithm that makes no constructions,
|
||||
you can use a kernel that provides exact predicates but <em>inexact</em>
|
||||
constructions. One such example is the convex hull algorithm
|
||||
which we will see in the next section.
|
||||
The output is a subset of the input, and the algorithm
|
||||
only compares coordinates and performs orientation tests.
|
||||
The output is a subset of the input, and the algorithm
|
||||
only compares coordinates and performs orientation tests.
|
||||
|
||||
At a first glance the kernel doing exact predicates and constructions
|
||||
seems to be the perfect choice, but performance requirements
|
||||
or limited memory resources make that it is not. Also for many
|
||||
or limited memory resources make that it is not. Furthermore, for many
|
||||
algorithms it is irrelevant to do exact constructions. For example
|
||||
a surface mesh simplification algorithm that iteratively contracts
|
||||
an edge, by collapsing it to the midpoint of the edge.
|
||||
|
||||
Most \cgal packages explain what kind of kernel they need or support.
|
||||
an edge by collapsing it to the midpoint of the edge.
|
||||
|
||||
Most \cgal packages explain which kind of kernel they should use or support.
|
||||
|
||||
\section intro_convex_hull The Convex Hull of a Sequence of Points
|
||||
|
||||
All examples in this section compute the 2D convex hull of a set of points.
|
||||
We show that algorithms get their input as a begin/end iterator pair
|
||||
denoting a range of points, and that they write the result, in the
|
||||
example the points on the convex hull, into an output iterator.
|
||||
|
||||
We show that algorithms get their input as a begin/end iterator pair
|
||||
denoting a range of points, and that they write the result (in the
|
||||
example the points on the convex hull) into an output iterator.
|
||||
|
||||
\subsection intro_array The Convex Hull of Points in a Built-in Array
|
||||
|
||||
In the first example we have as input an array of five points.
|
||||
As the convex hull of these points is a subset of the input
|
||||
In the first example, we have as input an array of five points.
|
||||
As the convex hull of these points is a subset of the input,
|
||||
it is safe to provide an array for storing the result which
|
||||
has the same size.
|
||||
|
||||
\cgalExample{Convex_hull_2/array_convex_hull_2.cpp}
|
||||
|
||||
We saw in the previous section that \cgal comes
|
||||
with several kernels. As the convex hull algorithm only makes
|
||||
We have seen in the previous section that \cgal comes
|
||||
with several kernels. Since the convex hull algorithm only makes
|
||||
comparisons of coordinates and orientation tests of input points,
|
||||
we can choose a kernel that provides exact predicates, but no
|
||||
we can choose a kernel that provides exact predicates, but no
|
||||
exact geometric constructions.
|
||||
|
||||
The convex hull function takes three arguments, the start
|
||||
and past-the-end pointer for the input, and the start pointer of the
|
||||
and past-the-end pointer for the input, and the start pointer of the
|
||||
array for the result. The function returns the pointer
|
||||
into the result array just behind the last convex hull
|
||||
point written, so the pointer difference tells us how
|
||||
many points are on the convex hull.
|
||||
|
||||
many points are on the convex hull.
|
||||
|
||||
\subsection intro_vector The Convex Hull of Points in a Vector
|
||||
|
||||
In the second example we replace the built-in array
|
||||
by a `std::vector` of the Standard Template Library.
|
||||
In the second example, we replace the built-in array
|
||||
by an `std::vector` of the Standard Template Library.
|
||||
|
||||
\cgalExample{Convex_hull_2/vector_convex_hull_2.cpp}
|
||||
|
||||
We put some points in the vector calling the `push_back()`
|
||||
We put some points in the vector, calling the `push_back()`
|
||||
method of the `std::vector` class.
|
||||
|
||||
We then call the convex hull function. The first two arguments,
|
||||
|
|
@ -175,8 +165,8 @@ generalization of pointers: they can be dereferenced and
|
|||
incremented. The convex hull function is *generic* in the sense
|
||||
that it takes as input whatever can be dereferenced and incremented.
|
||||
|
||||
The third argument is where the result gets written to. In the
|
||||
previous example we provided a pointer to allocated memory. The
|
||||
The third argument is where the result gets written to. In the
|
||||
previous example we provided a pointer to allocated memory. The
|
||||
generalization of such a pointer is the *output iterator*, which
|
||||
allows to increment and assign a value to the dereferenced iterator.
|
||||
In this example we start with an empty vector which grows as needed.
|
||||
|
|
@ -185,34 +175,32 @@ iterator generated by the helper function
|
|||
`std::back_inserter(result)`. This output iterator does nothing when
|
||||
incremented, and calls `result.push_back(..)` on the assignment.
|
||||
|
||||
|
||||
If you know the \stl, the Standard Template Library, the above makes
|
||||
perfect sense, as this is the way the \stl decouples algorithms from
|
||||
containers. If you don't know the \stl, you maybe better first
|
||||
familiarize yourself with its basic ideas.
|
||||
|
||||
|
||||
\section intro_traits About Kernels and Traits Classes
|
||||
|
||||
In this section we show how we express the requirements that must
|
||||
In this section, we show how we express the requirements that must
|
||||
be fulfilled in order that a function like `convex_hull_2()`
|
||||
can be used with an arbitrary point type.
|
||||
|
||||
If you look at the manual page of the function `convex_hull_2()`
|
||||
and the other 2D convex hull algorithms, you see that they come in two
|
||||
versions. In the examples we have seen so far the function that takes two
|
||||
versions. In the examples we have seen so far, the function that takes two
|
||||
iterators for the range of input points and an output iterator for
|
||||
writing the result to. The second version has an additional template
|
||||
parameter `Traits`, and an additional parameter of this type.
|
||||
|
||||
\code{.cpp}
|
||||
template<class InputIterator , class OutputIterator , class Traits >
|
||||
OutputIterator
|
||||
OutputIterator
|
||||
convex_hull_2(InputIterator first,
|
||||
InputIterator beyond,
|
||||
OutputIterator result,
|
||||
const Traits & ch_traits)
|
||||
\endcode
|
||||
\endcode
|
||||
|
||||
What are the geometric primitives a typical convex hull algorithm
|
||||
uses? Of course, this depends on the algorithm, so let us consider
|
||||
|
|
@ -238,10 +226,8 @@ test, while `Less_xy_2` is used for sorting the points. The requirements these
|
|||
types have to satisfy are documented in full with the concept
|
||||
`ConvexHullTraits_2`.
|
||||
|
||||
|
||||
|
||||
The types are regrouped for a simple reason. The alternative would
|
||||
have been a rather lengthy function template, and an even longer
|
||||
have been a rather lengthy function template, and an even longer
|
||||
function call.
|
||||
|
||||
\code{.cpp}
|
||||
|
|
@ -258,7 +244,7 @@ this template parameter? And why do we have template parameters at all?
|
|||
To answer the first question, any model of the %CGAL concept `Kernel` provides
|
||||
what is required by the concept `ConvexHullTraits_2`.
|
||||
|
||||
As for the second question, think about an application where we want to
|
||||
As for the second question, think about an application where we want to
|
||||
compute the convex hull of 3D points projected into the `yz` plane. Using
|
||||
the class `Projection_traits_yz_3` this is a small modification
|
||||
of the previous example.
|
||||
|
|
@ -277,15 +263,14 @@ traits object to store state, for example if the projection plane was
|
|||
given by a direction, which is hardwired in the class
|
||||
`Projection_traits_yz_3`.
|
||||
|
||||
|
||||
\section intro_concept Concepts and Models
|
||||
|
||||
In the previous section we wrote that "Any model of the CGAL concept
|
||||
Kernel provides what is required by the concept ConvexHullTraits_2".
|
||||
In the previous section, we wrote that "Any model of the CGAL concept
|
||||
Kernel provides what is required by the concept `ConvexHullTraits_2`.
|
||||
|
||||
A \em concept is a set of requirements on a type, namely that it has
|
||||
certain nested types, certain member functions, or comes with certain
|
||||
free functions that take the type as it. A \em model of a concept
|
||||
free functions that take the type as it. A \em model of a concept
|
||||
is a class that fulfills the requirements of the concept.
|
||||
|
||||
Let's have a look at the following function.
|
||||
|
|
@ -299,30 +284,30 @@ duplicate(T t)
|
|||
}
|
||||
\endcode
|
||||
|
||||
If you want to instantiate this function with a class `C` this
|
||||
class must at least provide a copy constructor, and we
|
||||
say that class `C` must be a model of `CopyConstructible`.
|
||||
If you want to instantiate this function with a class `C`, this
|
||||
class must at least provide a copy constructor, and we
|
||||
say that class `C` must be a model of `CopyConstructible`.
|
||||
A singleton class does not fulfill this requirment.
|
||||
|
||||
Another example is the function
|
||||
Another example is the function:
|
||||
|
||||
\code{.cpp}
|
||||
template <typename T>
|
||||
template <typename T>
|
||||
T& std::min(const T& a, const T& b)
|
||||
{
|
||||
return (a<b)?a:b;
|
||||
}
|
||||
}
|
||||
\endcode
|
||||
|
||||
This function only compiles if the `operator<(..)` is defined for the type used as `T`,
|
||||
and we say that the type must be a model of `LessThanComparable`.
|
||||
|
||||
An example for a concept with required free functions is the `HalfedgeListGraph` in the
|
||||
\cgal package \ref PkgBGL. In order to be a model of `HalfedgeListGraph` a class `G`
|
||||
\cgal package \ref PkgBGL. In order to be a model of `HalfedgeListGraph` a class `G`
|
||||
there must be a global function `halfedges(const G&)`, etc.
|
||||
|
||||
An example for a concept with a required traits class is `InputIterator`.
|
||||
For a model of an `InputIterator` a specialization of the class
|
||||
For a model of an `InputIterator` a specialization of the class
|
||||
<a href="http://en.cppreference.com/w/cpp/iterator/iterator_traits"> `std::iterator_traits`</a>
|
||||
must exist (or the generic template must be applicable).
|
||||
|
||||
|
|
@ -333,11 +318,9 @@ Tutorial and Reference" by Nicolai M. Josuttis from Addison-Wesley, or
|
|||
"Generic Programming and the STL" by Matthew H. Austern for the \stl
|
||||
and its notion of *concepts* and *models*.
|
||||
|
||||
Other resources for \cgal are the rest of the \ref tutorials "tutorials"
|
||||
and the user support page at
|
||||
https://www.cgal.org/.
|
||||
Other resources for \cgal are the rest of the \ref tutorials "tutorials"
|
||||
and the user support page at https://www.cgal.org/.
|
||||
|
||||
*/
|
||||
} /* namespace CGAL */
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -8,9 +8,7 @@ combined to achieve extensive and complex geometric tasks. The tutorials aim at
|
|||
providing help and ideas on how to use CGAL beyond the simple examples of the
|
||||
User Manual.
|
||||
|
||||
|
||||
|
||||
\section tuto_list List of available tutorials
|
||||
\section tuto_list List of Available Tutorials
|
||||
|
||||
- \subpage tutorial_hello_world presents you some short example
|
||||
programs to get a first idea for the look and feel of a program that
|
||||
|
|
@ -19,4 +17,9 @@ User Manual.
|
|||
define what primitives are used by a geometric algorithm, the
|
||||
notions of \em concept and \em model.
|
||||
|
||||
\section tuto_examples Package Examples
|
||||
|
||||
Each \cgal package comes with a set of commented examples that illustrate basic features of the package.
|
||||
See for example Section \ref Triangulation3secexamples of the User Manual of the package \ref PkgTriangulation3.
|
||||
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,240 @@
|
|||
/*!
|
||||
\page usage Using %CGAL on Unix (Linux, macOS, ...)
|
||||
\cgalAutoToc
|
||||
|
||||
Since \cgal version 5.0, \cgal is header-only be default, which means
|
||||
that there is <b>no need to build \cgal before it can be used</b>.
|
||||
However, some dependencies of \cgal might still need to be installed.
|
||||
|
||||
\section usage_introduction Quick Start: Compiling a Program using CGAL
|
||||
|
||||
Assuming that you have obtained \cgal through one of the package managers offering \cgal on your platform
|
||||
(see Section \ref secgettingcgal), you can download \cgal examples (
|
||||
<a href="https://github.com/CGAL/cgal/releases/download/releases/CGAL-\cgalReleaseNumber/CGAL-\cgalReleaseNumber-examples.tar.xz">CGAL-\cgalReleaseNumber-examples.tar.xz</a>)
|
||||
and the compilation of an example is as simple as:
|
||||
|
||||
cd $HOME/CGAL-\cgalReleaseNumber/examples/Triangulation_2 # go to an example directory
|
||||
cmake -DCMAKE_BUILD_TYPE=Release . # configure the examples
|
||||
make # build the examples
|
||||
|
||||
Compiling your own program is similar:
|
||||
|
||||
cd /path/to/your/program
|
||||
path/to/cgal/Scripts/scripts/cgal_create_CMakeLists -s your_program
|
||||
cmake -DCMAKE_BUILD_TYPE=Release .
|
||||
make
|
||||
|
||||
The script `cgal_create_CMakeLists` and its options are detailed in Section \ref devman_create_cgal_CMakeLists.
|
||||
|
||||
In a less ideal world, you might have to install some required tools and third-party libraries.
|
||||
This is what this page is about.
|
||||
|
||||
\section secprerequisites Prerequisites
|
||||
|
||||
Using \cgal requires a few core components to be previously installed:
|
||||
<ul>
|
||||
<li> a supported compiler (see Section \ref seccompilers),</li>
|
||||
<li> \ref seccmake,</li>
|
||||
<li> \ref thirdpartyBoost,</li>
|
||||
<li> \ref thirdpartyMPFR.</li>
|
||||
</ul>
|
||||
|
||||
Optional third-party software might be required to build examples and demos shipped with \cgal,
|
||||
or to build your own project using \cgal, see Section \ref secoptional3rdpartysoftware.
|
||||
|
||||
\section secgettingcgal Downloading CGAL
|
||||
|
||||
\cgal can be obtained through different channels. We recommend using a package manager as
|
||||
this will ensure that all essential third party dependencies are present, and with the correct versions.
|
||||
You may also download the sources of \cgal directly, but it is then your responsability to independently
|
||||
acquire these dependencies.
|
||||
|
||||
The examples and demos of \cgal are not included when you install \cgal with a package manager,
|
||||
and must be downloaded
|
||||
<a href="https://github.com/CGAL/cgal/releases/download/releases/CGAL-\cgalReleaseNumber/CGAL-\cgalReleaseNumber-examples.tar.xz">here</a>.
|
||||
|
||||
\subsection secusingpkgman Using a Package Manager
|
||||
|
||||
On most operating systems, package managers offer \cgal and its essential third party dependencies.
|
||||
|
||||
On macOS, we recommend using of <a href="https://brew.sh/">Homebrew</a> in the following way:
|
||||
|
||||
brew install cgal
|
||||
|
||||
On Linux distributions such as `Debian`/`Ubuntu`/`Mint`, use `apt-get` in the following way:
|
||||
|
||||
sudo apt-get install libcgal-dev
|
||||
|
||||
For other distributions or package manager, please consult your respective documentation.
|
||||
|
||||
\subsection secusingwebsite Using CGAL Source Archive
|
||||
|
||||
You can also obtain the \cgal library sources directly from
|
||||
<A HREF="https://www.cgal.org/download.html">https://www.cgal.org/download.html</A>.
|
||||
|
||||
Once you have downloaded the file `CGAL-\cgalReleaseNumber``.tar.xz` containing the
|
||||
\cgal sources, you have to unpack it. Under a Unix-like shell, use the
|
||||
command:
|
||||
|
||||
tar xf CGAL-\cgalReleaseNumber.tar.xz
|
||||
|
||||
The directory `CGAL-\cgalReleaseNumber` will be created. This directory
|
||||
contains the following subdirectories:
|
||||
|
||||
| Directory | Contents |
|
||||
| :------------------------- | :----------|
|
||||
| `auxiliary` (Windows only) | precompiled \sc{Gmp} and \sc{Mpfr} for Windows |
|
||||
| `cmake/modules` | modules for finding and using libraries |
|
||||
| `demo` | demo programs (most of them need \sc{Qt}, geomview or other third-party products) |
|
||||
| `doc_html` | documentation (HTML) |
|
||||
| `examples` | example programs |
|
||||
| `include` | header files |
|
||||
| `scripts` | some useful scripts (e.g. for creating CMakeLists.txt files) |
|
||||
| `src` | source files |
|
||||
|
||||
The directories `include/CGAL/CORE` and `src/CGALCore` contain a
|
||||
distribution of the <a href="https://cs.nyu.edu/exact/">Core library</a> version 1.7 for
|
||||
dealing with algebraic numbers. Note that \sc{Core} is not part of \cgal and has its
|
||||
own license.
|
||||
|
||||
The directory `include/CGAL/OpenNL` contains a distribution of the
|
||||
<a href="http://alice.loria.fr/index.php/software/4-library/23-opennl.html">Open Numerical Library</a>,
|
||||
which provides solvers for sparse linear systems, especially designed for the Computer Graphics community.
|
||||
\sc{OpenNL} is not part of \cgal and has its own license.
|
||||
|
||||
The only documentation shipped within \cgal sources is the present manual.
|
||||
The \cgal manual can also be accessed online at
|
||||
<a href="https://doc.cgal.org/latest/Manual/index.html">`https://doc.cgal.org`</a>
|
||||
or downloaded separately at
|
||||
<a href="https://github.com/CGAL/cgal/releases">`https://github.com/CGAL/cgal/releases`</a>.
|
||||
|
||||
\section section_headeronly Header-only Usage
|
||||
|
||||
\cgal is a <a href="https://en.wikipedia.org/wiki/Header-only">header-only</a> library, and as such
|
||||
there is no need to even configure it before using it. Programs using \cgal (examples, tests, demos, etc.)
|
||||
are instead configured using CMake and \cgal will be configured at the same time.
|
||||
|
||||
There is one exception to the last paragraph: if you want to install \cgal header files to
|
||||
a standard location (such as `/usr/local/include`):
|
||||
|
||||
cmake .
|
||||
make install
|
||||
|
||||
For more advanced installations, we refer to Section \ref installation_configwithcmake.
|
||||
|
||||
Note that even though \cgal is a header-only library, not all its dependencies
|
||||
are header-only. The libraries \sc{Gmp} and \sc{Mpfr}, for example, are not
|
||||
header-only. As such, these dependencies must be built or installed independently.
|
||||
|
||||
\section usage_configuring Configuring your Program
|
||||
|
||||
Before building anything using \cgal you have to choose the compiler/linker, set compiler
|
||||
and linker flags, specify which third-party libraries you want to use and where they can be found.
|
||||
Gathering all this information is called <I>configuration</I>. The end of the process is marked
|
||||
by the generation of a makefile or a Visual \cpp solution and project file that you can use
|
||||
to build your program.
|
||||
|
||||
CMake maintains configuration parameters in so-called <I>Cmake variables</I>, like the `CMAKE_CXX_COMPILER`
|
||||
in the example above. These variables <I>are not environment variables</I> but <I>CMake variables</I>.
|
||||
Some of the CMake variables represent user choices, such as `CMAKE_BUILD_TYPE`,
|
||||
whereas others indicate the details of a third-party library, such as `Boost_INCLUDE_DIR`
|
||||
or the compiler flags to use, such as `CMAKE_CXX_FLAGS`.
|
||||
|
||||
The most important CMake variable is the variable `CGAL_DIR`, which will serve to configure \cgal
|
||||
as you configure your program.
|
||||
|
||||
In a typical installation of dependencies, almost all CMake variables will be set automatically.
|
||||
The variable `CGAL_DIR` is also generally found when \cgal has been obtained via a package manager.
|
||||
In the rare event that it has not, the variable `CGAL_DIR` should be set manually to:
|
||||
|
||||
<ul>
|
||||
<li>something like `/usr/local/Cellar/cgal/CGAL-\cgalReleaseNumber/lib/cmake/CGAL`, for Brew.</li>
|
||||
<li>something like `/usr/lib/x86_64-linux-gnu/cmake/CGAL`, for Linux distributions.</li>
|
||||
</ul>
|
||||
|
||||
If \cgal has been obtained via other means, `CGAL_DIR` must point to the root directory
|
||||
of the \cgal source code (either the root of the unpacked release tarball or the root
|
||||
of the Git working directory).
|
||||
|
||||
It is also strongly recommended to set the build type variable to `Release` for performance reasons
|
||||
if no debugging is intended. Users should thus run:
|
||||
|
||||
cd CGAL-\cgalReleaseNumber/examples/Triangulation_2
|
||||
cmake -DCGAL_DIR=$HOME/CGAL-\cgalReleaseNumber -DCMAKE_BUILD_TYPE=Release . # we are here using a release tarball
|
||||
|
||||
\subsection usage_configuring_cmake_gui Specifying Missing Dependencies
|
||||
|
||||
The configuration process launched above might fail if CMake fails to find
|
||||
all the required dependencies. This typically happens if you have installed dependencies
|
||||
at non-standard locations.
|
||||
Although the command line tool `cmake` accepts CMake variables as arguments of the form
|
||||
`-D<VAR>:<TYPE>=<VALUE>`, this is only useful if you already know which variables
|
||||
need to be explicitly defined. or this reason, the simplest way to manually set the missing variables
|
||||
is to run the graphical user interface of CMake, `cmake-gui`.
|
||||
|
||||
cd CGAL-\cgalReleaseNumber/examples/Triangulation_2
|
||||
cmake-gui .
|
||||
|
||||
After the `CMake` window opens, press 'Configure'. A dialog will pop up and you will have to choose
|
||||
what shall be generated. After you have made your choice and pressed 'Finish', you will see
|
||||
the output of configuration tests in the lower portion of the application.
|
||||
Once these tests are done, you will see many red entries in the upper portion of the application.
|
||||
Just ignore them, and press 'Configure' again. By now, CMake should have found most required
|
||||
libraries and have initialized variables.
|
||||
If red entries are still present, you must provide the necessary information (paths/values).
|
||||
When all entries have been appropriately filled (and automatically filled values have been adjusted,
|
||||
if desired) and lines are gray, you are now ready to press 'Generate',
|
||||
and to exit `cmake-gui` afterwards.
|
||||
|
||||
\cgalAdvancedBegin
|
||||
You may also decide to solve missing dependencies using the command line tool (which is not recommended).
|
||||
If so, the page \ref configurationvariables lists variables which can be used to specify
|
||||
the location of third-party software.
|
||||
\cgalAdvancedEnd
|
||||
|
||||
If you do not need to debug, you should set the variable `CMAKE_BUILD_TYPE` to `Release`.
|
||||
|
||||
\subsection usage_configuring_external Configuring an External Program
|
||||
|
||||
Running `cmake` (or `cmake-gui`) requires a `CMakeLists.txt` file. This file is automatically provided
|
||||
for all shipped examples and demos of \cgal. For other programs, CMake can also be used to configure
|
||||
and build user programs, but one has to provide the corresponding `CMakeLists.txt`.
|
||||
This script can be generated either manually, or with the help of a shell-script,
|
||||
see Section \ref devman_create_cgal_CMakeLists. Using this shell-script,
|
||||
the process of configuring a user's program called `your_program.cpp` amounts to:
|
||||
|
||||
cd /path/to/your/program
|
||||
path/to/cgal/Scripts/scripts/cgal_create_CMakeLists -s your_program
|
||||
cmake -DCGAL_DIR=$HOME/CGAL-\cgalReleaseNumber -DCMAKE_BUILD_TYPE=Release .
|
||||
|
||||
Note that the script `cgal_create_CMakeLists` creates a very coarse `CMakeLists.txt` file which
|
||||
might not properly encode the third party dependencies of your program. Users are advised to look
|
||||
at the `CMakeLists.txt` files in the example folder(s) of the package that they are using to
|
||||
learn how to specify their dependencies.
|
||||
|
||||
\subsection usage_configuring_advanced_cmake Advanced Configuration Options
|
||||
|
||||
CMake keeps the variables that a user can manipulate in a so-called CMake cache, a simple text file
|
||||
named `CMakeCache.txt`, whose entries are of the form `VARIABLE:TYPE=VALUE`. Advanced users can manually
|
||||
edit this file, instead of going through the interactive configuration session.
|
||||
|
||||
\section usage_building_program Building your Program
|
||||
|
||||
The results of a successful configuration are build files that control the build step.
|
||||
The nature of the build files depends on the generator used during configuration, but in most cases
|
||||
they contain several <I>targets</I>, such as all the examples of the Triangulation_2 package.
|
||||
|
||||
In a \sc{Unix}-like environment the default generator produces makefiles.
|
||||
You can use the `make` command-line tool for the succeeding build step as follows:
|
||||
|
||||
cd CGAL-\cgalReleaseNumber/examples/Triangulation_2
|
||||
make # build all the examples of the Triangulation_2 package
|
||||
|
||||
\cgalAdvancedBegin
|
||||
The build files produced by CMake are autoconfigured. That is, if you change any of the dependencies,
|
||||
the build step automatically goes all the way back to the configuration step. This way, once the target
|
||||
has been configured the very first time by invoking cmake, you don't necessarily need to invoke `cmake`
|
||||
again. Rebuilding will call itself `cmake` and re-generate the build file whenever needed.
|
||||
\cgalAdvancedEnd
|
||||
|
||||
*/
|
||||
|
|
@ -0,0 +1,353 @@
|
|||
/*!
|
||||
|
||||
\page configurationvariables Summary of %CGAL's Configuration Variables
|
||||
\cgalAutoToc
|
||||
|
||||
\cgalAdvancedBegin
|
||||
This page lists CMake variables which you can use to help CMake find missing dependencies
|
||||
while using the command line. We however recommend using the graphical interface (`cmake-gui`).
|
||||
\cgalAdvancedEnd
|
||||
|
||||
\section installation_summary Summary of CGAL's Configuration Variables
|
||||
|
||||
Most configuration variables are not environment variables but
|
||||
<I>CMake variables</I>. They are given in the command line to CMake
|
||||
via the `-D` option, or passed from the interactive interface
|
||||
of `cmake-gui`. Unless indicated differently, all the variables
|
||||
summarized below are CMake variables.
|
||||
|
||||
\subsection installation_component_selection Component Selection
|
||||
|
||||
The following boolean variables indicate which \cgal components to
|
||||
configure and build. Their values can be ON or OFF.
|
||||
|
||||
|
||||
| Variable | %Default Value |
|
||||
| :------- | :--------------- |
|
||||
| `WITH_examples` | OFF |
|
||||
| `WITH_demos` | OFF |
|
||||
| `WITH_CGAL_Core` | ON |
|
||||
| `WITH_CGAL_Qt5` | ON |
|
||||
| `WITH_CGAL_ImageIO` | ON |
|
||||
|
||||
\subsection installation_flags Compiler and Linker Flags
|
||||
|
||||
The following variables specify compiler and linker flags. Each variable holds a
|
||||
space-separated list of command-line switches for the compiler and linker and
|
||||
their default values are automatically defined by CMake based on the target platform.
|
||||
|
||||
Have in mind that these variables specify a list of flags, not just one
|
||||
single flag. If you provide your own definition for a variable, you will <I>entirely</I> override
|
||||
the list of flags chosen by CMake for that particular variable.
|
||||
|
||||
The variables that correspond to both debug and release builds are always
|
||||
used in conjunction with those for the specific build type.
|
||||
|
||||
|
||||
| Program | Both Debug and Release | Release Only | Debug Only |
|
||||
| :------ | :---------------------- | :------------- | :----------- |
|
||||
| C++ Compiler | `CMAKE_CXX_FLAGS` | `CMAKE_CXX_FLAGS_RELEASE` | `CMAKE_CXX_FLAGS_DEBUG` |
|
||||
| Linker (shared libs) | `CMAKE_SHARED_LINKER_FLAGS` | `CMAKE_SHARED_LINKER_FLAGS_RELEASE` | `CMAKE_SHARED_LINKER_FLAGS_DEBUG` |
|
||||
| Linker (static libs) | `CMAKE_MODULE_LINKER_FLAGS` | `CMAKE_MODULE_LINKER_FLAGS_RELEASE` | `CMAKE_MODULE_LINKER_FLAGS_DEBUG` |
|
||||
| Linker (programs) | `CMAKE_EXE_LINKER_FLAGS` | `CMAKE_EXE_LINKER_FLAGS_RELEASE` | `CMAKE_EXE_LINKER_FLAGS_DEBUG`|
|
||||
|
||||
|
||||
\subsection installation_additional_flags Additional Compiler and Linker Flags
|
||||
|
||||
The following variables can be used to <I>add</I> flags without overriding the ones
|
||||
defined by cmake.
|
||||
|
||||
|
||||
| Program | Both Debug and Release | Release Only | Debug Only |
|
||||
| :------ | :---------------------- | :------------- | :----------- |
|
||||
| C++ Compiler | `CGAL_CXX_FLAGS` | `CGAL_CXX_FLAGS_RELEASE` | `CGAL_CXX_FLAGS_DEBUG` |
|
||||
| Linker (shared libs) | `CGAL_SHARED_LINKER_FLAGS` | `CGAL_SHARED_LINKER_FLAGS_RELEASE` | `CGAL_SHARED_LINKER_FLAGS_DEBUG` |
|
||||
| Linker (static libs) | `CGAL_MODULE_LINKER_FLAGS` | `CGAL_MODULE_LINKER_FLAGS_RELEASE` | `CGAL_MODULE_LINKER_FLAGS_DEBUG` |
|
||||
| Linker (programs) | `CGAL_EXE_LINKER_FLAGS` | `CGAL_EXE_LINKER_FLAGS_RELEASE` | `CGAL_EXE_LINKER_FLAGS_DEBUG` |
|
||||
|
||||
\subsection installation_misc Miscellaneous Variables
|
||||
|
||||
Note that the default build type is <b>`Debug`</b>, which should only be used to debug
|
||||
and will serverly limit performances.
|
||||
|
||||
| Variable | Description | Type | %Default Value |
|
||||
| :- | :- | :- | :- |
|
||||
| `CMAKE_BUILD_TYPE` | Indicates type of build. Possible values are 'Debug' or 'Release' | CMake | |
|
||||
| `CMAKE_INSTALL_PREFIX`| Installation directory path | CMake | Debug |
|
||||
| `CMAKE_C_COMPILER` | Full-path to the executable corresponding to the C compiler to use. | CMake | platform-dependent |
|
||||
| `CMAKE_CXX_COMPILER` | Full-path to the executable corresponding to the C++ compiler to use. | CMake | platform-dependent |
|
||||
| `CXX` | Idem | Environment | Idem |
|
||||
| `BUILD_SHARED_LIBS` | Whether to build shared or static libraries. | CMake | TRUE |
|
||||
|
||||
\subsection installation_variables_building Variables Used Only When Building Programs (Such as Demos or Examples)
|
||||
|
||||
|
||||
| Variable | Description | Type | %Default Value |
|
||||
| :- | :- | :- | :- |
|
||||
| `CGAL_DIR` | Full-path to the binary directory where \cgal was configured |Either CMake or Environment | none |
|
||||
|
||||
|
||||
\subsection installation_variables_third_party Variables Providing Information About 3rd-Party Libraries
|
||||
\anchor sec3partysoftwareconfig
|
||||
|
||||
The following variables provide information about the availability and
|
||||
location of the 3rd party libraries used by \cgal. CMake automatically
|
||||
searches for dependencies so you need to specify these variables if
|
||||
CMake was unable to locate something. This is indicated by a value ending in
|
||||
`NOTFOUND`.
|
||||
|
||||
Since 3rd-party libraries are system wide, many of the CMake variables listed below can alternatively
|
||||
be given as similarly-named environment variables instead. Keep in mind that you must provide one or the
|
||||
other but never both.
|
||||
|
||||
\subsection installation_boost Boost Libraries
|
||||
|
||||
In most cases, if \sc{Boost} is not automatically found, setting the `BOOST_ROOT`
|
||||
variable is enough. If it is not, you can specify the header and library
|
||||
directories individually. You can also provide the full pathname to a specific compiled library
|
||||
if it cannot be found in the library directory or its name is non-standard.
|
||||
|
||||
By default, when \sc{Boost} binary libraries are needed, the shared versions
|
||||
are used if present. You can set the variable
|
||||
`CGAL_Boost_USE_STATIC_LIBS` to `ON` if you want to link
|
||||
with static versions explicitly.
|
||||
|
||||
On Windows, if you link with \sc{Boost} shared libraries, you must ensure that
|
||||
the `.dll` files are found by the dynamic linker, at run time.
|
||||
For example, you can add the path to the \sc{Boost} `.dll` to the
|
||||
`PATH` environment variable.
|
||||
|
||||
| Variable | Description | Type |
|
||||
| :- | :- | :- |
|
||||
| `BOOST_ROOT`\cgalFootnote{The environment variable can be spelled either `BOOST_ROOT` or `BOOSTROOT`} | Root directory of your \sc{Boost} installation | Either CMake or Environment |
|
||||
| `Boost_INCLUDE_DIR` | Directory containing the `boost/version.hpp` file | CMake |
|
||||
| `BOOST_INCLUDEDIR` | Idem | Environment |
|
||||
| `Boost_LIBRARY_DIRS` | Directory containing the compiled \sc{Boost} libraries | CMake |
|
||||
| `BOOST_LIBRARYDIR` | Idem | Environment |
|
||||
| `Boost_(xyz)_LIBRARY_RELEASE` | Full pathname to a release build of the compiled 'xyz' \sc{Boost} library | CMake |
|
||||
| `Boost_(xyz)_LIBRARY_DEBUG` | Full pathname to a debug build of the compiled 'xyz' \sc{Boost} library | CMake |
|
||||
|
||||
|
||||
\subsection installation_gmp GMP and MPFR Libraries
|
||||
|
||||
Under Windows, auto-linking is used, so only the <I>directory</I>
|
||||
containing the libraries is needed and you would specify `GMP|MPFR_LIBRARY_DIR` rather than
|
||||
`GMP|MPFR_LIBRARIES`. On the other hand, under Linux the actual library filename is needed.
|
||||
Thus you would specify `GMP|MPFR_LIBRARIES`. In no case you need to specify both.
|
||||
|
||||
\cgal uses both \sc{Gmp} and \sc{Mpfr} so both need to be supported. If either of them is unavailable the
|
||||
usage of \sc{Gmp} and of \sc{Mpfr} will be disabled.
|
||||
|
||||
|
||||
| Variable | Description | Type |
|
||||
| :- | :- | :- |
|
||||
| `CGAL_DISABLE_GMP` | Indicates whether to search and use \sc{Gmp}/\sc{Mpfr} or not | CMake |
|
||||
| `GMP_DIR` | Directory of \sc{Gmp} default installation | Environment |
|
||||
| `GMP_INCLUDE_DIR` | Directory containing the `gmp.h` file | CMake |
|
||||
| `GMP_INC_DIR` | Idem | Environment |
|
||||
| `GMP_LIBRARIES_DIR` | Directory containing the compiled \sc{Gmp} library | CMake |
|
||||
| `GMP_LIB_DIR` | Idem | Environment |
|
||||
| `GMP_LIBRARIES` | Full pathname of the compiled \sc{Gmp} library | CMake |
|
||||
| `MPFR_INCLUDE_DIR` | Directory containing the `mpfr.h` file | CMake |
|
||||
| `MPFR_INC_DIR` | Idem | Environment |
|
||||
| `MPFR_LIBRARIES_DIR` | Directory containing the compiled \sc{Mpfr} library | CMake |
|
||||
| `MPFR_LIB_DIR` | Idem | Environment |
|
||||
| `MPFR_LIBRARIES` | Full pathname of the compiled \sc{Mpfr} library | CMake |
|
||||
|
||||
|
||||
|
||||
Under Linux, the \sc{Gmpxx} is also searched for, and you may specify the following variables:
|
||||
|
||||
|
||||
| Variable | Description | Type |
|
||||
| :- | :- | :- |
|
||||
| `GMPXX_DIR` | Directory of \sc{gmpxx} default installation | Environment |
|
||||
| `GMPXX_INCLUDE_DIR` | Directory containing the `gmpxx.h` file | CMake |
|
||||
| `GMPXX_LIBRARIES` | Full pathname of the compiled \sc{Gmpxx} library | CMake |
|
||||
|
||||
|
||||
|
||||
\subsection installation_qt5 Qt5 Library
|
||||
|
||||
You must set the cmake or environment variable `Qt5_DIR` to point to the path
|
||||
to the directory containing the file `Qt5Config.cmake` created by your \sc{Qt}5 installation. If you are
|
||||
using the open source edition it should be `<path>/qt-everywhere-opensource-src-<version>/qtbase/lib/cmake/Qt5`.
|
||||
|
||||
\subsection installation_leda LEDA Library
|
||||
|
||||
When the \leda libraries are not automatically found, yet they are installed on the system
|
||||
with base names 'leda' and 'ledaD' (for the release and debug versions resp.), it might
|
||||
be sufficient to just indicate the library directory via the `LEDA_LIBRARY_DIRS` variable.
|
||||
If that doesn't work because, for example, the names are different, you can provide the full pathnames of each variant
|
||||
via `LEDA_LIBRARY_RELEASE` and `LEDA_LIBRARY_DEBUG`.
|
||||
|
||||
The variables specifying definitions and flags can be left undefined if they are not needed by LEDA.
|
||||
|
||||
|
||||
| Variable | Description | Type |
|
||||
| :- | :- | :- |
|
||||
| `WITH_LEDA` | Indicates whether to search and use \leda or not | CMake |
|
||||
| `LEDA_DIR` | Directory of \sc{LEDA} default installation | Environment |
|
||||
| `LEDA_INCLUDE_DIR` | Directory containing the file `LEDA/system/basic.h` | CMake |
|
||||
| `LEDA_LIBRARIES` | Directory containing the compiled \leda libraries | CMake |
|
||||
| `LEDA_INC_DIR` | Directory containing the file `LEDA/system/basic.h` | Environment |
|
||||
| `LEDA_LIB_DIR` | Directory containing the compiled \leda libraries | Environment |
|
||||
| `LEDA_LIBRARY_RELEASE` | Full pathname to a release build of the \leda library | CMake |
|
||||
| `LEDA_LIBRARY_DEBUG` | Full pathname to a debug build of the \leda library | CMake |
|
||||
| `LEDA_DEFINITIONS` | Preprocessor definitions | CMake |
|
||||
| `LEDA_CXX_FLAGS` | Compiler flags | CMake |
|
||||
| `LEDA_LINKER_FLAGS` | Linker flags | CMake |
|
||||
|
||||
|
||||
\subsection installation_mpfi MPFI Library
|
||||
|
||||
\cgal provides a number type based on this library, but the \cgal library
|
||||
itself does not depend on \sc{Mpfi}. This means that this library must be
|
||||
configured when compiling an application that uses the above number type.
|
||||
|
||||
When \sc{Mpfi} files are not on the standard path, the locations of the headers
|
||||
and library files must be specified by using environment variables.
|
||||
|
||||
|
||||
| Variable | Description | Type |
|
||||
| :- | :- | :- |
|
||||
| `MPFI_DIR` |Directory of \sc{MPFI} default installation | Environment |
|
||||
| `MPFI_INCLUDE_DIR` | Directory containing the `mpfi.h` file | CMake |
|
||||
| `MPFI_INC_DIR` | Idem | Environment |
|
||||
| `MPFI_LIBRARIES_DIR` | Directory containing the compiled \sc{Mpfi} library | CMake |
|
||||
| `MPFI_LIB_DIR` | Idem | Environment |
|
||||
| `MPFI_LIBRARIES` | Full pathname of the compiled \sc{Mpfi} library | CMake |
|
||||
|
||||
|
||||
|
||||
\subsection installation_rs RS and RS3 Library
|
||||
|
||||
As said before, only the \cgal univariate algebraic kernel depends on the
|
||||
library Rs. As the algebraic kernel is not compiled as a part of the \cgal
|
||||
library, this library is not detected nor configured at installation time.
|
||||
|
||||
CMake will try to find Rs in the standard header and library
|
||||
directories. When it is not automatically detected, the locations of the
|
||||
headers and library files must be specified using environment variables.
|
||||
|
||||
Rs needs \sc{Gmp} 4.2 or later and \sc{Mpfi} 1.3.4 or later. The variables
|
||||
related to the latter library may also need to be defined.
|
||||
|
||||
|
||||
| Variable | Description | Type |
|
||||
| :- | :- | :- |
|
||||
| `RS_DIR` | Directory of \sc{Rs} default installation | Environment |
|
||||
| `RS_INCLUDE_DIR` | Directory containing the `rs_exports.h` file | CMake |
|
||||
| `RS_INC_DIR` | Idem | Environment |
|
||||
| `RS_LIBRARIES_DIR` | Directory containing the compiled \sc{Rs} library | CMake |
|
||||
| `RS_LIB_DIR` | Idem | Environment |
|
||||
| `RS_LIBRARIES` | Full pathname of the compiled \sc{Rs} library | CMake |
|
||||
|
||||
Similar variables exist for \sc{Rs3}.
|
||||
|
||||
| Variable | Description | Type |
|
||||
| :- | :- | :-
|
||||
| `RS3_DIR` | Directory of \sc{Rs3} default installation | Environment |
|
||||
| `RS3_INCLUDE_DIR` | Directory containing the file `rs3_fncts.h` file | CMake |
|
||||
| `RS3_INC_DIR` | Idem | Environment |
|
||||
| `RS3_LIBRARIES_DIR` | Directory containing the compiled \sc{Rs3} library | CMake |
|
||||
| `RS3_LIB_DIR` | Idem | Environment |
|
||||
| `RS3_LIBRARIES` | Full pathname of the compiled \sc{Rs3} library | CMake |
|
||||
|
||||
|
||||
\subsection installation_ntl NTL Library
|
||||
|
||||
Some polynomial computations in \cgal's algebraic kernel
|
||||
are speed up when \sc{Ntl} is available.
|
||||
As the algebraic kernel is not compiled as a part of the \cgal
|
||||
library, this library is not detected nor configured at installation time.
|
||||
|
||||
CMake will try to find \sc{Ntl} in the standard header and library
|
||||
directories. When it is not automatically detected, the locations of the
|
||||
headers and library files must be specified using environment variables.
|
||||
|
||||
| Variable | Description | Type |
|
||||
| :- | :- | :- |
|
||||
| `NTL_DIR` | Directory of \sc{NTL} default installation | Environment |
|
||||
| `NTL_INCLUDE_DIR` | Directory containing the `NTL/ZZX.h` file | CMake |
|
||||
| `NTL_INC_DIR` | Idem | Environment |
|
||||
| `NTL_LIBRARIES_DIR` | Directory containing the compiled \sc{Ntl} library | CMake |
|
||||
| `NTL_LIB_DIR` | Idem | Environment |
|
||||
| `NTL_LIBRARIES` | Full pathname of the compiled \sc{Ntl} library | CMake |
|
||||
|
||||
\subsection installation_eigen Eigen Library
|
||||
|
||||
\sc{Eigen} is a header-only template library.
|
||||
Only the <I>directory</I> containing the header files of \sc{Eigen} 3.1 (or greater) is needed.
|
||||
|
||||
|
||||
| Variable | Description | Type |
|
||||
| :- | :- | :- |
|
||||
| `EIGEN3_INCLUDE_DIR` | Directory containing the file `signature_of_eigen3_matrix_library` | CMake |
|
||||
| `EIGEN3_INC_DIR` | Idem | Environment |
|
||||
|
||||
\subsection installation_esbtl ESBTL Library
|
||||
|
||||
One skin surface example requires the \sc{Esbtl} library in order to read \sc{Pdb} files.
|
||||
|
||||
If \sc{Esbtl} is not automatically found, setting the `ESBTL_INC_DIR`
|
||||
environment variable is sufficient.
|
||||
|
||||
|
||||
| Variable | Description | Type |
|
||||
| :- | :- | :- |
|
||||
| `ESBTL_DIR` | Directory of \sc{ESBTL} default installation | Environment |
|
||||
| `ESBTL_INC_DIR` | Directory containing the `ESBTL/default.h` file | Environment |
|
||||
| `ESBTL_INCLUDE_DIR` | Directory containing the `ESBTL/default.h` file | CMake |
|
||||
|
||||
\subsection installation_tbb TBB Library
|
||||
|
||||
If \sc{Tbb} is not automatically found, the user must set the `TBB_ROOT`
|
||||
environment variable. The environment variable `TBB_ARCH_PLATFORM=<arch>/<compiler>` must be set.
|
||||
`<arch>` is `ia32` or `intel64`. `<compiler>` describes the Linux kernel, gcc version or Visual Studio version
|
||||
used. It should be set to what is used in `$TBB_ROOT/lib/<arch>`.
|
||||
|
||||
For windows users, the folder `TBB_ROOT/bin/<arch>/<compiler>` should be added to the `PATH` variable.
|
||||
|
||||
Note that the variables in the table below are being used.
|
||||
|
||||
| Variable | Description | Type |
|
||||
| :- | :- | :- |
|
||||
| `TBB_ROOT` | Directory of \sc{Tbb} default installation | Environment |
|
||||
| `TBB_INCLUDE_DIRS` | Directory containing the `tbb/tbb.h` file | CMake |
|
||||
| `TBB_LIBRARY_DIRS` | Directory(ies) containing the compiled TBB libraries | CMake |
|
||||
| `TBB_LIBRARIES` | Full pathnames of the compiled TBB libraries (both release and debug versions, using "optimized" and "debug" CMake keywords). Note that if the debug versions are not found, the release versions will be used instead for the debug mode. | CMake |
|
||||
| `TBB_RELEASE_LIBRARY` | Full pathname of the compiled TBB release library | CMake |
|
||||
| `TBB_MALLOC_RELEASE_LIBRARY` | Full pathname of the compiled TBB release malloc library | CMake |
|
||||
| `TBB_DEBUG_LIBRARY` | Full pathname of the compiled TBB debug library | CMake |
|
||||
| `TBB_MALLOC_DEBUG_LIBRARY` | Full pathname of the compiled TBB debug malloc library | CMake |
|
||||
| `TBB_MALLOCPROXY_DEBUG_LIBRARY` | Full pathname of the compiled TBB debug malloc_proxy library (optional) | CMake |
|
||||
| `TBB_MALLOCPROXY_RELEASE_LIBRARY` | Full pathname of the compiled TBB release malloc_proxy library (optional) | CMake |
|
||||
|
||||
\section installation_compiler_workarounds Compiler Workarounds
|
||||
|
||||
A number of boolean flags are used to workaround compiler bugs and
|
||||
limitations. They all start with the prefix `CGAL_CFG`. These
|
||||
flags are used to work around compiler bugs and limitations. For
|
||||
example, the flag `CGAL_CFG_NO_CPP0X_LONG_LONG` denotes
|
||||
that the compiler does not know the type `long long`.
|
||||
|
||||
For each installation a file <TT><CGAL/compiler_config.h></TT>
|
||||
is defined, with the correct
|
||||
settings of all flags. This file is generated automatically by CMake,
|
||||
and it is located in the `include` directory of where you run
|
||||
CMake. For an in-source configuration this means
|
||||
`CGAL-\cgalReleaseNumber``/include`.
|
||||
|
||||
The test programs used to generate the `compiler_config.h`
|
||||
file can be found in `config/testfiles`.
|
||||
Both
|
||||
`compiler_config.h` and the test programs contain a short
|
||||
description of the problem. In case of trouble with one of the
|
||||
`CGAL_CFG` flags, it is a good idea to take a look at it.
|
||||
|
||||
The file `CGAL/compiler_config.h` is included from
|
||||
`<CGAL/config.h>`.
|
||||
which is included by all \cgal header files.
|
||||
|
||||
*/
|
||||
|
|
@ -0,0 +1,313 @@
|
|||
/*!
|
||||
\page installation Building %CGAL libraries (non header-only mode)
|
||||
\cgalAutoToc
|
||||
|
||||
\cgalAdvancedBegin
|
||||
Since \cgal version 5.0, \cgal is header-only be default, which means
|
||||
that there is no need to compile \cgal or its libraries before it can be used.
|
||||
|
||||
This page is for advanced users that have a good reason to still use the old way.
|
||||
If this is not your case, head over back to the page \ref general_intro.
|
||||
\cgalAdvancedEnd
|
||||
|
||||
This page is a step-by-step description of how to configure, build, and (optionally) install \cgal
|
||||
in case you do not wish to use the - now enabled by default - header-only mode of \cgal.
|
||||
|
||||
It is assumed that you have downloaded a source archive of \cgal, and are using Linux or macOS.
|
||||
|
||||
\section installation_idealworld Quick Installation
|
||||
|
||||
Ideally, compiling and installing \cgal, as well as compiling some examples shipped by \cgal is as simple as:
|
||||
|
||||
cd $HOME/CGAL-\cgalReleaseNumber
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DCGAL_HEADER_ONLY=OFF -DCMAKE_BUILD_TYPE=Release .. # configure CGAL
|
||||
make # build CGAL
|
||||
make install # install CGAL
|
||||
cd examples/Triangulation_2 # go to an example directory
|
||||
cmake -DCGAL_DIR=$CMAKE_INSTALLED_PREFIX/lib/CGAL -DCMAKE_BUILD_TYPE=Release . # configure the examples
|
||||
make # build the examples
|
||||
|
||||
In a less ideal world, you might have to install some required tools and third-party libraries.
|
||||
This is what this page is about.
|
||||
|
||||
\section installation_configwithcmake Configuring CGAL with CMake
|
||||
|
||||
Before building \cgal, or anything using \cgal, you have to choose the compiler/linker,
|
||||
set compiler and linker flags, specify which
|
||||
third-party libraries you want to use and where they can be found, and
|
||||
which \cgal libraries you want to build. Gathering
|
||||
all this information is called <I>configuration</I>.
|
||||
The end of the process is marked by the generation of a makefile that you can use to build \cgal.
|
||||
|
||||
CMake maintains configuration parameters in so-called <I>cmake variables</I>. Some of the CMake
|
||||
variables represent user choices, such as `CMAKE_BUILD_TYPE`, while others
|
||||
indicate the details of a third-party library, such as `Boost_INCLUDE_DIR` or which compiler flags to use,
|
||||
such as `CMAKE_CXX_FLAGS`.
|
||||
|
||||
The next sections first present the CMake variables related to \cgal, followed by more generic variables,
|
||||
and finally the configuration and build processes.
|
||||
|
||||
\subsection seclibraries CGAL Libraries
|
||||
|
||||
\cgal is split into four libraries. During configuration, you can select the libraries that
|
||||
you would like to build by setting a CMake variable of the form <TT>WITH_<library></TT>. By default all
|
||||
are switched `ON`. All activated libraries are to be built after configuration.
|
||||
|
||||
Note that some libraries have specific dependencies in addition to the essential ones. See the page
|
||||
\ref secessential3rdpartysoftware for more information.
|
||||
|
||||
| Library | CMake Variable | Functionality | Dependencies |
|
||||
| :-------- | :------------- | :------------ | :----------- |
|
||||
| `%CGAL` | none | Main library | \sc{Gmp}, \sc{Mpfr}, \sc{Boost} (headers) |
|
||||
| `CGAL_Core` | `WITH_CGAL_Core` | The %CORE library for algebraic numbers.\cgalFootnote{CGAL_Core is not part of \cgal, but a custom version of the \sc{Core} library distributed by \cgal for the user convenience and it has it's own license.} | \sc{Gmp} and \sc{Mpfr} |
|
||||
| `CGAL_ImageIO` | `WITH_CGAL_ImageIO` | Utilities to read and write image files | \sc{zlib}, \sc{Vtk} (optional) |
|
||||
| `CGAL_Qt5` | `WITH_CGAL_Qt5` | `QGraphicsView` support for \sc{Qt}5-based demos | \sc{Qt}5 |
|
||||
|
||||
Shared libraries, also called <I>dynamic-link libraries</I>, are built by default
|
||||
(`.so` on Linux, `.dylib` on macOS). You
|
||||
can choose to produce static libraries instead, by setting the CMake
|
||||
variable `BUILD_SHARED_LIBS` to `FALSE`.
|
||||
|
||||
\subsection installation_examples CGAL Examples and Demos
|
||||
|
||||
\cgal is distributed with a large collection of examples and demos. By default, these are <B>not</B> configured along with
|
||||
the \cgal libraries, unless you set the variables `WITH_examples=ON` and/or `WITH_demos=ON`.
|
||||
Additionally, even when configured with \cgal, they are not automatically built along with the libraries.
|
||||
You must build the `examples` or `demos` targets (or IDE projects) explicitly.
|
||||
|
||||
If you do not plan to compile any demos, you may skip some of the dependencies (such as \sc{Qt}),
|
||||
as the corresponding \cgal-libraries will not be used. Note, however, that your own demos
|
||||
might need these \cgal-libraries and thus their dependencies. See the page
|
||||
\ref secessential3rdpartysoftware for more information.
|
||||
|
||||
\subsection installation_debugrelease Debug vs. Release
|
||||
|
||||
The CMake variable `CMAKE_BUILD_TYPE` indicates how to build the libraries.
|
||||
It accepts the values `Debug` or `Release`. Note that the default value is `Debug`, since it is
|
||||
default value in `CMake`. If you do not plan on debugging, it is important to set the variable
|
||||
to `Release` for performance reasons.
|
||||
|
||||
This is however not an issue for solution/project files, since the user selects the build type
|
||||
from within the IDE in this environment.
|
||||
|
||||
\subsection installation_miscvariables Other CMake Variables
|
||||
|
||||
There are many more variables that can be used during configuration. The most important ones are:
|
||||
<ul>
|
||||
<li> `CMAKE_INSTALL_PREFIX=<dir>` installation directory [/usr/local]</li>
|
||||
<li>`CMAKE_BUILD_TYPE=<Debug|Release>` build type [Release]</li>
|
||||
<li>`BUILD_SHARED_LIBS=<TRUE|FALSE>` shared or static libraries [TRUE]</li>
|
||||
<li>`CMAKE_C_COMPILER=<program>` C compiler [gcc]</li>
|
||||
<li>`CMAKE_CXX_COMPILER=<program>` C++ compiler [g++]</li>
|
||||
</ul>
|
||||
|
||||
In case you want to add additional compiler and linker flags, you can use
|
||||
<ul>
|
||||
<li>`CGAL_CXX_FLAGS` additional compiler flags</li>
|
||||
<li>`CGAL_MODULE_LINKER_FLAGS` add. linker flags (static libraries)</li>
|
||||
<li>`CGAL_SHARED_LINKER_FLAGS` add. linker flags (shared libraries)</li>
|
||||
<li>`CGAL_EXE_LINKER_FLAGS` add. linker flags (executables)</li>
|
||||
</ul>
|
||||
|
||||
Variants with the additional suffix "_DEBUG" and "_RELEASE" allow to set
|
||||
separate values for debug and release builds. In case you do not want to add
|
||||
additional flags, but to override the default flags, replace "CGAL" by
|
||||
"CMAKE" in the variable names above.
|
||||
|
||||
A comprehensive list of CMake variables can be found on the \ref configurationvariables page.
|
||||
|
||||
Note that CMake maintains a cache name `CMakeCache.txt`. If you change options
|
||||
(or your environment changes), it is best to remove that file to avoid
|
||||
problems.
|
||||
|
||||
\subsection installation_configuring_gui Configuring CGAL with the CMake GUI
|
||||
|
||||
The simplest way to start the configuration process is to run the graphical
|
||||
user interface of CMake, `cmake-gui`. You must pass as
|
||||
argument the root directory of \cgal. For example:
|
||||
|
||||
cd CGAL-\cgalReleaseNumber/build
|
||||
cmake-gui .. # The two dots indicate the parent directory
|
||||
|
||||
After `cmake-gui` opens, press *Configure*.
|
||||
A dialog will pop up and you will have to choose what shall be generated.
|
||||
After you have made your choice and pressed *Finish*, you will see
|
||||
the output of configuration tests in the lower portion of the application.
|
||||
When these tests are done, you will see many
|
||||
red entries in the upper portion of the application. Just ignore them and press *Configure*.
|
||||
By now CMake should have found many libraries and have initialized variables.
|
||||
If you still find red entries, you have to provide the necessary information.
|
||||
This typically happens if you have installed software at non-standard locations.
|
||||
|
||||
Providing information and pressing *Configure* goes on until
|
||||
all entries are grayed. You are now ready to press *Generate*. Once this is
|
||||
done, you can quit `cmake-gui`.
|
||||
|
||||
Since you intend to build CGAL libraries, you should also ensure that the variable
|
||||
`CGAL_HEADER_ONLY` has not been set.
|
||||
|
||||
If you do not need to debug, you should set the variable `CMAKE_BUILD_TYPE` to `Release`.
|
||||
|
||||
\subsection installation_configuring_cmd Configuring CGAL with the cmake Command-Line Tool
|
||||
|
||||
Alternatively, you can run the command-line tool called `cmake`.
|
||||
You pass as argument the root directory of \cgal.
|
||||
The command line tool `cmake` accepts CMake variables as arguments of the form `-D<VAR>:<TYPE>=<VALUE>`, as
|
||||
in the example above, but this is only useful if you already know which variables need to be explicitly defined.
|
||||
For example:
|
||||
|
||||
cd CGAL-\cgalReleaseNumber/build
|
||||
cmake ..
|
||||
|
||||
The configuration process not only determines the location of the required dependencies, it also dynamically generates a
|
||||
`compiler_config.h` file, which encodes the properties of your system and a special file named
|
||||
`CGALConfig.cmake`, which is used to build programs using \cgal. The
|
||||
purpose of this file is explained below.
|
||||
|
||||
\cgalAdvancedBegin
|
||||
CMake keeps the variables that a user can manipulate in a
|
||||
so-called <I>CMake cache</I>, a simple text file named
|
||||
`CMakeCache.txt`, whose entries are of the form
|
||||
`VARIABLE:TYPE=VALUE`. Advanced users can manually edit this file,
|
||||
instead of going through the interactive configuration session.
|
||||
\cgalAdvancedEnd
|
||||
|
||||
\subsection installation_cgalconfig CGALConfig.cmake
|
||||
|
||||
During configuration of the \cgal libraries a file named `CGALConfig.cmake` is generated
|
||||
in \cgal's root directory (in contrast to \cgal's source directory that has been used
|
||||
for installation). This file contains the definitions of several CMake variables
|
||||
that summarize the configuration of \cgal and will be essential during the configuration and
|
||||
building of a program using \cgal, see Section \ref installation_buildprogram.
|
||||
|
||||
\section seccmakeoutofsource Multiple Builds
|
||||
|
||||
While you can choose between release or debug builds, and shared or static libraries,
|
||||
it is not possible to generate different variants during a single configuration. You need to run CMake in a
|
||||
different directory for each variant you are interested in, each with its own selection of configuration parameters.
|
||||
|
||||
CMake stores the resulting makefiles, along with several temporary and auxiliary files such
|
||||
as the variables cache, in the directory where it is executed, called `CMAKE_BINARY_DIR`, but it
|
||||
takes the source files and configuration scripts from
|
||||
`CMAKE_SOURCE_DIR`.
|
||||
|
||||
The binary and source directories do not need to be the same. Thus, you can configure multiple variants by creating a
|
||||
distinct directory for each configuration and by running CMake from there. This is known in CMake terminology
|
||||
as <I>out-of-source configuration</I>, as opposite to an <I>in-source
|
||||
configuration</I>, as showed in the previous sections.
|
||||
You can, for example, generate subdirectories `CGAL-\cgalReleaseNumber``/build/debug` and
|
||||
`CGAL-\cgalReleaseNumber``/build/release` for two configurations, respectively:
|
||||
|
||||
mkdir CGAL-\cgalReleaseNumber/build/debug
|
||||
cd CGAL-\cgalReleaseNumber/build/debug
|
||||
cmake -DCMAKE_BUILD_TYPE=Debug ../..
|
||||
|
||||
mkdir CGAL-\cgalReleaseNumber/build/release
|
||||
cd CGAL-\cgalReleaseNumber/build/release
|
||||
cmake -DCMAKE_BUILD_TYPE=Release ../..
|
||||
|
||||
\section secbuilding Building CGAL
|
||||
|
||||
The results of a successful configuration are build files that control the build step.
|
||||
The nature of the build files depends on the generator used during configuration, but in all cases they
|
||||
contain several <I>targets</I>, one per library, and a default global target corresponding
|
||||
to all the libraries.
|
||||
|
||||
For example, in a \sc{Unix}-like environment the default generator produces makefiles.
|
||||
You can use the `make` command-line tool for the succeeding build step as follows:
|
||||
|
||||
# build all the selected libraries at once
|
||||
make
|
||||
|
||||
The resulting libraries are placed in the subdirectory `lib` under `<CMAKE_BINARY_DIR>`
|
||||
(which is `CGAL-\cgalReleaseNumber` in case you run an in-source-configuration).
|
||||
|
||||
\cgalAdvancedBegin
|
||||
The build files produced by CMake are autoconfigured. That
|
||||
is, if you change any of the dependencies, the build step
|
||||
automatically goes all the way back to the configuration step. This
|
||||
way, once the target has been configured the very first time by
|
||||
invoking cmake, you don't necessarily need to invoke `cmake`
|
||||
again. Rebuilding will call itself `cmake` and re-generate the
|
||||
build file whenever needed.
|
||||
\cgalAdvancedEnd
|
||||
|
||||
\subsection ssec_installation_build_ex_demos Building Examples and Demos
|
||||
|
||||
If you have turned on the configuration of examples
|
||||
(`-DWITH_examples=ON`) and/or demos (`-DWITH_demos=ON`), there will be additional
|
||||
targets named `examples` and `demos`, plus one target for
|
||||
each example and each demo in the build files.
|
||||
None of these targets are included by default, so you need to build them explicitly
|
||||
<I>after</I> the \cgal libraries have been successfully built.
|
||||
The targets `examples` and `demos` include themselves all the targets
|
||||
for examples and demos respectively.
|
||||
|
||||
# build all examples at once
|
||||
make examples
|
||||
|
||||
# build all demos at once
|
||||
make demos
|
||||
|
||||
If you are interested in the demos or examples of just a particular module, you can build them in the following way:
|
||||
|
||||
make -C demo/Alpha_shapes_2 # equivalent to "cd demo/Alpha_shapes_2; make"
|
||||
make -C examples/Alpha_shapes_2 # equivalent to "cd examples/Alpha_shapes_2; make"
|
||||
|
||||
When using `UNIX Makefiles`, you can find out the exact name of the example or demo target
|
||||
of a particular package by typing `make help | grep <package>`.
|
||||
|
||||
\section secinstalling Installing CGAL
|
||||
|
||||
On many platforms, library pieces such as headers, docs and binaries
|
||||
are expected to be placed in specific locations. A typical example
|
||||
being `/usr/include` and `/usr/lib`. The process
|
||||
of placing or copying the library elements into its standard location
|
||||
is sometimes referred to as <I>Installation</I> and it is a
|
||||
postprocessing step after the build step.
|
||||
|
||||
CMake carries out the installation by producing a build target named <I>install</I>.
|
||||
Assuming you have successfully configured and built \cgal as demonstrated in the previous sections,
|
||||
the installation simply amounts to:
|
||||
|
||||
# install CGAL
|
||||
make install
|
||||
|
||||
\cgalAdvancedBegin
|
||||
The files are copied into a directory tree relative to the <I>installation directory</I> determined by the
|
||||
CMake variable `CMAKE_INSTALL_PREFIX`. This variable defaults to `/usr/local` under \sc{Unix}-like operating systems.
|
||||
If you want to install to a different location, you must override that CMake
|
||||
variable explicitly <I>at the configuration time</I> and not when executing the install step.
|
||||
\cgalAdvancedEnd
|
||||
|
||||
The file `CGALConfig.cmake` is installed by default in
|
||||
`$CMAKE_INSTALLED_PREFIX/lib/``CGAL-\cgalReleaseNumber`.
|
||||
|
||||
\section installation_buildprogram Building a Program using CGAL
|
||||
|
||||
Similarly to \cgal and its libraries, compiling a program using \cgal is done in the usual
|
||||
two steps of configuration and building.
|
||||
|
||||
The configuration process is also done using `cmake` (or `cmake-gui`) and requires a `CMakeLists.txt` file.
|
||||
This file is automatically provided for all shipped examples and demos of \cgal.
|
||||
For other programs, CMake can also be used to configure
|
||||
and build user programs, but one has to provide the corresponding `CMakeLists.txt`.
|
||||
This script can be generated either manually, or with the help of a shell-script,
|
||||
see Section \ref devman_create_cgal_CMakeLists. Using this shell-script,
|
||||
the process of configuring a user's program called `your_program.cpp` amounts to:
|
||||
|
||||
cd /path/to/your/program
|
||||
cgal_create_CMakeLists -s your_program
|
||||
cmake -DCGAL_DIR=XXXXXX -DCMAKE_BUILD_TYPE=Release .
|
||||
make
|
||||
|
||||
In order to configure a program, you need to indicate the location of the \cgal configuration file
|
||||
in the CMake variable `CGAL_DIR` (as shown in the example above).
|
||||
If you have installed \cgal, `CGAL_DIR` must afterwards be set to `$CMAKE_INSTALLED_PREFIX/lib/CGAL`.
|
||||
|
||||
The variable `CGAL_DIR` can also be an environment variable, but setting it manually makes particular sense
|
||||
if you have multiple out-of-source builds of \cgal as in Section \ref seccmakeoutofsource.
|
||||
|
||||
*/
|
||||
|
|
@ -2,13 +2,17 @@
|
|||
|
||||
\mainpage
|
||||
|
||||
The goal of the \cgal Open Source Project is to provide easy access to
|
||||
efficient and reliable geometric algorithms in the form of a C++
|
||||
library.
|
||||
The Computational Geometry Algorithms Library (\cgal) is a software project
|
||||
that provides easy access to efficient and reliable geometric algorithms
|
||||
in the form of a C++ library.
|
||||
|
||||
The Computational Geometry Algorithms Library offers data structures
|
||||
and algorithms like \ref PartTriangulationsAndDelaunayTriangulations "triangulations", \ref PartVoronoiDiagrams "Voronoi diagrams", \ref PartPolygons, \ref PartPolyhedra, \ref PartArrangements "arrangements of curves", \ref PartMeshing "mesh generation", \ref PartGeometryProcessing "geometry processing", \ref PartConvexHullAlgorithms "convex hull algorithms", to name just
|
||||
a few.
|
||||
<h2>Package Overview</h2>
|
||||
|
||||
\cgal offers data structures and algorithms like \ref PartTriangulationsAndDelaunayTriangulations "triangulations",
|
||||
\ref PartVoronoiDiagrams "Voronoi diagrams", \ref PartPolygons, \ref PartPolyhedra,
|
||||
\ref PartArrangements "arrangements of curves", \ref PartMeshing "mesh generation",
|
||||
\ref PartGeometryProcessing "geometry processing", \ref PartConvexHullAlgorithms "convex hull algorithms",
|
||||
to name just a few.
|
||||
|
||||
All these data structures and algorithms operate on geometric objects
|
||||
like points and segments, and perform geometric tests on them. These
|
||||
|
|
@ -20,33 +24,32 @@ solver for linear and quadratic programs. It further offers interfaces
|
|||
to third party software such as the GUI libraries Qt, Geomview, and
|
||||
the Boost Graph Library.
|
||||
|
||||
Demos and Examples
|
||||
==================
|
||||
The complete list of packages is available on the page \ref packages.
|
||||
|
||||
In the distribution of the library you find the two directories *demo*
|
||||
and *examples*. They contain subdirectories for the \cgal packages.
|
||||
The demos use third party libraries for the graphical user interface. The
|
||||
examples don't have this dependency and most examples are refered to in the
|
||||
user manual.
|
||||
<h2>Getting Started</h2>
|
||||
|
||||
Head over to \ref general_intro to learn how to obtain, install, and use \cgal.
|
||||
|
||||
<h2>License</h2>
|
||||
|
||||
License
|
||||
=======
|
||||
%CGAL is distributed under a dual-license scheme. %CGAL can be used
|
||||
together with Open Source software free of charge. Using %CGAL in
|
||||
other contexts can be done by obtaining a commercial license from
|
||||
[GeometryFactory](http://www.geometryfactory.com). For more details
|
||||
see the \ref licenseIssues "License" page.
|
||||
see the \ref license "License" page.
|
||||
|
||||
Manuals for the Previous Releases
|
||||
=================================
|
||||
<h2>Acknowledgement</h2>
|
||||
|
||||
We provide bibtex entries for each package so that you can cite \cgal correctly in your publications,
|
||||
see the page \ref how_to_cite_cgal.
|
||||
|
||||
<h2>Manuals for the Previous Releases</h2>
|
||||
|
||||
For releases >= 4.2, visit [https://doc.cgal.org/X.Y](https://doc.cgal.org/4.2)
|
||||
|
||||
For releases X.Y, with 3.1 <= X.Y <= 4.1 visit
|
||||
[https://doc.cgal.org/Manual/X.Y/doc_html/cgal_manual/packages.html](https://doc.cgal.org/Manual/3.1/doc_html/cgal_manual/packages.html)
|
||||
|
||||
|
||||
|
||||
\htmlonly[block]
|
||||
<div style="display:none">
|
||||
\endhtmlonly
|
||||
|
|
@ -55,6 +58,7 @@ For releases X.Y, with 3.1 <= X.Y <= 4.1 visit
|
|||
\subpage tutorials
|
||||
\subpage packages
|
||||
\subpage dev_manual
|
||||
\subpage license
|
||||
|
||||
\htmlonly[block]
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,17 +1,14 @@
|
|||
namespace CGAL {
|
||||
|
||||
/*!
|
||||
|
||||
\page manual Organization of the Manual
|
||||
\cgalAutoToc
|
||||
\author %CGAL Editorial Board
|
||||
|
||||
|
||||
Organization of the Manual
|
||||
==========================
|
||||
\section secorganization Organization of the Manual
|
||||
|
||||
This manual is organized in several parts covering the many domains
|
||||
of computational geometry. Each part consists of several chapters,
|
||||
of computational geometry.
|
||||
Each part consists of several chapters,
|
||||
and each chapter is split into a *User Manual* and a *Reference
|
||||
Manual*. The User Manual gives the general idea and comes with examples.
|
||||
The Reference Manual presents the \sc{Api} of the various classes
|
||||
|
|
@ -28,8 +25,7 @@ The scope of the search box is the package you currently look at and the
|
|||
packages it depends on, or it is the whole manual when you are in
|
||||
a top level page such as the package overview.
|
||||
|
||||
Organization of the Reference Manual
|
||||
====================================
|
||||
\section secorganizationref Organization of the Reference Manual
|
||||
|
||||
The \cgal library is a library of class templates. Consequently, we express
|
||||
the requirements on template arguments by specifying \em concepts
|
||||
|
|
@ -70,6 +66,47 @@ As pointed out in Section \ref intro_concept "Concepts and Models"
|
|||
the notion of a \em concept is about requirements,
|
||||
and it can be a required global function or a required traits class.
|
||||
|
||||
*/
|
||||
} /* namespace CGAL */
|
||||
\section markingSpecialFunctionality Marking of Special Functionality
|
||||
|
||||
In this manual, you will encounter sections marked as follows.
|
||||
|
||||
\subsection advanced_features Advanced Features
|
||||
|
||||
Some functionality is considered more advanced, for example because it is
|
||||
relatively low-level, or requires special care to be properly used.
|
||||
|
||||
\cgalAdvancedBegin
|
||||
Such functionality is identified this way in the manual.
|
||||
\cgalAdvancedEnd
|
||||
|
||||
\subsection debugging_support Debugging Support Features
|
||||
|
||||
Usually related to advanced features that for example may not guarantee
|
||||
class invariants, some functionality is provided that helps debugging,
|
||||
for example by performing invariants checks on demand.
|
||||
|
||||
\cgalDebugBegin
|
||||
Such functionality is identified this way in the manual.
|
||||
\cgalDebugEnd
|
||||
|
||||
\subsection deprecated_code Deprecated Code
|
||||
|
||||
Sometimes, the \cgal project decides that a feature is <em>deprecated</em>. This means
|
||||
that it still works in the current release, but it will be removed in the next,
|
||||
or a subsequent release. This can happen when we have found a better way to do
|
||||
something, and we would like to reduce the maintenance cost of \cgal at some
|
||||
point in the future. There is a trade-off between maintaining backward
|
||||
compatibility and implementing new features more easily.
|
||||
|
||||
In order to help users manage the changes to apply to their code, we attempt
|
||||
to make \cgal code emit warnings when deprecated code is used. This can be
|
||||
done using some compiler specific features. Those warnings can be disabled
|
||||
by defining the macro `CGAL_NO_DEPRECATION_WARNINGS`. On top of this, we
|
||||
also provide a macro, `CGAL_NO_DEPRECATED_CODE`, which, when defined,
|
||||
disables all deprecated features. This allows users to easily test if their
|
||||
code relies on deprecated features.
|
||||
|
||||
\deprecated Such functionality is identified this way in the manual.
|
||||
|
||||
*/
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,275 @@
|
|||
/*!
|
||||
\page windows Using %CGAL on Windows (with Visual C++)
|
||||
\cgalAutoToc
|
||||
|
||||
\cgal \cgalReleaseNumber is supported for the following \sc{MS} Visual `C++` compilers:
|
||||
14.0, 15.9, 16.0 (\sc{Visual Studio} 2015, 2017, and 2019).
|
||||
|
||||
\cgal is a library that has mandatory dependencies that must be first installed:
|
||||
\ref thirdpartyBoost and \ref thirdpartyMPFR.
|
||||
|
||||
You have two options to install \cgal and its dependencies: you can either use
|
||||
the *Vcpkg library manager*, which will automatically install an appropriate version of
|
||||
these dependencies as you install \cgal, or you can install the dependencies on your own
|
||||
(making sure that you are using a supported version) by following their respective
|
||||
installation instructions.
|
||||
|
||||
If you choose to use `vcpkg`, you might have to bootstrap and download
|
||||
and compile it, but from then on `vcpkg` will make your life easier.
|
||||
On the other hand, if you need to specify a specific version, or have already installed
|
||||
a certain version of a dependency and do not wish to potentially have multiple versions installed,
|
||||
you will want to use the \cgal Installer.
|
||||
|
||||
We explain the two approaches in the next two sections.
|
||||
|
||||
\section sec-installing-with-vcpkg Installing CGAL with the Vcpkg Library Manager
|
||||
|
||||
\subsection ssec-vcpk-install-vcpk Installing Vcpkg
|
||||
|
||||
The first step is to clone or download `vcpkg` from
|
||||
<a href="https://github.com/microsoft/vcpkg">https://github.com/microsoft/vcpkg</a>.
|
||||
|
||||
C:\dev> git clone https://github.com/microsoft/vcpkg
|
||||
C:\dev> cd vcpkg
|
||||
C:\dev\vcpkg> .\bootstrap-vcpkg.bat
|
||||
|
||||
\subsection ssec-vcpk-install-cgal Installing CGAL with Vcpkg
|
||||
|
||||
By default `vcpkg` installs for 32 bit binaries and will use the latest version of Visual C++
|
||||
installed on your machine. If you develop 64 bit software you must
|
||||
set the Windows environment variable `VCPKG_DEFAULT_TRIPLE` to `x64-windows`
|
||||
or pass the option `--triplet x64-windows` whenever you install a package.
|
||||
We refer to the
|
||||
<a href="https://github.com/microsoft/vcpkg/blob/master/docs/examples/installing-and-using-packages.md#step-2-use">official documentation</a>
|
||||
of `vcpkg` if you want to compile for an older version of a compiler.
|
||||
|
||||
You are now ready to install \cgal:
|
||||
|
||||
C:\dev\vcpkg> ./vcpkg.exe install cgal
|
||||
|
||||
This will take several minutes as it downloads \mpir (a fork of \gmp),
|
||||
\mpfr, all boost header files, and it will compile \mpir and \mpfr, as well
|
||||
as several boost libraries.
|
||||
Afterwards, you will find the include files, libraries, and dlls in the
|
||||
subdirectory `C:\dev\vcpkg\installed\x64-windows`.
|
||||
|
||||
Note that \cgal is a header-only library, and there are therefore no `lib` or `dll` files for \cgal.
|
||||
|
||||
\subsection ssec-vcpkg-compile-example Compiling an Example
|
||||
|
||||
In this section we show how to compile a program that uses \cgal.
|
||||
The examples you find in these User Manual pages are not downloaded when you install \cgal
|
||||
with the Vcpkg library manager. You must download them separately from the following download page:
|
||||
<a href="https://github.com/CGAL/cgal/releases/download/releases/CGAL-\cgalReleaseNumber/CGAL-\cgalReleaseNumber-examples.zip">CGAL-\cgalReleaseNumber-examples.zip</a>
|
||||
|
||||
Assuming you have unzipped this file in your home directory `C:\Users\Me`,
|
||||
we will next compile an example from the 2D Triangulation package.
|
||||
|
||||
\subsubsection sssec-vcpkg-configuration-example Configuring of an Example
|
||||
|
||||
Before building anything using \cgal, you have to choose the compiler/linker, set compiler
|
||||
and linker flags, specify which third-party libraries you want to use and where they can be found.
|
||||
Gathering all this information is called *configuration* and we use *CMake* as configuration tool
|
||||
(see Section \ref seccmake for more information on supported versions and where to download it).
|
||||
|
||||
The end of the process is marked by the generation of a Visual \cpp solution
|
||||
and a project file that you can use to build your program.
|
||||
|
||||
C:\Users\Me\CGAL-\cgalReleaseNumber> cd examples\Triangulation_2
|
||||
C:\Users\Me\CGAL-\cgalReleaseNumber\examples\Triangulation_2> mkdir build
|
||||
C:\Users\Me\CGAL-\cgalReleaseNumber\examples\Triangulation_2> cd build
|
||||
C:\Users\Me\CGAL-\cgalReleaseNumber\examples\Triangulation_2\build> cmake-gui ..
|
||||
|
||||
The command `cmake-gui` launches the graphical interface for `cmake`.
|
||||
When you hit the *Configure* button, you must:
|
||||
<ul>
|
||||
<li>specify the *Generator* (e.g., Visual Studio 16 2019),</li>
|
||||
<li>specify the *Optional Platform* (e.g., `x64` in case you want to create 64 bit binaries),</li>
|
||||
<li>select *Specify toolchain file for cross compilation* (the file `vcpkg.cmake` within the directory
|
||||
where you have installed `vcpkg`, e.g. `C:/dev/vcpkg/scripts/buildsystems/vcpkg.cmake`).</li>
|
||||
</ul>
|
||||
Once the configuration process is done, tick *Advanced* and *Grouped* in `cmake-gui`.
|
||||
You will see entries for where header files and libraries are taken from.
|
||||
|
||||
If you do not need to debug, you should set the variable `CMAKE_BUILD_TYPE` to `Release`.
|
||||
|
||||
\subsubsection sssect-vcpkg-additional-dependencies Additional Dependencies
|
||||
|
||||
Some \cgal packages also have additional dependencies. For example, during the configuration process
|
||||
above, you may have observed the following message:
|
||||
|
||||
NOTICE: The example draw_triangulation_2 requires Qt and will not be compiled
|
||||
|
||||
\cgal is a library of algorithms and data structures and as such does
|
||||
not depend on `Qt`. However, one of the examples in the Triangulation_2 package does require `Qt`
|
||||
for visualization purposes. If you already have `Qt` installed, you can simply fill in the requested
|
||||
CMake variables and paths. Otherwise, you can also install it using `vcpkg`:
|
||||
|
||||
C:\dev\vcpkg> ./vcpkg.exe install qt5
|
||||
|
||||
Remember to specify `--triplet` or the related environment variable in case you target 64-bit applications.
|
||||
|
||||
As Qt5 is modular and as the \cgal examples and demos use only some of these modules
|
||||
you can save download and compilation time by specifying an *installation option*:
|
||||
|
||||
C:\dev\vcpkg> ./vcpkg.exe install cgal[qt]
|
||||
|
||||
In both cases, when you start `cmake-gui` again and hit the *Configure* button,
|
||||
the CMake variables and paths concerning Qt should now be filled.
|
||||
|
||||
Note that not all optional dependencies are available through the Vcpkg library manager.
|
||||
In this case, you must download and install them independently (see page \ref thirdparty
|
||||
for information on support versions and download links) as well as fill the missing information
|
||||
within the `CMake` interface until configuration is successful (no more red lines indicating
|
||||
missing dependencies).
|
||||
|
||||
\cgalAdvancedBegin
|
||||
You may also decide to solve missing dependencies using the `CMake` command line tool (which is not recommended).
|
||||
If so, the page \ref configurationvariables lists variables which can be used to specify
|
||||
the location of third-party software.
|
||||
\cgalAdvancedEnd
|
||||
|
||||
\subsubsection sssect-vcpkg-compilation Compilation of an Example
|
||||
|
||||
Once the configuration process is successful, hit the *Generate* button,
|
||||
and you will find the file `Triangulation_2_examples.sln`
|
||||
in the directory `C:\Users\Me\CGAL-\cgalReleaseNumber\examples\Triangulation_2\build`.
|
||||
Double-click it to open it. There is one project per `.cpp` file in the directory.
|
||||
Compile them all, or just the one you are interested in.
|
||||
|
||||
\subsection subsect-vpckg-my-code Configuring and Compiling Your Code Using CGAL
|
||||
|
||||
Configuring and compiling your own code is practically the same as for \cgal examples
|
||||
if you use `cmake`. Running `cmake` (or `cmake-gui`) requires a `CMakeLists.txt` file.
|
||||
This file is automatically provided for all examples and demos of \cgal. For your own programs,
|
||||
you are advised to look at the `CMakeLists.txt` files in the example
|
||||
folder of the package(s) that you are using to learn how to specify \cgal and additional third party
|
||||
dependencies.
|
||||
|
||||
\section install-with-installer Installing with the CGAL Installer
|
||||
|
||||
You can download and run `CGAL-\cgalReleaseNumber``-Setup.exe` from https://www.cgal.org/download/windows.html.
|
||||
It is a self-extracting executable that downloads the \cgal header files, and optionally the source code of the
|
||||
examples and demos. Additionally, it can download precompiled versions of \gmp and \mpfr.
|
||||
|
||||
\subsection ssect-installer-boost Installing Boost
|
||||
|
||||
`Boost` is a mandatory dependency of \cgal. Binary versions of `Boost` are available on
|
||||
<a href="https://sourceforge.net/projects/boost/files/boost-binaries/">SourceForge</a>.
|
||||
The `Boost` installers install both `Boost` headers and precompiled libraries.
|
||||
Please note that the \cgal project is not responsible for the files provided on this website.
|
||||
When \cgal \cgalReleaseNumber was released, the latest version of `Boost` was 1.71.
|
||||
A typical installation of `Boost` would consist of the following steps:
|
||||
|
||||
<ul>
|
||||
<li>Download and run the file boost_1_71_0-msvc-XX.Y-64.exe (where XX.Y = 14.0 for VC 2015, XX.Y = 14.1 for 2017, XX.Y = 14.2 for VC 2019).</li>
|
||||
<li>Extract the files to a new directory, e.g. `c:\dev\libboost_1_71_0`.</li>
|
||||
<li>Set the following two environment variables to point respectively to the path of the libraries and the headers
|
||||
<ul>
|
||||
<li>`BOOST_LIBRARYDIR = C:\dev\libboost_1_71_0\lib64-msvc-XX.Y`</li>
|
||||
<li>`BOOST_INCLUDEDIR = C:\dev\libboost_1_71_0`</li>
|
||||
</ul>
|
||||
as this will help `cmake` to find Boost.</li>
|
||||
<li>Add the path to the Boost `dlls` (`C:\dev\libboost_1_71_0\lib64-msvc-XX.Y`) files to the `PATH` environment variable.</li>
|
||||
</ul>
|
||||
|
||||
\subsection ssect-installer-install-cgal Installing CGAL Itself
|
||||
|
||||
Download and run `CGAL-\cgalReleaseNumber``-Setup.exe` from
|
||||
<a href="https://www.cgal.org/download/windows.html">https://www.cgal.org/download/windows.html</a>.
|
||||
It is a self extracting executable that downloads the \cgal header files, and optionally the source code of the
|
||||
examples and demos. Additionally, it can download the precompiled versions of \gmp and \mpfr. You must
|
||||
specify if you want the 32 or the 64 bit versions of these two libraries.
|
||||
|
||||
Setting the environment variable `CGAL_DIR` to `C:\dev\CGAL-\cgalReleaseNumber` is a good idea
|
||||
to help `cmake` to find \cgal during the configuration process, detailed in the next section.
|
||||
|
||||
\subsection ssect-installer-compile-example Compiling an Example
|
||||
|
||||
We assume that you have downloaded the examples with the \cgal Installer.
|
||||
|
||||
Before building anything using \cgal, you have to choose the compiler/linker, set compiler
|
||||
and linker flags, specify which third-party libraries you want to use and where they can be found.
|
||||
Gathering all this information is called *configuration* and we use CMake as configuration tool
|
||||
(see Section \ref seccmake for more information on minimal supported versions and where to
|
||||
download it).
|
||||
|
||||
The end of the process is marked by the generation of a Visual \cpp solution
|
||||
and a project file that you can use to build your program.
|
||||
|
||||
C:\dev\CGAL-\cgalReleaseNumber> cd examples\Triangulation_2
|
||||
C:\dev\CGAL-\cgalReleaseNumber\examples\Triangulation_2> mkdir build
|
||||
C:\dev\CGAL-\cgalReleaseNumber\examples\Triangulation_2> cd build
|
||||
C:\dev\CGAL-\cgalReleaseNumber\examples\Triangulation_2\build> cmake-gui ..
|
||||
|
||||
The command `cmake-gui` launches the graphical interface for `cmake`.
|
||||
When you hit the *Configure* button, you must:
|
||||
<ul>
|
||||
<li>Specify the *Generator*, e.g., Visual Studio 16 2019), and</li>
|
||||
<li>specify an *Optional Platform* (`x64` in case you want to create 64 bit binaries).</li>
|
||||
</ul>
|
||||
Once the configuration is done, tick `Advanced` and `Grouped` in `cmake-gui`.
|
||||
You will see entries for where header files and libraries are taken from.
|
||||
|
||||
If you do not need to debug, you should set the variable `CMAKE_BUILD_TYPE` to `Release`.
|
||||
|
||||
\subsubsection ssect-installer-additional-dependencies Additional Dependencies
|
||||
|
||||
Some \cgal packages also have additional dependencies. For example, during the configuration process
|
||||
above, you may have observed the following message:
|
||||
|
||||
NOTICE: The example draw_triangulation_2 requires Qt and will not be compiled
|
||||
|
||||
\cgal is a library of algorithms and data structures and as such does
|
||||
not depend on `Qt`. However, one of the examples does for visualization purposes only. Either you
|
||||
have Qt installed and you can fill in the requested CMake variables, or you must install it.
|
||||
A typical `Qt` installation would consist of the following steps:
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
Download and install the Qt library for open source development package for your Visual Studio version at
|
||||
<a href="https://www.qt.io/download/">https://www.qt.io/download/</a>
|
||||
(here is the direct link to the <a href="https://www1.qt.io/offline-installers/">offline installers</a>).</li>
|
||||
<li>Add the environment variable `QTDIR` pointing to the place you installed Qt, e.g., `C:\dev\Qt\Qt5.13.1`,
|
||||
as this will help `cmake` to find Qt.</li>
|
||||
<li>Add the bin directory of Qt, e.g. add `C:\dev\Qt\Qt5.13.1\msvcXXXX_YY\bin` to `PATH`, where `XXXX_YY` is something like `vc2017_64`.
|
||||
To avoid any conflict with another dll with the same name from another folder, add this path as the first in the list.</li>
|
||||
</ul>
|
||||
|
||||
Once you have installed `Qt`, the CMake variables concerning `Qt` should now be filled when you
|
||||
press *Configure* in the \cgal directory.
|
||||
|
||||
You must follow a similar process for other dependencies (see page \ref thirdparty for information
|
||||
on supported versions of third party libraries as well as download links) and fill the missing information
|
||||
within the `CMake` interface until configuration is successful (no more red lines indicating
|
||||
missing dependencies).
|
||||
|
||||
\cgalAdvancedBegin
|
||||
You may also decide to solve missing dependencies using the `CMake` command line tool (which is not recommended).
|
||||
If so, the page \ref configurationvariables lists variables which can be used to specify
|
||||
the location of third-party software.
|
||||
\cgalAdvancedEnd
|
||||
|
||||
\subsubsection sssect-installer-compilation Compilation of an Example
|
||||
|
||||
Once the configuration process is successful, hit the *Generate* button,
|
||||
and you will find the file `Triangulation_2_examples.sln`
|
||||
in the directory `C:\dev\CGAL-\cgalReleaseNumber\examples\Triangulation_2\build`.
|
||||
Double-click it in order to open it. You will see one project per `.cpp` file.
|
||||
Compile them all, or just the one you are interested in.
|
||||
|
||||
\subsection subsect-installer-my-code Configuring and Compiling My Code Using CGAL
|
||||
|
||||
Configuring and compiling your own code is practically the same as for \cgal examples
|
||||
if you use `cmake`. Running `cmake` (or `cmake-gui`) requires a `CMakeLists.txt` file.
|
||||
This file is automatically provided for all examples and demos of \cgal. For your own programs,
|
||||
you are advised to look at the `CMakeLists.txt` files in the example
|
||||
folder of the package(s) that you are using to learn how to specify \cgal and additional third party
|
||||
dependencies.
|
||||
|
||||
\section install-with-tarball Installing from the Source Archive
|
||||
|
||||
Instead of the installer you can also download release tarballs. The sole difference
|
||||
is that the installer also downloads precompiled \gmp and \mpfr libraries.
|
||||
|
||||
*/
|
||||
|
|
@ -233,6 +233,9 @@ ALIASES = "sc{1}=<span style=\"font-variant: small-caps;\">\1</sp
|
|||
"protocgal=\sc{C++gal}" \
|
||||
"plageo=\sc{Plageo}" \
|
||||
"stl=\sc{STL}" \
|
||||
"gmp=\sc{GMP}" \
|
||||
"mpir=\sc{MPIR}" \
|
||||
"mpfr=\sc{MPFR}" \
|
||||
"leda=\sc{LEDA}" \
|
||||
"gcc=\sc{GCC}" \
|
||||
"cpp=\sc{C++}" \
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@
|
|||
|
||||
var url_re = /(cgal\.geometryfactory\.com\/CGAL\/doc\/|doc\.cgal\.org\/)(master|latest|(\d\.\d+|\d\.\d+\.\d+))\//;
|
||||
var url_local = /.*\/doc_output\//;
|
||||
var current_version_local = '5.0-beta2'
|
||||
var current_version_local = '5.0'
|
||||
var all_versions = [
|
||||
'master',
|
||||
'latest',
|
||||
'5.0',
|
||||
'4.14.1',
|
||||
'4.14.2',
|
||||
'4.13.2',
|
||||
'4.12.2',
|
||||
'4.11.3',
|
||||
|
|
|
|||
|
|
@ -234,6 +234,9 @@ ALIASES = "sc{1}=<span style=\"font-variant: small-caps;\">\1</sp
|
|||
"protocgal=\sc{C++gal}" \
|
||||
"plageo=\sc{Plageo}" \
|
||||
"stl=\sc{STL}" \
|
||||
"gmp=\sc{GMP}" \
|
||||
"mpir=\sc{MPIR}" \
|
||||
"mpfr=\sc{MPFR}" \
|
||||
"leda=\sc{LEDA}" \
|
||||
"gcc=\sc{GCC}" \
|
||||
"cpp=\sc{C++}" \
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@
|
|||
|
||||
var url_re = /(cgal\.geometryfactory\.com\/CGAL\/doc\/|doc\.cgal\.org\/)(master|latest|(\d\.\d+|\d\.\d+\.\d+))\//;
|
||||
var url_local = /.*\/doc_output\//;
|
||||
var current_version_local = '5.0-beta2'
|
||||
var current_version_local = '5.0'
|
||||
var all_versions = [
|
||||
'master',
|
||||
'latest',
|
||||
'5.0',
|
||||
'4.14.1',
|
||||
'4.14.2',
|
||||
'4.13.2',
|
||||
'4.12.2',
|
||||
'4.11.3',
|
||||
|
|
|
|||
|
|
@ -201,6 +201,9 @@ ALIASES = "sc{1}=<span style=\"font-variant: small-caps;\">\1</span>"
|
|||
ALIASES += "cgal=\sc{%CGAL}"
|
||||
ALIASES += "protocgal=\sc{C++gal}"
|
||||
ALIASES += "plageo=\sc{Plageo}"
|
||||
ALIASES += "gmp=\sc{GMP}"
|
||||
ALIASES += "mpir=\sc{MPIR}"
|
||||
ALIASES += "mpfr=\sc{MPFR}"
|
||||
ALIASES += "stl=\sc{STL}"
|
||||
ALIASES += "leda=\sc{LEDA}"
|
||||
ALIASES += "gcc=\sc{GCC}"
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@
|
|||
|
||||
var url_re = /(cgal\.geometryfactory\.com\/CGAL\/doc\/|doc\.cgal\.org\/)(master|latest|(\d\.\d+|\d\.\d+\.\d+))\//;
|
||||
var url_local = /.*\/doc_output\//;
|
||||
var current_version_local = '5.0-beta2'
|
||||
var current_version_local = '5.0'
|
||||
var all_versions = [
|
||||
'master',
|
||||
'latest',
|
||||
'5.0',
|
||||
'4.14.1',
|
||||
'4.14.2',
|
||||
'4.13.2',
|
||||
'4.12.2',
|
||||
'4.11.3',
|
||||
|
|
|
|||
|
|
@ -146,8 +146,6 @@ distributed in an open disc. The default `Creator` is
|
|||
\cgalModels `InputIterator`
|
||||
\cgalModels `PointGenerator`
|
||||
|
||||
\sa `std::copy_n()`
|
||||
\sa `CGAL::Counting_iterator`
|
||||
\sa `CGAL::Points_on_segment_2<Point_2>`
|
||||
\sa `CGAL::Random_points_in_square_2<Point_2, Creator>`
|
||||
\sa `CGAL::Random_points_in_triangle_2<Point_2, Creator>`
|
||||
|
|
@ -155,8 +153,6 @@ distributed in an open disc. The default `Creator` is
|
|||
\sa `CGAL::Random_points_on_segment_2<Point_2, Creator>`
|
||||
\sa `CGAL::Random_points_on_square_2<Point_2, Creator>`
|
||||
\sa `CGAL::Random_points_in_sphere_3<Point_3, Creator>`
|
||||
\sa `std::random_shuffle`
|
||||
|
||||
*/
|
||||
template< typename Point_2, typename Creator >
|
||||
class Random_points_in_disc_2 {
|
||||
|
|
@ -214,16 +210,12 @@ distributed in a half-open square. The default `Creator` is
|
|||
\cgalModels `InputIterator`
|
||||
\cgalModels `PointGenerator`
|
||||
|
||||
\sa `std::copy_n()`
|
||||
\sa `CGAL::Counting_iterator`
|
||||
\sa `CGAL::Points_on_segment_2<Point_2>`
|
||||
\sa `CGAL::Random_points_in_triangle_2<Point_2, Creator>`
|
||||
\sa `CGAL::Random_points_in_disc_2<Point_2, Creator>`
|
||||
\sa `CGAL::Random_points_on_segment_2<Point_2, Creator>`
|
||||
\sa `CGAL::Random_points_on_square_2<Point_2, Creator>`
|
||||
\sa `CGAL::Random_points_in_cube_3<Point_3, Creator>`
|
||||
\sa `std::random_shuffle`
|
||||
|
||||
*/
|
||||
template< typename Point_2, typename Creator >
|
||||
class Random_points_in_square_2 {
|
||||
|
|
@ -283,8 +275,6 @@ distributed inside a triangle. The default `Creator` is
|
|||
\cgalModels `InputIterator`
|
||||
\cgalModels `PointGenerator`
|
||||
|
||||
\sa `std::copy_n()`
|
||||
\sa `CGAL::Counting_iterator`
|
||||
\sa `CGAL::Points_on_segment_2<Point_2>`
|
||||
\sa `CGAL::Random_points_in_disc_2<Point_2, Creator>`
|
||||
\sa `CGAL::Random_points_on_segment_2<Point_2, Creator>`
|
||||
|
|
@ -292,8 +282,6 @@ distributed inside a triangle. The default `Creator` is
|
|||
\sa `CGAL::Random_points_in_cube_3<Point_3, Creator>`
|
||||
\sa `CGAL::Random_points_in_triangle_3<Point_2, Creator>`
|
||||
\sa `CGAL::Random_points_in_tetrahedron_3<Point_2, Creator>`
|
||||
\sa `std::random_shuffle`
|
||||
|
||||
*/
|
||||
template< typename Point_2, typename Creator >
|
||||
class Random_points_in_triangle_2 {
|
||||
|
|
@ -360,8 +348,6 @@ typedef const Point_2& reference;
|
|||
\cgalModels `InputIterator`
|
||||
\cgalModels `PointGenerator`
|
||||
|
||||
\sa `std::copy_n()`
|
||||
\sa `CGAL::Counting_iterator`
|
||||
\sa `CGAL::Points_on_segment_2<Point_2>`
|
||||
\sa `CGAL::Random_points_in_disc_2<Point_2, Creator>`
|
||||
\sa `CGAL::Random_points_on_segment_2<Point_2, Creator>`
|
||||
|
|
@ -374,8 +360,6 @@ typedef const Point_2& reference;
|
|||
\sa`CGAL::Random_points_in_tetrahedral_mesh_3<C3T3>`
|
||||
\sa `CGAL::Random_points_in_triangles_3<Point_3>`
|
||||
\sa `CGAL::Random_points_in_triangles_2<Point_2>`
|
||||
\sa `std::random_shuffle`
|
||||
|
||||
*/
|
||||
template< typename Point_2,
|
||||
typename Triangulation,
|
||||
|
|
@ -432,8 +416,6 @@ get_default_random() );
|
|||
\cgalModels `InputIterator`
|
||||
\cgalModels `PointGenerator`
|
||||
|
||||
\sa `std::copy_n()`
|
||||
\sa `CGAL::Counting_iterator`
|
||||
\sa `CGAL::Points_on_segment_2<Point_2>`
|
||||
\sa `CGAL::Random_points_in_disc_2<Point_2, Creator>`
|
||||
\sa `CGAL::Random_points_on_segment_2<Point_2, Creator>`
|
||||
|
|
@ -445,8 +427,6 @@ get_default_random() );
|
|||
\sa `CGAL::Random_points_in_tetrahedral_mesh_boundary_3<C3T3>`
|
||||
\sa `CGAL::Random_points_in_tetrahedral_mesh_3<C3T3>`
|
||||
\sa `CGAL::Random_points_in_triangles_3<Point_3>`
|
||||
\sa `std::random_shuffle`
|
||||
|
||||
*/
|
||||
template< typename Point_2,
|
||||
typename Triangle_2 = typename Kernel_traits<Point_2>::Kernel::Triangle_2,
|
||||
|
|
@ -506,8 +486,6 @@ rounding errors.
|
|||
\cgalModels `InputIterator`
|
||||
\cgalModels `PointGenerator`
|
||||
|
||||
\sa `std::copy_n()`
|
||||
\sa `CGAL::Counting_iterator`
|
||||
\sa `CGAL::Points_on_segment_2<Point_2>`
|
||||
\sa `CGAL::Random_points_in_disc_2<Point_2, Creator>`
|
||||
\sa `CGAL::Random_points_in_square_2<Point_2, Creator>`
|
||||
|
|
@ -515,8 +493,6 @@ rounding errors.
|
|||
\sa `CGAL::Random_points_on_segment_2<Point_2, Creator>`
|
||||
\sa `CGAL::Random_points_on_square_2<Point_2, Creator>`
|
||||
\sa `CGAL::Random_points_on_sphere_3<Point_3, Creator>`
|
||||
\sa `std::random_shuffle`
|
||||
|
||||
*/
|
||||
template< typename Point_2, typename Creator >
|
||||
class Random_points_on_circle_2 {
|
||||
|
|
@ -577,16 +553,12 @@ distributed on a segment. The default `Creator` is
|
|||
\cgalModels `InputIterator`
|
||||
\cgalModels `PointGenerator`
|
||||
|
||||
\sa `std::copy_n()`
|
||||
\sa `CGAL::Counting_iterator`
|
||||
\sa `CGAL::Points_on_segment_2<Point_2>`
|
||||
\sa `CGAL::Random_points_in_disc_2<Point_2, Creator>`
|
||||
\sa `CGAL::Random_points_in_square_2<Point_2, Creator>`
|
||||
\sa `CGAL::Random_points_in_triangle_2<Point_2, Creator>`
|
||||
\sa `CGAL::Random_points_on_circle_2<Point_2, Creator>`
|
||||
\sa `CGAL::Random_points_on_square_2<Point_2, Creator>`
|
||||
\sa `std::random_shuffle`
|
||||
|
||||
*/
|
||||
template< typename Point_2, typename Creator >
|
||||
class Random_points_on_segment_2 {
|
||||
|
|
@ -647,16 +619,12 @@ distributed on the boundary of a square. The default `Creator` is
|
|||
\cgalModels `InputIterator`
|
||||
\cgalModels `PointGenerator`
|
||||
|
||||
\sa `std::copy_n()`
|
||||
\sa `CGAL::Counting_iterator`
|
||||
\sa `CGAL::Points_on_segment_2<Point_2>`
|
||||
\sa `CGAL::Random_points_in_disc_2<Point_2, Creator>`
|
||||
\sa `CGAL::Random_points_in_square_2<Point_2, Creator>`
|
||||
\sa `CGAL::Random_points_in_triangle_2<Point_2, Creator>`
|
||||
\sa `CGAL::Random_points_on_circle_2<Point_2, Creator>`
|
||||
\sa `CGAL::Random_points_on_segment_2<Point_2, Creator>`
|
||||
\sa `std::random_shuffle`
|
||||
|
||||
*/
|
||||
template< typename Point_2, typename Creator >
|
||||
class Random_points_on_square_2 {
|
||||
|
|
@ -717,8 +685,6 @@ endpoints are specified upon construction. The points are equally spaced.
|
|||
|
||||
\cgalModels `PointGenerator`
|
||||
|
||||
\sa `std::copy_n()`
|
||||
\sa `CGAL::Counting_iterator`
|
||||
\sa `CGAL::points_on_segment<Point_2>`
|
||||
\sa `CGAL::Random_points_in_disc_2<Point_2, Creator>`
|
||||
\sa `CGAL::Random_points_in_square_2<Point_2, Creator>`
|
||||
|
|
@ -727,8 +693,6 @@ endpoints are specified upon construction. The points are equally spaced.
|
|||
\sa `CGAL::Random_points_on_segment_2<Point_2, Creator>`
|
||||
\sa `CGAL::Random_points_on_square_2<Point_2, Creator>`
|
||||
\sa `CGAL::random_selection()`
|
||||
\sa `std::random_shuffle`
|
||||
|
||||
*/
|
||||
template< typename Point_2 >
|
||||
class Points_on_segment_2 {
|
||||
|
|
|
|||
|
|
@ -44,15 +44,11 @@ distributed in a half-open cube. The default `Creator` is
|
|||
\cgalModels `InputIterator`
|
||||
\cgalModels `PointGenerator`
|
||||
|
||||
\sa `std::copy_n()`
|
||||
\sa `CGAL::Counting_iterator`
|
||||
\sa `CGAL::Random_points_in_square_2<Point_2, Creator>`
|
||||
\sa `CGAL::Random_points_in_sphere_3<Point_3, Creator>`
|
||||
\sa `CGAL::Random_points_in_triangle_3<Point_3, Creator>`
|
||||
\sa `CGAL::Random_points_in_tetrahedron_3<Point_3, Creator>`
|
||||
\sa `CGAL::Random_points_on_sphere_3<Point_3, Creator>`
|
||||
\sa `std::random_shuffle`
|
||||
|
||||
*/
|
||||
template< typename Point_3, typename Creator >
|
||||
class Random_points_in_cube_3 {
|
||||
|
|
@ -113,15 +109,11 @@ distributed strictly inside a sphere. The default `Creator` is
|
|||
\cgalModels `InputIterator`
|
||||
\cgalModels `PointGenerator`
|
||||
|
||||
\sa `std::copy_n()`
|
||||
\sa `CGAL::Counting_iterator`
|
||||
\sa `CGAL::Random_points_in_disc_2<Point_2, Creator>`
|
||||
\sa `CGAL::Random_points_in_cube_3<Point_3, Creator>`
|
||||
\sa `CGAL::Random_points_in_triangle_3<Point_3, Creator>`
|
||||
\sa `CGAL::Random_points_in_tetrahedron_3<Point_3, Creator>`
|
||||
\sa `CGAL::Random_points_on_sphere_3<Point_3, Creator>`
|
||||
\sa `std::random_shuffle`
|
||||
|
||||
*/
|
||||
template< typename Point_3, typename Creator >
|
||||
class Random_points_in_sphere_3 {
|
||||
|
|
@ -182,14 +174,10 @@ distributed inside a 3D triangle. The default `Creator` is
|
|||
\cgalModels `InputIterator`
|
||||
\cgalModels `PointGenerator`
|
||||
|
||||
\sa `std::copy_n()`
|
||||
\sa `CGAL::Counting_iterator`
|
||||
\sa `CGAL::Random_points_in_disc_2<Point_2, Creator>`
|
||||
\sa `CGAL::Random_points_in_cube_3<Point_3, Creator>`
|
||||
\sa `CGAL::Random_points_in_tetrahedron_3<Point_3, Creator>`
|
||||
\sa `CGAL::Random_points_on_sphere_3<Point_3, Creator>`
|
||||
\sa `std::random_shuffle`
|
||||
|
||||
*/
|
||||
template< typename Point_3, typename Creator >
|
||||
class Random_points_in_triangle_3 {
|
||||
|
|
@ -260,10 +248,10 @@ distributed on a segment. The default `Creator` is
|
|||
\cgalModels `InputIterator`
|
||||
\cgalModels `PointGenerator`
|
||||
|
||||
\sa `std::copy_n()`
|
||||
\sa `CGAL::Counting_iterator`
|
||||
\sa `std::random_shuffle`
|
||||
|
||||
\sa `CGAL::Random_points_in_cube_3<Point_3, Creator>`
|
||||
\sa `CGAL::Random_points_in_triangle_3<Point_3, Creator>`
|
||||
\sa `CGAL::Random_points_on_sphere_3<Point_3, Creator>`
|
||||
\sa `CGAL::Random_points_in_tetrahedron_3<Point_3, Creator>`
|
||||
*/
|
||||
template< typename Point_3, typename Creator >
|
||||
class Random_points_on_segment_3 {
|
||||
|
|
@ -326,13 +314,10 @@ distributed inside a tetrahedron. The default `Creator` is
|
|||
\cgalModels `InputIterator`
|
||||
\cgalModels `PointGenerator`
|
||||
|
||||
\sa `std::copy_n()`
|
||||
\sa `CGAL::Counting_iterator`
|
||||
\sa `CGAL::Random_points_on_segment_3<Point_3, Creator>`
|
||||
\sa `CGAL::Random_points_in_cube_3<Point_3, Creator>`
|
||||
\sa `CGAL::Random_points_in_triangle_3<Point_3, Creator>`
|
||||
\sa `CGAL::Random_points_on_sphere_3<Point_3, Creator>`
|
||||
\sa `std::random_shuffle`
|
||||
|
||||
*/
|
||||
template< typename Point_3, typename Creator >
|
||||
class Random_points_in_tetrahedron_3 {
|
||||
|
|
@ -405,8 +390,6 @@ The triangle range must be valid and unchanged while the iterator is used.
|
|||
\cgalModels `InputIterator`
|
||||
\cgalModels `PointGenerator`
|
||||
|
||||
\sa `std::copy_n()`
|
||||
\sa `CGAL::Counting_iterator`
|
||||
\sa `CGAL::Random_points_in_cube_3<Point_3, Creator>`
|
||||
\sa `CGAL::Random_points_in_triangle_3<Point_3, Creator>`
|
||||
\sa `CGAL::Random_points_in_tetrahedron_3<Point_3, Creator>`
|
||||
|
|
@ -414,8 +397,6 @@ The triangle range must be valid and unchanged while the iterator is used.
|
|||
\sa `CGAL::Random_points_in_tetrahedral_mesh_boundary_3<C3T3>`
|
||||
\sa `CGAL::Random_points_in_tetrahedral_mesh_3<C3T3>`
|
||||
\sa `CGAL::Random_points_in_triangles_2<Point_2>`
|
||||
\sa `std::random_shuffle`
|
||||
|
||||
*/
|
||||
template< typename Point_3,
|
||||
typename Triangle_3=typename Kernel_traits<Point_3>::Kernel::Triangle_3,
|
||||
|
|
@ -476,8 +457,6 @@ The triangle mesh must be valid and unchanged while the iterator is used.
|
|||
\cgalModels `InputIterator`
|
||||
\cgalModels `PointGenerator`
|
||||
|
||||
\sa `std::copy_n()`
|
||||
\sa `CGAL::Counting_iterator`
|
||||
\sa `CGAL::Random_points_in_disc_2<Point_2, Creator>`
|
||||
\sa `CGAL::Random_points_in_cube_3<Point_3, Creator>`
|
||||
\sa `CGAL::Random_points_in_triangle_3<Point_3, Creator>`
|
||||
|
|
@ -487,7 +466,6 @@ The triangle mesh must be valid and unchanged while the iterator is used.
|
|||
\sa `CGAL::Random_points_in_tetrahedral_mesh_3<C3T3>`
|
||||
\sa `CGAL::Random_points_in_triangles_2<Point_2>`
|
||||
\sa `CGAL::Random_points_in_triangles_3<Point_3>`
|
||||
\sa `std::random_shuffle`
|
||||
|
||||
*/
|
||||
template < class TriangleMesh,
|
||||
|
|
@ -559,8 +537,6 @@ The tetrahedral mesh must be valid and unchanged while the iterator is used.
|
|||
\cgalModels `InputIterator`
|
||||
\cgalModels `PointGenerator`
|
||||
|
||||
\sa `std::copy_n()`
|
||||
\sa `CGAL::Counting_iterator`
|
||||
\sa `CGAL::Random_points_in_disc_2<Point_2, Creator>`
|
||||
\sa `CGAL::Random_points_in_cube_3<Point_3, Creator>`
|
||||
\sa `CGAL::Random_points_in_triangle_3<Point_3, Creator>`
|
||||
|
|
@ -570,8 +546,6 @@ The tetrahedral mesh must be valid and unchanged while the iterator is used.
|
|||
\sa `CGAL::Random_points_in_tetrahedral_mesh_3<C3T3>`
|
||||
\sa `CGAL::Random_points_in_triangles_2<Point_2>`
|
||||
\sa `CGAL::Random_points_in_triangles_3<Point_3>`
|
||||
\sa `std::random_shuffle`
|
||||
|
||||
*/
|
||||
template <class C3T3,
|
||||
class Creator = Creator_uniform_3<
|
||||
|
|
@ -637,8 +611,6 @@ The tetrahedral mesh must be valid and unchanged while the iterator is used.
|
|||
\cgalModels `InputIterator`
|
||||
\cgalModels `PointGenerator`
|
||||
|
||||
\sa `std::copy_n()`
|
||||
\sa `CGAL::Counting_iterator`
|
||||
\sa `CGAL::Random_points_in_disc_2<Point_2, Creator>`
|
||||
\sa `CGAL::Random_points_in_cube_3<Point_3, Creator>`
|
||||
\sa `CGAL::Random_points_in_triangle_3<Point_3, Creator>`
|
||||
|
|
@ -648,8 +620,6 @@ The tetrahedral mesh must be valid and unchanged while the iterator is used.
|
|||
\sa `CGAL::Random_points_in_tetrahedral_mesh_boundary_3<C3T3>`
|
||||
\sa `CGAL::Random_points_in_triangles_2<Point_2>`
|
||||
\sa `CGAL::Random_points_in_triangles_3<Point_3>`
|
||||
\sa `std::random_shuffle`
|
||||
|
||||
*/
|
||||
template <class C3T3,
|
||||
class Creator = Creator_uniform_3<
|
||||
|
|
@ -715,13 +685,9 @@ rounding errors.
|
|||
\cgalModels `InputIterator`
|
||||
\cgalModels `PointGenerator`
|
||||
|
||||
\sa `std::copy_n()`
|
||||
\sa `CGAL::Counting_iterator`
|
||||
\sa `CGAL::Random_points_on_circle_2<Point_2, Creator>`
|
||||
\sa `CGAL::Random_points_in_cube_3<Point_3, Creator>`
|
||||
\sa `CGAL::Random_points_in_sphere_3<Point_3, Creator>`
|
||||
\sa `std::random_shuffle`
|
||||
|
||||
*/
|
||||
template< typename Point_3, typename Creator >
|
||||
class Random_points_on_sphere_3 {
|
||||
|
|
|
|||
|
|
@ -43,13 +43,10 @@ distributed in an open ball in any dimension.
|
|||
\cgalModels `InputIterator`
|
||||
\cgalModels `PointGenerator`
|
||||
|
||||
\sa `std::copy_n()`
|
||||
\sa `CGAL::Counting_iterator`
|
||||
\sa `CGAL::Random_points_in_disc_2<Point_2, Creator>`
|
||||
\sa `CGAL::Random_points_in_sphere_3<Point_3, Creator>`
|
||||
\sa `CGAL::Random_points_in_cube_d<Point_d>`
|
||||
\sa `CGAL::Random_points_on_sphere_d<Point_d>`
|
||||
|
||||
*/
|
||||
template< typename Point_d >
|
||||
class Random_points_in_ball_d {
|
||||
|
|
@ -112,13 +109,10 @@ distributed in an half-open cube.
|
|||
\cgalModels `InputIterator`
|
||||
\cgalModels `PointGenerator`
|
||||
|
||||
\sa `std::copy_n()`
|
||||
\sa `CGAL::Counting_iterator`
|
||||
\sa `CGAL::Random_points_in_square_2<Point_2, Creator>`
|
||||
\sa `CGAL::Random_points_in_cube_3<Point_3, Creator>`
|
||||
\sa `CGAL::Random_points_in_ball_d<Point_d>`
|
||||
\sa `CGAL::Random_points_on_sphere_d<Point_d>`
|
||||
|
||||
*/
|
||||
template< typename Point_d >
|
||||
class Random_points_in_cube_d {
|
||||
|
|
@ -187,13 +181,10 @@ rounding errors.
|
|||
\cgalModels `InputIterator`
|
||||
\cgalModels `PointGenerator`
|
||||
|
||||
\sa `std::copy_n()`
|
||||
\sa `CGAL::Counting_iterator`
|
||||
\sa `CGAL::Random_points_on_circle_2<Point_2, Creator>`
|
||||
\sa `CGAL::Random_points_on_sphere_3<Point_3, Creator>`
|
||||
\sa `CGAL::Random_points_in_cube_d<Point_d>`
|
||||
\sa `CGAL::Random_points_in_ball_d<Point_d>`
|
||||
|
||||
*/
|
||||
template< typename Point_d >
|
||||
class Random_points_on_sphere_d {
|
||||
|
|
|
|||
|
|
@ -244,7 +244,7 @@ MainWindow::open(QString fileName)
|
|||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
std::vector<K::Point_3> point_3_s;
|
||||
CGAL::read_multi_point_WKT(ifs, point_3_s);
|
||||
BOOST_FOREACH(const K::Point_3& point_3, point_3_s)
|
||||
for(const K::Point_3& point_3 : point_3_s)
|
||||
{
|
||||
points.push_back(Apollonius_site_2(K::Point_2(point_3.x(), point_3.y()), point_3.z()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -499,7 +499,7 @@ MainWindow::open(QString fileName)
|
|||
{
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
CGAL::read_multi_point_WKT(ifs, points);
|
||||
BOOST_FOREACH(K::Point_2 p, points)
|
||||
for(K::Point_2 p : points)
|
||||
{
|
||||
mc.insert(p);
|
||||
me.insert(p);
|
||||
|
|
|
|||
|
|
@ -358,7 +358,7 @@ MainWindow::loadWKTConstraints(QString
|
|||
do{
|
||||
std::vector<Polygon> polygons;
|
||||
CGAL::read_multi_polygon_WKT(ifs, polygons);
|
||||
BOOST_FOREACH(const Polygon& poly, polygons)
|
||||
for(const Polygon& poly : polygons)
|
||||
{
|
||||
if(poly.outer_boundary().is_empty())
|
||||
continue;
|
||||
|
|
@ -388,7 +388,7 @@ MainWindow::loadWKTConstraints(QString
|
|||
do{
|
||||
std::vector<LineString > linestrings;
|
||||
CGAL::read_multi_linestring_WKT(ifs, linestrings);
|
||||
BOOST_FOREACH(const LineString& ls, linestrings)
|
||||
for(const LineString& ls : linestrings)
|
||||
{
|
||||
bool first_pass=true;
|
||||
LineString::const_iterator it = ls.begin();
|
||||
|
|
|
|||
|
|
@ -401,7 +401,7 @@ MainWindow::loadWKT(QString
|
|||
{
|
||||
std::vector<K::Point_2> mpts;
|
||||
CGAL::read_multi_point_WKT(ifs, mpts);
|
||||
BOOST_FOREACH(const K::Point_2& p, mpts)
|
||||
for(const K::Point_2& p : mpts)
|
||||
svd.insert(p);
|
||||
}while(ifs.good() && !ifs.eof());
|
||||
//Lines
|
||||
|
|
@ -412,7 +412,7 @@ MainWindow::loadWKT(QString
|
|||
typedef std::vector<K::Point_2> LineString;
|
||||
std::vector<LineString> mls;
|
||||
CGAL::read_multi_linestring_WKT(ifs, mls);
|
||||
BOOST_FOREACH(const LineString& ls, mls)
|
||||
for(const LineString& ls : mls)
|
||||
{
|
||||
if(ls.empty())
|
||||
continue;
|
||||
|
|
@ -450,7 +450,7 @@ MainWindow::loadWKT(QString
|
|||
typedef CGAL::Polygon_with_holes_2<K> Polygon;
|
||||
std::vector<Polygon> mps;
|
||||
CGAL::read_multi_polygon_WKT(ifs, mps);
|
||||
BOOST_FOREACH(const Polygon& poly, mps)
|
||||
for(const Polygon& poly : mps)
|
||||
{
|
||||
if(poly.outer_boundary().is_empty())
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -273,7 +273,7 @@ MainWindow::open(QString fileName)
|
|||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
std::vector<std::vector<Point_2> > mls;
|
||||
CGAL::read_multi_linestring_WKT(ifs, mls);
|
||||
BOOST_FOREACH(const std::vector<Point_2>& ls, mls)
|
||||
for(const std::vector<Point_2>& ls : mls)
|
||||
{
|
||||
if(ls.size() > 2)
|
||||
continue;
|
||||
|
|
@ -315,7 +315,7 @@ MainWindow::on_actionSaveSegments_triggered()
|
|||
{
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
std::vector<std::vector<Point_2> >mls;
|
||||
BOOST_FOREACH(const Segment_2& seg, input)
|
||||
for(const Segment_2& seg : input)
|
||||
{
|
||||
std::vector<Point_2> ls(2);
|
||||
ls[0] = seg.source();
|
||||
|
|
|
|||
|
|
@ -572,12 +572,12 @@ MainWindow::loadWKT(QString
|
|||
typedef CGAL::Point_2<K> Point;
|
||||
std::vector<Polygon> mps;
|
||||
CGAL::read_multi_polygon_WKT(ifs, mps);
|
||||
BOOST_FOREACH(const Polygon& p, mps)
|
||||
for(const Polygon& p : mps)
|
||||
{
|
||||
if(p.outer_boundary().is_empty())
|
||||
continue;
|
||||
|
||||
BOOST_FOREACH(Point point, p.outer_boundary().container())
|
||||
for(Point point : p.outer_boundary().container())
|
||||
cdt.insert(point);
|
||||
for(Polygon::General_polygon_2::Edge_const_iterator
|
||||
e_it=p.outer_boundary().edges_begin(); e_it != p.outer_boundary().edges_end(); ++e_it)
|
||||
|
|
@ -586,7 +586,7 @@ MainWindow::loadWKT(QString
|
|||
for(Polygon::Hole_const_iterator h_it =
|
||||
p.holes_begin(); h_it != p.holes_end(); ++h_it)
|
||||
{
|
||||
BOOST_FOREACH(Point point, h_it->container())
|
||||
for(Point point : h_it->container())
|
||||
cdt.insert(point);
|
||||
for(Polygon::General_polygon_2::Edge_const_iterator
|
||||
e_it=h_it->edges_begin(); e_it != h_it->edges_end(); ++e_it)
|
||||
|
|
@ -604,7 +604,7 @@ MainWindow::loadWKT(QString
|
|||
typedef std::vector<K::Point_2> LineString;
|
||||
std::vector<LineString> mls;
|
||||
CGAL::read_multi_linestring_WKT(ifs, mls);
|
||||
BOOST_FOREACH(const LineString& ls, mls)
|
||||
for(const LineString& ls : mls)
|
||||
{
|
||||
if(ls.empty())
|
||||
continue;
|
||||
|
|
@ -642,7 +642,7 @@ MainWindow::loadWKT(QString
|
|||
{
|
||||
std::vector<K::Point_2> mpts;
|
||||
CGAL::read_multi_point_WKT(ifs, mpts);
|
||||
BOOST_FOREACH(const K::Point_2& p, mpts)
|
||||
for(const K::Point_2& p : mpts)
|
||||
{
|
||||
cdt.insert(p);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ MainWindow::on_actionLoadPoints_triggered()
|
|||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
std::vector<K::Point_3> points_3;
|
||||
CGAL::read_multi_point_WKT(ifs, points_3);
|
||||
BOOST_FOREACH(const K::Point_3& p, points_3)
|
||||
for(const K::Point_3& p : points_3)
|
||||
{
|
||||
points.push_back(Weighted_point_2(K::Point_2(p.x(), p.y()), p.z()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,3 +3,5 @@ The following files have been copied from Qt Free Edition version 4.4:
|
|||
fileOpen.png
|
||||
fileSave.png,
|
||||
fit-page-32.png
|
||||
|
||||
This Qt version was released under GPL-2 and GPL-3.
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ namespace internal
|
|||
static typename Local_kernel::Point_3 get_local_point(const typename K::Point_2& p)
|
||||
{
|
||||
CGAL::Cartesian_converter<K, Local_kernel> converter;
|
||||
return Local_point(converter(p.x()), 0, converter(p.y()));
|
||||
return typename Local_kernel::Point_3(converter(p.x()), 0, converter(p.y()));
|
||||
}
|
||||
static typename Local_kernel::Point_3 get_local_point(const typename K::Weighted_point_2& p)
|
||||
{
|
||||
|
|
@ -91,13 +91,18 @@ namespace internal
|
|||
static typename Local_kernel::Vector_3 get_local_vector(const typename K::Vector_2& v)
|
||||
{
|
||||
CGAL::Cartesian_converter<K, Local_kernel> converter;
|
||||
return Local_vector(converter(v.x()), 0, converter(v.y()));
|
||||
return typename Local_kernel::Vector_3(converter(v.x()), 0, converter(v.y()));
|
||||
}
|
||||
static typename Local_kernel::Vector_3 get_local_vector(const typename K::Vector_3& v)
|
||||
{
|
||||
CGAL::Cartesian_converter<K, Local_kernel> converter;
|
||||
return converter(v);
|
||||
}
|
||||
static typename Local_kernel::Ray_2 get_local_ray(const typename K::Ray_2& r)
|
||||
{
|
||||
CGAL::Cartesian_converter<K, Local_kernel> converter;
|
||||
return converter(r);
|
||||
}
|
||||
};
|
||||
|
||||
// Specialization when K==Local_kernel, because there is no need of convertion here.
|
||||
|
|
@ -116,6 +121,8 @@ namespace internal
|
|||
{ return typename Local_kernel::Vector_3(v.x(), 0, v.y()); }
|
||||
static const typename Local_kernel::Vector_3& get_local_vector(const typename Local_kernel::Vector_3& v)
|
||||
{ return v; }
|
||||
static const typename Local_kernel::Ray_2& get_local_ray(const typename Local_kernel::Ray_2& r)
|
||||
{ return r; }
|
||||
};
|
||||
} // End namespace internal
|
||||
|
||||
|
|
@ -127,6 +134,7 @@ public:
|
|||
typedef CGAL::Exact_predicates_inexact_constructions_kernel Local_kernel;
|
||||
typedef Local_kernel::Point_3 Local_point;
|
||||
typedef Local_kernel::Vector_3 Local_vector;
|
||||
typedef Local_kernel::Ray_2 Local_ray;
|
||||
|
||||
Buffer_for_vao(std::vector<BufferType>* pos=nullptr,
|
||||
std::vector<IndexType>* indices=nullptr,
|
||||
|
|
@ -143,6 +151,7 @@ public:
|
|||
m_zero_x(true),
|
||||
m_zero_y(true),
|
||||
m_zero_z(true),
|
||||
m_inverse_normal(false),
|
||||
m_face_started(false)
|
||||
{}
|
||||
|
||||
|
|
@ -193,6 +202,17 @@ public:
|
|||
bool has_zero_z() const
|
||||
{ return m_zero_z; }
|
||||
|
||||
void negate_normals()
|
||||
{
|
||||
m_inverse_normal=!m_inverse_normal;
|
||||
for (std::vector<BufferType>*array=m_flat_normal_buffer; array!=nullptr;
|
||||
array=(array==m_gouraud_normal_buffer?nullptr:m_gouraud_normal_buffer))
|
||||
{
|
||||
for (std::size_t i=0; i<array->size(); ++i)
|
||||
{ (*array)[i]=-(*array)[i]; }
|
||||
}
|
||||
}
|
||||
|
||||
// 1.1) Add a point, without color. Return the index of the added point.
|
||||
template<typename KPoint>
|
||||
std::size_t add_point(const KPoint& kp)
|
||||
|
|
@ -212,6 +232,16 @@ public:
|
|||
return m_pos_buffer->size()-3;
|
||||
}
|
||||
|
||||
template<typename KPoint>
|
||||
std::size_t add_point_infinity(const KPoint& kp)
|
||||
{
|
||||
if (!has_position()) return (std::size_t)-1;
|
||||
|
||||
Local_point p=get_local_point(kp);
|
||||
add_point_in_buffer(p, *m_pos_buffer);
|
||||
return m_pos_buffer->size()-3;
|
||||
}
|
||||
|
||||
// 1.2) Add a point, with color.
|
||||
template<typename KPoint>
|
||||
void add_point(const KPoint& kp, const CGAL::Color& c)
|
||||
|
|
@ -243,7 +273,7 @@ public:
|
|||
add_segment(kp1, kp2);
|
||||
add_color(c);
|
||||
add_color(c);
|
||||
}
|
||||
}
|
||||
|
||||
// 2.3) Add an indexed segment, without color.
|
||||
template<typename T>
|
||||
|
|
@ -253,6 +283,44 @@ public:
|
|||
add_indexed_point(index2);
|
||||
}
|
||||
|
||||
// 3.1) Add a ray segment, without color
|
||||
template<typename KPoint, typename KVector>
|
||||
void add_ray_segment(const KPoint& kp1, const KVector& kp2)
|
||||
{
|
||||
add_point(kp1);
|
||||
add_point_infinity(kp2);
|
||||
}
|
||||
|
||||
//3.2) Add a ray segment, with color
|
||||
template<typename KPoint, typename KVector>
|
||||
void add_ray_segment(const KPoint& kp1, const KVector& kp2,
|
||||
const CGAL::Color& c)
|
||||
{
|
||||
add_point(kp1);
|
||||
add_point_infinity(kp2);
|
||||
add_color(c);
|
||||
add_color(c);
|
||||
}
|
||||
|
||||
// 4.1) Add a line, without color
|
||||
template<typename KPoint>
|
||||
void add_line_segment(const KPoint& kp1, const KPoint& kp2)
|
||||
{
|
||||
add_point_infinity(kp1);
|
||||
add_point_infinity(kp2);
|
||||
}
|
||||
|
||||
// 4.1) Add a line, with color
|
||||
template<typename KPoint>
|
||||
void add_line_segment(const KPoint& kp1, const KPoint& kp2,
|
||||
const CGAL::Color& c)
|
||||
{
|
||||
add_point_infinity(kp1);
|
||||
add_point_infinity(kp2);
|
||||
add_color(c);
|
||||
add_color(c);
|
||||
}
|
||||
|
||||
/// @return true iff a face has begun.
|
||||
bool is_a_face_started() const
|
||||
{ return m_face_started; }
|
||||
|
|
@ -399,9 +467,10 @@ public:
|
|||
|
||||
/// adds `kv` coordinates to `buffer`
|
||||
template<typename KVector>
|
||||
static void add_normal_in_buffer(const KVector& kv, std::vector<float>& buffer)
|
||||
static void add_normal_in_buffer(const KVector& kv, std::vector<float>& buffer,
|
||||
bool inverse_normal=false)
|
||||
{
|
||||
Local_vector n=get_local_vector(kv);
|
||||
Local_vector n=(inverse_normal?-get_local_vector(kv):get_local_vector(kv));
|
||||
buffer.push_back(n.x());
|
||||
buffer.push_back(n.y());
|
||||
buffer.push_back(n.z());
|
||||
|
|
@ -457,8 +526,9 @@ public:
|
|||
}
|
||||
return true;
|
||||
}
|
||||
CGAL::Bbox_3 *bb() const { return m_bb; }
|
||||
|
||||
protected:
|
||||
protected:
|
||||
void face_begin_internal(bool has_color, bool has_normal)
|
||||
{
|
||||
if (is_a_face_started())
|
||||
|
|
@ -484,23 +554,23 @@ protected:
|
|||
if (m_indices_of_points_of_face.size()>0)
|
||||
{
|
||||
add_indexed_point(m_indices_of_points_of_face[i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
add_point(m_points_of_face[i]); // Add the position of the point
|
||||
if (m_started_face_is_colored)
|
||||
{ add_color(m_color_of_face); } // Add the color
|
||||
add_flat_normal(normal); // Add the flat normal
|
||||
// Its smooth normal (if given by the user)
|
||||
if (m_vertex_normals_for_face.size()>0)
|
||||
{ // Here we have 3 vertex normals; we can use Gouraud
|
||||
add_gouraud_normal(m_vertex_normals_for_face[i]);
|
||||
}
|
||||
else
|
||||
{ // Here user does not provide all vertex normals: we use face normal istead
|
||||
// and thus we will not be able to use Gouraud
|
||||
add_gouraud_normal(normal);
|
||||
}
|
||||
if (m_started_face_is_colored)
|
||||
{ add_color(m_color_of_face); } // Add the color
|
||||
add_flat_normal(normal); // Add the flat normal
|
||||
// Its smooth normal (if given by the user)
|
||||
if (m_vertex_normals_for_face.size()>0)
|
||||
{ // Here we have 3 vertex normals; we can use Gouraud
|
||||
add_gouraud_normal(m_vertex_normals_for_face[i]);
|
||||
}
|
||||
else
|
||||
{ // Here user does not provide all vertex normals: we use face normal istead
|
||||
// and thus we will not be able to use Gouraud
|
||||
add_gouraud_normal(normal);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -766,14 +836,14 @@ protected:
|
|||
void add_flat_normal(const KVector& kv)
|
||||
{
|
||||
if(m_flat_normal_buffer != nullptr)
|
||||
{ add_normal_in_buffer(kv, *m_flat_normal_buffer); }
|
||||
{ add_normal_in_buffer(kv, *m_flat_normal_buffer, m_inverse_normal); }
|
||||
}
|
||||
|
||||
template<typename KVector>
|
||||
void add_gouraud_normal(const KVector& kv)
|
||||
{
|
||||
if(m_gouraud_normal_buffer != nullptr)
|
||||
{ add_normal_in_buffer(kv, *m_gouraud_normal_buffer); }
|
||||
{ add_normal_in_buffer(kv, *m_gouraud_normal_buffer, m_inverse_normal); }
|
||||
}
|
||||
|
||||
protected:
|
||||
|
|
@ -826,8 +896,10 @@ protected:
|
|||
bool m_zero_x; /// True iff all points have x==0
|
||||
bool m_zero_y; /// True iff all points have y==0
|
||||
bool m_zero_z; /// True iff all points have z==0
|
||||
|
||||
bool m_inverse_normal;;
|
||||
|
||||
// Local variables, used when we started a new face.
|
||||
// Local variables, used when we started a new face.g
|
||||
bool m_face_started;
|
||||
bool m_started_face_is_colored;
|
||||
bool m_started_face_has_normal;
|
||||
|
|
|
|||
|
|
@ -15,10 +15,12 @@
|
|||
|
||||
#include <CGAL/license/GraphicsView.h>
|
||||
#include <iostream>
|
||||
#include <tuple>
|
||||
#include <string>
|
||||
|
||||
#ifdef CGAL_USE_BASIC_VIEWER
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef __GNUC__
|
||||
#if __GNUC__ >= 9
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wdeprecated-copy"
|
||||
|
|
@ -35,7 +37,7 @@
|
|||
#include <QGLBuffer>
|
||||
#include <QOpenGLShaderProgram>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef __GNUC__
|
||||
#if __GNUC__ >= 9
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
|
@ -43,6 +45,7 @@
|
|||
|
||||
#include <vector>
|
||||
#include <cstdlib>
|
||||
#include <cfloat>
|
||||
|
||||
#include <CGAL/Buffer_for_vao.h>
|
||||
#include <CGAL/Qt/CreateOpenGLContext.h>
|
||||
|
|
@ -59,14 +62,14 @@ const char vertex_source_color[] =
|
|||
"attribute highp vec4 vertex;\n"
|
||||
"attribute highp vec3 normal;\n"
|
||||
"attribute highp vec3 color;\n"
|
||||
|
||||
|
||||
"uniform highp mat4 mvp_matrix;\n"
|
||||
"uniform highp mat4 mv_matrix; \n"
|
||||
|
||||
|
||||
"varying highp vec4 fP; \n"
|
||||
"varying highp vec3 fN; \n"
|
||||
"varying highp vec4 fColor; \n"
|
||||
|
||||
|
||||
"uniform highp float point_size; \n"
|
||||
"void main(void)\n"
|
||||
"{\n"
|
||||
|
|
@ -89,9 +92,8 @@ const char fragment_source_color[] =
|
|||
"uniform highp vec4 light_spec; \n"
|
||||
"uniform highp vec4 light_amb; \n"
|
||||
"uniform float spec_power ; \n"
|
||||
|
||||
|
||||
"void main(void) { \n"
|
||||
|
||||
" highp vec3 L = light_pos.xyz - fP.xyz; \n"
|
||||
" highp vec3 V = -fP.xyz; \n"
|
||||
|
||||
|
|
@ -102,7 +104,6 @@ const char fragment_source_color[] =
|
|||
" highp vec3 R = reflect(-L, N); \n"
|
||||
" highp vec4 diffuse = max(dot(N,L), 0.0) * light_diff * fColor; \n"
|
||||
" highp vec4 specular = pow(max(dot(R,V), 0.0), spec_power) * light_spec; \n"
|
||||
|
||||
"gl_FragColor = light_amb*fColor + diffuse ; \n"
|
||||
"} \n"
|
||||
"\n"
|
||||
|
|
@ -235,7 +236,7 @@ inline CGAL::Color get_random_color(CGAL::Random& random)
|
|||
}
|
||||
//------------------------------------------------------------------------------
|
||||
class Basic_viewer_qt : public CGAL::QGLViewer
|
||||
{
|
||||
{
|
||||
public:
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel Local_kernel;
|
||||
typedef Local_kernel::Point_3 Local_point;
|
||||
|
|
@ -248,18 +249,28 @@ public:
|
|||
bool draw_edges=true,
|
||||
bool draw_faces=true,
|
||||
bool use_mono_color=false,
|
||||
bool inverse_normal=false) :
|
||||
bool inverse_normal=false,
|
||||
bool draw_rays=true,
|
||||
bool draw_lines=true,
|
||||
bool draw_text=true) :
|
||||
CGAL::QGLViewer(parent),
|
||||
m_draw_vertices(draw_vertices),
|
||||
m_draw_edges(draw_edges),
|
||||
m_draw_rays(draw_rays),
|
||||
m_draw_lines(draw_lines),
|
||||
m_draw_faces(draw_faces),
|
||||
m_flatShading(true),
|
||||
m_use_mono_color(use_mono_color),
|
||||
m_inverse_normal(inverse_normal),
|
||||
m_draw_text(draw_text),
|
||||
m_size_points(7.),
|
||||
m_size_edges(3.1),
|
||||
m_size_edges(3.1),
|
||||
m_size_rays(3.1),
|
||||
m_size_lines(3.1),
|
||||
m_vertices_mono_color(200, 60, 60),
|
||||
m_edges_mono_color(0, 0, 0),
|
||||
m_rays_mono_color(0, 0, 0),
|
||||
m_lines_mono_color(0, 0, 0),
|
||||
m_faces_mono_color(60, 60, 200),
|
||||
m_ambient_color(0.6f, 0.5f, 0.5f, 0.5f),
|
||||
m_are_buffers_initialized(false),
|
||||
|
|
@ -281,6 +292,24 @@ public:
|
|||
&m_bounding_box,
|
||||
&arrays[COLOR_SEGMENTS],
|
||||
nullptr, nullptr),
|
||||
m_buffer_for_mono_rays(&arrays[POS_MONO_RAYS],
|
||||
nullptr,
|
||||
&m_bounding_box,
|
||||
nullptr, nullptr),
|
||||
m_buffer_for_colored_rays(&arrays[POS_COLORED_RAYS],
|
||||
nullptr,
|
||||
&m_bounding_box,
|
||||
&arrays[COLOR_RAYS],
|
||||
nullptr, nullptr),
|
||||
m_buffer_for_mono_lines(&arrays[POS_MONO_RAYS],
|
||||
nullptr,
|
||||
&m_bounding_box,
|
||||
nullptr, nullptr),
|
||||
m_buffer_for_colored_lines(&arrays[POS_COLORED_LINES],
|
||||
nullptr,
|
||||
&m_bounding_box,
|
||||
&arrays[COLOR_LINES],
|
||||
nullptr, nullptr),
|
||||
m_buffer_for_mono_faces(&arrays[POS_MONO_FACES],
|
||||
nullptr,
|
||||
&m_bounding_box,
|
||||
|
|
@ -290,7 +319,7 @@ public:
|
|||
m_buffer_for_colored_faces(&arrays[POS_COLORED_FACES],
|
||||
nullptr,
|
||||
&m_bounding_box,
|
||||
&arrays[COLOR_FACES],
|
||||
&arrays[COLOR_FACES],
|
||||
&arrays[FLAT_NORMAL_COLORED_FACES],
|
||||
&arrays[SMOOTH_NORMAL_COLORED_FACES])
|
||||
{
|
||||
|
|
@ -300,6 +329,9 @@ public:
|
|||
setWindowTitle(title);
|
||||
|
||||
resize(500, 450);
|
||||
|
||||
if (inverse_normal)
|
||||
{ negate_all_normals(); }
|
||||
}
|
||||
|
||||
~Basic_viewer_qt()
|
||||
|
|
@ -307,7 +339,7 @@ public:
|
|||
for (unsigned int i=0; i<NB_VBO_BUFFERS; ++i)
|
||||
buffers[i].destroy();
|
||||
|
||||
for (int i=0; i<NB_VAO_BUFFERS; ++i)
|
||||
for (unsigned int i=0; i<NB_VAO_BUFFERS; ++i)
|
||||
vao[i].destroy();
|
||||
}
|
||||
|
||||
|
|
@ -317,6 +349,7 @@ public:
|
|||
{ arrays[i].clear(); }
|
||||
|
||||
m_bounding_box=CGAL::Bbox_3();
|
||||
m_texts.clear();
|
||||
}
|
||||
|
||||
bool is_empty() const
|
||||
|
|
@ -325,10 +358,14 @@ public:
|
|||
m_buffer_for_colored_points.is_empty() &&
|
||||
m_buffer_for_mono_segments.is_empty() &&
|
||||
m_buffer_for_colored_segments.is_empty() &&
|
||||
m_buffer_for_mono_rays.is_empty() &&
|
||||
m_buffer_for_colored_rays.is_empty() &&
|
||||
m_buffer_for_mono_lines.is_empty() &&
|
||||
m_buffer_for_colored_lines.is_empty() &&
|
||||
m_buffer_for_mono_faces.is_empty() &&
|
||||
m_buffer_for_colored_faces.is_empty());
|
||||
}
|
||||
|
||||
|
||||
const CGAL::Bbox_3& bounding_box() const
|
||||
{ return m_bounding_box; }
|
||||
|
||||
|
|
@ -340,7 +377,11 @@ public:
|
|||
m_buffer_for_mono_segments.has_zero_x() &&
|
||||
m_buffer_for_colored_segments.has_zero_x() &&
|
||||
m_buffer_for_mono_faces.has_zero_x() &&
|
||||
m_buffer_for_colored_faces.has_zero_x();
|
||||
m_buffer_for_colored_faces.has_zero_x() &&
|
||||
m_buffer_for_mono_rays.has_zero_x() &&
|
||||
m_buffer_for_colored_rays.has_zero_x() &&
|
||||
m_buffer_for_mono_lines.has_zero_x() &&
|
||||
m_buffer_for_colored_lines.has_zero_x();
|
||||
}
|
||||
|
||||
bool has_zero_y() const
|
||||
|
|
@ -351,7 +392,11 @@ public:
|
|||
m_buffer_for_mono_segments.has_zero_y() &&
|
||||
m_buffer_for_colored_segments.has_zero_y() &&
|
||||
m_buffer_for_mono_faces.has_zero_y() &&
|
||||
m_buffer_for_colored_faces.has_zero_y();
|
||||
m_buffer_for_colored_faces.has_zero_y() &&
|
||||
m_buffer_for_mono_rays.has_zero_y() &&
|
||||
m_buffer_for_colored_rays.has_zero_y() &&
|
||||
m_buffer_for_mono_lines.has_zero_y() &&
|
||||
m_buffer_for_colored_lines.has_zero_y();
|
||||
}
|
||||
|
||||
bool has_zero_z() const
|
||||
|
|
@ -362,7 +407,11 @@ public:
|
|||
m_buffer_for_mono_segments.has_zero_z() &&
|
||||
m_buffer_for_colored_segments.has_zero_z() &&
|
||||
m_buffer_for_mono_faces.has_zero_z() &&
|
||||
m_buffer_for_colored_faces.has_zero_z();
|
||||
m_buffer_for_colored_faces.has_zero_z() &&
|
||||
m_buffer_for_mono_rays.has_zero_z() &&
|
||||
m_buffer_for_colored_rays.has_zero_z() &&
|
||||
m_buffer_for_mono_lines.has_zero_z() &&
|
||||
m_buffer_for_colored_lines.has_zero_z();
|
||||
}
|
||||
|
||||
template<typename KPoint>
|
||||
|
|
@ -371,23 +420,89 @@ public:
|
|||
|
||||
template<typename KPoint>
|
||||
void add_point(const KPoint& p, const CGAL::Color& acolor)
|
||||
{ m_buffer_for_colored_points.add_point(p, acolor); }
|
||||
|
||||
{ m_buffer_for_colored_points.add_point(p, acolor); }
|
||||
|
||||
template<typename KPoint>
|
||||
void add_segment(const KPoint& p1, const KPoint& p2)
|
||||
{ m_buffer_for_mono_segments.add_segment(p1, p2); }
|
||||
|
||||
|
||||
template<typename KPoint>
|
||||
void add_segment(const KPoint& p1, const KPoint& p2,
|
||||
const CGAL::Color& acolor)
|
||||
{ m_buffer_for_colored_segments.add_segment(p1, p2, acolor); }
|
||||
{ m_buffer_for_colored_segments.add_segment(p1, p2, acolor); }
|
||||
|
||||
template <typename KPoint, typename KVector>
|
||||
void update_bounding_box_for_ray(const KPoint &p, const KVector &v)
|
||||
{
|
||||
Local_point lp = get_local_point(p);
|
||||
Local_vector lv = get_local_vector(v);
|
||||
CGAL::Bbox_3 b = (lp + lv).bbox();
|
||||
m_bounding_box += b;
|
||||
}
|
||||
|
||||
template <typename KPoint, typename KVector>
|
||||
void update_bounding_box_for_line(const KPoint &p, const KVector &v,
|
||||
const KVector &pv)
|
||||
{
|
||||
Local_point lp = get_local_point(p);
|
||||
Local_vector lv = get_local_vector(v);
|
||||
Local_vector lpv = get_local_vector(pv);
|
||||
|
||||
CGAL::Bbox_3 b = lp.bbox() + (lp + lv).bbox() + (lp + lpv).bbox();
|
||||
m_bounding_box += b;
|
||||
}
|
||||
|
||||
template <typename KPoint, typename KVector>
|
||||
void add_ray(const KPoint &p, const KVector &v)
|
||||
{
|
||||
double bigNumber = 1e30;
|
||||
m_buffer_for_mono_rays.add_ray_segment(p, (p + (bigNumber)*v));
|
||||
}
|
||||
|
||||
template <typename KPoint, typename KVector>
|
||||
void add_ray(const KPoint &p, const KVector &v, const CGAL::Color &acolor)
|
||||
{
|
||||
double bigNumber = 1e30;
|
||||
m_buffer_for_colored_rays.add_ray_segment(p, (p + (bigNumber)*v), acolor);
|
||||
}
|
||||
|
||||
template <typename KPoint, typename KVector>
|
||||
void add_line(const KPoint &p, const KVector &v)
|
||||
{
|
||||
double bigNumber = 1e30;
|
||||
m_buffer_for_mono_lines.add_line_segment((p - (bigNumber)*v),
|
||||
(p + (bigNumber)*v));
|
||||
}
|
||||
|
||||
template <typename KPoint, typename KVector>
|
||||
void add_line(const KPoint &p, const KVector &v, const CGAL::Color &acolor)
|
||||
{
|
||||
double bigNumber = 1e30;
|
||||
m_buffer_for_colored_lines.add_line_segment((p - (bigNumber)*v),
|
||||
(p + (bigNumber)*v), acolor);
|
||||
}
|
||||
|
||||
template<typename KPoint>
|
||||
void add_text(const KPoint& kp, const QString& txt)
|
||||
{
|
||||
Local_point p=get_local_point(kp);
|
||||
m_texts.push_back(std::make_tuple(p, txt));
|
||||
}
|
||||
|
||||
template<typename KPoint>
|
||||
void add_text(const KPoint& kp, const char* txt)
|
||||
{ add_text(kp, QString(txt)); }
|
||||
|
||||
template<typename KPoint>
|
||||
void add_text(const KPoint& kp, const std::string& txt)
|
||||
{ add_text(kp, txt.c_str()); }
|
||||
|
||||
bool is_a_face_started() const
|
||||
{
|
||||
return m_buffer_for_mono_faces.is_a_face_started() ||
|
||||
m_buffer_for_colored_faces.is_a_face_started();
|
||||
}
|
||||
|
||||
|
||||
void face_begin()
|
||||
{
|
||||
if (is_a_face_started())
|
||||
|
|
@ -396,7 +511,7 @@ public:
|
|||
}
|
||||
else
|
||||
{ m_buffer_for_mono_faces.face_begin(); }
|
||||
}
|
||||
}
|
||||
|
||||
void face_begin(const CGAL::Color& acolor)
|
||||
{
|
||||
|
|
@ -417,7 +532,7 @@ public:
|
|||
{ return m_buffer_for_colored_faces.add_point_in_face(kp); }
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
template<typename KPoint, typename KVector>
|
||||
bool add_point_in_face(const KPoint& kp, const KVector& p_normal)
|
||||
{
|
||||
|
|
@ -455,20 +570,20 @@ protected:
|
|||
{
|
||||
rendering_program_face.removeAllShaders();
|
||||
rendering_program_p_l.removeAllShaders();
|
||||
|
||||
|
||||
// Create the buffers
|
||||
for (unsigned int i=0; i<NB_VBO_BUFFERS; ++i)
|
||||
{
|
||||
if(!buffers[i].isCreated() && !buffers[i].create())
|
||||
{ std::cerr<<"VBO Creation number "<<i<<" FAILED"<<std::endl; }
|
||||
}
|
||||
|
||||
for (int i=0; i<NB_VAO_BUFFERS; ++i)
|
||||
|
||||
for (unsigned int i=0; i<NB_VAO_BUFFERS; ++i)
|
||||
{
|
||||
if(!vao[i].isCreated() && !vao[i].create())
|
||||
{ std::cerr<<"VAO Creation number "<<i<<" FAILED"<<std::endl; }
|
||||
}
|
||||
|
||||
|
||||
// Vertices and segments shader
|
||||
|
||||
const char* source_ = isOpenGL_4_3()
|
||||
|
|
@ -515,7 +630,7 @@ protected:
|
|||
if(!rendering_program_face.addShader(vertex_shader_face))
|
||||
{ std::cerr<<"adding vertex shader FAILED"<<std::endl; }
|
||||
if(!rendering_program_face.addShader(fragment_shader_face))
|
||||
{ std::cerr<<"adding fragment shader FAILED"<<std::endl; }
|
||||
{ std::cerr<<"adding fragment shader FAILED"<<std::endl; }
|
||||
if(!rendering_program_face.link())
|
||||
{ std::cerr<<"linking Program FAILED"<<std::endl; }
|
||||
}
|
||||
|
|
@ -528,7 +643,7 @@ protected:
|
|||
|
||||
// 1.1) Mono points
|
||||
vao[VAO_MONO_POINTS].bind();
|
||||
|
||||
|
||||
unsigned int bufn = 0;
|
||||
assert(bufn<NB_VBO_BUFFERS);
|
||||
buffers[bufn].bind();
|
||||
|
|
@ -540,9 +655,9 @@ protected:
|
|||
buffers[bufn].release();
|
||||
|
||||
rendering_program_p_l.disableAttributeArray("color");
|
||||
|
||||
|
||||
vao[VAO_MONO_POINTS].release();
|
||||
|
||||
|
||||
// 1.2) Color points
|
||||
vao[VAO_COLORED_POINTS].bind();
|
||||
|
||||
|
|
@ -555,7 +670,7 @@ protected:
|
|||
rendering_program_p_l.setAttributeBuffer("vertex",GL_FLOAT,0,3);
|
||||
buffers[bufn].release();
|
||||
|
||||
++bufn;
|
||||
++bufn;
|
||||
assert(bufn<NB_VBO_BUFFERS);
|
||||
buffers[bufn].bind();
|
||||
buffers[bufn].allocate(arrays[COLOR_POINTS].data(),
|
||||
|
|
@ -567,11 +682,11 @@ protected:
|
|||
vao[VAO_COLORED_POINTS].release();
|
||||
|
||||
// 2) SEGMENT SHADER
|
||||
|
||||
|
||||
// 2.1) Mono segments
|
||||
vao[VAO_MONO_SEGMENTS].bind();
|
||||
|
||||
++bufn;
|
||||
|
||||
++bufn;
|
||||
assert(bufn<NB_VBO_BUFFERS);
|
||||
buffers[bufn].bind();
|
||||
buffers[bufn].allocate(arrays[POS_MONO_SEGMENTS].data(),
|
||||
|
|
@ -585,9 +700,9 @@ protected:
|
|||
|
||||
vao[VAO_MONO_SEGMENTS].release();
|
||||
|
||||
// 1.2) Color segments
|
||||
// 2.1) Color segments
|
||||
vao[VAO_COLORED_SEGMENTS].bind();
|
||||
|
||||
|
||||
++bufn;
|
||||
assert(bufn<NB_VBO_BUFFERS);
|
||||
buffers[bufn].bind();
|
||||
|
|
@ -608,16 +723,107 @@ protected:
|
|||
buffers[bufn].release();
|
||||
|
||||
vao[VAO_COLORED_SEGMENTS].release();
|
||||
|
||||
|
||||
rendering_program_p_l.release();
|
||||
|
||||
// 3) FACE SHADER
|
||||
|
||||
// 3) RAYS SHADER
|
||||
|
||||
// 3.1) Mono rays
|
||||
vao[VAO_MONO_RAYS].bind();
|
||||
|
||||
++bufn;
|
||||
assert(bufn<NB_VBO_BUFFERS);
|
||||
buffers[bufn].bind();
|
||||
buffers[bufn].allocate(arrays[POS_MONO_RAYS].data(),
|
||||
static_cast<int>(arrays[POS_MONO_RAYS].size()*sizeof(float)));
|
||||
rendering_program_p_l.enableAttributeArray("vertex");
|
||||
rendering_program_p_l.setAttributeArray("vertex",GL_FLOAT,0,3);
|
||||
|
||||
buffers[bufn].release();
|
||||
|
||||
rendering_program_p_l.disableAttributeArray("color");
|
||||
|
||||
vao[VAO_MONO_RAYS].release();
|
||||
|
||||
// 3.2) Color rays
|
||||
|
||||
vao[VAO_COLORED_RAYS].bind();
|
||||
|
||||
++bufn;
|
||||
assert(bufn<NB_VBO_BUFFERS);
|
||||
buffers[bufn].bind();
|
||||
buffers[bufn].allocate(arrays[POS_COLORED_RAYS].data(),
|
||||
static_cast<int>(arrays[POS_COLORED_RAYS].size()*sizeof(float)));
|
||||
rendering_program_p_l.enableAttributeArray("vertex");
|
||||
rendering_program_p_l.setAttributeBuffer("vertex",GL_FLOAT,0,3);
|
||||
|
||||
buffers[bufn].release();
|
||||
|
||||
++bufn;
|
||||
assert(bufn<NB_VBO_BUFFERS);
|
||||
buffers[bufn].bind();
|
||||
buffers[bufn].allocate(arrays[COLOR_RAYS].data(),
|
||||
static_cast<int>(arrays[COLOR_RAYS].size()*sizeof(float)));
|
||||
rendering_program_p_l.enableAttributeArray("color");
|
||||
rendering_program_p_l.setAttributeBuffer("color",GL_FLOAT,0,3);
|
||||
buffers[bufn].release();
|
||||
|
||||
vao[VAO_COLORED_RAYS].release();
|
||||
|
||||
rendering_program_p_l.release();
|
||||
|
||||
// 4) LINES SHADER
|
||||
// 4.1) Mono lines
|
||||
vao[VAO_MONO_LINES].bind();
|
||||
|
||||
++bufn;
|
||||
assert(bufn<NB_VBO_BUFFERS);
|
||||
buffers[bufn].bind();
|
||||
buffers[bufn].allocate(arrays[POS_MONO_LINES].data(),
|
||||
static_cast<int>(arrays[POS_MONO_LINES].size()*sizeof(float)));
|
||||
rendering_program_p_l.enableAttributeArray("vertex");
|
||||
rendering_program_p_l.setAttributeArray("vertex",GL_FLOAT,0,3);
|
||||
|
||||
buffers[bufn].release();
|
||||
|
||||
rendering_program_p_l.disableAttributeArray("color");
|
||||
|
||||
vao[VAO_MONO_LINES].release();
|
||||
|
||||
// 4.2 Color lines
|
||||
|
||||
vao[VAO_COLORED_LINES].bind();
|
||||
|
||||
++bufn;
|
||||
assert(bufn<NB_VBO_BUFFERS);
|
||||
buffers[bufn].bind();
|
||||
buffers[bufn].allocate(arrays[POS_COLORED_LINES].data(),
|
||||
static_cast<int>(arrays[POS_COLORED_LINES].size()*sizeof(float)));
|
||||
rendering_program_p_l.enableAttributeArray("vertex");
|
||||
rendering_program_p_l.setAttributeBuffer("vertex",GL_FLOAT,0,3);
|
||||
|
||||
buffers[bufn].release();
|
||||
|
||||
++bufn;
|
||||
assert(bufn<NB_VBO_BUFFERS);
|
||||
buffers[bufn].bind();
|
||||
buffers[bufn].allocate(arrays[COLOR_LINES].data(),
|
||||
static_cast<int>(arrays[COLOR_LINES].size()*sizeof(float)));
|
||||
rendering_program_p_l.enableAttributeArray("color");
|
||||
rendering_program_p_l.setAttributeBuffer("color",GL_FLOAT,0,3);
|
||||
buffers[bufn].release();
|
||||
|
||||
vao[VAO_COLORED_LINES].release();
|
||||
|
||||
rendering_program_p_l.release();
|
||||
|
||||
// 5) FACE SHADER
|
||||
rendering_program_face.bind();
|
||||
|
||||
// 3.1) Mono faces
|
||||
// 5.1) Mono faces
|
||||
vao[VAO_MONO_FACES].bind();
|
||||
|
||||
// 3.1.1) points of the mono faces
|
||||
// 5.1.1) points of the mono faces
|
||||
++bufn;
|
||||
assert(bufn<NB_VBO_BUFFERS);
|
||||
buffers[bufn].bind();
|
||||
|
|
@ -627,8 +833,8 @@ protected:
|
|||
rendering_program_face.setAttributeBuffer("vertex",GL_FLOAT,0,3);
|
||||
|
||||
buffers[bufn].release();
|
||||
|
||||
// 3.1.2) normals of the mono faces
|
||||
|
||||
// 5.1.2) normals of the mono faces
|
||||
++bufn;
|
||||
assert(bufn<NB_VBO_BUFFERS);
|
||||
buffers[bufn].bind();
|
||||
|
|
@ -646,17 +852,17 @@ protected:
|
|||
}
|
||||
rendering_program_face.enableAttributeArray("normal");
|
||||
rendering_program_face.setAttributeBuffer("normal",GL_FLOAT,0,3);
|
||||
|
||||
|
||||
buffers[bufn].release();
|
||||
|
||||
// 3.1.3) color of the mono faces
|
||||
// 5.1.3) color of the mono faces
|
||||
rendering_program_face.disableAttributeArray("color");
|
||||
vao[VAO_MONO_FACES].release();
|
||||
|
||||
// 3.2) Color faces
|
||||
// 5.2) Color faces
|
||||
vao[VAO_COLORED_FACES].bind();
|
||||
|
||||
// 3.2.1) points of the color faces
|
||||
|
||||
// 5.2.1) points of the color faces
|
||||
++bufn;
|
||||
assert(bufn<NB_VBO_BUFFERS);
|
||||
buffers[bufn].bind();
|
||||
|
|
@ -664,10 +870,10 @@ protected:
|
|||
static_cast<int>(arrays[POS_COLORED_FACES].size()*sizeof(float)));
|
||||
rendering_program_face.enableAttributeArray("vertex");
|
||||
rendering_program_face.setAttributeBuffer("vertex",GL_FLOAT,0,3);
|
||||
|
||||
|
||||
buffers[bufn].release();
|
||||
|
||||
// 3.2.2) normals of the color faces
|
||||
|
||||
// 5.2.2) normals of the color faces
|
||||
++bufn;
|
||||
assert(bufn<NB_VBO_BUFFERS);
|
||||
buffers[bufn].bind();
|
||||
|
|
@ -685,10 +891,10 @@ protected:
|
|||
}
|
||||
rendering_program_face.enableAttributeArray("normal");
|
||||
rendering_program_face.setAttributeBuffer("normal",GL_FLOAT,0,3);
|
||||
|
||||
|
||||
buffers[bufn].release();
|
||||
|
||||
// 3.2.3) colors of the faces
|
||||
|
||||
// 5.2.3) colors of the faces
|
||||
++bufn;
|
||||
assert(bufn<NB_VBO_BUFFERS);
|
||||
buffers[bufn].bind();
|
||||
|
|
@ -696,13 +902,13 @@ protected:
|
|||
static_cast<int>(arrays[COLOR_FACES].size()*sizeof(float)));
|
||||
rendering_program_face.enableAttributeArray("color");
|
||||
rendering_program_face.setAttributeBuffer("color",GL_FLOAT,0,3);
|
||||
|
||||
|
||||
buffers[bufn].release();
|
||||
|
||||
|
||||
vao[VAO_COLORED_FACES].release();
|
||||
|
||||
|
||||
rendering_program_face.release();
|
||||
|
||||
|
||||
m_are_buffers_initialized = true;
|
||||
}
|
||||
|
||||
|
|
@ -712,12 +918,12 @@ protected:
|
|||
QMatrix4x4 mvMatrix;
|
||||
double mat[16];
|
||||
viewer->camera()->getModelViewProjectionMatrix(mat);
|
||||
for(int i=0; i < 16; i++)
|
||||
for(unsigned int i=0; i < 16; i++)
|
||||
{
|
||||
mvpMatrix.data()[i] = (float)mat[i];
|
||||
}
|
||||
viewer->camera()->getModelViewMatrix(mat);
|
||||
for(int i=0; i < 16; i++)
|
||||
for(unsigned int i=0; i < 16; i++)
|
||||
{
|
||||
mvMatrix.data()[i] = (float)mat[i];
|
||||
}
|
||||
|
|
@ -734,13 +940,13 @@ protected:
|
|||
|
||||
CGAL::Bbox_3 bb;
|
||||
if (bb==bounding_box()) // Case of "empty" bounding box
|
||||
{
|
||||
{
|
||||
bb=Local_point(CGAL::ORIGIN).bbox();
|
||||
bb=bb + Local_point(1,1,1).bbox(); // To avoid a warning from Qglviewer
|
||||
}
|
||||
else
|
||||
{ bb=bounding_box(); }
|
||||
|
||||
|
||||
QVector4D position((bb.xmax()-bb.xmin())/2,
|
||||
(bb.ymax()-bb.ymin())/2,
|
||||
bb.zmax(), 0.0);
|
||||
|
|
@ -764,13 +970,18 @@ protected:
|
|||
rendering_program_face.setUniformValue(mvpLocation, mvpMatrix);
|
||||
rendering_program_face.setUniformValue(mvLocation, mvMatrix);
|
||||
rendering_program_face.release();
|
||||
|
||||
|
||||
rendering_program_p_l.bind();
|
||||
int mvpLocation2 = rendering_program_p_l.uniformLocation("mvp_matrix");
|
||||
rendering_program_p_l.setUniformValue(mvpLocation2, mvpMatrix);
|
||||
rendering_program_p_l.release();
|
||||
}
|
||||
|
||||
// Returns true if the data structure lies on a plane
|
||||
bool is_two_dimensional() {
|
||||
return (!is_empty() && (has_zero_x() || has_zero_y() || has_zero_z()));
|
||||
}
|
||||
|
||||
virtual void draw()
|
||||
{
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
|
@ -792,7 +1003,7 @@ protected:
|
|||
rendering_program_p_l.setUniformValue("point_size", GLfloat(m_size_points));
|
||||
glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(arrays[POS_MONO_POINTS].size()/3));
|
||||
vao[VAO_MONO_POINTS].release();
|
||||
|
||||
|
||||
vao[VAO_COLORED_POINTS].bind();
|
||||
if (m_use_mono_color)
|
||||
{
|
||||
|
|
@ -846,6 +1057,83 @@ protected:
|
|||
rendering_program_p_l.release();
|
||||
}
|
||||
|
||||
if(m_draw_rays)
|
||||
{
|
||||
rendering_program_p_l.bind();
|
||||
|
||||
vao[VAO_MONO_RAYS].bind();
|
||||
color.setRgbF((double)m_rays_mono_color.red()/(double)255,
|
||||
(double)m_rays_mono_color.green()/(double)255,
|
||||
(double)m_rays_mono_color.blue()/(double)255);
|
||||
rendering_program_p_l.setAttributeValue("color",color);
|
||||
glLineWidth(m_size_rays);
|
||||
glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(arrays[POS_MONO_RAYS].size()/3));
|
||||
vao[VAO_MONO_RAYS].release();
|
||||
|
||||
vao[VAO_COLORED_RAYS].bind();
|
||||
if (m_use_mono_color)
|
||||
{
|
||||
color.setRgbF((double)m_rays_mono_color.red()/(double)255,
|
||||
(double)m_rays_mono_color.green()/(double)255,
|
||||
(double)m_rays_mono_color.blue()/(double)255);
|
||||
rendering_program_p_l.disableAttributeArray("color");
|
||||
rendering_program_p_l.setAttributeValue("color",color);
|
||||
}
|
||||
else
|
||||
{
|
||||
rendering_program_p_l.enableAttributeArray("color");
|
||||
}
|
||||
glLineWidth(m_size_rays);
|
||||
glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(arrays[POS_COLORED_RAYS].size()/3));
|
||||
vao[VAO_COLORED_RAYS].release();
|
||||
|
||||
rendering_program_p_l.release();
|
||||
}
|
||||
|
||||
if(m_draw_lines)
|
||||
{
|
||||
rendering_program_p_l.bind();
|
||||
|
||||
vao[VAO_MONO_LINES].bind();
|
||||
color.setRgbF((double)m_lines_mono_color.red()/(double)255,
|
||||
(double)m_lines_mono_color.green()/(double)255,
|
||||
(double)m_lines_mono_color.blue()/(double)255);
|
||||
rendering_program_p_l.setAttributeValue("color",color);
|
||||
glLineWidth(m_size_lines);
|
||||
glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(arrays[POS_MONO_LINES].size()/3));
|
||||
vao[VAO_MONO_LINES].release();
|
||||
|
||||
rendering_program_p_l.release();
|
||||
|
||||
vao[VAO_COLORED_LINES].bind();
|
||||
if (m_use_mono_color)
|
||||
{
|
||||
color.setRgbF((double)m_rays_mono_color.red()/(double)255,
|
||||
(double)m_rays_mono_color.green()/(double)255,
|
||||
(double)m_rays_mono_color.blue()/(double)255);
|
||||
rendering_program_p_l.disableAttributeArray("color");
|
||||
rendering_program_p_l.setAttributeValue("color",color);
|
||||
}
|
||||
else
|
||||
{
|
||||
rendering_program_p_l.enableAttributeArray("color");
|
||||
}
|
||||
glLineWidth(m_size_lines);
|
||||
glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(arrays[POS_COLORED_LINES].size()/3));
|
||||
vao[VAO_COLORED_LINES].release();
|
||||
|
||||
rendering_program_p_l.release();
|
||||
}
|
||||
|
||||
// Fix Z-fighting by drawing faces at a depth
|
||||
GLfloat offset_factor;
|
||||
GLfloat offset_units;
|
||||
if (is_two_dimensional()) {
|
||||
glGetFloatv(GL_POLYGON_OFFSET_FACTOR, &offset_factor);
|
||||
glGetFloatv(GL_POLYGON_OFFSET_UNITS, &offset_units);
|
||||
glPolygonOffset(0.1f, 0.9f);
|
||||
}
|
||||
|
||||
if (m_draw_faces)
|
||||
{
|
||||
rendering_program_face.bind();
|
||||
|
|
@ -874,10 +1162,13 @@ protected:
|
|||
glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(arrays[POS_COLORED_FACES].size()/3));
|
||||
vao[VAO_COLORED_FACES].release();
|
||||
|
||||
if (is_two_dimensional())
|
||||
glPolygonOffset(offset_factor, offset_units);
|
||||
|
||||
rendering_program_face.release();
|
||||
}
|
||||
|
||||
if (!is_empty() && (has_zero_x() || has_zero_y() || has_zero_z()))
|
||||
if (is_two_dimensional())
|
||||
{
|
||||
camera()->setType(CGAL::qglviewer::Camera::ORTHOGRAPHIC);
|
||||
// Camera Constraint:
|
||||
|
|
@ -893,6 +1184,21 @@ protected:
|
|||
constraint.setRotationConstraintDirection(CGAL::qglviewer::Vec(cx, cy, cz));
|
||||
camera()->frame()->setConstraint(&constraint);
|
||||
}
|
||||
|
||||
if (m_draw_text)
|
||||
{
|
||||
glDisable(GL_LIGHTING);
|
||||
for (std::size_t i=0; i<m_texts.size(); ++i)
|
||||
{
|
||||
CGAL::qglviewer::Vec screenPos=camera()->projectedCoordinatesOf
|
||||
(CGAL::qglviewer::Vec(std::get<0>(m_texts[i]).x(),
|
||||
std::get<0>(m_texts[i]).y(),
|
||||
std::get<0>(m_texts[i]).z()));
|
||||
|
||||
drawText((int)screenPos[0], (int)screenPos[1], std::get<1>(m_texts[i]));
|
||||
}
|
||||
glEnable(GL_LIGHTING);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void redraw()
|
||||
|
|
@ -900,7 +1206,7 @@ protected:
|
|||
initialize_buffers();
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
virtual void init()
|
||||
{
|
||||
// Restore previous viewer state.
|
||||
|
|
@ -916,6 +1222,7 @@ protected:
|
|||
setKeyDescription(::Qt::Key_G, "Switch between flat/Gouraud shading display");
|
||||
setKeyDescription(::Qt::Key_M, "Toggles mono color");
|
||||
setKeyDescription(::Qt::Key_N, "Inverse direction of normals");
|
||||
setKeyDescription(::Qt::Key_T, "Toggles text display");
|
||||
setKeyDescription(::Qt::Key_V, "Toggles vertices display");
|
||||
setKeyDescription(::Qt::Key_Plus, "Increase size of edges");
|
||||
setKeyDescription(::Qt::Key_Minus, "Decrease size of edges");
|
||||
|
|
@ -939,7 +1246,7 @@ protected:
|
|||
|
||||
CGAL::Bbox_3 bb;
|
||||
if (bb==bounding_box()) // Case of "empty" bounding box
|
||||
{
|
||||
{
|
||||
bb=Local_point(CGAL::ORIGIN).bbox();
|
||||
bb=bb + Local_point(1,1,1).bbox(); // To avoid a warning from Qglviewer
|
||||
}
|
||||
|
|
@ -957,13 +1264,10 @@ protected:
|
|||
|
||||
void negate_all_normals()
|
||||
{
|
||||
for (unsigned int k=BEGIN_NORMAL; k<END_NORMAL; ++k)
|
||||
{
|
||||
for (std::size_t i=0; i<arrays[k].size(); ++i)
|
||||
{ arrays[k][i]=-arrays[k][i]; }
|
||||
}
|
||||
m_buffer_for_mono_faces.negate_normals();
|
||||
m_buffer_for_colored_faces.negate_normals();
|
||||
}
|
||||
|
||||
|
||||
virtual void keyPressEvent(QKeyEvent *e)
|
||||
{
|
||||
const ::Qt::KeyboardModifiers modifiers = e->modifiers();
|
||||
|
|
@ -973,8 +1277,7 @@ protected:
|
|||
m_draw_edges=!m_draw_edges;
|
||||
displayMessage(QString("Draw edges=%1.").arg(m_draw_edges?"true":"false"));
|
||||
update();
|
||||
}
|
||||
else if ((e->key()==::Qt::Key_F) && (modifiers==::Qt::NoButton))
|
||||
}else if ((e->key()==::Qt::Key_F) && (modifiers==::Qt::NoButton))
|
||||
{
|
||||
m_draw_faces=!m_draw_faces;
|
||||
displayMessage(QString("Draw faces=%1.").arg(m_draw_faces?"true":"false"));
|
||||
|
|
@ -1002,6 +1305,12 @@ protected:
|
|||
negate_all_normals();
|
||||
redraw();
|
||||
}
|
||||
else if ((e->key()==::Qt::Key_T) && (modifiers==::Qt::NoButton))
|
||||
{
|
||||
m_draw_text=!m_draw_text;
|
||||
displayMessage(QString("Draw text=%1.").arg(m_draw_text?"true":"false"));
|
||||
update();
|
||||
}
|
||||
else if ((e->key()==::Qt::Key_V) && (modifiers==::Qt::NoButton))
|
||||
{
|
||||
m_draw_vertices=!m_draw_vertices;
|
||||
|
|
@ -1146,16 +1455,23 @@ protected:
|
|||
protected:
|
||||
bool m_draw_vertices;
|
||||
bool m_draw_edges;
|
||||
bool m_draw_rays;
|
||||
bool m_draw_lines;
|
||||
bool m_draw_faces;
|
||||
bool m_flatShading;
|
||||
bool m_use_mono_color;
|
||||
bool m_inverse_normal;
|
||||
bool m_draw_text;
|
||||
|
||||
double m_size_points;
|
||||
double m_size_edges;
|
||||
double m_size_rays;
|
||||
double m_size_lines;
|
||||
|
||||
CGAL::Color m_vertices_mono_color;
|
||||
CGAL::Color m_edges_mono_color;
|
||||
CGAL::Color m_rays_mono_color;
|
||||
CGAL::Color m_lines_mono_color;
|
||||
CGAL::Color m_faces_mono_color;
|
||||
QVector4D m_ambient_color;
|
||||
|
||||
|
|
@ -1173,12 +1489,18 @@ protected:
|
|||
POS_COLORED_POINTS,
|
||||
POS_MONO_SEGMENTS,
|
||||
POS_COLORED_SEGMENTS,
|
||||
POS_MONO_RAYS,
|
||||
POS_COLORED_RAYS,
|
||||
POS_MONO_LINES,
|
||||
POS_COLORED_LINES,
|
||||
POS_MONO_FACES,
|
||||
POS_COLORED_FACES,
|
||||
END_POS,
|
||||
BEGIN_COLOR=END_POS,
|
||||
COLOR_POINTS=BEGIN_COLOR,
|
||||
COLOR_SEGMENTS,
|
||||
COLOR_RAYS,
|
||||
COLOR_LINES,
|
||||
COLOR_FACES,
|
||||
END_COLOR,
|
||||
BEGIN_NORMAL=END_COLOR,
|
||||
|
|
@ -1195,20 +1517,28 @@ protected:
|
|||
Buffer_for_vao<float> m_buffer_for_colored_points;
|
||||
Buffer_for_vao<float> m_buffer_for_mono_segments;
|
||||
Buffer_for_vao<float> m_buffer_for_colored_segments;
|
||||
Buffer_for_vao<float> m_buffer_for_mono_rays;
|
||||
Buffer_for_vao<float> m_buffer_for_colored_rays;
|
||||
Buffer_for_vao<float> m_buffer_for_mono_lines;
|
||||
Buffer_for_vao<float> m_buffer_for_colored_lines;
|
||||
Buffer_for_vao<float> m_buffer_for_mono_faces;
|
||||
Buffer_for_vao<float> m_buffer_for_colored_faces;
|
||||
|
||||
|
||||
static const unsigned int NB_VBO_BUFFERS=(END_POS-BEGIN_POS)+
|
||||
(END_COLOR-BEGIN_COLOR)+2; // +2 for 2 vectors of normals
|
||||
|
||||
QGLBuffer buffers[NB_VBO_BUFFERS];
|
||||
|
||||
// The following enum gives the indices of the differents vao.
|
||||
enum
|
||||
enum
|
||||
{ VAO_MONO_POINTS=0,
|
||||
VAO_COLORED_POINTS,
|
||||
VAO_MONO_SEGMENTS,
|
||||
VAO_COLORED_SEGMENTS,
|
||||
VAO_MONO_RAYS,
|
||||
VAO_COLORED_RAYS,
|
||||
VAO_MONO_LINES,
|
||||
VAO_COLORED_LINES,
|
||||
VAO_MONO_FACES,
|
||||
VAO_COLORED_FACES,
|
||||
NB_VAO_BUFFERS
|
||||
|
|
@ -1217,6 +1547,8 @@ protected:
|
|||
|
||||
QOpenGLShaderProgram rendering_program_face;
|
||||
QOpenGLShaderProgram rendering_program_p_l;
|
||||
|
||||
std::vector<std::tuple<Local_point, QString> > m_texts;
|
||||
};
|
||||
|
||||
} // End namespace CGAL
|
||||
|
|
|
|||
70
INSTALL.md
70
INSTALL.md
|
|
@ -1,71 +1,55 @@
|
|||
Building CGAL Libraries From a Branch
|
||||
=====================================
|
||||
NOTICE
|
||||
======
|
||||
|
||||
Building CGAL using the *branch build* presented here keeps the
|
||||
build-sources attached to the Git repository.
|
||||
Since Version 5.0, CGAL is a header-only library it is not needed
|
||||
to build and install it. Usage of CGAL should thus simply amount to:
|
||||
|
||||
Note that we do not document here what are the dependancies and cmake options that
|
||||
are needed to configure CGAL as they are already documented in the
|
||||
[installation manual](https://doc.cgal.org/latest/Manual/installation.html).
|
||||
|
||||
Branch Build of CGAL
|
||||
====================
|
||||
The cmake script at the root of the repository is the one to use to
|
||||
build the CGAL library from a branch. It will collect the list of packages
|
||||
of the branch and will append their include folder to the include path.
|
||||
This is main noticeable difference with a build using a regular *flat* release.
|
||||
|
||||
Here is an example of how to build the library in Debug:
|
||||
``` {.bash}
|
||||
git clone https://github.com/CGAL/cgal.git /path/to/cgal.git
|
||||
cd /path/to/cgal.git
|
||||
cd /path/to/cgal.git/Triangulation_2/examples/Triangulation_2
|
||||
mkdir -p build/debug
|
||||
cd build/debug
|
||||
cmake -DCMAKE_BUILD_TYPE=Debug ../..
|
||||
cmake -DCMAKE_BUILD_TYPE=Debug -DCGAL_DIR=/path/to/cgal.git
|
||||
make
|
||||
```
|
||||
|
||||
Here is an example of how to build the library in Release:
|
||||
``` {.bash}
|
||||
git clone https://github.com/CGAL/cgal.git /path/to/cgal.git
|
||||
cd /path/to/cgal.git
|
||||
mkdir -p build/release
|
||||
cd build/release
|
||||
cmake -DCMAKE_BUILD_TYPE=Release ../..
|
||||
make
|
||||
```
|
||||
Note that *no installation is required* to use that version of CGAL once it has been compiled.
|
||||
in the case of the building of an example in debug mode.
|
||||
|
||||
For more information head over to the [CGAL manual](https://doc.cgal.org/latest/Manual/general_intro.html).
|
||||
Note that this page describes the setting of CGAL as a sources release and, as such,
|
||||
files are organized in a slightly different way, see the [Layout of the CGAL Git Repository](README.md).
|
||||
|
||||
|
||||
Building a Program Using CGAL
|
||||
=============================
|
||||
|
||||
To compile a program using CGAL, simply set `CGAL_DIR` to the location
|
||||
of where you built the library (environment or cmake variable).
|
||||
of the directory containing `CGALConfig.cmake` (for example the root
|
||||
of the extracted source archive or the root of a git checkout).
|
||||
|
||||
Here is an example of how to build in debug the examples from the 3D Triangulations package:
|
||||
|
||||
``` {.bash}
|
||||
cmake -DCGAL_DIR:PATH=/path/to/cgal.git/build/debug /path/to/cgal.git/Triangulation_3/examples/Triangulation_3
|
||||
cd /path/to/cgal.git/Triangulation_3/examples/Triangulation_3
|
||||
mkdir -p build/debug
|
||||
cd build/debug
|
||||
cmake -DCGAL_DIR:PATH=/path/to/cgal.git ../..
|
||||
make
|
||||
```
|
||||
|
||||
If you're trying to build examples or tests that does not already have a `CMakeLists.txt`, you can trigger its creation by calling the script [`cgal_create_cmake_script`](Scripts/scripts/cgal_create_cmake_script) found in `/path/to/cgal.git/Scripts/scripts/` at the root of the example/test directory. Here is an example for the examples of the 2D Triangulation package:
|
||||
If you are trying to build examples or tests that do not already have a `CMakeLists.txt`,
|
||||
you can trigger its creation by calling the script [`cgal_create_cmake_script`](Scripts/scripts/cgal_create_cmake_script)
|
||||
found in `/path/to/cgal.git/Scripts/scripts/` at the root of the example/test directory.
|
||||
Here is an example for the examples of the 2D Triangulation package:
|
||||
|
||||
``` {.bash}
|
||||
cd /path/to/cgal.git/Triangulation_2/examples/Triangulation_2
|
||||
/path/to/cgal.git/Scripts/scripts/cgal_create_cmake_script
|
||||
cd -
|
||||
cmake -DCGAL_DIR:PATH=/path/to/cgal.git/build/debug /path/to/cgal.git/Triangulation_2/examples/Triangulation_2
|
||||
cd /path/to/cgal.git/Triangulation_2/examples/Triangulation_2
|
||||
mkdir -p build/debug
|
||||
cd build/debug
|
||||
cmake -DCGAL_DIR:PATH=/path/to/cgal.git ../..
|
||||
make
|
||||
```
|
||||
|
||||
Note If You Switch Between Branches
|
||||
===================================
|
||||
A build may be outdated after an include/dir has been deleted,
|
||||
switched or even updated. This might lead to compile problems (link
|
||||
with outdated version). Thus, it is recommended to build CGAL after
|
||||
each update, switch, merge of a branch (in particular if directories
|
||||
have been added/deleted, or cpp files have been added, deleted or
|
||||
altered).
|
||||
|
||||
|
||||
For more information head over to the [CGAL manual](https://doc.cgal.org/latest/Manual/general_intro.html).
|
||||
|
|
|
|||
|
|
@ -1,10 +1,65 @@
|
|||
Release History
|
||||
===============
|
||||
|
||||
Release 5.1
|
||||
-----------
|
||||
|
||||
Release date: June 2020
|
||||
|
||||
### 3D Fast Intersection and Distance Computation
|
||||
- **Breaking change**: the internal search tree is now lazily constructed. To disable it, one must call
|
||||
the new function `do_not_accelerate_distance_queries()` before the first distance query.
|
||||
|
||||
### Polygon Mesh Processing
|
||||
|
||||
- The function `CGAL::Polygon_mesh_processing::stitch_borders()` now returns the number
|
||||
of halfedge pairs that were stitched.
|
||||
|
||||
### 2D Triangulations
|
||||
- To fix an inconsistency between code and documentation and to clarify which types of intersections
|
||||
are truly allowed in constrained Delaunay triangulations, the tag `CGAL::No_intersection_tag`
|
||||
has been deprecated in favor of two new tags `CGAL::No_constraint_intersection_tag`
|
||||
and `CGAL::No_constraint_intersection_requiring_constructions_tag`.
|
||||
The latter is equivalent to the now-deprecated `CGAL::No_intersection_tag`, and allows constraints
|
||||
to intersect as long as no new point has to be created to represent that intersection (for example,
|
||||
the intersection of two constraint segments in a 'T'-like junction is an existing point
|
||||
and does not require any new construction). The former tag, `CGAL::No_constraint_intersection_tag`,
|
||||
does not allow any intersection, except for the configuration of two constraints having a single
|
||||
common endpoints, for convience.
|
||||
|
||||
### dD Spatial Searching
|
||||
|
||||
- Improved the performance of the kd-tree in some cases:
|
||||
- Not storing the points coordinates inside the tree usually
|
||||
generates a lot of cache misses, leading to non-optimal
|
||||
performance. This is the case for example
|
||||
when indices are stored inside the tree, or to a lesser extent when the points
|
||||
coordinates are stored in a dynamically allocated array (e.g., `Epick_d`
|
||||
with dynamic dimension) — we says "to a lesser extent" because the points
|
||||
are re-created by the kd-tree in a cache-friendly order after its construction,
|
||||
so the coordinates are more likely to be stored in a near-optimal order
|
||||
on the heap.
|
||||
In these cases, the new `EnablePointsCache` template parameter of the
|
||||
`CGAL::Kd_tree` class can be set to `CGAL::Tag_true`. The points coordinates
|
||||
will then be cached in an optimal way. This will increase memory
|
||||
consumption but provides better search performance. See the updated
|
||||
`GeneralDistance` and `FuzzyQueryItem`
|
||||
concepts for additional requirements when using such a cache.
|
||||
- In most cases (e.g., Euclidean distance), the distance computation
|
||||
algorithm knows before its end that the distance will be greater
|
||||
than or equal to some given value. This is used in the (orthogonal)
|
||||
k-NN search to interrupt some distance computations before its end,
|
||||
saving precious milliseconds, in particular in medium-to-high dimension.
|
||||
|
||||
### dD Geometry Kernel
|
||||
- Epick\_d and Epeck\_d gain 2 new functors: `Power_side_of_bounded_power_sphere_d` and
|
||||
`Compute_squared_radius_smallest_orthogonal_sphere_d`. Those are
|
||||
essential for the computation of weighted alpha-complexes.
|
||||
|
||||
[Release 5.0](https://github.com/CGAL/cgal/releases/tag/releases%2FCGAL-5.0)
|
||||
-----------
|
||||
|
||||
Release date: October 2019
|
||||
Release date: November 2019
|
||||
|
||||
### General changes
|
||||
|
||||
|
|
@ -18,6 +73,9 @@ Release date: October 2019
|
|||
- Since CGAL 4.9, CGAL can be used as a header-only library, with
|
||||
dependencies. Since CGAL 5.0, that is now the default, unless
|
||||
specified differently in the (optional) CMake configuration.
|
||||
- The section "Getting Started with CGAL" of the documentation has
|
||||
been updated and reorganized.
|
||||
- The minimal version of Boost is now 1.57.0.
|
||||
|
||||
|
||||
### [Polygonal Surface Reconstruction](https://doc.cgal.org/5.0/Manual/packages.html#PkgPolygonalSurfaceReconstruction) (new package)
|
||||
|
|
|
|||
|
|
@ -1191,7 +1191,7 @@ You must disable CGAL_ENABLE_CHECK_HEADERS.")
|
|||
file(GLOB html_files RELATIVE "${DOC_DIR}/doc_output/" "${DOC_DIR}/doc_output/*/*.html")
|
||||
file(GLOB example_files RELATIVE "${CMAKE_SOURCE_DIR}/" "${CMAKE_SOURCE_DIR}/*/examples/*/*.cpp")
|
||||
find_program(AWK awk)
|
||||
set(awk_arguments [=[{ match($0, /# *include *(<|[<"])(CGAL\/[^>&"]*)([>"]|>)/,arr); if(arr[2]!="") print arr[2] }]=])
|
||||
set(awk_arguments [=[{ match($0, /# *include *(<|[<"])(CGAL\/[^>&"]*)([>"]|>)| (CGAL\/[^>&"]*\.h)/,arr); if(arr[2]!="") print arr[2]; if(arr[4]!="") print arr[4] }]=])
|
||||
message("listing headers from html files")
|
||||
foreach(f ${html_files})
|
||||
execute_process(COMMAND "${AWK}" "${awk_arguments}" "${DOC_DIR}/doc_output/${f}"
|
||||
|
|
|
|||
|
|
@ -1,199 +1,15 @@
|
|||
INTRODUCTION
|
||||
============
|
||||
NOTICE
|
||||
======
|
||||
|
||||
This file describes how to install CGAL. The instructions in this file
|
||||
are for the most common use cases, and cover the command line tools.
|
||||
Since Version 5.0, CGAL is now header-only by default, meaning that you do not need to build and install CGAL. Usage of CGAL as a header-only library
|
||||
simply amounts to, for example:
|
||||
|
||||
For further information, or in case of problems, please see the
|
||||
detailed installation instructions, which can be found in this
|
||||
distribution in the file ./doc_html/index.html or on the CGAL website
|
||||
https://doc.cgal.org/latest/Manual/installation.html
|
||||
|
||||
The documentation of CGAL is available in PDF and HTML formats.
|
||||
It is not bundled with the software but can be downloaded separately
|
||||
at <https://www.cgal.org/Manual>.
|
||||
|
||||
For more information about CGAL, see the <https://www.cgal.org/>.
|
||||
|
||||
In the current file, x.y is an implicit replacement for the current version
|
||||
of CGAL (3.5.1, 3.6, and so on).
|
||||
|
||||
|
||||
PREREQUISITES
|
||||
=============
|
||||
|
||||
To install CGAL, you need 'cmake' and several third-party libraries.
|
||||
Some are essential for entire CGAL, some are mandatory for particular
|
||||
CGAL packages, some are only needed for demos.
|
||||
|
||||
* CMake (>= 3.1), the build system used by CGAL
|
||||
Required for building CGAL
|
||||
|
||||
* Boost (>= 1.48)
|
||||
Required for building CGAL and for applications using CGAL
|
||||
Optional compiled Boost library: Boost.Program_options
|
||||
http://www.boost.org/ or http://www.boostpro.com/products/free/
|
||||
You need the former if you plan to compile the boost libraries yourself,
|
||||
for example because you target 64 bit applications for XP64
|
||||
|
||||
* Exact Arithmetic
|
||||
CGAL combines floating point arithmetic with exact arithmetic, in order
|
||||
to be fast and reliable. CGAL offers support for GMP and MPFR, for LEDA
|
||||
exact number types, as well as a built-in exact number type used when
|
||||
none of the other two is installed.
|
||||
Required by several examples which have hard coded the number type.
|
||||
|
||||
- GMP (>= 4.1.4)
|
||||
http://gmplib.org/
|
||||
or precompiled version that can be downloaded with CGAL-x.y-Setup.exe
|
||||
based on http://fp.gladman.plus.com/computing/gmp4win.htm
|
||||
|
||||
- MPFR (>= 2.2.1)
|
||||
https://www.mpfr.org/
|
||||
or precompiled version that can be downloaded with CGAL-x.y-Setup.exe
|
||||
based on http://fp.gladman.plus.com/computing/gmp4win.htm
|
||||
|
||||
- LEDA (>= 6.2)
|
||||
http://www.algorithmic-solutions.com/leda/index.htm
|
||||
|
||||
* Visualization
|
||||
Required for most demos
|
||||
|
||||
- Qt5 (>= 5.9)
|
||||
http://qt-project.org/
|
||||
|
||||
- Geomview
|
||||
http://www.geomview.org/
|
||||
Not supported with Visual C++
|
||||
|
||||
* Numerical Libraries
|
||||
- EIGEN (>=3.1)
|
||||
Required by the packages:
|
||||
* Estimation of Local Differential Properties of Point-Sampled Surfaces
|
||||
* Approximation of Ridges and Umbilics on Triangulated Surface Meshes
|
||||
* Planar Parameterization of Triangulated Surface Meshes
|
||||
* Surface Reconstruction from Point Sets
|
||||
http://eigen.tuxfamily.org/index.php?title=Main_Page
|
||||
|
||||
- MPFI
|
||||
Required by the package:
|
||||
* Algebraic Kernel
|
||||
https://gforge.inria.fr/projects/mpfi/
|
||||
(or shipped with RS http://vegas.loria.fr/rs/)
|
||||
|
||||
- RS (root isolation)
|
||||
Required by the package:
|
||||
* Algebraic Kernel
|
||||
http://vegas.loria.fr/rs/
|
||||
|
||||
- NTL (Number Type Theory)
|
||||
Optional for the packages:
|
||||
* Polynomial
|
||||
* Algebraic Kernel
|
||||
http://www.shoup.net/ntl/
|
||||
|
||||
* Miscellaneous
|
||||
|
||||
- zlib
|
||||
Optional for the package:
|
||||
* Surface Mesh Generator can read compressed images directly
|
||||
http://www.zlib.net/
|
||||
|
||||
- ESBTL
|
||||
Optional to read PDB files:
|
||||
* Import data from a PDB file as CGAL points or weighted points.
|
||||
An example is given in package Skin_surface (see example skin_surface_pdb_reader.cpp)
|
||||
http://esbtl.sourceforge.net/
|
||||
|
||||
CONFIGURATION
|
||||
=============
|
||||
|
||||
To configure CGAL, type
|
||||
```
|
||||
cmake .
|
||||
```
|
||||
in the directory that contains this INSTALL file. You can add several options
|
||||
to this command. The most important ones are
|
||||
|
||||
* `-DCMAKE_INSTALL_PREFIX=<dir>` installation directory [/usr/local]
|
||||
* `-DCMAKE_BUILD_TYPE=<Debug|Release>` build type [Release]
|
||||
* `-DBUILD_SHARED_LIBS=<TRUE|FALSE>` shared or static libraries [TRUE]
|
||||
* `-DCMAKE_C_COMPILER=<program>` C compiler [gcc]
|
||||
* `-DCMAKE_CXX_COMPILER=<program>` C++ compiler [g++]
|
||||
|
||||
In case you want to add additional compiler and linker flags, you can use
|
||||
|
||||
* `-DCGAL_CXX_FLAGS` additional compiler flags
|
||||
* `-DCGAL_MODULE_LINKER_FLAGS` add. linker flags (static libraries)
|
||||
* `-DCGAL_SHARED_LINKER_FLAGS` add. linker flags (shared libraries)
|
||||
* `-DCGAL_EXE_LINKER_FLAGS` add. linker flags (executables)
|
||||
|
||||
Variants with the additional suffix "_DEBUG" and "_RELEASE" allow to set
|
||||
separate values for debug and release builds. In case you do not want to add
|
||||
additional flags, but to override the default flags, replace "CGAL" by
|
||||
"CMAKE" in the variable names above.
|
||||
|
||||
By default demos and examples are not configured. If you want to configure
|
||||
them at the same time as the CGAL library, you can use
|
||||
|
||||
* `-DWITH_examples=true`
|
||||
* `-DWITH_demos=true`
|
||||
|
||||
Note that CMake maintains a cache name `CMakeCache.txt`. If you change options
|
||||
(or your environment changes), it is best to remove that file to avoid
|
||||
problems.
|
||||
|
||||
|
||||
BUILDING
|
||||
========
|
||||
|
||||
To build the CGAL libraries, type
|
||||
```
|
||||
make
|
||||
```
|
||||
(or nmake in a Windows command prompt).
|
||||
If you want, you can install the CGAL header and libraries. To do so, type
|
||||
```
|
||||
make install
|
||||
```
|
||||
You can build all demos or examples by typing
|
||||
```
|
||||
make demos
|
||||
make examples
|
||||
```
|
||||
If you are interested in the demos or examples of just a particular module,
|
||||
you can build them in the following way:
|
||||
```
|
||||
make -C demo/Alpha_shapes_2 (or: cd demo/Alpha_shapes_2; make)
|
||||
make -C examples/Alpha_shapes_2 (or: cd examples/Alpha_shapes_2; make)
|
||||
```
|
||||
A list of all available make targets can be obtained by
|
||||
```
|
||||
make help
|
||||
``` {.bash}
|
||||
cd /path/to/cgal/examples/Triangulation_2
|
||||
mkdir -p build/debug
|
||||
cd build/debug
|
||||
cmake -DCMAKE_BUILD_TYPE=Debug -DCGAL_DIR=/path/to/cgal
|
||||
make
|
||||
```
|
||||
|
||||
OUT-OF-SOURCE BUILDS
|
||||
====================
|
||||
|
||||
The above instructions build the CGAL library in the same directory tree as
|
||||
the CGAL sources. Sometimes it is advisable to place all the generated files
|
||||
somewhere else. For example, if you want to build the library in several
|
||||
configurations (debug and release, different compilers, and so on). Using
|
||||
different build directories keeps all the generated files separated for each
|
||||
configuration.
|
||||
|
||||
In the following, `$CGAL_SRC` denotes the directory with the CGAL sources;
|
||||
`$CGAL_BUILD` is an arbitrary directory where the generated files will be
|
||||
placed. You can perform an out-of-source build as follows:
|
||||
```
|
||||
mkdir $CGAL_BUILD
|
||||
cd $CGAL_BUILD
|
||||
cmake [options] $CGAL_SRC
|
||||
make
|
||||
make install (if desired)
|
||||
make demos (if desired)
|
||||
make examples (if desired)
|
||||
```
|
||||
Basically, the only difference is the last parameter of the `cmake` command:
|
||||
`$CGAL_SRC` instead of `.` .
|
||||
|
||||
For more information head over to the [CGAL manual](https://doc.cgal.org/latest/Manual/general_intro.html).
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ licenses:
|
|||
(see LICENSE.LGPL).
|
||||
- OpenNL, in the directory "include/CGAL/OpenNL", is licensed under the LGPL
|
||||
(see LICENSE.LGPL).
|
||||
- ETH Zurich random forest algorithm, in the directory "CGAL/Classification/ETHZ",
|
||||
is licensed under a MIT like license (see LICENSE.RFL).
|
||||
|
||||
All other files that do not have an explicit copyright notice (e.g., all
|
||||
examples and some demos) are licensed under a very permissive license. The
|
||||
|
|
|
|||
|
|
@ -36,7 +36,9 @@ endif()
|
|||
if(NOT Qt5_FOUND)
|
||||
set(CGAL_Qt5_MISSING_DEPS "${CGAL_Qt5_MISSING_DEPS} Qt5")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS ${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/include/CGAL/Qt/GraphicsItem.h)
|
||||
set(CGAL_Qt5_MISSING_DEPS "${CGAL_Qt5_MISSING_DEPS} <CGAL/Qt/*.h> headers")
|
||||
endif()
|
||||
|
||||
#.rst:
|
||||
# Result Variables
|
||||
|
|
|
|||
|
|
@ -25,13 +25,9 @@ in the form of a C++ library.
|
|||
</p>
|
||||
|
||||
<h3>Manuals</h3>
|
||||
|
||||
<ul>
|
||||
<li><a href ="Manual/index.html">CGAL Manual - Table of Contents</a>
|
||||
<li><a href ="Manual/packages.html">CGAL Manual - Package Overview</a>
|
||||
<li>You can also access the CGAL Online Manual from the
|
||||
You can access the CGAL Online Manual from the
|
||||
<a href="https://doc.cgal.org/">CGAL website</a>.
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -39,7 +35,7 @@ in the form of a C++ library.
|
|||
|
||||
<ul>
|
||||
<li><a href ="https://www.cgal.org/">CGAL Homepage</a>
|
||||
<li><a href ="https://www.cgal.org/FAQ.html#installation">FAQ concerning Installation</a>
|
||||
<li><a href ="https://www.cgal.org/FAQ.html">FAQ</a>
|
||||
<li><a href ="http://www.boost.org/doc/">Boost Documentation</a>
|
||||
<li><a href ="http://en.cppreference.com/w/">STL Reference</a>
|
||||
</ul>
|
||||
|
|
|
|||
|
|
@ -1,15 +1,13 @@
|
|||
// This header file is a copy of "boost/config/auto_link.hpp"
|
||||
// from boost version 1.44.0
|
||||
// but slightly modified to accommodate CGAL libraries.
|
||||
|
||||
//
|
||||
// Before CGAL-4.7-beta1, it has been synchronized with
|
||||
// libs/config/ version boost-1.58.0-39-g15d56c9, file
|
||||
// include/boost/config/auto_link.hpp
|
||||
|
||||
//
|
||||
// (C) Copyright John Maddock 2003.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@
|
|||
#ifndef CGAL_VERSION_H
|
||||
#define CGAL_VERSION_H
|
||||
|
||||
#define CGAL_VERSION 5.0-beta2
|
||||
#define CGAL_VERSION_NR 1050000920
|
||||
#define CGAL_VERSION 5.1
|
||||
#define CGAL_VERSION_NR 1050100000
|
||||
#define CGAL_SVN_REVISION 99999
|
||||
#define CGAL_GIT_HASH abcdef
|
||||
#define CGAL_RELEASE_DATE 20190930
|
||||
#define CGAL_RELEASE_DATE 20191108
|
||||
|
||||
#include <CGAL/version_macros.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -155,6 +155,25 @@ struct Intersection_traits<K, typename K::Iso_cuboid_3, typename K::Point_3> {
|
|||
typedef typename boost::optional< variant_type > result_type;
|
||||
};
|
||||
|
||||
// Iso_cuboid_3 Triangle_3, variant of 4
|
||||
template<typename K>
|
||||
struct Intersection_traits<K, typename K::Iso_cuboid_3, typename K::Triangle_3> {
|
||||
typedef typename
|
||||
boost::variant< typename K::Point_3, typename K::Segment_3,
|
||||
typename K::Triangle_3, std::vector<typename K::Point_3> > variant_type;
|
||||
|
||||
typedef typename boost::optional< variant_type > result_type;
|
||||
};
|
||||
|
||||
template<typename K>
|
||||
struct Intersection_traits<K, typename K::Triangle_3, typename K::Iso_cuboid_3> {
|
||||
typedef typename
|
||||
boost::variant< typename K::Point_3, typename K::Segment_3,
|
||||
typename K::Triangle_3, std::vector<typename K::Point_3> > variant_type;
|
||||
|
||||
typedef typename boost::optional< variant_type > result_type;
|
||||
};
|
||||
|
||||
// Point_3 Line_3, variant of one
|
||||
template<typename K>
|
||||
struct Intersection_traits<K, typename K::Point_3, typename K::Line_3> {
|
||||
|
|
|
|||
|
|
@ -18,9 +18,11 @@
|
|||
#include <CGAL/Triangle_3.h>
|
||||
|
||||
#include <CGAL/Intersections_3/internal/Iso_cuboid_3_Triangle_3_do_intersect.h>
|
||||
#include <CGAL/Intersections_3/internal/Iso_cuboid_3_Triangle_3_intersection.h>
|
||||
|
||||
namespace CGAL {
|
||||
CGAL_DO_INTERSECT_FUNCTION(Iso_cuboid_3,Triangle_3, 3)
|
||||
CGAL_DO_INTERSECT_FUNCTION(Iso_cuboid_3, Triangle_3, 3)
|
||||
CGAL_INTERSECTION_FUNCTION(Iso_cuboid_3, Triangle_3, 3)
|
||||
}
|
||||
|
||||
#endif // CGAL_INTERSECTIONS_3_BBOX_3_TRIANGLE_3_H
|
||||
|
|
|
|||
|
|
@ -0,0 +1,217 @@
|
|||
// Copyright (c) 2019 GeometryFactory(France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org)
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
|
||||
//
|
||||
//
|
||||
// Author(s) : Maxime Gimeno
|
||||
//
|
||||
|
||||
#ifndef CGAL_INTERSECTIONS_3_INTERNAL_ISO_CUBOID_3_TRIANGLE_3_INTERSECTION_H
|
||||
#define CGAL_INTERSECTIONS_3_INTERNAL_ISO_CUBOID_3_TRIANGLE_3_INTERSECTION_H
|
||||
|
||||
#include <CGAL/kernel_basic.h>
|
||||
#include <CGAL/intersections.h>
|
||||
|
||||
#include <iterator>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
namespace Intersections {
|
||||
|
||||
namespace internal {
|
||||
|
||||
//only work for convex polygons, but in here that's always the case
|
||||
template<class K>
|
||||
void clip_poly_halfspace(
|
||||
std::vector<typename K::Point_3>& polygon,
|
||||
const typename K::Plane_3& pl,
|
||||
const K& k)
|
||||
{
|
||||
if(polygon.empty())
|
||||
return;
|
||||
|
||||
typedef typename K::Point_3 Point;
|
||||
typedef typename K::Plane_3 Plane;
|
||||
typedef typename K::Segment_3 Segment;
|
||||
|
||||
typedef typename Intersection_traits<K,
|
||||
Plane,
|
||||
CGAL::Segment_3<K> >::result_type SP_type;
|
||||
|
||||
// Keep in memory which points we are going to delete later (newer intersection points
|
||||
// by construction will not be deleted)
|
||||
std::list<std::pair<Point, bool> > p_list;
|
||||
for(const Point& p : polygon)
|
||||
p_list.emplace_back(p, pl.has_on_positive_side(p));
|
||||
|
||||
//corefine with plane.
|
||||
auto it = p_list.begin();
|
||||
while(it != p_list.end())
|
||||
{
|
||||
const Point& p1 = (it++)->first;
|
||||
if(it == p_list.end())
|
||||
break;
|
||||
|
||||
const Point& p2 = it->first;
|
||||
const Segment seg = k.construct_segment_3_object()(p1, p2);
|
||||
|
||||
if(do_intersect(seg, pl))
|
||||
{
|
||||
SP_type inter = k.intersect_3_object()(seg, pl);
|
||||
if(inter)
|
||||
{
|
||||
Point* p_inter = boost::get<Point>(&*inter);
|
||||
if(p_inter
|
||||
&& !(k.equal_3_object()(*p_inter, p1))
|
||||
&& !(k.equal_3_object()(*p_inter, p2)))
|
||||
{
|
||||
// 'false' because we know the intersection is by construction not on the positive side of the plane
|
||||
p_list.insert(it, std::make_pair(*p_inter, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(polygon.size() > 2)
|
||||
{
|
||||
const Point& p2 = p_list.front().first;
|
||||
const Point& p1 = p_list.back().first;
|
||||
const Segment seg(p1, p2);
|
||||
|
||||
if(do_intersect(seg, pl))
|
||||
{
|
||||
SP_type inter = typename K::Intersect_3()(seg, pl);
|
||||
if(inter)
|
||||
{
|
||||
Point* p_inter = boost::get<Point>(&*inter);
|
||||
if(p_inter
|
||||
&& !(k.equal_3_object()(*p_inter, p1))
|
||||
&& !(k.equal_3_object()(*p_inter, p2)))
|
||||
{
|
||||
// 'false' because we know the intersection is by construction not on the positive side of the plane
|
||||
p_list.emplace_back(*p_inter, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//remove all points on positive side
|
||||
for(auto it = p_list.begin(); it != p_list.end();)
|
||||
{
|
||||
if(it->second)
|
||||
it = p_list.erase(it);
|
||||
else
|
||||
++it;
|
||||
}
|
||||
|
||||
// Update the polygon
|
||||
polygon.clear();
|
||||
for(const auto& pr : p_list)
|
||||
polygon.push_back(pr.first);
|
||||
}
|
||||
|
||||
template <class K>
|
||||
typename Intersection_traits<K, typename K::Iso_cuboid_3, typename K::Triangle_3>::result_type
|
||||
intersection(
|
||||
const typename K::Iso_cuboid_3 &cub,
|
||||
const typename K::Triangle_3 &tr,
|
||||
const K& k)
|
||||
{
|
||||
typedef typename K::Point_3 Point;
|
||||
typedef typename K::Segment_3 Segment;
|
||||
typedef typename K::Triangle_3 Triangle;
|
||||
typedef typename K::Plane_3 Plane;
|
||||
typedef std::vector<Point> Poly;
|
||||
|
||||
typedef typename Intersection_traits<K,
|
||||
CGAL::Iso_cuboid_3<K>,
|
||||
CGAL::Triangle_3<K> >::result_type Res_type;
|
||||
|
||||
//Lazy implem: clip 6 times the input triangle.
|
||||
Plane planes[6];
|
||||
planes[0] = Plane(cub.vertex(0),
|
||||
cub.vertex(1),
|
||||
cub.vertex(5));
|
||||
|
||||
planes[1] = Plane(cub.vertex(0),
|
||||
cub.vertex(4),
|
||||
cub.vertex(3));
|
||||
|
||||
planes[2] = Plane(cub.vertex(0),
|
||||
cub.vertex(3),
|
||||
cub.vertex(1));
|
||||
|
||||
planes[3] = Plane(cub.vertex(7),
|
||||
cub.vertex(6),
|
||||
cub.vertex(1));
|
||||
|
||||
planes[4] = Plane(cub.vertex(7),
|
||||
cub.vertex(3),
|
||||
cub.vertex(4));
|
||||
|
||||
planes[5] = Plane(cub.vertex(7),
|
||||
cub.vertex(4),
|
||||
cub.vertex(6));
|
||||
|
||||
std::vector<Point> poly;
|
||||
poly.push_back(tr.vertex(0));
|
||||
poly.push_back(tr.vertex(1));
|
||||
poly.push_back(tr.vertex(2));
|
||||
|
||||
for (int i = 0; i < 6; ++i)
|
||||
clip_poly_halfspace<K>(poly, planes[i], k);
|
||||
|
||||
switch(poly.size())
|
||||
{
|
||||
case 0:
|
||||
return Res_type();
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
Point res = poly.front();
|
||||
return Res_type(std::forward<Point>(res));
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
Segment res = Segment(poly.front(), poly.back());
|
||||
return Res_type(std::forward<Segment>(res));
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
|
||||
Triangle res = Triangle(poly[0], poly[1], poly[2]);
|
||||
return Res_type(std::forward<Triangle>(res));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
return Res_type(std::forward<Poly>(poly));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
template <class K>
|
||||
typename Intersection_traits<K, typename K::Iso_cuboid_3, typename K::Triangle_3>::result_type
|
||||
intersection(
|
||||
const typename K::Triangle_3 &tr,
|
||||
const typename K::Iso_cuboid_3 &cub,
|
||||
const K& k)
|
||||
{
|
||||
return intersection(cub, tr, k);
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
} // namespace Intersections
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // CGAL_INTERSECTIONS_3_INTERNAL_ISO_CUBOID_3_TRIANGLE_3_INTERSECTION_H
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/Homogeneous.h>
|
||||
#include <CGAL/MP_Float.h>
|
||||
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
||||
|
||||
#include <CGAL/AABB_tree.h>
|
||||
#include <CGAL/AABB_traits.h>
|
||||
|
|
@ -61,6 +62,7 @@ struct Test {
|
|||
typedef CGAL::Iso_cuboid_3< K > Cub;
|
||||
typedef CGAL::Sphere_3< K > Sph;
|
||||
typedef CGAL::Bbox_3 Bbox;
|
||||
typedef std::vector<P> Pol;
|
||||
|
||||
|
||||
template < typename Type >
|
||||
|
|
@ -94,20 +96,20 @@ struct Test {
|
|||
|
||||
bool approx_equal(const S & p, const S & q)
|
||||
{
|
||||
return approx_equal(p.source(), q.source()) && approx_equal(p.target(), q.target());
|
||||
return approx_equal(p.source(), q.source()) && approx_equal(p.target(), q.target());
|
||||
}
|
||||
|
||||
/*
|
||||
bool approx_equal(const Pol & p, const Pol & q)
|
||||
{
|
||||
if (p.size() != q.size())
|
||||
return false;
|
||||
for(typename Pol::const_iterator itp = p.begin(), itq = q.begin(); itp != p.end(); ++itp, ++itq)
|
||||
if (!approx_equal(*itp, *itq))
|
||||
return false;
|
||||
return true;
|
||||
if(p.size() != q.size())
|
||||
return false;
|
||||
|
||||
for(typename Pol::const_iterator itp = p.begin(), itq = q.begin(); itp != p.end(); ++itp, ++itq)
|
||||
if(!approx_equal(*itp, *itq))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
|
||||
template < typename O1, typename O2>
|
||||
void check_no_intersection(const O1& o1, const O2& o2)
|
||||
|
|
@ -563,11 +565,114 @@ struct Test {
|
|||
<< do_intersect_counter << "\n";
|
||||
} // end function Bbox_Tr
|
||||
|
||||
void run()
|
||||
void Cub_Tr(bool is_exact)
|
||||
{
|
||||
typedef typename CGAL::Intersection_traits<K, Tr, Cub>::result_type Res;
|
||||
|
||||
std::cout << "Triangle_3 - Cuboid_3\n";
|
||||
|
||||
// tr outside
|
||||
Cub cub(P(1,1,1), P(2,2,2));
|
||||
check_no_intersection(cub, Tr(P(1.1, 2, 0), P(2, 3, 1), P(4, 5, 6)));
|
||||
|
||||
// tr in a face
|
||||
check_intersection(cub, Tr(P(1, 1.1, 1), P(1, 1.5, 1), P(1, 1, 1.1)),
|
||||
Tr(P(1, 1.1, 1), P(1, 1.5, 1), P(1, 1, 1.1)));
|
||||
|
||||
//face in a tr
|
||||
Tr tr(P(-3, -3, 1), P(3, -3, 1), P(1.5, 6, 1));
|
||||
Res res = CGAL::intersection(cub, tr);
|
||||
Pol* poly = boost::get<std::vector<P> >(&*res);
|
||||
assert(poly != nullptr);
|
||||
assert(poly->size() == 4);
|
||||
if(is_exact)
|
||||
{
|
||||
for(auto& p : *poly)
|
||||
assert(tr.has_on(p) && cub.has_on_boundary(p));
|
||||
}
|
||||
|
||||
//tr adj to a cuboid vertex
|
||||
check_intersection(cub, Tr(P(1, 0.5, 0.5), P(3, 2, 1), P(3, 1, 2)), P(2,1,1));
|
||||
|
||||
//tr adj to a point on a cuboid edge
|
||||
check_intersection(cub, Tr(P(1, 0.5, 0.5), P(3, 2, 1), P(3, 1, 2)), P(2,1,1));
|
||||
|
||||
//tr adj to a point on a cuboid face
|
||||
check_intersection(cub, Tr(P(1, 1.5, 1.5), P(0, 0, 0), P(-4, 3, 1)), P(1, 1.5, 1.5));
|
||||
|
||||
//tr adj to an edge
|
||||
check_intersection(cub, Tr(P(2, 1.5, 2), P(5, 6, 7), P(4, 7, 6)), P(2, 1.5, 2));
|
||||
|
||||
//tr sharing an edge
|
||||
check_intersection(cub, Tr(P(2, 1.5, 2), P(2, 2.5, 2), P(4, 7, 6)),
|
||||
S(P(2, 1.5, 2), P(2, 2, 2)));
|
||||
|
||||
//tr sharing part of an edge
|
||||
check_intersection(cub, Tr(P(2, 1.5, 2), P(5, 6, 7), P(4, 7, 6)), P(2, 1.5, 2));
|
||||
|
||||
//tr inside
|
||||
check_intersection(cub, Tr(P(1.1,1.1,1.1), P(1.8,1.8,1.8), P(1.5,1.8,1.1)),
|
||||
Tr(P(1.1,1.1,1.1), P(1.8,1.8,1.8), P(1.5,1.8,1.1)));
|
||||
|
||||
//tr through
|
||||
tr = Tr(P(2, 4, 2), P(1, 3.5, -0.5), P(1, -1, 1));
|
||||
res = CGAL::intersection(cub, tr);
|
||||
poly = boost::get<std::vector<P> >(&*res);
|
||||
assert(poly != nullptr);
|
||||
assert(poly->size() == 4);
|
||||
if(is_exact)
|
||||
{
|
||||
for(const P& p : *poly)
|
||||
assert(tr.has_on(p) && cub.has_on_boundary(p));
|
||||
}
|
||||
|
||||
//cutting in half along diagonal (intersection == triangle)
|
||||
check_intersection(cub, Tr(P(1, 1, 1), P(2, 2, 2), P(2, 2, 1)),
|
||||
Tr(P(1, 1, 1), P(2, 2, 2), P(2, 2, 1)));
|
||||
|
||||
//cutting in half along diagonal (intersection included in triangle)
|
||||
tr = Tr(P(1, 1, 10), P(10, 10, 1), P(1, 1, 1));
|
||||
res = CGAL::intersection(cub, tr);
|
||||
poly = boost::get<std::vector<P> >(&*res);
|
||||
assert(poly != nullptr);
|
||||
assert(poly->size() == 4);
|
||||
if(is_exact)
|
||||
{
|
||||
for(const P& p : *poly)
|
||||
assert(tr.has_on(p) && cub.has_on_boundary(p));
|
||||
}
|
||||
|
||||
//6 points intersection
|
||||
tr = Tr(P(18.66, -5.4, -11.33), P(-2.41, -7.33, 19.75), P(-10.29, 20.15, -10.33));
|
||||
res = CGAL::intersection(cub, tr);
|
||||
poly = boost::get<std::vector<P> >(&*res);
|
||||
assert(poly != nullptr);
|
||||
assert(poly->size() == 6);
|
||||
if(is_exact)
|
||||
{
|
||||
for(const P& p : *poly)
|
||||
assert(tr.has_on(p) && cub.has_on_boundary(p));
|
||||
}
|
||||
|
||||
//triangle clipping a cuboid corner
|
||||
tr = Tr(P(1.02, 1.33, 0.62), P(1.95, 2.54, 0.95), P(0.79, 2.36, 1.92));
|
||||
res = CGAL::intersection(cub, tr);
|
||||
Tr* tr_res = boost::get<Tr>(&*res);
|
||||
assert(tr_res != nullptr);
|
||||
if(is_exact)
|
||||
{
|
||||
assert(cub.has_on_boundary((*tr_res)[0]));
|
||||
assert(cub.has_on_boundary((*tr_res)[1]));
|
||||
assert(cub.has_on_boundary((*tr_res)[2]));
|
||||
}
|
||||
}
|
||||
|
||||
void run(bool is_exact = false)
|
||||
{
|
||||
std::cout << "3D Intersection tests\n";
|
||||
P_do_intersect();
|
||||
Cub_Cub();
|
||||
Cub_Tr(is_exact);
|
||||
L_Cub();
|
||||
Pl_L();
|
||||
Pl_Pl();
|
||||
|
|
@ -590,8 +695,16 @@ struct Test {
|
|||
|
||||
int main()
|
||||
{
|
||||
Test< CGAL::Simple_cartesian<double> >().run();
|
||||
Test< CGAL::Homogeneous<CGAL::MP_Float> >().run();
|
||||
// TODO : test more kernels.
|
||||
std::cout << " |||||||| Test Simple_cartesian<double> ||||||||" << std::endl;
|
||||
Test< CGAL::Simple_cartesian<double> >().run();
|
||||
|
||||
std::cout << " |||||||| Test CGAL::Homogeneous<CGAL::MP_Float> ||||||||" << std::endl;
|
||||
Test< CGAL::Homogeneous<CGAL::MP_Float> >().run();
|
||||
|
||||
std::cout << " |||||||| Test EPECK ||||||||" << std::endl;
|
||||
Test< CGAL::Epeck >().run(true);
|
||||
|
||||
std::cout << " |||||||| Test CGAL::Homogeneous<CGAL::Epeck_ft> ||||||||" << std::endl;
|
||||
Test< CGAL::Homogeneous<CGAL::Epeck_ft> >().run(true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ struct Projector<R,0>
|
|||
static typename R::FT y(const typename R::Point_3& p) {return p.z();}
|
||||
static typename R::FT x(const typename R::Vector_3& p) {return p.y();}
|
||||
static typename R::FT y(const typename R::Vector_3& p) {return p.z();}
|
||||
static Bbox_2 bbox(const Bbox_3& bb) { return Bbox_2(bb.ymin(),bb.zmin(),bb.ymax(),bb.zmax()); }
|
||||
static const int x_index=1;
|
||||
static const int y_index=2;
|
||||
};
|
||||
|
|
@ -60,6 +61,7 @@ struct Projector<R,1>
|
|||
static typename R::FT y(const typename R::Point_3& p) {return p.z();}
|
||||
static typename R::FT x(const typename R::Vector_3& p) {return p.x();}
|
||||
static typename R::FT y(const typename R::Vector_3& p) {return p.z();}
|
||||
static Bbox_2 bbox(const Bbox_3& bb) { return Bbox_2(bb.xmin(),bb.zmin(),bb.xmax(),bb.zmax()); }
|
||||
static const int x_index=0;
|
||||
static const int y_index=2;
|
||||
};
|
||||
|
|
@ -78,11 +80,18 @@ struct Projector<R,2>
|
|||
static typename R::FT y(const typename R::Point_3& p) {return p.y();}
|
||||
static typename R::FT x(const typename R::Vector_3& p) {return p.x();}
|
||||
static typename R::FT y(const typename R::Vector_3& p) {return p.y();}
|
||||
static Bbox_2 bbox(const Bbox_3& bb) { return Bbox_2(bb.xmin(),bb.ymin(),bb.xmax(),bb.ymax()); }
|
||||
static const int x_index=0;
|
||||
static const int y_index=1;
|
||||
};
|
||||
|
||||
|
||||
template <class R,int dim>
|
||||
class Construct_bbox_projected_2 {
|
||||
public:
|
||||
typedef typename R::Point_3 Point;
|
||||
|
||||
Bbox_2 operator()(const Point& p) const { typename R::Construct_bbox_3 bb; return Projector<R, dim>::bbox(bb(p)); }
|
||||
};
|
||||
|
||||
template <class R,int dim>
|
||||
class Orientation_projected_3
|
||||
|
|
@ -795,7 +804,8 @@ public:
|
|||
typedef Construct_weighted_circumcenter_projected_3<Rp,dim> Construct_weighted_circumcenter_2;
|
||||
typedef Power_side_of_bounded_power_circle_projected_3<Rp,dim> Power_side_of_bounded_power_circle_2;
|
||||
typedef Power_side_of_oriented_power_circle_projected_3<Rp, dim> Power_side_of_oriented_power_circle_2;
|
||||
|
||||
typedef Construct_bbox_projected_2<Rp,dim> Construct_bbox_2;
|
||||
|
||||
typedef typename Rp::Construct_point_3 Construct_point_2;
|
||||
typedef typename Rp::Construct_weighted_point_3 Construct_weighted_point_2;
|
||||
typedef typename Rp::Construct_segment_3 Construct_segment_2;
|
||||
|
|
@ -805,7 +815,7 @@ public:
|
|||
typedef typename Rp::Construct_scaled_vector_3 Construct_scaled_vector_2;
|
||||
typedef typename Rp::Construct_triangle_3 Construct_triangle_2;
|
||||
typedef typename Rp::Construct_line_3 Construct_line_2;
|
||||
typedef typename Rp::Construct_bbox_3 Construct_bbox_2;
|
||||
|
||||
|
||||
struct Less_xy_2 {
|
||||
typedef bool result_type;
|
||||
|
|
|
|||
|
|
@ -27,9 +27,6 @@ _test_cls_ray_3(const R& )
|
|||
typedef typename R::RT RT;
|
||||
typedef typename R::FT FT;
|
||||
|
||||
typename R::Ray_3 ir;
|
||||
CGAL::Ray_3<R> r1(ir);
|
||||
|
||||
RT n1 = 8;
|
||||
RT n2 = 20;
|
||||
RT n3 = 4;
|
||||
|
|
@ -42,10 +39,18 @@ _test_cls_ray_3(const R& )
|
|||
CGAL::Point_3<R> p2( n4, n5, n6, n5);
|
||||
CGAL::Point_3<R> p3( n7, n2, n4, n7);
|
||||
|
||||
typename R::Ray_3 ir ( p2, p1 );
|
||||
|
||||
CGAL::Ray_3<R> r1( ir );
|
||||
CGAL::Ray_3<R> r2( p1, p2 );
|
||||
CGAL::Ray_3<R> r3( p2, p1 );
|
||||
CGAL::Ray_3<R> r4( r2 );
|
||||
r1 = r4;
|
||||
|
||||
typename R::Ray_3 ir2 ( r4 );
|
||||
ir = r1;
|
||||
r4 = ir2;
|
||||
|
||||
CGAL::Direction_3<R> dir( p2 - p1 );
|
||||
CGAL::Vector_3<R> vec( p2 - p1 );
|
||||
CGAL::Line_3<R> l( p1, p2 );
|
||||
|
|
|
|||
|
|
@ -27,9 +27,6 @@ _test_cls_segment_3(const R& )
|
|||
typedef typename R::RT RT;
|
||||
typedef typename R::FT FT;
|
||||
|
||||
typename R::Segment_3 is;
|
||||
CGAL::Segment_3<R> s1(is);
|
||||
|
||||
RT n1 = 7;
|
||||
RT n2 = 21;
|
||||
RT n3 = 14;
|
||||
|
|
@ -42,11 +39,19 @@ _test_cls_segment_3(const R& )
|
|||
CGAL::Point_3<R> p2( n4, n5, n6, n5);
|
||||
CGAL::Point_3<R> p3( n2, n8, n2, n8);
|
||||
|
||||
typename R::Segment_3 is ( p2, p1 );
|
||||
|
||||
CGAL::Segment_3<R> s1( is );
|
||||
CGAL::Segment_3<R> s2( p1, p2 );
|
||||
CGAL::Segment_3<R> s3( p2, p1 );
|
||||
CGAL::Segment_3<R> s4( s2 );
|
||||
|
||||
s1 = s4;
|
||||
|
||||
typename R::Segment_3 is2 ( s4 );
|
||||
is = s1;
|
||||
s4 = is2;
|
||||
|
||||
assert( CGAL::parallel(s2, s3) );
|
||||
|
||||
CGAL::Vector_3<R> v0(p1, p2);
|
||||
|
|
|
|||
|
|
@ -120,6 +120,15 @@ public:
|
|||
template<class ForwardIterator>
|
||||
FT operator()(ForwardIterator first, ForwardIterator last);
|
||||
};
|
||||
class Compute_squared_radius_smallest_orthogonal_sphere_d {
|
||||
public:
|
||||
/*! returns the radius of the sphere defined by `A=tuple[first,last)`. The sphere is centered in the affine hull of A and orthogonal to all the spheres of A. The order of the points of A does not matter.
|
||||
\pre A is affinely independent.
|
||||
\tparam ForwardIterator has `Epeck_d::Weighted_point_d` as value type.
|
||||
*/
|
||||
template<class ForwardIterator>
|
||||
FT operator()(ForwardIterator first, ForwardIterator last);
|
||||
};
|
||||
/*! \cgalModels `Kernel_d::Side_of_bounded_sphere_d`
|
||||
*/
|
||||
class Side_of_bounded_sphere_d {
|
||||
|
|
@ -131,7 +140,18 @@ public:
|
|||
template<class ForwardIterator>
|
||||
Bounded_side operator()(ForwardIterator first, ForwardIterator last, const Point_d&p);
|
||||
};
|
||||
class Power_side_of_bounded_power_sphere_d {
|
||||
public:
|
||||
/*! returns the relative position of weighted point p to the sphere defined by `A=tuple[first,last)`. The sphere is centered in the affine hull of A and orthogonal to all the spheres of A. The order of the points of A does not matter.
|
||||
\pre A is affinely independent.
|
||||
\tparam ForwardIterator has `Epeck_d::Weighted_point_d` as value type.
|
||||
*/
|
||||
template<class ForwardIterator>
|
||||
Bounded_side operator()(ForwardIterator first, ForwardIterator last, const Weighted_point_d&p);
|
||||
};
|
||||
Construct_circumcenter_d construct_circumcenter_d_object();
|
||||
Compute_squared_radius_d compute_squared_radius_d_object();
|
||||
Compute_squared_radius_smallest_orthogonal_sphere_d compute_squared_radius_smallest_orthogonal_sphere_d_object();
|
||||
Power_side_of_bounded_power_sphere_d power_side_of_bounded_power_sphere_d_object();
|
||||
}; /* end Epeck_d */
|
||||
} /* end namespace CGAL */
|
||||
|
|
|
|||
|
|
@ -109,6 +109,15 @@ public:
|
|||
template<class ForwardIterator>
|
||||
FT operator()(ForwardIterator first, ForwardIterator last);
|
||||
};
|
||||
class Compute_squared_radius_smallest_orthogonal_sphere_d {
|
||||
public:
|
||||
/*! returns the radius of the sphere defined by `A=tuple[first,last)`. The sphere is centered in the affine hull of A and orthogonal to all the spheres of A. The order of the points of A does not matter.
|
||||
\pre A is affinely independent.
|
||||
\tparam ForwardIterator has `Epick_d::Weighted_point_d` as value type.
|
||||
*/
|
||||
template<class ForwardIterator>
|
||||
FT operator()(ForwardIterator first, ForwardIterator last);
|
||||
};
|
||||
/*! \cgalModels `Kernel_d::Side_of_bounded_sphere_d`
|
||||
*/
|
||||
class Side_of_bounded_sphere_d {
|
||||
|
|
@ -120,7 +129,18 @@ public:
|
|||
template<class ForwardIterator>
|
||||
Bounded_side operator()(ForwardIterator first, ForwardIterator last, const Point_d&p);
|
||||
};
|
||||
class Power_side_of_bounded_power_sphere_d {
|
||||
public:
|
||||
/*! returns the relative position of weighted point p to the sphere defined by `A=tuple[first,last)`. The sphere is centered in the affine hull of A and orthogonal to all the spheres of A. The order of the points of A does not matter.
|
||||
\pre A is affinely independent.
|
||||
\tparam ForwardIterator has `Epick_d::Weighted_point_d` as value type.
|
||||
*/
|
||||
template<class ForwardIterator>
|
||||
Bounded_side operator()(ForwardIterator first, ForwardIterator last, const Weighted_point_d&p);
|
||||
};
|
||||
Construct_circumcenter_d construct_circumcenter_d_object();
|
||||
Compute_squared_radius_d compute_squared_radius_d_object();
|
||||
Compute_squared_radius_smallest_orthogonal_sphere_d compute_squared_radius_smallest_orthogonal_sphere_d_object();
|
||||
Power_side_of_bounded_power_sphere_d power_side_of_bounded_power_sphere_d_object();
|
||||
}; /* end Epick_d */
|
||||
} /* end namespace CGAL */
|
||||
|
|
|
|||
|
|
@ -185,8 +185,7 @@ typedef CGAL::Triangulation_face_base_with_info_2<Face_info,P_traits> Fb1;
|
|||
|
||||
typedef CGAL::Constrained_triangulation_face_base_2<P_traits, Fb1> Fb;
|
||||
typedef CGAL::Triangulation_data_structure_2<Vb,Fb> TDS;
|
||||
// typedef CGAL::No_intersection_tag Itag;
|
||||
typedef CGAL::Exact_predicates_tag Itag;
|
||||
typedef CGAL::Exact_predicates_tag Itag;
|
||||
typedef CGAL::Constrained_Delaunay_triangulation_2<P_traits, TDS,
|
||||
Itag> CDT;
|
||||
|
||||
|
|
|
|||
|
|
@ -215,7 +215,6 @@ class Basic_viewer : public CGAL::QGLViewer, public QOpenGLFunctions_2_1
|
|||
|
||||
typedef CGAL::Constrained_triangulation_face_base_2<P_traits, Fb1> Fb;
|
||||
typedef CGAL::Triangulation_data_structure_2<Vb,Fb> TDS;
|
||||
// typedef CGAL::No_intersection_tag Itag;
|
||||
typedef CGAL::Exact_predicates_tag Itag;
|
||||
typedef CGAL::Constrained_Delaunay_triangulation_2<P_traits, TDS,
|
||||
Itag> CDT;
|
||||
|
|
|
|||
|
|
@ -23,11 +23,15 @@ LC_CTYPE=en_US.UTF-8
|
|||
# The script also updates the manual tools.
|
||||
|
||||
# "master" alone
|
||||
0 21 * * Sun cd $HOME/CGAL/create_internal_release && /usr/bin/time scl enable rh-git29 -- $HOME/bin/create_release $HOME/CGAL/branches/master.git --public --do-it --beta 2 || echo ERROR
|
||||
0 21 * * Sun cd $HOME/CGAL/create_internal_release && /usr/bin/time scl enable rh-git29 -- $HOME/bin/create_release $HOME/CGAL/branches/master.git --do-it || echo ERROR
|
||||
# "integration"
|
||||
0 21 * * Mon,Tue,Wed,Thu,Fri cd $HOME/CGAL/create_internal_release && /usr/bin/time scl enable rh-git29 -- $HOME/bin/create_release $HOME/CGAL/branches/integration.git $HOME/CGAL/branches/empty-dir --do-it --public --beta 2 || echo ERROR
|
||||
0 21 * * Mon,Tue,Wed,Thu cd $HOME/CGAL/create_internal_release && /usr/bin/time scl enable rh-git29 -- $HOME/bin/create_release $HOME/CGAL/branches/integration.git $HOME/CGAL/branches/empty-dir --do-it --public || echo ERROR
|
||||
# from branch 5.0
|
||||
0 21 * * fri cd $HOME/CGAL/create_internal_release-5.0-branch && /usr/bin/time scl enable rh-git29 -- $HOME/bin/create_release $HOME/CGAL/branches/CGAL-4.14-branch.git --public --do-it || echo ERROR
|
||||
# from branch 4.14
|
||||
0 21 * * Sat cd $HOME/CGAL/create_internal_release-4.14-branch && /usr/bin/time scl enable rh-git29 -- $HOME/bin/create_release $HOME/CGAL/branches/CGAL-4.14-branch.git --public --do-it || echo ERROR
|
||||
|
||||
## Older stuff
|
||||
# from branch 4.13
|
||||
#0 21 * * Fri cd $HOME/CGAL/create_internal_release-4.13-branch && /usr/bin/time scl enable rh-git29 -- $HOME/bin/create_release $HOME/CGAL/branches/CGAL-4.13-branch.git --public --do-it || echo ERROR
|
||||
# from branch 4.12
|
||||
|
|
@ -49,7 +53,7 @@ LC_CTYPE=en_US.UTF-8
|
|||
|
||||
# Launch our Docker testsuite , at 21:36,
|
||||
# after a pull of all new images at 20:23.
|
||||
06 20 * * * /usr/bin/time docker pull -a docker.io/cgal/testsuite-docker; docker rmi $(docker images | awk '/<none>/ {print $3}')
|
||||
06 20 * * * for i in $(cat /home/lrineau/.config/CGAL/test_cgal_docker_images); do docker pull $i; done; docker rmi $(docker images | awk '/<none>/ {print $3}')
|
||||
36 21 * * * cd /home/lrineau/Git/cgal-testsuite-dockerfiles && /usr/bin/time ./test_cgal.py --use-fedora-selinux-policy --force-rm --max-cpus 12 --container-cpus 4 --jobs 5 --upload-results --images $($HOME/bin/docker_images_to_test_today)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,76 @@
|
|||
The CGAL Open Source Project is pleased to announce the release 5.0 Beta 2
|
||||
of CGAL, the Computational Geometry Algorithms Library.
|
||||
|
||||
CGAL version 5.0 Beta 2 is a public testing release. It should provide
|
||||
a solid ground to report bugs that need to be tackled before the
|
||||
release of the final version of CGAL 5.0 in November.
|
||||
|
||||
### General changes
|
||||
|
||||
- CGAL 5.0 is the first release of CGAL that requires a C++ compiler
|
||||
with the support of C++14 or later. The new list of supported
|
||||
compilers is:
|
||||
- Visual C++ 14.0 (from Visual Studio 2015 Update 3) or later,
|
||||
- Gnu g++ 6.3 or later (on Linux or MacOS),
|
||||
- LLVM Clang version 8.0 or later (on Linux or MacOS), and
|
||||
- Apple Clang compiler versions 7.0.2 and 10.0.1 (on MacOS).
|
||||
- Since CGAL 4.9, CGAL can be used as a header-only library, with
|
||||
dependencies. Since CGAL 5.0, that is now the default, unless
|
||||
specified differently in the (optional) CMake configuration.
|
||||
- The section "Getting Started with CGAL" of the documentation has
|
||||
been updated and reorganized.
|
||||
- The minimal version of Boost is now 1.57.0.
|
||||
|
||||
|
||||
### [Polygonal Surface Reconstruction](https://doc.cgal.org/5.0/Manual/packages.html#PkgPolygonalSurfaceReconstruction) (new package)
|
||||
|
||||
- This package provides a method for piecewise planar object reconstruction from point clouds.
|
||||
The method takes as input an unordered point set sampled from a piecewise planar object
|
||||
and outputs a compact and watertight surface mesh interpolating the input point set.
|
||||
The method assumes that all necessary major planes are provided (or can be extracted from
|
||||
the input point set using the shape detection method described in Point Set Shape Detection,
|
||||
or any other alternative methods).The method can handle arbitrary piecewise planar objects
|
||||
and is capable of recovering sharp features and is robust to noise and outliers. See also
|
||||
the associated [blog entry](https://www.cgal.org/2019/08/05/Polygonal_surface_reconstruction/).
|
||||
|
||||
### [Shape Detection](https://doc.cgal.org/5.0/Manual/packages.html#PkgShapeDetection) (major changes)
|
||||
- **Breaking change:** The concept `ShapeDetectionTraits` has been renamed to [`EfficientRANSACTraits`](https://doc.cgal.org/5.0/Shape_detection/classEfficientRANSACTraits.html).
|
||||
- **Breaking change:** The `Shape_detection_3` namespace has been renamed to [`Shape_detection`](https://doc.cgal.org/5.0/Shape_detection/annotated.html).
|
||||
- Added a new, generic implementation of region growing. This enables for example applying region growing to inputs such as 2D and 3D point sets,
|
||||
or models of the [`FaceGraph`](https://doc.cgal.org/5.0/BGL/classFaceGraph.html) concept. Learn more about this new algorithm with this [blog entry](https://www.cgal.org/2019/07/30/Shape_detection/).
|
||||
|
||||
### [dD Geometry Kernel](https://doc.cgal.org/5.0/Manual/packages.html#PkgKernelD)
|
||||
- A new exact kernel, [`Epeck_d`](https://doc.cgal.org/5.0/Kernel_d/structCGAL_1_1Epeck__d.html), is now available.
|
||||
|
||||
### 2D and 3D Triangulations
|
||||
|
||||
- **Breaking change:** Several deprecated functions and classes have been
|
||||
removed. See the full list of breaking changes in the release
|
||||
notes.
|
||||
|
||||
- **Breaking change:** The constructor and the `insert()` function of
|
||||
`CGAL::Triangulation_2` or `CGAL::Triangulation_3` which take a range
|
||||
of points as argument are now guaranteed to insert the points
|
||||
following the order of `InputIterator`. Note that this change only
|
||||
affects the base class `CGAL::Triangulation_[23]` and not any
|
||||
derived class, such as `CGAL::Delaunay_triangulation_[23]`.
|
||||
|
||||
|
||||
### [Polygon Mesh Processing](https://doc.cgal.org/latest/Manual/packages.html#PkgPolygonMeshProcessing)
|
||||
- Introduced a [wide range of new functions](https://doc.cgal.org/5.0/Polygon_mesh_processing/index.html#title36)
|
||||
related to location of queries on a triangle mesh,
|
||||
such as [`CGAL::Polygon_mesh_processing::locate(Point, Mesh)`](https://doc.cgal.org/5.0/Polygon_mesh_processing/group__PMP__locate__grp.html#gada09bd8740ba69ead9deca597d53cf15).
|
||||
The location of a point on a triangle mesh is expressed as the pair of a face and the barycentric
|
||||
coordinates of the point in this face, enabling robust manipulation of locations
|
||||
(for example, intersections of two 3D segments living within the same face).
|
||||
- Added the mesh smoothing function [`smooth_mesh()`](https://doc.cgal.org/5.0/Polygon_mesh_processing/group__PMP__meshing__grp.html#gaa0551d546f6ab2cd9402bea12d8332a3),
|
||||
which can be used to improve the quality of triangle elements based on various geometric characteristics.
|
||||
- Added the shape smoothing function [`smooth_shape()`](https://doc.cgal.org/5.0/Polygon_mesh_processing/group__PMP__meshing__grp.html#gaaa083ec78bcecf351e04d1bbf460b4a2),
|
||||
which can be used to smooth the surface of a triangle mesh, using the mean curvature flow to perform noise removal.
|
||||
(See also the new entry in the [User Manual](https://doc.cgal.org/5.0/Polygon_mesh_processing/index.html#title8))
|
||||
|
||||
### [Point Set Processing](https://doc.cgal.org/latest/Manual/packages.html#PkgPointSetProcessing3)
|
||||
- **Breaking change**: the API using iterators and overloads for optional parameters (deprecated since
|
||||
CGAL 4.12) has been removed. The current (and now only) API uses ranges and Named Parameters.
|
||||
|
||||
See https://www.cgal.org/2019/10/31/cgal50-beta2/ for a complete list of changes.
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
The CGAL Open Source Project is pleased to announce the release 5.0
|
||||
of CGAL, the Computational Geometry Algorithms Library.
|
||||
|
||||
Besides fixes and general enhancement to existing packages, the
|
||||
following has changed since CGAL 4.14.2:
|
||||
|
||||
### General changes
|
||||
|
||||
- CGAL 5.0 is the first release of CGAL that requires a C++ compiler
|
||||
with the support of C++14 or later. The new list of supported
|
||||
compilers is:
|
||||
- Visual C++ 14.0 (from Visual Studio 2015 Update 3) or later,
|
||||
- Gnu g++ 6.3 or later (on Linux or MacOS),
|
||||
- LLVM Clang version 8.0 or later (on Linux or MacOS), and
|
||||
- Apple Clang compiler versions 7.0.2 and 10.0.1 (on MacOS).
|
||||
- Since CGAL 4.9, CGAL can be used as a header-only library, with
|
||||
dependencies. Since CGAL 5.0, that is now the default, unless
|
||||
specified differently in the (optional) CMake configuration.
|
||||
- The section "Getting Started with CGAL" of the documentation has
|
||||
been updated and reorganized.
|
||||
- The minimal version of Boost is now 1.57.0.
|
||||
|
||||
|
||||
### [Polygonal Surface Reconstruction](https://doc.cgal.org/5.0/Manual/packages.html#PkgPolygonalSurfaceReconstruction) (new package)
|
||||
|
||||
- This package provides a method for piecewise planar object reconstruction from point clouds.
|
||||
The method takes as input an unordered point set sampled from a piecewise planar object
|
||||
and outputs a compact and watertight surface mesh interpolating the input point set.
|
||||
The method assumes that all necessary major planes are provided (or can be extracted from
|
||||
the input point set using the shape detection method described in Point Set Shape Detection,
|
||||
or any other alternative methods).The method can handle arbitrary piecewise planar objects
|
||||
and is capable of recovering sharp features and is robust to noise and outliers. See also
|
||||
the associated [blog entry](https://www.cgal.org/2019/08/05/Polygonal_surface_reconstruction/).
|
||||
|
||||
### [Shape Detection](https://doc.cgal.org/5.0/Manual/packages.html#PkgShapeDetection) (major changes)
|
||||
- **Breaking change:** The concept `ShapeDetectionTraits` has been renamed to [`EfficientRANSACTraits`](https://doc.cgal.org/5.0/Shape_detection/classEfficientRANSACTraits.html).
|
||||
- **Breaking change:** The `Shape_detection_3` namespace has been renamed to [`Shape_detection`](https://doc.cgal.org/5.0/Shape_detection/annotated.html).
|
||||
- Added a new, generic implementation of region growing. This enables for example applying region growing to inputs such as 2D and 3D point sets,
|
||||
or models of the [`FaceGraph`](https://doc.cgal.org/5.0/BGL/classFaceGraph.html) concept. Learn more about this new algorithm with this [blog entry](https://www.cgal.org/2019/07/30/Shape_detection/).
|
||||
|
||||
### [dD Geometry Kernel](https://doc.cgal.org/5.0/Manual/packages.html#PkgKernelD)
|
||||
- A new exact kernel, [`Epeck_d`](https://doc.cgal.org/5.0/Kernel_d/structCGAL_1_1Epeck__d.html), is now available.
|
||||
|
||||
### 2D and 3D Triangulations
|
||||
|
||||
- **Breaking change:** Several deprecated functions and classes have been
|
||||
removed. See the full list of breaking changes in the release
|
||||
notes.
|
||||
|
||||
- **Breaking change:** The constructor and the `insert()` function of
|
||||
`CGAL::Triangulation_2` or `CGAL::Triangulation_3` which take a range
|
||||
of points as argument are now guaranteed to insert the points
|
||||
following the order of `InputIterator`. Note that this change only
|
||||
affects the base class `CGAL::Triangulation_[23]` and not any
|
||||
derived class, such as `CGAL::Delaunay_triangulation_[23]`.
|
||||
|
||||
|
||||
### [Polygon Mesh Processing](https://doc.cgal.org/latest/Manual/packages.html#PkgPolygonMeshProcessing)
|
||||
- Introduced a [wide range of new functions](https://doc.cgal.org/5.0/Polygon_mesh_processing/index.html#title36)
|
||||
related to location of queries on a triangle mesh,
|
||||
such as [`CGAL::Polygon_mesh_processing::locate(Point, Mesh)`](https://doc.cgal.org/5.0/Polygon_mesh_processing/group__PMP__locate__grp.html#gada09bd8740ba69ead9deca597d53cf15).
|
||||
The location of a point on a triangle mesh is expressed as the pair of a face and the barycentric
|
||||
coordinates of the point in this face, enabling robust manipulation of locations
|
||||
(for example, intersections of two 3D segments living within the same face).
|
||||
- Added the mesh smoothing function [`smooth_mesh()`](https://doc.cgal.org/5.0/Polygon_mesh_processing/group__PMP__meshing__grp.html#gaa0551d546f6ab2cd9402bea12d8332a3),
|
||||
which can be used to improve the quality of triangle elements based on various geometric characteristics.
|
||||
- Added the shape smoothing function [`smooth_shape()`](https://doc.cgal.org/5.0/Polygon_mesh_processing/group__PMP__meshing__grp.html#gaaa083ec78bcecf351e04d1bbf460b4a2),
|
||||
which can be used to smooth the surface of a triangle mesh, using the mean curvature flow to perform noise removal.
|
||||
(See also the new entry in the [User Manual](https://doc.cgal.org/5.0/Polygon_mesh_processing/index.html#title8))
|
||||
|
||||
### [Point Set Processing](https://doc.cgal.org/latest/Manual/packages.html#PkgPointSetProcessing3)
|
||||
- **Breaking change**: the API using iterators and overloads for optional parameters (deprecated since
|
||||
CGAL 4.12) has been removed. The current (and now only) API uses ranges and Named Parameters.
|
||||
|
||||
See https://www.cgal.org/2019/11/08/cgal50/ for a complete list of changes.
|
||||
|
|
@ -1,33 +1,38 @@
|
|||
Subject: CGAL 5.0 Beta 1 Released, Computational Geometry Algorithms Library
|
||||
Subject: CGAL 5.0 Beta 2 Released, Computational Geometry Algorithms Library
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Body:
|
||||
|
||||
The CGAL Open Source Project is pleased to announce the release 5.0 Beta 1
|
||||
The CGAL Open Source Project is pleased to announce the release 5.0 Beta 2
|
||||
of CGAL, the Computational Geometry Algorithms Library.
|
||||
|
||||
|
||||
CGAL version 5.0 Beta 1 is a public testing release. It should provide
|
||||
a solid ground to report bugs that need to be tackled before the
|
||||
release of the final version of CGAL 5.0 in October.
|
||||
CGAL version 5.0 Beta 2 is a public testing release. It should provide a
|
||||
solid ground to report bugs that need to be tackled before the release
|
||||
of the final version of CGAL 5.0 in November.
|
||||
|
||||
|
||||
CGAL 5.0 is the first release of CGAL that requires a C++ compiler
|
||||
with the support of C++14 or later. The new list of supported
|
||||
compilers is:
|
||||
|
||||
- Visual C++ 14.0 (from Visual Studio 2015 Update 3) or later,
|
||||
- Gnu g++ 6.3 or later (on Linux or MacOS),
|
||||
- LLVM Clang version 8.0 or later (on Linux or MacOS), and
|
||||
- Apple Clang compiler versions 7.0.2 and 10.0.1 (on MacOS).
|
||||
|
||||
Since CGAL 4.9, CGAL can be used as a header-only library, with
|
||||
dependencies. Since CGAL 5.0, that is now the default, unless
|
||||
specified differently in the (optional) CMake configuration.
|
||||
The important changes since CGAL 5.0 Beta 1 are the fix of CMake
|
||||
issues, with header-only installations, and the update of the section
|
||||
“Getting Started with CGAL” of the documentation.
|
||||
|
||||
|
||||
Besides fixes and general enhancement to existing packages, the following
|
||||
has changed since CGAL 4.14:
|
||||
|
||||
General changes
|
||||
|
||||
- CGAL 5.0 is the first release of CGAL that requires a C++ compiler
|
||||
with the support of C++14 or later. The new list of supported
|
||||
compilers is:
|
||||
- Visual C++ 14.0 (from Visual Studio 2015 Update 3) or later,
|
||||
- Gnu g++ 6.3 or later (on Linux or MacOS),
|
||||
- LLVM Clang version 8.0 or later (on Linux or MacOS), and
|
||||
- Apple Clang compiler versions 7.0.2 and 10.0.1 (on MacOS).
|
||||
- Since CGAL 4.9, CGAL can be used as a header-only library, with
|
||||
dependencies. Since CGAL 5.0, that is now the default, unless
|
||||
specified differently in the (optional) CMake configuration.
|
||||
- The section “Getting Started with CGAL” of the documentation has
|
||||
been updated and reorganized.
|
||||
- The minimal version of Boost is now 1.57.0.
|
||||
|
||||
Polygonal Surface Reconstruction (new package)
|
||||
|
||||
|
|
@ -68,16 +73,14 @@ dD Geometry Kernel
|
|||
2D and 3D Triangulations
|
||||
|
||||
- BREAKING CHANGE: Several deprecated functions and classes have been
|
||||
removed. See the full list of breaking changes in the release
|
||||
notes.
|
||||
removed. See the full list of breaking changes in the release notes.
|
||||
|
||||
- BREAKING CHANGE: The constructor and the insert() function of
|
||||
CGAL::Triangulation_2 or CGAL::Triangulation_3 which take a range
|
||||
of points as argument are now guaranteed to insert the points
|
||||
following the order of InputIterator. Note that this change only
|
||||
affects the base class CGAL::Triangulation_[23] and not any
|
||||
derived class, such as CGAL::Delaunay_triangulation_[23].
|
||||
|
||||
CGAL::Triangulation_2 or CGAL::Triangulation_3 which take a range of
|
||||
points as argument are now guaranteed to insert the points following
|
||||
the order of InputIterator. Note that this change only affects the
|
||||
base class CGAL::Triangulation_[23] and not any derived class, such
|
||||
as CGAL::Delaunay_triangulation_[23].
|
||||
|
||||
Polygon Mesh Processing
|
||||
|
||||
|
|
@ -102,8 +105,7 @@ Point Set Processing
|
|||
parameters (deprecated since CGAL 4.12) has been removed. The
|
||||
current (and now only) API uses ranges and Named Parameters.
|
||||
|
||||
|
||||
See https://www.cgal.org/2019/09/30/cgal50-beta1/ for a complete list of
|
||||
See https://www.cgal.org/2019/10/31/cgal50-beta2/ for a complete list of
|
||||
changes.
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,11 @@ PUBLIC_RELEASE_DIR="$1"
|
|||
|
||||
INTERNAL_RELEASE=`basename ${PUBLIC_RELEASE_DIR/-public/}`
|
||||
|
||||
PUBLIC_RELEASE_NAME=`basename ${~${ZIP_TARBALL::="$PUBLIC_RELEASE_DIR"/*.zip}}`
|
||||
ZIP_TARBALL=("$PUBLIC_RELEASE_DIR"/*-library.zip(N))
|
||||
[ -z "$ZIP_TARBALL" ] && ZIP_TARBALL=("$PUBLIC_RELEASE_DIR"/*.zip(N))
|
||||
|
||||
PUBLIC_RELEASE_NAME=`basename "$ZIP_TARBALL"`
|
||||
PUBLIC_RELEASE_NAME=${PUBLIC_RELEASE_NAME/-library.zip/}
|
||||
PUBLIC_RELEASE_NAME=${PUBLIC_RELEASE_NAME/.zip/}
|
||||
DEST_DIR="${RELEASE_CANDIDATES_DIR}/$PUBLIC_RELEASE_NAME"
|
||||
|
||||
|
|
@ -55,12 +59,6 @@ pushd "$DEST_DIR"
|
|||
zip -q -r "$DEST_DIR/${PUBLIC_RELEASE_NAME}-doc_html.zip" doc_html
|
||||
popd
|
||||
|
||||
printf "bzip2 doc_html tarball...\n"
|
||||
bzip2 --best < "$DEST_DIR/${PUBLIC_RELEASE_NAME}-doc_html.tar" > "$DEST_DIR/${PUBLIC_RELEASE_NAME}-doc_html.tar.bz2"
|
||||
|
||||
printf "bzip2 source tarball...\n"
|
||||
zcat "$DEST_DIR/${PUBLIC_RELEASE_NAME}.tar.gz" | bzip2 --best > "$DEST_DIR/${PUBLIC_RELEASE_NAME}.tar.bz2"
|
||||
|
||||
printf "xz doc_html tarball...\n"
|
||||
xz --best < "$DEST_DIR/${PUBLIC_RELEASE_NAME}-doc_html.tar" > "$DEST_DIR/${PUBLIC_RELEASE_NAME}-doc_html.tar.xz"
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
0
|
||||
1
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
CGAL-5.0-beta2
|
||||
CGAL-5.1-dev
|
||||
|
|
|
|||
|
|
@ -48,9 +48,10 @@ sub sort_releases($$)
|
|||
my $b = $_[0];
|
||||
my $a = $_[1];
|
||||
|
||||
#take only the numbers from release id, skipping I and Ic
|
||||
my @A = ($a =~ /\d+/g);
|
||||
my @B = ($b =~ /\d+/g);
|
||||
#take only the numbers from release id, skipping the bug-fix
|
||||
#number, and I and Ic
|
||||
my @A = ($a =~ /(\d+)\.(\d+)\.?(:?\d+)?(:?-Ic?-)?(\d+)?/a);
|
||||
my @B = ($b =~ /(\d+)\.(\d+)\.?(:?\d+)?(:?-Ic?-)?(\d+)?/a);
|
||||
|
||||
while(@A and @B) {
|
||||
my $av = shift(@A);
|
||||
|
|
@ -67,8 +68,8 @@ sub write_selects()
|
|||
print OUTPUTV "<p>You can browse the test results of a different version :</p>";
|
||||
my %releases;
|
||||
foreach $_ (glob("results-*.shtml")) {
|
||||
$_ =~ /results-([^I]*)((-Ic?)-([^I].*))\.shtml/;
|
||||
$releases{"$1$3"}=1;
|
||||
$_ =~ /results-(\d+.\d+)([^I]*)((-Ic?)-([^I].*))\.shtml/a;
|
||||
$releases{"$1"}=1;
|
||||
}
|
||||
print OUTPUTV "<table><tr>\n";
|
||||
print OUTPUTV " <th>All releases (<a href=\"${test_results_url}\">last one</a>)</th>\n";
|
||||
|
|
@ -79,7 +80,7 @@ sub write_selects()
|
|||
}
|
||||
print OUTPUTV "</tr>\n";
|
||||
print OUTPUTV "<tr>\n";
|
||||
write_select("sel", ".*");
|
||||
write_select("sel");
|
||||
$count = 0;
|
||||
foreach $_ (sort sort_releases (keys %releases)) {
|
||||
write_select("sel" . $count, $_);
|
||||
|
|
@ -91,19 +92,27 @@ sub write_selects()
|
|||
sub write_select()
|
||||
{
|
||||
my $id = shift(@_);
|
||||
my $pattern = shift(@_);
|
||||
my $pattern = ".*";
|
||||
if (@_ != 0) {
|
||||
$pattern = quotemeta(shift(@_));
|
||||
}
|
||||
my($filename, @result);
|
||||
print OUTPUTV " <td><select id=\"$id\" onchange=\"sel=document.getElementById(\'$id\'); top.location.href=sel.options[sel.selectedIndex].value\">\n";
|
||||
|
||||
print OUTPUTV '<option value="">', "</option>\n";
|
||||
foreach $_ (sort sort_releases (glob("results-*.shtml"))) {
|
||||
$_ =~ /results-${pattern}(-.*|)\.shtml/ || next;
|
||||
print OUTPUTV '<option disabled selected value="">(select a release)', "</option>\n";
|
||||
my %results;
|
||||
foreach $_ (glob("results-*.shtml")) {
|
||||
my $ctime = (stat($_))[10];
|
||||
$results{$_} = $ctime;
|
||||
}
|
||||
foreach $_ (sort { $results{$b} <=> $results{$a} } keys %results) {
|
||||
$_ =~ /results-${pattern}(\.\d+)?(-.*|)\.shtml/ || next;
|
||||
my $ctime = (stat($_))[10];
|
||||
my $date = time2str('%a %Y/%m/%d', $ctime);
|
||||
print OUTPUTV '<option value="', $_, '">';
|
||||
($filename) = m/results-(.*?)\.shtml\s*/;
|
||||
# printf OUTPUTV "%-20s (last modified: %s)</option>\n", $filename, $date;
|
||||
printf OUTPUTV '%2$s: %1$s</option>
|
||||
printf OUTPUTV '%1$s (%2$s)</option>
|
||||
', $filename, $date;
|
||||
}
|
||||
print OUTPUTV "</select></td>";
|
||||
|
|
@ -282,7 +291,7 @@ EOF
|
|||
print_result_table();
|
||||
|
||||
if ($PLATFORMS_BESIDE_RESULTS) {
|
||||
print OUTPUT "<td>\n<table border=\"0\" cellspacing=\"2\" cellpadding=\"0\">\n";
|
||||
print OUTPUT "<td>\n<table class=\"beside\" border=\"0\" cellspacing=\"2\" cellpadding=\"0\">\n";
|
||||
if ($platform_count > 0) {
|
||||
my $repeat_count = (1 + 1.1/16.5)*scalar(keys %test_directories)/($platform_count+0.25);
|
||||
while ($repeat_count >= 1) {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
#include <CGAL/license/Mesh_3.h>
|
||||
|
||||
#include <CGAL/Hash_handles_with_or_without_timestamps.h>
|
||||
#include <CGAL/Time_stamper.h>
|
||||
|
||||
#include <vtkPoints.h>
|
||||
#include <vtkUnstructuredGrid.h>
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
#include <CGAL/license/Mesh_3.h>
|
||||
|
||||
#include <CGAL/Hash_handles_with_or_without_timestamps.h>
|
||||
#include <CGAL/Time_stamper.h>
|
||||
#include <CGAL/utility.h>
|
||||
|
||||
#include <boost/unordered_map.hpp>
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
#include <CGAL/license/Mesh_3.h>
|
||||
|
||||
#include <CGAL/Hash_handles_with_or_without_timestamps.h>
|
||||
#include <CGAL/Time_stamper.h>
|
||||
#include <CGAL/IO/File_medit.h>
|
||||
|
||||
#include <iostream>
|
||||
|
|
|
|||
|
|
@ -18,9 +18,9 @@
|
|||
|
||||
#include <CGAL/array.h>
|
||||
#include <CGAL/boost/graph/Euler_operations.h>
|
||||
#include <CGAL/Hash_handles_with_or_without_timestamps.h>
|
||||
#include <CGAL/Polygon_mesh_processing/orient_polygon_soup.h>
|
||||
#include <CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h>
|
||||
#include <CGAL/Time_stamper.h>
|
||||
|
||||
#include <boost/unordered_map.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include <CGAL/linear_least_squares_fitting_3.h>
|
||||
#include <CGAL/Mesh_3/Triangulation_helpers.h>
|
||||
#include <CGAL/Hash_handles_with_or_without_timestamps.h>
|
||||
#include <CGAL/Time_stamper.h>
|
||||
#include <CGAL/tuple.h>
|
||||
#include <CGAL/iterator.h>
|
||||
#include <CGAL/array.h>
|
||||
|
|
|
|||
|
|
@ -1,384 +0,0 @@
|
|||
// Copyright (c) 2010, 2012 GeometryFactory Sarl (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
|
||||
//
|
||||
//
|
||||
// Author(s) : Laurent Rineau
|
||||
//
|
||||
|
||||
#ifndef CGAL_MESH_3_DETECT_POLYLINES_IN_POLYHEDRA_H
|
||||
#define CGAL_MESH_3_DETECT_POLYLINES_IN_POLYHEDRA_H
|
||||
|
||||
#include <CGAL/license/Mesh_3.h>
|
||||
|
||||
#include <CGAL/Compare_handles_with_or_without_timestamps.h>
|
||||
#include <CGAL/Mesh_3/Detect_polylines_in_polyhedra_fwd.h>
|
||||
#include <CGAL/Default.h>
|
||||
#include <CGAL/Hash_handles_with_or_without_timestamps.h>
|
||||
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/unordered_map.hpp>
|
||||
#include <boost/unordered_set.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace CGAL { namespace Mesh_3 {
|
||||
|
||||
template <typename Polyhedron>
|
||||
struct Detect_polylines
|
||||
{
|
||||
typedef typename Polyhedron::Traits Geom_traits;
|
||||
typedef typename Geom_traits::Point_3 Point_3;
|
||||
typedef typename Polyhedron::Halfedge_const_handle Halfedge_const_handle;
|
||||
typedef typename Polyhedron::Halfedge_handle Halfedge_handle;
|
||||
typedef typename Polyhedron::Vertex_const_handle Vertex_const_handle;
|
||||
typedef typename Polyhedron::Vertex_handle Vertex_handle;
|
||||
typedef typename Polyhedron::size_type size_type;
|
||||
typedef CGAL::Compare_handles_with_or_without_timestamps Compare_handles;
|
||||
|
||||
typedef CGAL::Hash_handles_with_or_without_timestamps Hash_fct;
|
||||
typedef boost::unordered_set<Vertex_handle, Hash_fct> Vertices_set;
|
||||
typedef boost::unordered_map<Vertex_handle,
|
||||
size_type,
|
||||
Hash_fct> Vertices_counter;
|
||||
|
||||
typedef boost::unordered_set<Halfedge_handle, Hash_fct> Feature_edges_set;
|
||||
|
||||
Feature_edges_set edges_to_consider;
|
||||
Vertices_set corner_vertices;
|
||||
|
||||
// typedef std::vector<Point_3> Polyline_and_context;
|
||||
|
||||
typedef typename Polyhedron::Vertex Polyhedron_vertex;
|
||||
typedef typename Polyhedron_vertex::Set_of_indices Set_of_indices;
|
||||
|
||||
template <typename T>
|
||||
static
|
||||
void display_index(std::ostream& stream, const T& x)
|
||||
{
|
||||
stream << x;
|
||||
}
|
||||
|
||||
template <typename T, typename U>
|
||||
static
|
||||
void display_index(std::ostream& stream, const std::pair<T,U>& p)
|
||||
{
|
||||
stream << p.first << "+" << p.second;
|
||||
}
|
||||
|
||||
static
|
||||
void display_set(std::ostream& stream, Set_of_indices set) {
|
||||
stream << "( ";
|
||||
for(typename Set_of_indices::value_type i : set) {
|
||||
display_index(stream, i);
|
||||
stream << " ";
|
||||
}
|
||||
stream << ")";
|
||||
}
|
||||
|
||||
static Set_of_indices
|
||||
edge_indices(const Halfedge_handle he) {
|
||||
Set_of_indices set_of_indices;
|
||||
const Set_of_indices& source_set =
|
||||
he->opposite()->vertex()->incident_patches_ids_set();
|
||||
const Set_of_indices& target_set =
|
||||
he->vertex()->incident_patches_ids_set();
|
||||
std::set_intersection(source_set.begin(), source_set.end(),
|
||||
target_set.begin(), target_set.end(),
|
||||
std::inserter(set_of_indices,
|
||||
set_of_indices.begin()));
|
||||
if(set_of_indices.empty()) {
|
||||
std::cerr << "Indices set of following edge is empty:\n";
|
||||
std::cerr << " " << he->opposite()->vertex()->point()
|
||||
<< " ";
|
||||
display_set(std::cerr, source_set);
|
||||
std::cerr << "\n";
|
||||
std::cerr << " " << he->vertex()->point()
|
||||
<< " ";
|
||||
display_set(std::cerr, target_set);
|
||||
std::cerr << "\n";
|
||||
}
|
||||
return set_of_indices;
|
||||
}
|
||||
|
||||
static Halfedge_handle canonical(Halfedge_handle he)
|
||||
{
|
||||
const Halfedge_handle& op = he->opposite();
|
||||
if(Compare_handles()(he, op))
|
||||
return he;
|
||||
else
|
||||
return op;
|
||||
}
|
||||
|
||||
static bool is_feature(const Halfedge_handle he) {
|
||||
return
|
||||
he->is_feature_edge() || he->opposite()->is_feature_edge();
|
||||
}
|
||||
|
||||
/** Follow a polyline or a polygon, from the halfedge he. */
|
||||
template <typename Polyline_and_context, typename Polylines_output_iterator>
|
||||
Polylines_output_iterator
|
||||
follow_half_edge(const Halfedge_handle he,
|
||||
Polylines_output_iterator polylines_out,
|
||||
Polyline_and_context = Polyline_and_context())
|
||||
{
|
||||
typename Feature_edges_set::iterator it =
|
||||
edges_to_consider.find(canonical(he));
|
||||
if(it == edges_to_consider.end()) {
|
||||
return polylines_out;
|
||||
}
|
||||
|
||||
Polyline_and_context polyline;
|
||||
polyline.polyline_content.push_back(he->opposite()->vertex()->point());
|
||||
|
||||
Halfedge_handle current_he = he;
|
||||
|
||||
Set_of_indices set_of_indices_of_current_edge
|
||||
= edge_indices(current_he);
|
||||
|
||||
do {
|
||||
CGAL_assertion(!set_of_indices_of_current_edge.empty());
|
||||
CGAL_assertion(is_feature(current_he));
|
||||
CGAL_assertion_code(const size_type n = )
|
||||
edges_to_consider.erase(canonical(current_he));
|
||||
CGAL_assertion(n > 0);
|
||||
Vertex_handle v = current_he->vertex();
|
||||
polyline.polyline_content.push_back(v->point());
|
||||
// std::cerr << v->point() << std::endl;
|
||||
if(corner_vertices.count(v) > 0) break;
|
||||
typename Polyhedron::Halfedge_around_vertex_circulator
|
||||
loop_he = v->vertex_begin();
|
||||
++loop_he;
|
||||
// CGAL_assertion((&*loop_he) != (&*current_he) );
|
||||
while((&*loop_he) == (&*current_he) ||
|
||||
(!is_feature(loop_he)) ) {
|
||||
++loop_he;
|
||||
// CGAL_assertion((&*loop_he) != (&*current_he) );
|
||||
}
|
||||
|
||||
Set_of_indices set_of_indices_of_next_edge =
|
||||
edge_indices(loop_he);
|
||||
|
||||
if(! (set_of_indices_of_next_edge.size() ==
|
||||
set_of_indices_of_current_edge.size()
|
||||
&&
|
||||
std::equal(set_of_indices_of_next_edge.begin(),
|
||||
set_of_indices_of_next_edge.end(),
|
||||
set_of_indices_of_current_edge.begin())) )
|
||||
{
|
||||
// the vertex is a special vertex, a new corner
|
||||
#ifdef CGAL_MESH_3_PROTECTION_DEBUG
|
||||
std::cerr << "New corner vertex " << v->point() << std::endl;
|
||||
std::cerr << " indices were: ";
|
||||
for(typename Set_of_indices::value_type i :
|
||||
set_of_indices_of_current_edge) {
|
||||
std::cerr << i << " ";
|
||||
}
|
||||
std::cerr << "\n now: ";
|
||||
for(typename Set_of_indices::value_type i :
|
||||
set_of_indices_of_next_edge) {
|
||||
std::cerr << i << " ";
|
||||
}
|
||||
std::cerr << "\n";
|
||||
#endif
|
||||
++v->nb_of_feature_edges;
|
||||
corner_vertices.insert(v);
|
||||
polyline.context.adjacent_patches_ids=set_of_indices_of_current_edge;
|
||||
*polylines_out++ = polyline;
|
||||
polyline.polyline_content.clear();
|
||||
polyline.polyline_content.push_back(loop_he->vertex()->point());
|
||||
set_of_indices_of_current_edge = set_of_indices_of_next_edge;
|
||||
}
|
||||
|
||||
current_he = loop_he->opposite();
|
||||
} while(current_he != he );
|
||||
|
||||
polyline.context.adjacent_patches_ids=set_of_indices_of_current_edge;
|
||||
*polylines_out++ = polyline;
|
||||
return polylines_out;
|
||||
}
|
||||
|
||||
/** Loop around a corner vertex, and try to follow a polyline of feature
|
||||
edges, from each incident edge. */
|
||||
template <typename Polyline_and_context, typename Polylines_output_iterator>
|
||||
Polylines_output_iterator
|
||||
loop_around_corner(const Vertex_handle v,
|
||||
Polylines_output_iterator polylines_out,
|
||||
Polyline_and_context empty_polyline =
|
||||
Polyline_and_context() )
|
||||
{
|
||||
typename Polyhedron::Halfedge_around_vertex_circulator
|
||||
he = v->vertex_begin(), end(he);
|
||||
do {
|
||||
CGAL_assertion(he->vertex() == v);
|
||||
polylines_out = follow_half_edge(he->opposite(),
|
||||
polylines_out,
|
||||
empty_polyline);
|
||||
++he;
|
||||
} while(he != end);
|
||||
return polylines_out;
|
||||
}
|
||||
|
||||
/** For a non-corner vertex v (that is incident to two feature edges),
|
||||
measure the angle between the two edges, and mark the vertex as corner
|
||||
edge, if the angle is < 120°. **/
|
||||
static bool measure_angle(const Vertex_handle v)
|
||||
{
|
||||
Halfedge_handle e1;
|
||||
Halfedge_handle e2;
|
||||
typename Polyhedron::Halfedge_around_vertex_circulator he =
|
||||
v->vertex_begin(), end(he);
|
||||
// std::cerr << "measure_handle(" << (void*)(&*v)
|
||||
// << " = " << v->point() << ")";
|
||||
bool first = true;
|
||||
bool done = false;
|
||||
do {
|
||||
CGAL_assertion(he->vertex() == v);
|
||||
// std::cerr << he->opposite()->vertex()->point() << std::endl;
|
||||
if(is_feature(he)) {
|
||||
if(first) {
|
||||
e1 = he;
|
||||
first = false;
|
||||
}
|
||||
else {
|
||||
if(done) {
|
||||
std::cerr << v->point() << " should be a corner!\n"
|
||||
<< " Too many adjacent feature edges!\n";
|
||||
return false;
|
||||
}
|
||||
e2 = he;
|
||||
done = true;
|
||||
}
|
||||
// std::cerr << "x";
|
||||
}
|
||||
// else
|
||||
// std::cerr << ".";
|
||||
++he;
|
||||
} while(he != end);
|
||||
if(!done) {
|
||||
std::cerr << v->point() << " should be a corner!\n"
|
||||
<< " Not enough adjacent feature edge!\n";
|
||||
return false;
|
||||
}
|
||||
// std::cerr << "\n";
|
||||
const Point_3 pv = v->point();
|
||||
const Point_3 pa = e1->opposite()->vertex()->point();
|
||||
const Point_3 pb = e2->opposite()->vertex()->point();
|
||||
const typename Geom_traits::Vector_3 av = pv - pa;
|
||||
const typename Geom_traits::Vector_3 bv = pv - pb;
|
||||
const typename Geom_traits::FT sc_prod = av * bv;
|
||||
if( sc_prod >= 0 ||
|
||||
(sc_prod < 0 &&
|
||||
CGAL::square(sc_prod) < (av * av) * (bv * bv) / 4 ) )
|
||||
{
|
||||
// std::cerr << "Corner (" << pa << ", " << pv
|
||||
// << ", " << pb << ")\n";
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Polyline_and_context,
|
||||
typename Polylines_output_iterator>
|
||||
Polylines_output_iterator
|
||||
operator()(Polyhedron* pMesh,
|
||||
Polylines_output_iterator out_it,
|
||||
Polyline_and_context empty_polyline)
|
||||
{
|
||||
// That call orders the set of edges of the polyhedron, so that the
|
||||
// feature edges are at the end of the sequence of edges.
|
||||
// pMesh->normalize_border();
|
||||
Vertices_counter feature_vertices;
|
||||
|
||||
// Iterate over all edges, and find out which vertices are corner
|
||||
// vertices (more than two incident feature edges).
|
||||
for(typename Polyhedron::Edge_iterator
|
||||
eit = pMesh->edges_begin (),
|
||||
end = pMesh->edges_end();
|
||||
eit != end; ++eit)
|
||||
{
|
||||
if(!eit->is_feature_edge()) continue;
|
||||
edges_to_consider.insert(canonical(eit));
|
||||
typename Polyhedron::Vertex_handle v = eit->vertex();
|
||||
for(unsigned i = 0; i < 2; ++i) {
|
||||
if(++feature_vertices[v] == 3)
|
||||
corner_vertices.insert(v);
|
||||
v = eit->opposite()->vertex();
|
||||
}
|
||||
}
|
||||
|
||||
for(typename Polyhedron::Vertex_iterator
|
||||
vit = pMesh->vertices_begin (),
|
||||
end = pMesh->vertices_end();
|
||||
vit != end; ++vit)
|
||||
{
|
||||
if(feature_vertices.count(vit) !=0 &&
|
||||
feature_vertices[vit] == 1) {
|
||||
corner_vertices.insert(vit);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CGAL_MESH_3_PROTECTION_DEBUG
|
||||
std::cerr << "Corner vertices: " << corner_vertices.size() << std::endl;
|
||||
std::cerr << "Feature vertices: " << feature_vertices.size() << std::endl;
|
||||
#endif
|
||||
|
||||
// // Iterate over non-corner feature vertices, and measure the angle.
|
||||
for(typename Vertices_counter::iterator it = feature_vertices.begin(),
|
||||
end = feature_vertices.end(); it != end; ++it)
|
||||
{
|
||||
const Vertex_handle v = it->first;
|
||||
if(corner_vertices.count(v) == 0) {
|
||||
CGAL_assertion(it->second == 2);
|
||||
if(measure_angle(v)) {
|
||||
corner_vertices.insert(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef CGAL_MESH_3_PROTECTION_DEBUG
|
||||
std::cerr << "New corner vertices: "
|
||||
<< corner_vertices.size() << std::endl;
|
||||
#endif
|
||||
|
||||
// Follow the polylines...
|
||||
for(typename Vertices_set::iterator it = corner_vertices.begin(),
|
||||
end = corner_vertices.end(); it != end; ++it)
|
||||
{
|
||||
out_it = loop_around_corner(*it, out_it, empty_polyline);
|
||||
}
|
||||
|
||||
// ... and the cycles.
|
||||
while(! edges_to_consider.empty() ) {
|
||||
out_it = follow_half_edge(*edges_to_consider.begin(),
|
||||
out_it,
|
||||
empty_polyline);
|
||||
}
|
||||
|
||||
return out_it;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Polyhedron,
|
||||
typename Polyline_and_context,
|
||||
typename Polylines_output_iterator>
|
||||
Polylines_output_iterator
|
||||
detect_polylines(Polyhedron* pMesh,
|
||||
Polylines_output_iterator out_it) {
|
||||
|
||||
Detect_polylines<Polyhedron> go;
|
||||
Polyline_and_context empty_polyline;
|
||||
return go(pMesh, out_it, empty_polyline);
|
||||
}
|
||||
|
||||
} // end namespace CGAL::Mesh_3
|
||||
} // end namespace CGAL
|
||||
|
||||
|
||||
#endif // CGAL_MESH_3_DETECT_POLYLINES_IN_POLYHEDRA_H
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
// Copyright (c) 2010 GeometryFactory Sarl (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
|
||||
//
|
||||
//
|
||||
// Author(s) : Laurent Rineau
|
||||
//
|
||||
|
||||
#ifndef CGAL_DETECT_POLYLINES_IN_POLYHEDRA_FWD_H
|
||||
#define CGAL_DETECT_POLYLINES_IN_POLYHEDRA_FWD_H
|
||||
|
||||
#include <CGAL/license/Mesh_3.h>
|
||||
|
||||
|
||||
namespace CGAL { namespace Mesh_3 {
|
||||
|
||||
template <typename Polyhedron>
|
||||
struct Detect_polylines;
|
||||
|
||||
template <typename Polyhedron,
|
||||
typename Polyline_and_context,
|
||||
typename Polylines_output_iterator>
|
||||
Polylines_output_iterator
|
||||
detect_polylines(Polyhedron* pMesh,
|
||||
Polylines_output_iterator out_it);
|
||||
|
||||
} // end namespace CGAL::Mesh_3
|
||||
} // end namespace CGAL
|
||||
|
||||
|
||||
#endif // CGAL_DETECT_POLYLINES_IN_POLYHEDRA_FWD_H
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
#include <CGAL/Mesh_3/config.h>
|
||||
#include <CGAL/Mesh_3/Uniform_sizing_field.h>
|
||||
|
||||
#include <CGAL/Hash_handles_with_or_without_timestamps.h>
|
||||
#include <CGAL/Time_stamper.h>
|
||||
#include <CGAL/convex_hull_2.h>
|
||||
#include <CGAL/ch_graham_andrew.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
#include <CGAL/Bbox_3.h>
|
||||
#include <CGAL/Mesh_3/io_signature.h>
|
||||
#include <CGAL/Union_find.h>
|
||||
#include <CGAL/Hash_handles_with_or_without_timestamps.h>
|
||||
#include <CGAL/Time_stamper.h>
|
||||
|
||||
#include <boost/functional/hash.hpp>
|
||||
#include <boost/unordered_map.hpp>
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue