Merge branch 'master' into PMP-Extrude-GF

This commit is contained in:
Maxime GIMENO 2018-06-20 08:50:03 +02:00 committed by GitHub
commit e54d577b59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
302 changed files with 8645 additions and 4489 deletions

View File

@ -53,7 +53,7 @@ env:
compiler: clang-3.6 compiler: clang-3.6
install: install:
- echo "$PWD" - echo "$PWD"
- if [ -n "$TRAVIS_PULL_REQUEST" ] && [ "$PACKAGE" != CHECK ]; then DO_IGNORE=FALSE; for ARG in $(echo "$PACKAGE");do . $PWD/.travis/test_package.sh "$PWD" "$ARG"; echo "DO_IGNORE is $DO_IGNORE"; if [ "$DO_IGNORE" = "FALSE" ]; then break; fi; done; if [ "$DO_IGNORE" = "TRUE" ]; then travis_terminate 0; fi;fi - if [ -n "$TRAVIS_PULL_REQUEST" ] && [ "$PACKAGE" != CHECK ]; then DO_IGNORE=FALSE; for ARG in $(echo "$PACKAGE");do if [ "$ARG" = "Maintenance" ]; then continue; fi; . $PWD/.travis/test_package.sh "$PWD" "$ARG"; echo "DO_IGNORE is $DO_IGNORE"; if [ "$DO_IGNORE" = "FALSE" ]; then break; fi; done; if [ "$DO_IGNORE" = "TRUE" ]; then travis_terminate 0; fi;fi
- bash .travis/install.sh - bash .travis/install.sh
- export CXX=clang++-3.6 CC=clang-3.6; - export CXX=clang++-3.6 CC=clang-3.6;
before_script: before_script:

View File

@ -77,7 +77,8 @@ cd $ROOT
zsh $ROOT/Scripts/developer_scripts/test_merge_of_branch HEAD zsh $ROOT/Scripts/developer_scripts/test_merge_of_branch HEAD
#test dependencies #test dependencies
cd $ROOT cd $ROOT
bash Scripts/developer_scripts/cgal_check_dependencies.sh /usr/bin/doxygen bash Scripts/developer_scripts/cgal_check_dependencies.sh --check_headers /usr/bin/doxygen
cd .travis cd .travis
#parse current matrix and check that no package has been forgotten #parse current matrix and check that no package has been forgotten

View File

@ -10,7 +10,7 @@ env:
compiler: clang-3.6 compiler: clang-3.6
install: install:
- echo "$PWD" - echo "$PWD"
- if [ -n "$TRAVIS_PULL_REQUEST" ] && [ "$PACKAGE" != CHECK ]; then DO_IGNORE=FALSE; for ARG in $(echo "$PACKAGE");do . $PWD/.travis/test_package.sh "$PWD" "$ARG"; echo "DO_IGNORE is $DO_IGNORE"; if [ "$DO_IGNORE" = "FALSE" ]; then break; fi; done; if [ "$DO_IGNORE" = "TRUE" ]; then travis_terminate 0; fi;fi - if [ -n "$TRAVIS_PULL_REQUEST" ] && [ "$PACKAGE" != CHECK ]; then DO_IGNORE=FALSE; for ARG in $(echo "$PACKAGE");do if [ "$ARG" = "Maintenance" ]; then continue; fi; . $PWD/.travis/test_package.sh "$PWD" "$ARG"; echo "DO_IGNORE is $DO_IGNORE"; if [ "$DO_IGNORE" = "FALSE" ]; then break; fi; done; if [ "$DO_IGNORE" = "TRUE" ]; then travis_terminate 0; fi;fi
- bash .travis/install.sh - bash .travis/install.sh
- export CXX=clang++-3.6 CC=clang-3.6; - export CXX=clang++-3.6 CC=clang-3.6;
before_script: before_script:

View File

@ -21,6 +21,7 @@
#include "NewTabDialog.h" #include "NewTabDialog.h"
#include "ArrangementDemoWindow.h" #include "ArrangementDemoWindow.h"
#include "ui_NewTabDialog.h" #include "ui_NewTabDialog.h"
#include <QButtonGroup>
NewTabDialog::NewTabDialog( QWidget* parent, Qt::WindowFlags f ) : NewTabDialog::NewTabDialog( QWidget* parent, Qt::WindowFlags f ) :
QDialog( parent, f ), QDialog( parent, f ),

View File

@ -784,7 +784,7 @@ public:
* \return SMALLER if the curve is directed right; * \return SMALLER if the curve is directed right;
* LARGER if the curve is directed left. * LARGER if the curve is directed left.
*/ */
Comparison_result operator() (const X_monotone_curve_2& cv) Comparison_result operator() (const X_monotone_curve_2& cv) const
{ {
if (cv.is_directed_right()) if (cv.is_directed_right())
return (SMALLER); return (SMALLER);

View File

@ -1020,40 +1020,33 @@ add_face_to_border(typename boost::graph_traits<Graph>::halfedge_descriptor h1,
* collapses an edge in a graph. * collapses an edge in a graph.
* *
* \tparam Graph must be a model of `MutableFaceGraph` * \tparam Graph must be a model of `MutableFaceGraph`
* Let `v0` and `v1` be the source and target vertices, and let `e` and `e'` be the halfedges of edge `v0v1`. * Let `h` be the halfedge of `e`, and let `v0` and `v1` be the source and target vertices of `h`.
* Let `p_h` and `p_o_h` be respectively the edges of `prev(h,g)` and `prev(opposite(h, g), g)`.
* Let `o_n_h` and `o_n_o_h` be respectively the edges of `opposite(next(h,g))` and `opposite(next(opposite(h, g), g))`.
* *
* For `e`, let `en` and `ep` be the next and previous * After the collapse of edge `e` the following holds:
* halfedges, that is `en = next(e, g)`, `ep = prev(e, g)`, and let * - The edge `e` is no longer in `g`.
* `eno` and `epo` be their opposite halfedges, that is * - The faces incident to edge `e` are no longer in `g`.
* `eno = opposite(en, g)` and `epo = opposite(ep, g)`. * - `v0` is no longer in `g`.
* Analoguously, for `e'` define `en'`, `ep'`, `eno'`, and `epo'`. * - If `h` is not a border halfedge, `p_h` is no longer in `g` and is replaced by `o_n_h`.
* - If the opposite of `h` is not a border halfedge, `p_o_h` is no longer in `g` and is replaced by `o_n_o_h`.
* - The halfedges kept in `g` that had `v0` as target and source now have `v1` as target and source, respectively.
* - No other incidence information is changed in `g`.
* *
* Then, after the collapse of edge `v0v1` the following holds for `e` (and analoguously for `e'`) * \returns vertex `v1`.
*
* <UL>
* <LI>The edge `v0v1` is no longer in `g`.
* <LI>The faces incident to edge `v0v1` are no longer in `g`.
* <LI>Either `v0`, or `v1` is no longer in `g` while the other remains.
* Let `vgone` be the removed vertex and `vkept` be the remaining vertex.
* <LI>If `e` was a border halfedge, that is `is_border(e, g) == true`, then `next(ep,g) == en`, and `prev(en,g) == ep`.
* <LI>If `e` was not a border halfedge, that is `is_border(e, g) == false`, then `ep` and `epo` are no longer in `g` while `en` and `eno` are kept in `g`.
* <LI>For all halfedges `hv` in `halfedges_around_target(vgone, g)`, `target(*hv, g) == vkept` and `source(opposite(*hv, g), g) == vkept`.
* <LI>No other incidence information has changed in `g`.
* </UL>
* \returns vertex `vkept` (which can be either `v0` or `v1`).
* \pre g must be a triangulated graph * \pre g must be a triangulated graph
* \pre `does_satisfy_link_condition(v0v1,g) == true`. * \pre `does_satisfy_link_condition(e,g) == true`.
*/ */
template<typename Graph> template<typename Graph>
typename boost::graph_traits<Graph>::vertex_descriptor typename boost::graph_traits<Graph>::vertex_descriptor
collapse_edge(typename boost::graph_traits<Graph>::edge_descriptor v0v1, collapse_edge(typename boost::graph_traits<Graph>::edge_descriptor e,
Graph& g) Graph& g)
{ {
typedef boost::graph_traits< Graph > Traits; typedef boost::graph_traits< Graph > Traits;
typedef typename Traits::vertex_descriptor vertex_descriptor; typedef typename Traits::vertex_descriptor vertex_descriptor;
typedef typename Traits::halfedge_descriptor halfedge_descriptor; typedef typename Traits::halfedge_descriptor halfedge_descriptor;
halfedge_descriptor pq = halfedge(v0v1,g); halfedge_descriptor pq = halfedge(e,g);
halfedge_descriptor qp = opposite(pq, g); halfedge_descriptor qp = opposite(pq, g);
halfedge_descriptor pt = opposite(prev(pq, g), g); halfedge_descriptor pt = opposite(prev(pq, g), g);
halfedge_descriptor qb = opposite(prev(qp, g), g); halfedge_descriptor qb = opposite(prev(qp, g), g);
@ -1068,51 +1061,9 @@ collapse_edge(typename boost::graph_traits<Graph>::edge_descriptor v0v1,
vertex_descriptor q = target(pq, g); vertex_descriptor q = target(pq, g);
vertex_descriptor p = source(pq, g); vertex_descriptor p = source(pq, g);
#if 0
if(lTopLeftFaceExists && lBottomRightFaceExists){
std::cerr << " // do it low level" << std::endl;
halfedge_descriptor qt = next(pq,g);
halfedge_descriptor pb = next(qp,g);
halfedge_descriptor ppt = prev(pt,g);
halfedge_descriptor pqb = prev(qb,g);
if(halfedge(q,g) == pq){
set_halfedge(q, pqb,g);
}
vertex_descriptor t = target(qt,g);
if(halfedge(t,g) == pt){
set_halfedge(t, qt,g);
}
vertex_descriptor b = target(pb,g);
if(halfedge(b,g) == qb){
set_halfedge(t, pb,g);
}
set_face(qt, face(pt,g),g);
set_halfedge(face(qt,g),qt,g);
set_face(pb, face(qb,g),g);
set_halfedge(face(pb,g),pb,g);
set_next(qt, next(pt,g),g);
set_next(pb, next(qb,g),g);
set_next(ppt, qt,g);
set_next(pqb,pb,g);
remove_face(face(pq,g),g);
remove_face(face(qp,g),g);
remove_edge(v0v1,g);
remove_edge(edge(pt,g),g);
remove_edge(edge(qb,g),g);
remove_vertex(p,g);
Halfedge_around_target_circulator<Graph> beg(ppt,g), end(pqb,g);
while(beg != end){
CGAL_assertion(target(*beg,g) == p);
set_target(*beg,q,g);
--beg;
}
return q;
// return the vertex kept
}
#endif
bool lP_Erased = false, lQ_Erased = false ; bool lP_Erased = false;
if ( lTopFaceExists ) if ( lTopFaceExists )
{ {
@ -1137,7 +1088,7 @@ collapse_edge(typename boost::graph_traits<Graph>::edge_descriptor v0v1,
//CGAL_ECMS_TRACE(3, "Bottom face doesn't exist so vertex P already removed" ) ; //CGAL_ECMS_TRACE(3, "Bottom face doesn't exist so vertex P already removed" ) ;
lP_Erased = true ; lP_Erased = true ;
} }
} }
} }
@ -1158,19 +1109,20 @@ collapse_edge(typename boost::graph_traits<Graph>::edge_descriptor v0v1,
// << q.idx() << "->V" << target(qb, g).idx() // << q.idx() << "->V" << target(qb, g).idx()
// << ") by erasing bottom face" ) ; // << ") by erasing bottom face" ) ;
remove_face(opposite(qb, g),g);
if ( !lTopFaceExists ) if ( !lTopFaceExists )
{ {
//CGAL_ECMS_TRACE(3, "Top face doesn't exist so vertex Q already removed" ) ; //CGAL_ECMS_TRACE(3, "Top face doesn't exist so vertex Q already removed" ) ;
lQ_Erased = true ; lP_Erased = true ;
}
// q will be removed, swap p and q
internal::swap_vertices(p, q, g);
}
remove_face(opposite(qb, g),g);
} }
} }
CGAL_assertion( !lP_Erased || !lQ_Erased ) ; if ( !lP_Erased )
if ( !lP_Erased && !lQ_Erased )
{ {
//CGAL_ECMS_TRACE(3, "Removing vertex P by joining pQ" ) ; //CGAL_ECMS_TRACE(3, "Removing vertex P by joining pQ" ) ;
@ -1180,19 +1132,22 @@ collapse_edge(typename boost::graph_traits<Graph>::edge_descriptor v0v1,
CGAL_expensive_assertion(is_valid_polygon_mesh(g)); CGAL_expensive_assertion(is_valid_polygon_mesh(g));
return lP_Erased ? q : p ; return q;
} }
/** /**
* Collapses the edge `v0v1` replacing it with v0 or v1, as described in the paragraph above * collapses an edge in a graph having non-collapsable edges.
*
* Let `h` be the halfedge of `e`, and let `v0` and `v1` be the source and target vertices of `h`.
* Collapses the edge `e` replacing it with `v1`, as described in the paragraph above
* and guarantees that an edge `e2`, for which `get(edge_is_constrained_map, e2)==true`, * and guarantees that an edge `e2`, for which `get(edge_is_constrained_map, e2)==true`,
* is not removed after the collapse. * is not removed after the collapse.
* *
*
* \tparam Graph must be a model of `MutableFaceGraph` * \tparam Graph must be a model of `MutableFaceGraph`
* \tparam EdgeIsConstrainedMap mut be a model of `ReadablePropertyMap` with the edge descriptor of `Graph` * \tparam EdgeIsConstrainedMap mut be a model of `ReadablePropertyMap` with the edge descriptor of `Graph`
* as key type and a Boolean as value type. It indicates if an edge is constrained or not. * as key type and a Boolean as value type. It indicates if an edge is constrained or not.
* *
* \returns vertex `v1`.
* \pre This function requires `g` to be an oriented 2-manifold with or without boundaries. * \pre This function requires `g` to be an oriented 2-manifold with or without boundaries.
* Furthermore, the edge `v0v1` must satisfy the link condition, which guarantees that the surface mesh is also 2-manifold after the edge collapse. * Furthermore, the edge `v0v1` must satisfy the link condition, which guarantees that the surface mesh is also 2-manifold after the edge collapse.
* \pre `get(edge_is_constrained_map, v0v1)==false`. * \pre `get(edge_is_constrained_map, v0v1)==false`.
@ -1262,14 +1217,16 @@ collapse_edge(typename boost::graph_traits<Graph>::edge_descriptor v0v1,
{ {
// the vertex is of valence 3 and we simply need to remove the vertex // the vertex is of valence 3 and we simply need to remove the vertex
// and its indicent edges // and its indicent edges
bool lP_Erased = false;
halfedge_descriptor edge = halfedge_descriptor edge =
next(edges_to_erase[0],g) == edges_to_erase[1]? next(edges_to_erase[0],g) == edges_to_erase[1]?
edges_to_erase[0]:edges_to_erase[1]; edges_to_erase[0]:edges_to_erase[1];
if (target(edge,g) == p) if (target(edge,g) != p)
lP_Erased = true; {
// q will be removed, swap it with p
internal::swap_vertices(p, q, g);
}
remove_center_vertex(edge,g); remove_center_vertex(edge,g);
return lP_Erased? q : p; return q;
} }
else else
{ {
@ -1294,19 +1251,29 @@ collapse_edge(typename boost::graph_traits<Graph>::edge_descriptor v0v1,
join_vertex(pq,g); join_vertex(pq,g);
return q; return q;
} }
bool lQ_Erased = is_border(opposite(next(pq,g),g),g); if( is_border(opposite(next(pq,g),g),g) )
{
// q will be removed, swap it with p
internal::swap_vertices(p, q, g);
}
remove_face(opposite(edges_to_erase[0],g),g); remove_face(opposite(edges_to_erase[0],g),g);
return lQ_Erased?p:q; return q;
} }
if (! (is_border(edges_to_erase[0],g))){ if (! (is_border(edges_to_erase[0],g))){
// q will be removed, swap it with p
internal::swap_vertices(p, q, g);
join_face(edges_to_erase[0],g); join_face(edges_to_erase[0],g);
join_vertex(qp,g); join_vertex(qp,g);
return p; return q;
}
if(!is_border(opposite(next(qp,g),g),g))
{
// q will be removed, swap it with p
internal::swap_vertices(p, q, g);
} }
bool lP_Erased= is_border(opposite(next(qp,g),g),g);
remove_face(opposite(edges_to_erase[0],g),g); remove_face(opposite(edges_to_erase[0],g),g);
return lP_Erased?q:p; return q;
}; };
} }

View File

@ -1397,6 +1397,101 @@ clear_impl(FaceGraph& g)
} }
} }
template <class FaceGraph>
void swap_vertices(
typename boost::graph_traits<FaceGraph>::vertex_descriptor& p,
typename boost::graph_traits<FaceGraph>::vertex_descriptor& q,
FaceGraph& g)
{
typedef typename boost::graph_traits<FaceGraph>::halfedge_descriptor halfedge_descriptor;
halfedge_descriptor hq=halfedge(q, g);
halfedge_descriptor hp=halfedge(p, g);
BOOST_FOREACH(halfedge_descriptor h, halfedges_around_target(hq, g))
set_target(h, p, g);
BOOST_FOREACH(halfedge_descriptor h, halfedges_around_target(hp, g))
set_target(h, q, g);
set_halfedge(p, hq, g);
set_halfedge(q, hp, g);
}
template <class FaceGraph>
void swap_edges(
const typename boost::graph_traits<FaceGraph>::halfedge_descriptor& h1,
const typename boost::graph_traits<FaceGraph>::halfedge_descriptor& h2,
FaceGraph& g)
{
typedef typename boost::graph_traits<FaceGraph>::halfedge_descriptor halfedge_descriptor;
typedef typename boost::graph_traits<FaceGraph>::face_descriptor face_descriptor;
typedef typename boost::graph_traits<FaceGraph>::vertex_descriptor vertex_descriptor;
const halfedge_descriptor oh1 = opposite(h1, g), oh2 = opposite(h2, g);
// backup vertex pointers
vertex_descriptor s1 = target(oh1, g), s2 = target(oh2, g);
vertex_descriptor t1 = target(h1, g), t2 = target(h2, g);
// backup face pointers
face_descriptor f1 = face(h1, g), f2 = face(h2, g);
face_descriptor fo1 = face(oh1, g), fo2 = face(oh2, g);
// backup next prev pointers
halfedge_descriptor nh1 = next(h1, g), nh2 = next(h2, g);
halfedge_descriptor ph1 = prev(h1, g), ph2 = prev(h2, g);
halfedge_descriptor noh1 = next(oh1, g), noh2 = next(oh2, g);
halfedge_descriptor poh1 = prev(oh1, g), poh2 = prev(oh2, g);
// handle particular cases where next/prev are halfedges to be swapt
if (nh1 == oh2) nh1 = oh1;
if (nh1 == h2) nh1 = h1;
if (nh2 == oh1) nh2 = oh2;
if (nh2 == h1) nh2 = h2;
if (ph1 == oh2) ph1 = oh1;
if (ph1 == h2) ph1 = h1;
if (ph2 == oh1) ph2 = oh2;
if (ph2 == h1) ph2 = h2;
if (noh1 == oh2) noh1 = oh1;
if (noh1 == h2) noh1 = h1;
if (noh2 == oh1) noh2 = oh2;
if (noh2 == h1) noh2 = h2;
if (poh1 == oh2) poh1 = oh1;
if (poh1 == h2) poh1 = h1;
if (poh2 == oh1) poh2 = oh2;
if (poh2 == h1) poh2 = h2;
// (1) exchange next pointers
set_next(h1, nh2, g);
set_next(h2, nh1, g);
set_next(ph1, h2, g);
set_next(ph2, h1, g);
set_next(oh1, noh2, g);
set_next(oh2, noh1, g);
set_next(poh1, oh2, g);
set_next(poh2, oh1, g);
// (2) exchange vertex-halfedge pointers
set_target(h1, t2, g);
set_target(h2, t1, g);
set_target(oh1, s2, g);
set_target(oh2, s1, g);
if (halfedge(t1, g)==h1) set_halfedge(t1, h2, g);
if (halfedge(t2, g)==h2) set_halfedge(t2, h1, g);
if (halfedge(s1, g)==oh1) set_halfedge(s1, oh2, g);
if (halfedge(s2, g)==oh2) set_halfedge(s2, oh1, g);
// (3) exchange face-halfedge pointers
set_face(h1, f2, g);
set_face(h2, f1, g);
set_face(oh1, fo2, g);
set_face(oh2, fo1, g);
face_descriptor nf = boost::graph_traits<FaceGraph>::null_face();
if (f1 != nf && halfedge(f1, g)==h1) set_halfedge(f1, h2, g);
if (f2 != nf && halfedge(f2, g)==h2) set_halfedge(f2, h1, g);
if (fo1 != nf && halfedge(fo1, g)==oh1) set_halfedge(fo1, oh2, g);
if (fo2 != nf && halfedge(fo2, g)==oh2) set_halfedge(fo2, oh1, g);
}
} //end of internal namespace } //end of internal namespace
/** /**

View File

@ -31,9 +31,8 @@
#else #else
# define BOOST_PARAMETER_MAX_ARITY 12 # define BOOST_PARAMETER_MAX_ARITY 12
#endif #endif
#include <boost/parameter.hpp>
#include <boost/parameter/name.hpp>
#include <boost/parameter/name.hpp>
#if defined(__clang__) || (BOOST_GCC >= 40600) #if defined(__clang__) || (BOOST_GCC >= 40600)
# define CGAL_IGNORE_UNUSED_VARIABLES \ # define CGAL_IGNORE_UNUSED_VARIABLES \
@ -58,7 +57,7 @@ namespace CGAL
{ {
namespace parameters namespace parameters
{ {
template <typename T> template <typename T>
struct Base struct Base
{ {
@ -114,6 +113,20 @@ BOOST_PARAMETER_NAME( (number_of_initial_points, tag) number_of_initial_points_)
BOOST_PARAMETER_NAME( (maximal_number_of_vertices, tag ) maximal_number_of_vertices_) BOOST_PARAMETER_NAME( (maximal_number_of_vertices, tag ) maximal_number_of_vertices_)
BOOST_PARAMETER_NAME( (pointer_to_error_code, tag ) pointer_to_error_code_) BOOST_PARAMETER_NAME( (pointer_to_error_code, tag ) pointer_to_error_code_)
// First used in <CGAL/Labeled_mesh_domain_3.h>
BOOST_PARAMETER_NAME( (function, tag ) function_)
BOOST_PARAMETER_NAME( (bounding_object, tag ) bounding_object_)
BOOST_PARAMETER_NAME( (relative_error_bound, tag ) relative_error_bound_)
BOOST_PARAMETER_NAME( (p_rng, tag ) p_rng_)
BOOST_PARAMETER_NAME( (null_subdomain_index, tag ) null_subdomain_index_)
BOOST_PARAMETER_NAME( (construct_surface_patch_index, tag ) construct_surface_patch_index_)
// First used in <CGAL/Gray_image_mesh_domain_3.h>
BOOST_PARAMETER_NAME( (image, tag ) image_)
BOOST_PARAMETER_NAME( (iso_value, tag) iso_value_)
BOOST_PARAMETER_NAME( (value_outside, tag) value_outside_)
BOOST_PARAMETER_NAME( (image_values_to_subdomain_indices, tag ) image_values_to_subdomain_indices_)
CGAL_PRAGMA_DIAG_POP CGAL_PRAGMA_DIAG_POP
} // parameters } // parameters
} // CGAL } // CGAL

View File

@ -98,6 +98,8 @@ create_single_source_cgal_program( "test_Face_filtered_graph.cpp" )
create_single_source_cgal_program( "test_Euler_operations.cpp" ) create_single_source_cgal_program( "test_Euler_operations.cpp" )
create_single_source_cgal_program( "test_Collapse_edge.cpp" )
create_single_source_cgal_program( "test_graph_traits.cpp" ) create_single_source_cgal_program( "test_graph_traits.cpp" )
create_single_source_cgal_program( "test_Properties.cpp" ) create_single_source_cgal_program( "test_Properties.cpp" )
@ -105,6 +107,7 @@ create_single_source_cgal_program( "test_Properties.cpp" )
if(OpenMesh_FOUND) if(OpenMesh_FOUND)
target_link_libraries( test_clear PRIVATE ${OPENMESH_LIBRARIES}) target_link_libraries( test_clear PRIVATE ${OPENMESH_LIBRARIES})
target_link_libraries( test_Euler_operations PRIVATE ${OPENMESH_LIBRARIES}) target_link_libraries( test_Euler_operations PRIVATE ${OPENMESH_LIBRARIES})
target_link_libraries( test_Collapse_edge PRIVATE ${OPENMESH_LIBRARIES})
target_link_libraries( test_Face_filtered_graph PRIVATE ${OPENMESH_LIBRARIES}) target_link_libraries( test_Face_filtered_graph PRIVATE ${OPENMESH_LIBRARIES})
target_link_libraries( test_graph_traits PRIVATE ${OPENMESH_LIBRARIES} ) target_link_libraries( test_graph_traits PRIVATE ${OPENMESH_LIBRARIES} )
target_link_libraries( test_Properties PRIVATE ${OPENMESH_LIBRARIES}) target_link_libraries( test_Properties PRIVATE ${OPENMESH_LIBRARIES})

View File

@ -0,0 +1,24 @@
OFF
10 10 0
-1.5 0 0
-0.5 0 0
0.5 0 0
1.5 0 0
-0.75 -0.5 0
0 -0.5 0
0.75 -0.5 0
-0.75 0.5 0
0 0.5 0
0.75 0.5 0
3 0 1 7
3 7 1 8
3 8 1 2
3 2 9 8
3 9 2 3
3 0 4 1
3 1 4 5
3 1 5 2
3 2 5 6
3 2 6 3

View File

@ -0,0 +1,226 @@
#include "test_Prefix.h"
#include <boost/range/distance.hpp>
#include <CGAL/boost/graph/Euler_operations.h>
template < typename Mesh>
typename boost::graph_traits<Mesh>::
halfedge_descriptor find_halfedge(double x1, double y1,
double x2, double y2,
Mesh& m,
bool is_border = false)
{
typedef typename boost::property_map<Mesh, CGAL::vertex_point_t>::type VPMAP;
typedef typename boost::property_traits<VPMAP>::value_type Point;
typedef typename boost::graph_traits<Mesh>::halfedge_descriptor halfedge_descriptor;
VPMAP vpmap = get(CGAL::vertex_point, m);
BOOST_FOREACH(halfedge_descriptor h, halfedges(m))
{
if(get(vpmap, source(h, m)) == Point(x1,y1,0)
&& get(vpmap, target(h, m)) == Point(x2,y2,0))
{
if(is_border == CGAL::is_border(h, m))
return h;
else
return opposite(h, m);
}
}
return boost::graph_traits<Mesh>::null_halfedge();
}
template <typename Mesh>
void
collapse_edge_test()
{
CGAL_GRAPH_TRAITS_MEMBERS(Mesh);
typedef typename boost::graph_traits<Mesh>:: vertex_descriptor vertex_descriptor;
typedef typename boost::graph_traits<Mesh>:: halfedge_descriptor halfedge_descriptor;
const std::string fname = "data/flat_hexahedron.off";
Mesh m;
if(!CGAL::read_off(fname, m)) {
std::cout << "Error reading file: " << fname << std::endl;
}
bool m_is_valid = CGAL::is_valid(m);
assert(m_is_valid);
Mesh test_mesh;
CGAL::copy_face_graph(m, test_mesh);
m_is_valid = CGAL::is_valid(m);
assert(m_is_valid);
//case 1: General Case.
{
halfedge_descriptor he = find_halfedge(-0.5,0,
0.5,0,
test_mesh);
halfedge_descriptor en = next(he, test_mesh);
halfedge_descriptor eno = opposite(en, test_mesh);
halfedge_descriptor eno_prime = opposite(next(opposite(he, test_mesh), test_mesh), test_mesh);
vertex_descriptor v1 = target(he, test_mesh);
bool ok = CGAL::Euler::collapse_edge(edge(he, test_mesh), test_mesh) == v1;
assert(ok);
char found = 0;
BOOST_FOREACH(halfedge_descriptor it, CGAL::halfedges_around_target(v1,test_mesh))
{
if(it == eno
|| it == eno_prime){
++found;
}
}
assert(found == 2);
CGAL::clear(test_mesh);
}
//case 2: collapsing edge is not itself a border, but is incident upon a border edge that is removed.
{
CGAL::copy_face_graph(m, test_mesh);
halfedge_descriptor he = find_halfedge(0,0.5,
-0.75,0.5,
test_mesh);
CGAL::Euler::remove_face(he, test_mesh);
he = find_halfedge(-0.5,0,
0.5,0,
test_mesh);
halfedge_descriptor en = next(he, test_mesh);
halfedge_descriptor eno = opposite(en, test_mesh);
halfedge_descriptor eno_prime = opposite(next(opposite(he, test_mesh), test_mesh), test_mesh);
vertex_descriptor v1 = target(he, test_mesh);
bool ok = CGAL::Euler::collapse_edge(edge(he, test_mesh), test_mesh) == v1;
assert(ok);
char found = 0;
BOOST_FOREACH(halfedge_descriptor it, CGAL::halfedges_around_target(v1,test_mesh))
{
if(it == eno
|| it == eno_prime){
++found;
}
}
assert(found == 2);
CGAL::clear(test_mesh);
}
//case 3: collapsing edge is not itself a border, but is incident upon a border edge that is not removed
{
CGAL::copy_face_graph(m, test_mesh);
halfedge_descriptor he = find_halfedge(1.5,0,
0.75,0.5,
test_mesh);
CGAL::Euler::remove_face(he, test_mesh);
he = find_halfedge(-0.5,0,
0.5,0,
test_mesh);
halfedge_descriptor en = next(he, test_mesh);
halfedge_descriptor eno = opposite(en, test_mesh);
halfedge_descriptor eno_prime = opposite(next(opposite(he, test_mesh), test_mesh), test_mesh);
vertex_descriptor v1 = target(he, test_mesh);
bool ok = CGAL::Euler::collapse_edge(edge(he, test_mesh), test_mesh) == v1;
assert(ok);
char found = 0;
BOOST_FOREACH(halfedge_descriptor it, CGAL::halfedges_around_target(v1,test_mesh))
{
if(it == eno
|| it == eno_prime){
++found;
}
}
assert(found == 2);
CGAL::clear(test_mesh);
}
//case 4: collapsing edge is itself a border
{
CGAL::copy_face_graph(m, test_mesh);
halfedge_descriptor he = find_halfedge(-0.5, 0,
0, -0.5,
test_mesh);
CGAL::Euler::remove_face(he, test_mesh);
he = find_halfedge(0, -0.5,
-0.5, 0,
test_mesh);
CGAL::Euler::remove_face(he, test_mesh);
he = find_halfedge(0, -0.5,
0.75, -0.5,
test_mesh);
CGAL::Euler::remove_face(he, test_mesh);
he = find_halfedge(-0.5,0,
0.5,0,
test_mesh);
halfedge_descriptor en = next(he, test_mesh);
halfedge_descriptor eno = opposite(en, test_mesh);
halfedge_descriptor ep_prime = prev(opposite(he, test_mesh), test_mesh);
halfedge_descriptor eno_prime = opposite(next(opposite(he, test_mesh), test_mesh), test_mesh);
vertex_descriptor v1 = target(he, test_mesh);
bool ok = CGAL::Euler::collapse_edge(edge(he, test_mesh), test_mesh) == v1;
assert(ok);
char found = 0;
BOOST_FOREACH(halfedge_descriptor it, CGAL::halfedges_around_target(v1,test_mesh))
{
if(it == eno
|| it == eno_prime
|| it == ep_prime){
++found;
}
}
assert(found == 3);
CGAL::clear(test_mesh);
}
//case 5 singular case.
{
CGAL::copy_face_graph(m, test_mesh);
halfedge_descriptor he = find_halfedge(0.75,0.5,
1.5,0,
test_mesh);
CGAL::Euler::remove_face(he, test_mesh);
he = find_halfedge(0.75,-0.5,
1.5,0,
test_mesh);
CGAL::Euler::remove_face(he, test_mesh);
he = find_halfedge(0,0.5,
0.5,0,
test_mesh);
CGAL::Euler::remove_face(he, test_mesh);
he = find_halfedge(0.5,0,
0,-0.5,
test_mesh);
CGAL::Euler::remove_face(he, test_mesh);
he = find_halfedge(-0.5,0,
0.5,0,
test_mesh);
CGAL::Euler::remove_face(he, test_mesh);
halfedge_descriptor ep = prev(he, test_mesh);
halfedge_descriptor eno_prime = opposite(next(opposite(he, test_mesh), test_mesh), test_mesh);
vertex_descriptor v1 = target(he, test_mesh);
bool ok = CGAL::Euler::collapse_edge(edge(he, test_mesh), test_mesh) == v1;
assert(ok);
char found = 0;
BOOST_FOREACH(halfedge_descriptor it, CGAL::halfedges_around_target(v1,test_mesh))
{
if(it == ep)
++found;
else if( it == eno_prime){
++found;
}
}
assert(found == 2);
CGAL::clear(test_mesh);
}
}
int main()
{
collapse_edge_test<Polyhedron>();
collapse_edge_test<SM>();
#ifdef CGAL_USE_OPENMESH
collapse_edge_test<OMesh>();
#endif
std::cerr << "done\n";
return 0;
}

View File

@ -380,7 +380,27 @@ does_satisfy_link_condition()
assert(CGAL::Euler::does_satisfy_link_condition(*edges(f.m).first,f.m)); assert(CGAL::Euler::does_satisfy_link_condition(*edges(f.m).first,f.m));
} }
template <typename Graph>
void
test_swap_edges()
{
typedef typename boost::graph_traits<Graph>::halfedge_descriptor halfedge_descriptor;
std::size_t nbh=12;
Kernel::Point_3 pt(0,0,0);
// test all possible pairs of halfedges
for (std::size_t i=0; i<nbh-1; ++i)
{
for(std::size_t j=i+1; j<nbh; ++j)
{
Graph g;
CGAL::make_tetrahedron(pt,pt,pt,pt,g);
halfedge_descriptor h1 = *CGAL::cpp11::next(boost::begin(halfedges(g)), i);
halfedge_descriptor h2 = *CGAL::cpp11::next(boost::begin(halfedges(g)), j);
CGAL::internal::swap_edges(h1, h2, g);
CGAL_assertion(CGAL::is_valid_polygon_mesh(g));
}
}
}
template <typename Graph> template <typename Graph>
void void
@ -400,6 +420,7 @@ test_Euler_operations()
remove_center_vertex_test<Graph>(); remove_center_vertex_test<Graph>();
join_split_inverse<Graph>(); join_split_inverse<Graph>();
does_satisfy_link_condition<Graph>(); does_satisfy_link_condition<Graph>();
test_swap_edges<Graph>();
} }
int main() int main()

View File

@ -61,6 +61,8 @@ public:
BigFloat(float i) : RCBigFloat(new BigFloatRep(i)) {} BigFloat(float i) : RCBigFloat(new BigFloatRep(i)) {}
/// constructor for <tt>int</tt> /// constructor for <tt>int</tt>
BigFloat(int i) : RCBigFloat(new BigFloatRep(i)) {} BigFloat(int i) : RCBigFloat(new BigFloatRep(i)) {}
/// constructor for <tt>unsigned int</tt>
BigFloat(unsigned int i) : RCBigFloat(new BigFloatRep(i)) {}
/// constructor for <tt>long</tt> /// constructor for <tt>long</tt>
BigFloat(long l) : RCBigFloat(new BigFloatRep(l)) {} BigFloat(long l) : RCBigFloat(new BigFloatRep(l)) {}
/// constructor for <tt>double</tt> /// constructor for <tt>double</tt>

View File

@ -71,6 +71,7 @@ public:
public: public:
// constructors // constructors
BigFloatRep(int=0); //inline BigFloatRep(int=0); //inline
BigFloatRep(unsigned int); //inline
BigFloatRep(short); //inline BigFloatRep(short); //inline
BigFloatRep(float); //inline BigFloatRep(float); //inline
BigFloatRep(long); //inline BigFloatRep(long); //inline
@ -249,6 +250,9 @@ inline BigFloatRep::BigFloatRep(float n)
inline BigFloatRep::BigFloatRep(int n) inline BigFloatRep::BigFloatRep(int n)
: m(n), err(0), exp(0) {} : m(n), err(0), exp(0) {}
inline BigFloatRep::BigFloatRep(unsigned int n)
: m(n), err(0), exp(0) {}
// Chee (8/8/04) -- introduced constructor from long // Chee (8/8/04) -- introduced constructor from long
inline BigFloatRep::BigFloatRep(long n) inline BigFloatRep::BigFloatRep(long n)
: m(n), err(0), exp(0) {} : m(n), err(0), exp(0) {}

View File

@ -55,7 +55,7 @@
#else // CGAL_HEADER_ONLY #else // CGAL_HEADER_ONLY
#define CGAL_GLOBAL_STATE_VAR(TYPE, NAME, VALUE) \ #define CGAL_GLOBAL_STATE_VAR(TYPE, NAME, VALUE) \
CGAL_EXPORT extern TYPE NAME; \ CGAL_CORE_EXPORT extern TYPE NAME; \
inline TYPE& get_static_##NAME() \ inline TYPE& get_static_##NAME() \
{ \ { \
return NAME; \ return NAME; \

View File

@ -56,7 +56,7 @@ int readINT8little(FILE *f, CGAL_INT8 *i)
rc = fgetc(f); rc = fgetc(f);
if (rc == EOF) if (rc == EOF)
return rc; return EOF;
*i = CGAL_INT8(rc & 0xff); *i = CGAL_INT8(rc & 0xff);
return 0; return 0;
@ -69,7 +69,7 @@ int readUINT8little(FILE *f, CGAL_UINT8 *i)
rc = fgetc(f); rc = fgetc(f);
if (rc == EOF) if (rc == EOF)
return rc; return EOF;
*i = CGAL_UINT8(rc & 0xff); *i = CGAL_UINT8(rc & 0xff);
return 0; return 0;
@ -91,7 +91,7 @@ int readINT16little(FILE *f, CGAL_INT16 *i)
rc = fgetc(f); rc = fgetc(f);
if (rc == EOF) if (rc == EOF)
return rc; return EOF;
temp = temp | CGAL_INT16((rc & 0xff) << 8); temp = temp | CGAL_INT16((rc & 0xff) << 8);
*i = temp; *i = temp;
@ -108,7 +108,7 @@ int readUINT16little(FILE *f, CGAL_UINT16 *i)
rc = fgetc(f); rc = fgetc(f);
if (rc == EOF) if (rc == EOF)
return rc; return EOF;
temp = CGAL_INT16(temp | ((rc & 0xff) << 8)); temp = CGAL_INT16(temp | ((rc & 0xff) << 8));
*i = temp; *i = temp;
@ -132,7 +132,7 @@ int readINT32little(FILE *f, CGAL_INT32 *i)
rc = fgetc(f); rc = fgetc(f);
if (rc == EOF) if (rc == EOF)
return rc; return EOF;
temp = CGAL_INT32(temp | (((long)rc & 0xff) << 24)); temp = CGAL_INT32(temp | (((long)rc & 0xff) << 24));
*i = temp; *i = temp;
@ -151,7 +151,7 @@ int readUINT32little(FILE *f, CGAL_UINT32 *i)
rc = fgetc(f); rc = fgetc(f);
if (rc == EOF) if (rc == EOF)
return rc; return EOF;
temp = CGAL_UINT32(temp | (((long)rc & 0xff) << 24)); temp = CGAL_UINT32(temp | (((long)rc & 0xff) << 24));
*i = temp; *i = temp;
@ -185,7 +185,7 @@ int writeINT16little(FILE *f, CGAL_INT16 i)
rc = fputc((i & 0xff), f); rc = fputc((i & 0xff), f);
if (rc == EOF) if (rc == EOF)
return rc; return EOF;
return fputc(((i >> 8) & 0xff), f); return fputc(((i >> 8) & 0xff), f);
} }
@ -197,7 +197,7 @@ int writeUINT16little(FILE *f, CGAL_UINT16 i)
rc = fputc((i & 0xff), f); rc = fputc((i & 0xff), f);
if (rc == EOF) if (rc == EOF)
return rc; return EOF;
return fputc(((i >> 8) & 0xff), f); return fputc(((i >> 8) & 0xff), f);
} }
@ -209,15 +209,15 @@ int writeINT32little(FILE *f, CGAL_INT32 i)
rc = fputc((i & 0xff), f); rc = fputc((i & 0xff), f);
if (rc == EOF) if (rc == EOF)
return rc; return EOF;
rc = fputc(((i >> 8) & 0xff), f); rc = fputc(((i >> 8) & 0xff), f);
if (rc == EOF) if (rc == EOF)
return rc; return EOF;
rc = fputc(((i >> 16) & 0xff), f); rc = fputc(((i >> 16) & 0xff), f);
if (rc == EOF) if (rc == EOF)
return rc; return EOF;
return fputc(((i >> 24) & 0xff), f); return fputc(((i >> 24) & 0xff), f);
} }
@ -230,15 +230,15 @@ int writeUINT32little(FILE *f, CGAL_UINT32 i)
rc = fputc((i & 0xff), f); rc = fputc((i & 0xff), f);
if (rc == EOF) if (rc == EOF)
return rc; return EOF;
rc = fputc(((i >> 8) & 0xff), f); rc = fputc(((i >> 8) & 0xff), f);
if (rc == EOF) if (rc == EOF)
return rc; return EOF;
rc = fputc(((i >> 16) & 0xff), f); rc = fputc(((i >> 16) & 0xff), f);
if (rc == EOF) if (rc == EOF)
return rc; return EOF;
return fputc(((i >> 24) & 0xff), f); return fputc(((i >> 24) & 0xff), f);
} }

View File

@ -503,7 +503,7 @@ Image_3::labellized_trilinear_interpolation
static_cast<unsigned int>(lc)); static_cast<unsigned int>(lc));
if(lc == 1) { if(lc == 1) {
return labels[0]; return static_cast<Target_type>(labels[0]);
} }
double best_value = 0.; double best_value = 0.;
@ -521,7 +521,7 @@ Image_3::labellized_trilinear_interpolation
} }
} }
// CGAL_assertion(best_value > 0.5); // CGAL_assertion(best_value > 0.5);
return best; return static_cast<Target_type>(best);
} }
} // end namespace CGAL } // end namespace CGAL

View File

@ -3,13 +3,33 @@ message( "== CMake setup ==" )
project(CGAL CXX C) project(CGAL CXX C)
# Minimal version of CMake: # Minimal version of CMake:
cmake_minimum_required(VERSION 2.8.11) cmake_minimum_required(VERSION 3.1)
set( CGAL_BRANCH_BUILD ON CACHE INTERNAL "Create CGAL from a Git branch" FORCE) set( CGAL_BRANCH_BUILD ON CACHE INTERNAL "Create CGAL from a Git branch" FORCE)
include(${CMAKE_SOURCE_DIR}/Installation/cmake/modules/CGAL_SCM.cmake) include(${CMAKE_SOURCE_DIR}/Installation/cmake/modules/CGAL_SCM.cmake)
CGAL_detect_git(${CMAKE_SOURCE_DIR}) CGAL_detect_git(${CMAKE_SOURCE_DIR})
function(CGAL_error_if_detect_in_source_build)
# If in a Git repository, forbid in-source builds
get_filename_component(srcdir "${CMAKE_SOURCE_DIR}" REALPATH)
get_filename_component(bindir "${CMAKE_BINARY_DIR}" REALPATH)
if("${srcdir}" STREQUAL "${bindir}")
message(FATAL_ERROR [=[
############
Since CGAL-4.12.1, you can no longer configure an in-source build in a Git
repository. See this StackOverlow question and answers for a way to create
a separate build directory:
https://stackoverflow.com/q/45518317/1728537
############
]=])
endif()
endfunction()
if ( "${CGAL_SCM_NAME}" STREQUAL "git" )
CGAL_error_if_detect_in_source_build()
endif()
# add option for duplicate file detection # add option for duplicate file detection
option( CGAL_REPORT_DUPLICATE_FILES "Switch on to start (naive) detection of duplicate source- and headerfiles in packages" OFF) option( CGAL_REPORT_DUPLICATE_FILES "Switch on to start (naive) detection of duplicate source- and headerfiles in packages" OFF)

View File

@ -32,6 +32,7 @@
// provided you give a NT converter from A to B. // provided you give a NT converter from A to B.
// There's a Homogeneous counterpart. // There's a Homogeneous counterpart.
#include <CGAL/Cartesian_converter_fwd.h>
#include <CGAL/basic.h> #include <CGAL/basic.h>
#include <CGAL/NT_converter.h> #include <CGAL/NT_converter.h>
#include <CGAL/Enum_converter.h> #include <CGAL/Enum_converter.h>
@ -91,7 +92,7 @@ struct Converting_visitor : boost::static_visitor<> {
template < class K1, class K2, template < class K1, class K2,
// class Converter = NT_converter<typename K1::FT, typename K2::FT> > // class Converter = NT_converter<typename K1::FT, typename K2::FT> >
class Converter = typename internal::Default_converter<K1, K2>::Type > class Converter>
class Cartesian_converter : public Enum_converter class Cartesian_converter : public Enum_converter
{ {
typedef Enum_converter Base; typedef Enum_converter Base;

View File

@ -1250,7 +1250,7 @@ namespace CGAL {
/** Test if the map is valid. /** Test if the map is valid.
* @return true iff the map is valid. * @return true iff the map is valid.
*/ */
bool is_valid() const bool is_valid(bool show_errors=true) const
{ {
bool valid = true; bool valid = true;
unsigned int i = 0, j = 0; unsigned int i = 0, j = 0;
@ -1276,9 +1276,11 @@ namespace CGAL {
if ((!is_free(it, 0) && beta(it, 0, 1)!=it) || if ((!is_free(it, 0) && beta(it, 0, 1)!=it) ||
(!is_free(it, 1) && beta(it, 1, 0)!=it )) (!is_free(it, 1) && beta(it, 1, 0)!=it ))
{ {
std::cerr << "Map not valid: beta(0) " if (show_errors)
"is not the inverse of beta(1) for dart " { std::cerr << "Map not valid: beta(0) "
<<darts().index(it) << std::endl; "is not the inverse of beta(1) for dart "
<<darts().index(it) << std::endl;
}
valid = false; valid = false;
} }
@ -1286,9 +1288,11 @@ namespace CGAL {
for ( i = 2; i <= dimension; ++i) for ( i = 2; i <= dimension; ++i)
if (!is_free(it, i) && beta(it, i, i)!=it) if (!is_free(it, i) && beta(it, i, i)!=it)
{ {
std::cerr << "Map not valid: beta(" << i if (show_errors)
<< ") is not an involution for dart " { std::cerr << "Map not valid: beta(" << i
<<darts().index(it)<< std::endl; << ") is not an involution for dart "
<<darts().index(it)<< std::endl;
}
valid = false; valid = false;
} }
@ -1299,9 +1303,12 @@ namespace CGAL {
if ((is_free(it, i) != is_free(beta(it, 0), i)) || if ((is_free(it, i) != is_free(beta(it, 0), i)) ||
(!is_free(it, i) && beta(it, 0, i)!=beta(it, i, 1))) (!is_free(it, i) && beta(it, 0, i)!=beta(it, i, 1)))
{ {
std::cerr << "Map not valid: beta(0) o beta(" << i if (show_errors)
<< ") is not an involution for dart " {
<<darts().index(it)<< std::endl; std::cerr << "Map not valid: beta(0) o beta(" << i
<< ") is not an involution for dart "
<<darts().index(it)<< std::endl;
}
valid = false; valid = false;
} }
} }
@ -1311,9 +1318,12 @@ namespace CGAL {
if ((is_free(it, i) != is_free(beta(it, 1), i)) || if ((is_free(it, i) != is_free(beta(it, 1), i)) ||
(!is_free(it, i) && beta(it, 1, i)!=beta(it, i, 0))) (!is_free(it, i) && beta(it, 1, i)!=beta(it, i, 0)))
{ {
std::cerr << "Map not valid: beta(1) o beta(" << i if (show_errors)
<< ") is not an involution for dart " {
<<darts().index(it)<< std::endl; std::cerr << "Map not valid: beta(1) o beta(" << i
<< ") is not an involution for dart "
<<darts().index(it)<< std::endl;
}
valid = false; valid = false;
} }
} }
@ -1327,10 +1337,13 @@ namespace CGAL {
if ((is_free(it, j)!=is_free(beta(it, i), j)) || if ((is_free(it, j)!=is_free(beta(it, i), j)) ||
(!is_free(it, j) && beta(it, i, j)!=beta(it, j, i))) (!is_free(it, j) && beta(it, i, j)!=beta(it, j, i)))
{ {
std::cerr << "Map not valid: beta(" << i if (show_errors)
<< ") o beta(" << j {
<< ") is not an involution for dart " std::cerr << "Map not valid: beta(" << i
<< darts().index(it)<< std::endl; << ") o beta(" << j
<< ") is not an involution for dart "
<< darts().index(it)<< std::endl;
}
valid = false; valid = false;
} }
} }

View File

@ -329,7 +329,7 @@ struct Correct_invalid_attributes_functor
unsigned int nb=0; unsigned int nb=0;
bool found_dart = false; bool found_dart = false;
for ( CGAL::CMap_dart_iterator_basic_of_cell<CMap,i> for ( typename CMap::template Dart_of_cell_basic_range<i>::iterator
it(amap, adart, amark); it.cont(); ++it, ++nb ) it(amap, adart, amark); it.cont(); ++it, ++nb )
{ {
if ( a!=amap.template attribute<i>(it) ) if ( a!=amap.template attribute<i>(it) )

View File

@ -15,6 +15,11 @@ class DefaultConstructible {};
/// See http://en.cppreference.com/w/cpp/concept/CopyConstructible /// See http://en.cppreference.com/w/cpp/concept/CopyConstructible
class CopyConstructible {}; class CopyConstructible {};
/// \cgalConcept
/// Concept from the \cpp standard.
/// See http://en.cppreference.com/w/cpp/concept/Callable
class Callable {};
/// \cgalConcept /// \cgalConcept
/// Concept from the \cpp standard. /// Concept from the \cpp standard.
/// See http://en.cppreference.com/w/cpp/concept/EqualityComparable /// See http://en.cppreference.com/w/cpp/concept/EqualityComparable

View File

@ -18,13 +18,13 @@ make # build the \cgal libraries
Compiling an example or a demo shipped with \cgal is similarly simple: Compiling an example or a demo shipped with \cgal is similarly simple:
<PRE> <PRE>
cd examples/Straight_skeleton_2 # go to an example directory cd examples/Triangulation_2 # go to an example directory
cmake -DCGAL_DIR=$HOME/CGAL-\cgalReleaseNumber . # configure the examples cmake -DCGAL_DIR=$HOME/CGAL-\cgalReleaseNumber . # configure the examples
make # build the examples make # build the examples
</PRE> </PRE>
<PRE> <PRE>
cd demo/Straight_skeleton_2 # go to a demo directory cd demo/Triangulation_2 # go to a demo directory
cmake -DCGAL_DIR=$HOME/CGAL-\cgalReleaseNumber . # configure the demos cmake -DCGAL_DIR=$HOME/CGAL-\cgalReleaseNumber . # configure the demos
make # build the demos make # build the demos
</PRE> </PRE>
@ -551,14 +551,6 @@ and the \ref PkgRidges_3 packages.
The \sc{Eigen} web site is <A HREF="http://eigen.tuxfamily.org">`http://eigen.tuxfamily.org`</A>. The \sc{Eigen} web site is <A HREF="http://eigen.tuxfamily.org">`http://eigen.tuxfamily.org`</A>.
\subsection thirdpartylibQGLViewer libQGLViewer
libQGLViewer is a 3D widget based on \sc{Qt} 4's `QGLWidget`. In case of \sc{Qt}5 used, libQGLViewer needs to be recompiled with the proper \sc{Qt}5 version.
In \cgal some 3D demos are based on libQGLViewer.
It can be downloaded from <A HREF="http://www.libqglviewer.com/">`http://www.libqglviewer.com/`</A>.
\subsection thirdpartyESBTL ESBTL \subsection thirdpartyESBTL ESBTL
The \sc{Esbtl} (Easy Structural Biology Template Library) is a library that allows The \sc{Esbtl} (Easy Structural Biology Template Library) is a library that allows
@ -673,9 +665,6 @@ make examples
# build all demos at once # build all demos at once
make demos make demos
# build only the Straight Skeleton demo
make Straight_skeleton_2_demo
</PRE> </PRE>
\cgalAdvancedBegin \cgalAdvancedBegin
@ -757,7 +746,7 @@ Ideally, configuring and compiling a demo/example/program amounts to
<PRE> <PRE>
cd CGAL-\cgalReleaseNumber/examples/Straight_skeleton_2 cd CGAL-\cgalReleaseNumber/examples/Triangulation_2
cmake -DCGAL_DIR=$HOME/CGAL-\cgalReleaseNumber . cmake -DCGAL_DIR=$HOME/CGAL-\cgalReleaseNumber .
make make
@ -893,7 +882,7 @@ controlling variable right up front:
<PRE> <PRE>
cd CGAL-\cgalReleaseNumber cd CGAL-\cgalReleaseNumber
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=-g . cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=-g .
cd CGAL-\cgalReleaseNumber/examples/Straight_skeleton_2 cd CGAL-\cgalReleaseNumber/examples/Triangulation_2
cmake -DCGAL_DIR=CGAL-\cgalReleaseNumber -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS=-O2 -DCGAL_DONT_OVERRIDE_CMAKE_FLAGS=TRUE . cmake -DCGAL_DIR=CGAL-\cgalReleaseNumber -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS=-O2 -DCGAL_DONT_OVERRIDE_CMAKE_FLAGS=TRUE .
</PRE> </PRE>
\cgalAdvancedEnd \cgalAdvancedEnd
@ -1172,22 +1161,6 @@ Only the <I>directory</I> containing the header files of \sc{Eigen} 3.1 (or grea
| `EIGEN3_INCLUDE_DIR` | Directory containing the file `signature_of_eigen3_matrix_library` | CMake | | `EIGEN3_INCLUDE_DIR` | Directory containing the file `signature_of_eigen3_matrix_library` | CMake |
| `EIGEN3_INC_DIR` | Idem | Environment | | `EIGEN3_INC_DIR` | Idem | Environment |
\subsection installation_qgl QGLViewer Library
Some demos require the GLViewer library.
In most cases, if QGLViewer is not automatically found, setting the `QGLVIEWERROOT`
environment variable is sufficient. If it is not, you can specify the directory containing
the header files and the full pathnames of the release and debug libraries
| Variable | Description | Type |
| :- | :- | :- |
| `QGLVIEWERROOT` | Root directory of the QGLViewer library | Environment |
| `QGLVIEWER_INCLUDE_DIR` | Directory containing the `QGLViewer/qglviewer.h` file | CMake |
| `QGLVIEWER_LIBRARY_RELEASE` | Full pathname to a release build of the QGLViewer library | CMake |
| `QGLVIEWER_LIBRARY_DEBUG` | Full pathname to a debug build of the QGLViewer library | CMake |
\subsection installation_esbtl ESBTL Library \subsection installation_esbtl ESBTL Library
One skin surface example requires the \sc{Esbtl} library in order to read \sc{Pdb} files. One skin surface example requires the \sc{Esbtl} library in order to read \sc{Pdb} files.

View File

@ -1571,7 +1571,7 @@ MATHJAX_FORMAT = HTML-CSS
# The default value is: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2. # The default value is: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2.
# This tag requires that the tag USE_MATHJAX is set to YES. # This tag requires that the tag USE_MATHJAX is set to YES.
${CGAL_DOC_MATHJAX_LOCATION_FULL_OPTION_LINE} MATHJAX_RELPATH = ${CGAL_DOC_MATHJAX_LOCATION}
# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax # The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
# extension names that should be enabled during MathJax rendering. For example # extension names that should be enabled during MathJax rendering. For example

View File

@ -23,7 +23,7 @@
#define CGAL_EPIC_CONVERTER_H #define CGAL_EPIC_CONVERTER_H
#include <CGAL/basic.h> #include <CGAL/config.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
namespace CGAL { namespace CGAL {
@ -54,6 +54,8 @@ class Epic_converter {
typedef typename Exact_predicates_inexact_constructions_kernel::Sphere_3 Sphere_3; typedef typename Exact_predicates_inexact_constructions_kernel::Sphere_3 Sphere_3;
typedef typename Exact_predicates_inexact_constructions_kernel::Circle_3 Circle_3; typedef typename Exact_predicates_inexact_constructions_kernel::Circle_3 Circle_3;
typedef typename Exact_predicates_inexact_constructions_kernel::Iso_cuboid_3 Iso_cuboid_3; typedef typename Exact_predicates_inexact_constructions_kernel::Iso_cuboid_3 Iso_cuboid_3;
typedef typename IK::FT IK_FT;
public: public:
@ -61,6 +63,7 @@ public:
std::pair<double,bool> operator()(const typename IK::FT n) const std::pair<double,bool> operator()(const typename IK::FT n) const
{ {
double d; double d;
internal::init_double(d, (IK_FT*)(0));
if(fit_in_double(n,d)){ if(fit_in_double(n,d)){
return std::make_pair(d,true); return std::make_pair(d,true);
} }
@ -80,6 +83,7 @@ public:
std::pair<Point_2,bool> operator()(const typename IK::Point_2& p) const std::pair<Point_2,bool> operator()(const typename IK::Point_2& p) const
{ {
double x, y; double x, y;
internal::init_double(x, y, (IK_FT*)(0));
if(fit_in_double(p.x(),x) && fit_in_double(p.y(),y)){ if(fit_in_double(p.x(),x) && fit_in_double(p.y(),y)){
return std::make_pair(Point_2(x,y),true); return std::make_pair(Point_2(x,y),true);
} }
@ -89,6 +93,7 @@ public:
std::pair<Vector_2,bool> operator()(const typename IK::Vector_2& v) const std::pair<Vector_2,bool> operator()(const typename IK::Vector_2& v) const
{ {
double x, y; double x, y;
internal::init_double(x, y, (IK_FT*)(0));
if(fit_in_double(v.x(),x) && fit_in_double(v.y(),y)){ if(fit_in_double(v.x(),x) && fit_in_double(v.y(),y)){
return std::make_pair(Vector_2(x,y),true); return std::make_pair(Vector_2(x,y),true);
} }
@ -98,6 +103,7 @@ public:
std::pair<Direction_2,bool> operator()(const typename IK::Direction_2& d) const std::pair<Direction_2,bool> operator()(const typename IK::Direction_2& d) const
{ {
double x, y; double x, y;
internal::init_double(x, y, (IK_FT*)(0));
if(fit_in_double(d.dx(),x) && fit_in_double(d.dy(),y)){ if(fit_in_double(d.dx(),x) && fit_in_double(d.dy(),y)){
return std::make_pair(Direction_2(x,y),true); return std::make_pair(Direction_2(x,y),true);
} }
@ -266,6 +272,7 @@ public:
std::pair<Point_3,bool> operator()(const typename IK::Point_3& p) const std::pair<Point_3,bool> operator()(const typename IK::Point_3& p) const
{ {
double x, y, z; double x, y, z;
internal::init_double(x, y, z, (IK_FT*)(0));
if(fit_in_double(p.x(),x) && fit_in_double(p.y(),y) && fit_in_double(p.z(),z)){ if(fit_in_double(p.x(),x) && fit_in_double(p.y(),y) && fit_in_double(p.z(),z)){
return std::make_pair(Point_3(x,y,z),true); return std::make_pair(Point_3(x,y,z),true);
} }
@ -275,6 +282,7 @@ public:
std::pair<Vector_3,bool> operator()(const typename IK::Vector_3& v) const std::pair<Vector_3,bool> operator()(const typename IK::Vector_3& v) const
{ {
double x, y, z; double x, y, z;
internal::init_double(x, y, z, (IK_FT*)(0));
if(fit_in_double(v.x(),x) && fit_in_double(v.y(),y) && fit_in_double(v.z(),z)){ if(fit_in_double(v.x(),x) && fit_in_double(v.y(),y) && fit_in_double(v.z(),z)){
return std::make_pair(Vector_3(x,y,z),true); return std::make_pair(Vector_3(x,y,z),true);
} }
@ -284,6 +292,7 @@ public:
std::pair<Direction_3,bool> operator()(const typename IK::Direction_3& d) const std::pair<Direction_3,bool> operator()(const typename IK::Direction_3& d) const
{ {
double x, y, z; double x, y, z;
internal::init_double(x, y, z, (IK_FT*)(0));
if(fit_in_double(d.dx(),x) && fit_in_double(d.dy(),y) && fit_in_double(d.dz(),z)){ if(fit_in_double(d.dx(),x) && fit_in_double(d.dy(),y) && fit_in_double(d.dz(),z)){
return std::make_pair(Direction_3(x,y,z),true); return std::make_pair(Direction_3(x,y,z),true);
} }

View File

@ -55,6 +55,12 @@
namespace CGAL { namespace CGAL {
template <class E,
class A,
class E2A,
class K>
class Lazy_kernel_base;
template <typename AT, typename ET, typename EFT, typename E2A> class Lazy; template <typename AT, typename ET, typename EFT, typename E2A> class Lazy;
template <typename ET_> template <typename ET_>
@ -425,13 +431,19 @@ class Lazy_rep_##n :public Lazy_rep< AT, \
E2A >, \ E2A >, \
private EC \ private EC \
{ \ { \
\
template <class Ei, \
class Ai, \
class E2Ai,\
class Ki> \
friend class Lazy_kernel_base; \
BOOST_PP_REPEAT(n, CGAL_MLIST, _) \ BOOST_PP_REPEAT(n, CGAL_MLIST, _) \
const EC& ec() const { return *this; } \ const EC& ec() const { return *this; } \
public: \ public: \
void update_exact() const { \ void update_exact() const { \
this->et = new ET(ec()( BOOST_PP_ENUM(n, CGAL_LEXACT, _) ) ); \ this->et = new ET(ec()( BOOST_PP_ENUM(n, CGAL_LEXACT, _) ) ); \
this->at = E2A()(*(this->et)); \ this->at = E2A()(*(this->et)); \
BOOST_PP_REPEAT(n, CGAL_PRUNE_TREE, _) \ BOOST_PP_REPEAT(n, CGAL_PRUNE_TREE, _) \
} \ } \
Lazy_rep_##n(const AC& ac, const EC&, BOOST_PP_ENUM(n, CGAL_LARGS, _)) \ Lazy_rep_##n(const AC& ac, const EC&, BOOST_PP_ENUM(n, CGAL_LARGS, _)) \
: Lazy_rep<AT, ET, E2A>(ac( BOOST_PP_ENUM(n, CGAL_LN, CGAL::approx) )), BOOST_PP_ENUM(n, CGAL_LINIT, _) \ : Lazy_rep<AT, ET, E2A>(ac( BOOST_PP_ENUM(n, CGAL_LN, CGAL::approx) )), BOOST_PP_ENUM(n, CGAL_LINIT, _) \
@ -714,6 +726,17 @@ public:
template <typename AT_, typename ET_, typename EFT, typename E2A> template <typename AT_, typename ET_, typename EFT, typename E2A>
class Lazy : public Handle class Lazy : public Handle
{ {
template <class Exact_kernel_,
class Approximate_kernel_,
class E2A_>
friend struct Lazy_kernel;
template <class E_,
class A_,
class E2A_,
class K_>
friend class Lazy_kernel_base;
public : public :
typedef Lazy<AT_, ET_, EFT, E2A> Self; typedef Lazy<AT_, ET_, EFT, E2A> Self;
@ -784,7 +807,7 @@ public :
ptr()->print_dag(os, level); ptr()->print_dag(os, level);
} }
private: private:
// We have a static variable for optimizing the default constructor, // We have a static variable for optimizing the default constructor,
// which is in particular heavily used for pruning DAGs. // which is in particular heavily used for pruning DAGs.

View File

@ -304,6 +304,7 @@ public:
typedef EK_ Exact_kernel; typedef EK_ Exact_kernel;
typedef E2A_ E2A; typedef E2A_ E2A;
typedef Lazy_kernel_generic_base<EK_, AK_, E2A_, Kernel_> BaseClass;
template < typename Kernel2 > template < typename Kernel2 >
struct Base { typedef Lazy_kernel_base<Exact_kernel, Approximate_kernel, E2A, Kernel2> Type; }; struct Base { typedef Lazy_kernel_base<Exact_kernel, Approximate_kernel, E2A, Kernel2> Type; };
@ -320,6 +321,213 @@ public:
// typedef void Compute_z_3; // to detect where .z() is called // typedef void Compute_z_3; // to detect where .z() is called
// typedef void Construct_point_3; // to detect where the ctor is called // typedef void Construct_point_3; // to detect where the ctor is called
struct Compute_weight_2 : public BaseClass::Compute_weight_2
{
typedef typename Kernel_::FT FT;
typedef typename Kernel_::Point_2 Point_2;
typedef typename Kernel_::Weighted_point_2 Weighted_point_2;
FT operator()(const Weighted_point_2& p) const
{
typedef Lazy_rep_3<typename Approximate_kernel::Weighted_point_2,
typename Exact_kernel::Weighted_point_2,
typename Approximate_kernel::Construct_weighted_point_2,
typename Exact_kernel::Construct_weighted_point_2,
E2A_,
Return_base_tag,
Point_2,
FT
> LR;
LR * lr = dynamic_cast<LR*>(p.ptr());
if(lr && (! lr->et)){
return lr->l2;
}
return BaseClass().compute_weight_2_object()(p);
}
};
struct Compute_weight_3 : public BaseClass::Compute_weight_3
{
typedef typename Kernel_::FT FT;
typedef typename Kernel_::Point_3 Point_3;
typedef typename Kernel_::Weighted_point_3 Weighted_point_3;
FT operator()(const Weighted_point_3& p) const
{
typedef Lazy_rep_3<typename Approximate_kernel::Weighted_point_3,
typename Exact_kernel::Weighted_point_3,
typename Approximate_kernel::Construct_weighted_point_3,
typename Exact_kernel::Construct_weighted_point_3,
E2A_,
Return_base_tag,
Point_3,
FT
> LR;
LR * lr = dynamic_cast<LR*>(p.ptr());
if(lr && (! lr->et)){
return lr->l2;
}
return BaseClass().compute_weight_3_object()(p);
}
};
struct Construct_point_2 : public BaseClass::Construct_point_2
{
typedef typename Kernel_::FT FT;
typedef typename Kernel_::Point_2 Point_2;
typedef typename Kernel_::Weighted_point_2 Weighted_point_2;
#ifndef CGAL_CFG_MATCHING_BUG_6
using BaseClass::Construct_point_2::operator();
#else // CGAL_CFG_MATCHING_BUG_6
template <class ... T>
Point_2 operator()(const T& ...t) const
{
return BaseClass().construct_point_2_object()(t...);
}
#endif // CGAL_CFG_MATCHING_BUG_6
const Point_2& operator()(const Point_2& p) const
{
return p;
}
Point_2 operator()(const Weighted_point_2& p) const
{
typedef Lazy_rep_3<typename Approximate_kernel::Weighted_point_2,
typename Exact_kernel::Weighted_point_2,
typename Approximate_kernel::Construct_weighted_point_2,
typename Exact_kernel::Construct_weighted_point_2,
E2A_,
Return_base_tag,
Point_2,
FT
> LR;
typedef Lazy_rep_3<typename Approximate_kernel::Weighted_point_2,
typename Exact_kernel::Weighted_point_2,
typename Approximate_kernel::Construct_weighted_point_2,
typename Exact_kernel::Construct_weighted_point_2,
E2A_,
Return_base_tag,
Point_2,
int
> LRint;
LR * lr = dynamic_cast<LR*>(p.ptr());
if(lr && (! lr->et)){
return lr->l1;
} else {
LRint* lrint = dynamic_cast<LRint*>(p.ptr());
if(lrint && (! lrint->et)){
return lrint->l1;
}
}
return BaseClass().construct_point_2_object()(p);
}
};
struct Construct_point_3 : public BaseClass::Construct_point_3
{
typedef typename Kernel_::FT FT;
typedef typename Kernel_::Point_3 Point_3;
typedef typename Kernel_::Weighted_point_3 Weighted_point_3;
#ifndef CGAL_CFG_MATCHING_BUG_6
using BaseClass::Construct_point_3::operator();
#else // CGAL_CFG_MATCHING_BUG_6
template <class ... T>
Point_3 operator()(const T& ...t) const
{
return BaseClass().construct_point_3_object()(t...);
}
#endif // CGAL_CFG_MATCHING_BUG_6
const Point_3& operator()(const Point_3& p) const
{
return p;
}
Point_3 operator()(const Weighted_point_3& p) const
{
typedef Lazy_rep_3<typename Approximate_kernel::Weighted_point_3,
typename Exact_kernel::Weighted_point_3,
typename Approximate_kernel::Construct_weighted_point_3,
typename Exact_kernel::Construct_weighted_point_3,
E2A_,
Return_base_tag,
Point_3,
FT
> LR;
typedef Lazy_rep_3<typename Approximate_kernel::Weighted_point_3,
typename Exact_kernel::Weighted_point_3,
typename Approximate_kernel::Construct_weighted_point_3,
typename Exact_kernel::Construct_weighted_point_3,
E2A_,
Return_base_tag,
Point_3,
int
> LRint;
LR * lr = dynamic_cast<LR*>(p.ptr());
if(lr && (! lr->et)){
return lr->l1;
}else{
LRint* lrint = dynamic_cast<LRint*>(p.ptr());
if(lrint && (! lrint->et)){
return lrint->l1;
}
}
return BaseClass().construct_point_3_object()(p);
}
};
Construct_point_2 construct_point_2_object() const
{
return Construct_point_2();
}
Construct_point_3 construct_point_3_object() const
{
return Construct_point_3();
}
Compute_weight_2 compute_weight_2_object() const
{
return Compute_weight_2();
}
Compute_weight_3 compute_weight_3_object() const
{
return Compute_weight_3();
}
Assign_2 Assign_2
assign_2_object() const assign_2_object() const
{ return Assign_2(); } { return Assign_2(); }

View File

@ -31,6 +31,9 @@ namespace CGAL {
template < typename ET > template < typename ET >
class Lazy_exact_nt; class Lazy_exact_nt;
template <bool Protected>
class Interval_nt;
namespace internal { namespace internal {
// Utility function to check a posteriori that a subtraction was performed // Utility function to check a posteriori that a subtraction was performed
@ -152,6 +155,66 @@ template < typename ET >
inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, double& d5, double& d6, double& d7, double&d8, double& d9, double& d10, double& d11, double& d12, double& d13, double& d14, Lazy_exact_nt<ET>* ) inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, double& d5, double& d6, double& d7, double&d8, double& d9, double& d10, double& d11, double& d12, double& d13, double& d14, Lazy_exact_nt<ET>* )
{d0 = d1 = d2 = d3 = d4 = d5 = d6 = d7 = d8 = d9 = d10 = d11 = d12 = d13 = d14 = 0;} {d0 = d1 = d2 = d3 = d4 = d5 = d6 = d7 = d8 = d9 = d10 = d11 = d12 = d13 = d14 = 0;}
template < bool P >
inline void init_double(double& d0, Interval_nt<P>* )
{d0 = 0;}
template < bool P >
inline void init_double(double& d0, double& d1, Interval_nt<P>* )
{d0 = d1 = 0;}
template < bool P >
inline void init_double(double& d0, double& d1, double& d2, Interval_nt<P>* )
{d0 = d1 = d2 = 0;}
template < bool P >
inline void init_double(double& d0, double& d1, double& d2, double& d3, Interval_nt<P>* )
{d0 = d1 = d2 = d3 = 0;}
template < bool P >
inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, Interval_nt<P>* )
{d0 = d1 = d2 = d3 = d4 = 0;}
template < bool P >
inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, double& d5, Interval_nt<P>* )
{d0 = d1 = d2 = d3 = d4 = d5 = 0;}
template < bool P >
inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, double& d5, double& d6, Interval_nt<P>* )
{d0 = d1 = d2 = d3 = d4 = d5 = d6 = 0;}
template < bool P >
inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, double& d5, double& d6, double& d7, Interval_nt<P>* )
{d0 = d1 = d2 = d3 = d4 = d5 = d6 = d7 = 0;}
template < bool P >
inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, double& d5, double& d6, double& d7, double& d8, Interval_nt<P>* )
{d0 = d1 = d2 = d3 = d4 = d5 = d6 = d7 = d8 = 0;}
template < bool P >
inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, double& d5, double& d6, double& d7, double&d8, double& d9, Interval_nt<P>* )
{d0 = d1 = d2 = d3 = d4 = d5 = d6 = d7 = d8 = d9 = 0;}
template < bool P >
inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, double& d5, double& d6, double& d7, double&d8, double& d9, double& d10, Interval_nt<P>* )
{d0 = d1 = d2 = d3 = d4 = d5 = d6 = d7 = d8 = d9 = d10 = 0;}
template < bool P >
inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, double& d5, double& d6, double& d7, double&d8, double& d9, double& d10, double& d11, Interval_nt<P>* )
{d0 = d1 = d2 = d3 = d4 = d5 = d6 = d7 = d8 = d9 = d10 = d11 = 0;}
template < bool P >
inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, double& d5, double& d6, double& d7, double&d8, double& d9, double& d10, double& d11, double& d12, Interval_nt<P>* )
{d0 = d1 = d2 = d3 = d4 = d5 = d6 = d7 = d8 = d9 = d10 = d11 = d12 = 0;}
template < bool P >
inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, double& d5, double& d6, double& d7, double&d8, double& d9, double& d10, double& d11, double& d12, double& d13, Interval_nt<P>* )
{d0 = d1 = d2 = d3 = d4 = d5 = d6 = d7 = d8 = d9 = d10 = d11 = d12 = d13 = 0;}
template < bool P >
inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, double& d5, double& d6, double& d7, double&d8, double& d9, double& d10, double& d11, double& d12, double& d13, double& d14, Interval_nt<P>* )
{d0 = d1 = d2 = d3 = d4 = d5 = d6 = d7 = d8 = d9 = d10 = d11 = d12 = d13 = d14 = 0;}
// Auxiliary function to check if static filters can be applied, that is, // Auxiliary function to check if static filters can be applied, that is,
// if to_double() does not add roundoff errors. // if to_double() does not add roundoff errors.

View File

@ -0,0 +1,800 @@
// Copyright (c) 2018 GeometryFactory Sarl (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
// SPDX-License-Identifier: GPL-3.0+
//
//
// Author(s) : Guillaume Damiand <guillaume.damiand@liris.cnrs.fr>
#ifndef CGAL_VBO_BUFFER_FILLER_H
#define CGAL_VBO_BUFFER_FILLER_H
#include <CGAL/license/GraphicsView.h>
#include <CGAL/Triangulation_2_projection_traits_3.h>
#include <CGAL/Triangulation_vertex_base_with_info_2.h>
#include <CGAL/Triangulation_face_base_with_info_2.h>
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
#include <CGAL/Constrained_triangulation_plus_2.h>
#include <CGAL/Cartesian_converter.h>
#include <CGAL/IO/Color.h>
#include <vector>
#include <cstdlib>
#include <queue>
#include <boost/unordered_map.hpp>
namespace CGAL
{
typedef CGAL::Exact_predicates_inexact_constructions_kernel Local_kernel;
typedef Local_kernel::Point_3 Local_point;
typedef Local_kernel::Vector_3 Local_vector;
//------------------------------------------------------------------------------
namespace internal
{
template <class Point, class Vector>
void newell_single_step_3(const Point& p, const Point& q, Vector& n)
{
// Compute normal of the face by using Newell's method: for each edge PQ
// Nx += (Py - Qy) * (Pz + Qz);
// Ny += (Pz - Qz) * (Px + Qx);
// Nz += (Px - Qx) * (Py + Qy);
n = Vector(n.x()+((p.y()-q.y())*(p.z()+q.z())),
n.y()+((p.z()-q.z())*(p.x()+q.x())),
n.z()+((p.x()-q.x())*(p.y()+q.y())));
}
inline
Local_vector compute_normal_of_face(const std::vector<Local_point>& points)
{
Local_vector normal(CGAL::NULL_VECTOR);
unsigned int nb = 0;
for (std::size_t i=0; i<points.size(); ++i)
{
newell_single_step_3(points[i], points[(i+1)%points.size()], normal);
++nb;
}
assert(nb>0);
return (Local_kernel::Construct_scaled_vector_3()(normal, 1.0/nb));
}
////////////////////////////////////////////////////////////////
// Structs to transform any CGAL point/vector into a Local_point/Local_vector
template<typename K>
struct Geom_utils
{
static Local_point 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()));
}
static Local_point get_local_point(const typename K::Weighted_point_2& p)
{
typename K::Point_2 lp(p);
return Geom_utils<K>::get_local_point(lp);
}
static Local_point get_local_point(const typename K::Point_3& p)
{
CGAL::Cartesian_converter<K, Local_kernel> converter;
return converter(p);
}
static Local_point get_local_point(const typename K::Weighted_point_3& p)
{
typename K::Point_3 lp(p);
return Geom_utils<K>::get_local_point(lp);
}
static Local_vector 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()));
}
static Local_vector get_local_vector(const typename K::Vector_3& v)
{
CGAL::Cartesian_converter<K, Local_kernel> converter;
return converter(v);
}
};
// Specialization for Local_kernel, because there is no need of convertion here.
template<>
struct Geom_utils<Local_kernel>
{
static Local_point get_local_point(const Local_kernel::Point_2& p)
{ return Local_point(p.x(), 0, p.y()); }
static Local_point get_local_point(const Local_kernel::Weighted_point_2& p)
{ return Local_point(p.point().x(), 0, p.point().y());}
static const Local_point & get_local_point(const Local_kernel::Point_3& p)
{ return p; }
static Local_point get_local_point(const Local_kernel::Weighted_point_3& p)
{ return Local_point(p);}
static Local_vector get_local_vector(const Local_kernel::Vector_2& v)
{ return Local_vector(v.x(), 0, v.y()); }
static const Local_vector& get_local_vector(const Local_kernel::Vector_3& v)
{ return v; }
};
////////////////////////////////////////////////////////////////
// Global function to simplify function calls.
template<typename KPoint>
Local_point get_local_point(const KPoint& p)
{
return Geom_utils<typename CGAL::Kernel_traits<KPoint>::Kernel>::
get_local_point(p);
}
template<typename KVector>
Local_vector get_local_vector(const KVector& v)
{
return Geom_utils<typename CGAL::Kernel_traits<KVector>::Kernel>::
get_local_vector(v);
}
} // End namespace internal
//------------------------------------------------------------------------------
template<typename BufferType=float, typename IndexType=std::size_t>
class Buffer_for_vao
{
public:
Buffer_for_vao(std::vector<BufferType>* pos=NULL,
std::vector<IndexType>* indices=NULL,
CGAL::Bbox_3* bbox=NULL,
std::vector<BufferType>* color=NULL,
std::vector<BufferType>* flat_normal=NULL,
std::vector<BufferType>* gouraud_normal=NULL) :
m_pos_buffer(pos),
m_index_buffer(indices),
m_color_buffer(color),
m_flat_normal_buffer(flat_normal),
m_gouraud_normal_buffer(gouraud_normal),
m_bb(bbox),
m_face_started(false)
{}
void clear()
{
if (m_pos_buffer!=NULL) { m_pos_buffer->clear(); }
if (m_color_buffer!=NULL) { m_color_buffer->clear(); }
if (m_index_buffer!=NULL) { m_index_buffer->clear(); }
if (m_flat_normal_buffer!=NULL) { m_flat_normal_buffer->clear(); }
if (m_gouraud_normal_buffer!=NULL) { m_gouraud_normal_buffer->clear(); }
}
bool is_empty() const
{
return
(m_pos_buffer!=NULL && m_pos_buffer->empty()) &&
(m_color_buffer!=NULL || m_color_buffer->empty()) &&
(m_flat_normal_buffer!=NULL || m_flat_normal_buffer->empty()) &&
(m_gouraud_normal_buffer!=NULL || m_gouraud_normal_buffer->empty()) &&
(m_index_buffer!=NULL || m_index_buffer->empty());
}
bool has_position() const
{ return m_pos_buffer!=NULL; }
bool has_indices() const
{ return m_index_buffer!=NULL; }
bool has_color() const
{ return m_color_buffer!=NULL; }
bool has_flat_normal() const
{ return m_flat_normal_buffer!=NULL; }
bool has_gouraud_normal() const
{ return m_gouraud_normal_buffer!=NULL; }
// 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)
{
if (!has_position()) return (std::size_t)-1;
Local_point p=internal::get_local_point(kp);
add_point_in_buffer(p, *m_pos_buffer);
if (m_bb!=NULL)
{ (*m_bb)=(*m_bb)+p.bbox(); }
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)
{
add_point(kp);
add_color(c);
}
// 1.3) Add an indexed point, without color.
template<typename T>
void add_indexed_point(T index)
{
if (!has_indices()) return;
m_index_buffer->push_back((IndexType)index);
}
// 2.1) Add a segment, without color.
template<typename KPoint>
void add_segment(const KPoint& kp1, const KPoint& kp2)
{
add_point(kp1);
add_point(kp2);
}
// 2.2) Add a segment, with color.
template<typename KPoint>
void add_segment(const KPoint& kp1, const KPoint& kp2, const CGAL::Color& c)
{
add_segment(kp1, kp2);
add_color(c);
add_color(c);
}
// 2.3) Add an indexed segment, without color.
template<typename T>
void add_indexed_segment(T index1, T index2)
{
add_indexed_point(index1);
add_indexed_point(index2);
}
/// @return true iff a face has begun.
bool is_a_face_started() const
{ return m_face_started; }
// 3.1) Add a face, without color, without normal.
void face_begin()
{ face_begin_internal(false, false); }
// 3.2) Add a face, with a color, without normal.
void face_begin(const CGAL::Color& c)
{
m_color_of_face=c;
face_begin_internal(true, false);
}
// 3.3) Add a face, without a color, with a normal.
template<typename KNormal>
void face_begin(const KNormal& kv)
{
m_normal_of_face=internal::get_local_vector(kv);
face_begin_internal(false, true);
}
// 3.3) Add a face, with a color and with a normal.
template<typename KNormal>
void face_begin(const CGAL::Color& c, const KNormal& kv)
{
m_color_of_face=c;
m_normal_of_face=internal::get_local_vector(kv);
face_begin_internal(true, true);
}
/// Add a point at the end of the current face, without giving the vertex normal.
/// When this method is used, it is not possible to use the Gouraud shading.
/// @param p the point to add
template<typename KPoint>
bool add_point_in_face(const KPoint& kp)
{
if (!is_a_face_started()) return false;
Local_point p=internal::get_local_point(kp);
if (m_points_of_face.empty() || m_points_of_face.back()!=p) // TODO test if the distance between prev point and kp is smaller than an epsilon (?? not sure ??)
{
m_points_of_face.push_back(p);
return true;
}
return false;
}
/// Add a point at the end of the current face
/// @param p the point to add
/// @p_normal the vertex normal at this point (for Gouraud shading)
template<typename KPoint, typename KVector>
bool add_point_in_face(const KPoint& kp, const KVector& p_normal)
{
if (add_point_in_face(kp))
{
m_vertex_normals_for_face.push_back(internal::get_local_vector(p_normal));
return true;
}
return false;
}
/// Add an indexed point at the end of the current face, without giving the vertex normal.
/// When Indexation is used, it is not possible to use flat shading or multiple colors
/// for face sor edges.
/// Note that we still need the point itself, in order to triangulate the face when necessary.
template<typename T, typename KPoint>
bool add_indexed_point_in_face(T index, const KPoint& kp)
{
if (add_point_in_face(kp))
{
m_indices_of_points_of_face.push_back(index);
return true;
}
return false;
}
/// End the face: compute the triangulation.
void face_end()
{
if (!is_a_face_started()) return;
if (m_points_of_face.size()<3)
{
std::cerr<<"PB: you try to triangulate a face with "<<m_points_of_face.size()<<" vertices."
<<std::endl;
m_face_started=false;
m_points_of_face.clear();
m_vertex_normals_for_face.clear();
return;
}
if (m_indices_of_points_of_face.size()>0 &&
m_indices_of_points_of_face.size()!=m_points_of_face.size())
{
std::cerr<<"PB: you mixed some add_point_in_face(...) and some add_indexed_point_in_face(...)"
<<" for a same face. Indices for this face are ignored."<<std::endl;
m_indices_of_points_of_face.clear();
}
if (m_vertex_normals_for_face.size()>0 &&
m_vertex_normals_for_face.size()!=m_points_of_face.size())
{
std::cerr<<"PB: you only gave some vertex normals (and not all) for a same face. "
<<"All vertex normal are ignored and thus it is not possible to use Gouraud "
<<"shading for this face."
<<std::endl;
m_vertex_normals_for_face.clear();
}
Local_vector normal=(m_started_face_has_normal?m_normal_of_face:
internal::compute_normal_of_face(m_points_of_face));
if (m_points_of_face.size()==3)
{ triangular_face_end_internal(normal); } // Triangle: no need to triangulate
else if (is_current_face_convex(normal))
{
if (m_points_of_face.size()==4)
{ convex_quadrangular_face_end_internal(normal); } // Convex quad
else
{ convex_face_end_internal(normal); } // Convex face with > 4 vertices
}
else
{ // Non convex and more than 3 points: we triangulate
nonconvex_face_end_internal(normal);
}
m_face_started=false;
}
/// adds `kp` coordinates to `buffer`
template<typename KPoint>
static void add_point_in_buffer(const KPoint& kp, std::vector<float>& buffer)
{
Local_point p=internal::get_local_point(kp);
buffer.push_back(p.x());
buffer.push_back(p.y());
buffer.push_back(p.z());
}
/// adds `kv` coordinates to `buffer`
template<typename KVector>
static void add_normal_in_buffer(const KVector& kv, std::vector<float>& buffer)
{
Local_vector n=internal::get_local_vector(kv);
buffer.push_back(n.x());
buffer.push_back(n.y());
buffer.push_back(n.z());
}
///adds `acolor` RGB components to `buffer`
static void add_color_in_buffer(const CGAL::Color& acolor, std::vector<float>& buffer)
{
buffer.push_back((float)acolor.red()/(float)255);
buffer.push_back((float)acolor.green()/(float)255);
buffer.push_back((float)acolor.blue()/(float)255);
}
/// @return true iff the points of 'facet' form a convex face
static bool is_facet_convex(const std::vector<Local_point>& facet,
const Local_vector& normal)
{
Local_kernel::Orientation orientation, local_orientation;
std::size_t id=0;
do
{
const Local_point& S=facet[id];
const Local_point& T=facet[(id+1==facet.size())?0:id+1];
Local_vector V1=Local_vector((T-S).x(), (T-S).y(), (T-S).z());
const Local_point& U=facet[(id+2==facet.size())?0:id+2];
Local_vector V2=Local_vector((U-T).x(), (U-T).y(), (U-T).z());
orientation = Local_kernel::Orientation_3()(V1, V2, normal);
// Is it possible that orientation==COPLANAR ? Maybe if V1 or V2 is very small ?
}
while(++id!=facet.size() &&
(orientation==CGAL::COPLANAR || orientation==CGAL::ZERO));
//Here, all orientations were COPLANAR. Not sure this case is possible,
// but we stop here.
if (orientation==CGAL::COPLANAR || orientation==CGAL::ZERO)
{ return false; }
// Now we compute convexness
for(id=0; id<facet.size(); ++id)
{
const Local_point& S=facet[id];
const Local_point& T=facet[(id+1==facet.size())?0:id+1];
Local_vector V1=Local_vector((T-S).x(), (T-S).y(), (T-S).z());
const Local_point& U=facet[(id+2==facet.size())?0:id+2];
Local_vector V2=Local_vector((U-T).x(), (U-T).y(), (U-T).z());
local_orientation=Local_kernel::Orientation_3()(V1, V2, normal) ;
if(local_orientation!=CGAL::ZERO && local_orientation!=orientation)
{ return false; }
}
return true;
}
protected:
void face_begin_internal(bool has_color, bool has_normal)
{
if (is_a_face_started())
{
std::cerr<<"You cannot start a new face before to finish the previous one."<<std::endl;
return;
}
m_face_started=true;
m_started_face_is_colored=has_color;
m_started_face_has_normal=has_normal;
m_points_of_face.clear();
m_vertex_normals_for_face.clear();
m_indices_of_points_of_face.clear();
}
void triangular_face_end_internal(const Local_vector& normal)
{
for (int i=0; i<3; ++i)
{
// If user gave vertex indices
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);
}
}
}
}
void convex_quadrangular_face_end_internal(const Local_vector& normal)
{
// Add indices when they exist
if (m_indices_of_points_of_face.size()>0)
{
add_indexed_point(m_indices_of_points_of_face[0]);
add_indexed_point(m_indices_of_points_of_face[1]);
add_indexed_point(m_indices_of_points_of_face[2]);
add_indexed_point(m_indices_of_points_of_face[0]);
add_indexed_point(m_indices_of_points_of_face[2]);
add_indexed_point(m_indices_of_points_of_face[3]);
}
else
{
// (1) add points
add_point(m_points_of_face[0]);
add_point(m_points_of_face[1]);
add_point(m_points_of_face[2]);
add_point(m_points_of_face[0]);
add_point(m_points_of_face[2]);
add_point(m_points_of_face[3]);
// (2) Add flat and smooth normals and color
for(unsigned int i=0; i<6; ++i)
{
if (m_started_face_is_colored)
{ add_color(m_color_of_face); }
add_flat_normal(normal);
if (m_vertex_normals_for_face.size()==0)
{ add_gouraud_normal(normal); }
}
if (m_vertex_normals_for_face.size()>0)
{
add_gouraud_normal(m_vertex_normals_for_face[0]);
add_gouraud_normal(m_vertex_normals_for_face[1]);
add_gouraud_normal(m_vertex_normals_for_face[2]);
add_gouraud_normal(m_vertex_normals_for_face[0]);
add_gouraud_normal(m_vertex_normals_for_face[2]);
add_gouraud_normal(m_vertex_normals_for_face[3]);
}
}
}
void convex_face_end_internal(const Local_vector& normal)
{
for(std::size_t i=1; i<m_points_of_face.size()-1; ++i)
{
// Add indices when they exist
if (m_indices_of_points_of_face.size()>0)
{
add_indexed_point(m_indices_of_points_of_face[0]);
add_indexed_point(m_indices_of_points_of_face[i]);
add_indexed_point(m_indices_of_points_of_face[i+1]);
}
else
{
Local_point& p0 = m_points_of_face[0];
Local_point& p1 = m_points_of_face[i];
Local_point& p2 = m_points_of_face[i+1];
// (1) add points
add_point(p0);
add_point(p1);
add_point(p2);
// (2) Add flat normal and color
for(unsigned int j=0; j<3; ++j)
{
if (m_started_face_is_colored)
{ add_color(m_color_of_face); }
add_flat_normal(normal);
if (m_vertex_normals_for_face.size()==0)
{ add_gouraud_normal(normal); } // No smooth normal, we use the flat one instead
}
// (3) Add smooth normals if they exist
if (m_vertex_normals_for_face.size()>0)
{
add_gouraud_normal(m_vertex_normals_for_face[0]);
add_gouraud_normal(m_vertex_normals_for_face[i]);
add_gouraud_normal(m_vertex_normals_for_face[i+1]);
}
}
}
}
void nonconvex_face_end_internal(const Local_vector& normal)
{
try
{
P_traits cdt_traits(normal);
CDT cdt(cdt_traits);
bool with_vertex_normal=(m_vertex_normals_for_face.size()==m_points_of_face.size());
// (1) We insert all the edges as contraint in the CDT.
typename CDT::Vertex_handle previous=NULL, first=NULL;
for (unsigned int i=0; i<m_points_of_face.size(); ++i)
{
typename CDT::Vertex_handle vh = cdt.insert(m_points_of_face[i]);
if(first==NULL)
{ first=vh; }
if (with_vertex_normal)
{ vh->info().v=m_vertex_normals_for_face[i]; }
else
{ vh->info().v=normal; }
if (m_indices_of_points_of_face.size()>0)
{ vh->info().index=m_indices_of_points_of_face[i]; }
if(previous!=NULL && previous!=vh)
{ cdt.insert_constraint(previous, vh); }
previous=vh;
}
if (previous!=NULL && previous!=first)
{ cdt.insert_constraint(previous, first); }
// (2) We mark all external triangles
// (2.1) We initialize is_external and is_process values
for(typename CDT::All_faces_iterator fit = cdt.all_faces_begin(),
fitend = cdt.all_faces_end(); fit!=fitend; ++fit)
{
fit->info().is_external = true;
fit->info().is_process = false;
}
// (2.2) We check if the facet is external or internal
std::queue<typename CDT::Face_handle> face_queue;
typename CDT::Face_handle face_internal = NULL;
if (cdt.infinite_vertex()->face()!=NULL)
{ face_queue.push(cdt.infinite_vertex()->face()); }
while(!face_queue.empty())
{
typename CDT::Face_handle fh = face_queue.front();
face_queue.pop();
if(!fh->info().is_process)
{
fh->info().is_process = true;
for(int i=0; i<3; ++i)
{
if(!cdt.is_constrained(std::make_pair(fh, i)))
{
if (fh->neighbor(i)!=NULL)
{ face_queue.push(fh->neighbor(i)); }
}
else if (face_internal==NULL)
{
face_internal = fh->neighbor(i);
}
}
}
}
if ( face_internal!=NULL )
{ face_queue.push(face_internal); }
while(!face_queue.empty())
{
typename CDT::Face_handle fh = face_queue.front();
face_queue.pop();
if(!fh->info().is_process)
{
fh->info().is_process = true;
fh->info().is_external = false;
for(unsigned int i=0; i<3; ++i)
{
if(!cdt.is_constrained(std::make_pair(fh, i)))
{
if (fh->neighbor(i)!=NULL)
{ face_queue.push(fh->neighbor(i)); }
}
}
}
}
// (3) Now we iterates on the internal faces to add the vertices
// and the normals to the appropriate vectors
for(typename CDT::Finite_faces_iterator ffit=cdt.finite_faces_begin(),
ffitend = cdt.finite_faces_end(); ffit!=ffitend; ++ffit)
{
if(!ffit->info().is_external)
{
for(unsigned int i=0; i<3; ++i)
{
// Add indices when they exist
if (m_indices_of_points_of_face.size()>0)
{ add_indexed_point(ffit->vertex(i)->info().index); }
else
{
// (1) add point
add_point(ffit->vertex(i)->point());
// (2) Add face color
if (m_started_face_is_colored)
{ add_color(m_color_of_face); }
// (3) Add flat normal
add_flat_normal(normal);
// (4) Add smooth normals (or flat if smooth normals do not exist)
add_gouraud_normal(ffit->vertex(i)->info().v);
}
}
}
}
}
catch(...)
{ // Triangulation crash: the face is not filled
std::cerr<<"Catch: face not filled."<<std::endl;
}
}
/// @return true iff the current face is convex
bool is_current_face_convex(const Local_vector& N) const
{
return is_facet_convex(m_points_of_face, N);
}
void add_color(const CGAL::Color& acolor)
{
if (m_color_buffer!=NULL)
{ add_color_in_buffer(acolor, *m_color_buffer); }
}
template<typename KVector>
void add_flat_normal(const KVector& kv)
{
if(m_flat_normal_buffer != NULL)
{ add_normal_in_buffer(kv, *m_flat_normal_buffer); }
}
template<typename KVector>
void add_gouraud_normal(const KVector& kv)
{
if(m_gouraud_normal_buffer != NULL)
{ add_normal_in_buffer(kv, *m_gouraud_normal_buffer); }
}
protected:
// Types usefull for triangulation
struct Vertex_info
{
Local_vector v;
std::size_t index;
};
struct Face_info
{
bool exist_edge[3];
bool is_external;
bool is_process;
};
typedef CGAL::Triangulation_2_projection_traits_3<CGAL::Exact_predicates_inexact_constructions_kernel> P_traits;
typedef CGAL::Triangulation_vertex_base_with_info_2<Vertex_info, P_traits> Vb;
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::Exact_predicates_tag Itag;
typedef CGAL::Constrained_Delaunay_triangulation_2<P_traits, TDS, Itag> CDT;
protected:
std::vector<BufferType>* m_pos_buffer;
std::vector<IndexType>* m_index_buffer;
std::vector<BufferType>* m_color_buffer;
std::vector<BufferType>* m_flat_normal_buffer;
std::vector<BufferType>* m_gouraud_normal_buffer;
CGAL::Bbox_3* m_bb;
// Local variables, used when we started a new face.
bool m_face_started;
bool m_started_face_is_colored;
bool m_started_face_has_normal;
std::vector<Local_point> m_points_of_face;
std::vector<Local_vector> m_vertex_normals_for_face;
std::vector<std::size_t> m_indices_of_points_of_face;
CGAL::Color m_color_of_face;
Local_vector m_normal_of_face;
};
} // End namespace CGAL
#endif // CGAL_VBO_BUFFER_FILLER_H

File diff suppressed because it is too large Load Diff

View File

@ -3,17 +3,13 @@
Copyright (c) 2018 GeometryFactory Sarl (France). Copyright (c) 2018 GeometryFactory Sarl (France).
Copyright (C) 2002-2014 Gilles Debunne. All rights reserved. Copyright (C) 2002-2014 Gilles Debunne. All rights reserved.
This file is part of the CGAL::QGLViewer library version 2.7.0. This file is part of a fork of the QGLViewer library version 2.7.0.
http://www.libqglviewer.com - contact@libqglviewer.com http://www.libqglviewer.com - contact@libqglviewer.com
This file may be used under the terms of the GNU General Public License This file may be used under the terms of the GNU General Public License
version 3.0 as published by the Free Software Foundation and version 3.0 as published by the Free Software Foundation and
appearing in the LICENSE file included in the packaging of this file. appearing in the LICENSE file included in the packaging of this file.
libCGAL::QGLViewer uses dual licensing. Commercial/proprietary software must
purchase a libCGAL::QGLViewer Commercial License.
This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

View File

@ -3,17 +3,13 @@
Copyright (c) 2018 GeometryFactory Sarl (France). Copyright (c) 2018 GeometryFactory Sarl (France).
Copyright (C) 2002-2014 Gilles Debunne. All rights reserved. Copyright (C) 2002-2014 Gilles Debunne. All rights reserved.
This file is part of the CGAL::QGLViewer library version 2.7.0. This file is part of a fork of the QGLViewer library version 2.7.0.
http://www.libqglviewer.com - contact@libqglviewer.com http://www.libqglviewer.com - contact@libqglviewer.com
This file may be used under the terms of the GNU General Public License This file may be used under the terms of the GNU General Public License
version 3.0 as published by the Free Software Foundation and version 3.0 as published by the Free Software Foundation and
appearing in the LICENSE file included in the packaging of this file. appearing in the LICENSE file included in the packaging of this file.
libCGAL::QGLViewer uses dual licensing. Commercial/proprietary software must
purchase a libCGAL::QGLViewer Commercial License.
This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
@ -36,8 +32,8 @@
#include <CGAL/Qt/domUtils.h> #include <CGAL/Qt/domUtils.h>
#include <CGAL/Qt/keyFrameInterpolator.h> #include <CGAL/Qt/keyFrameInterpolator.h>
using namespace std; namespace CGAL{
using namespace CGAL::qglviewer; namespace qglviewer{
/*! Default constructor. /*! Default constructor.
@ -1602,12 +1598,10 @@ int project(qreal objx, qreal objy, qreal objz, GLdouble *modelview,
fTempo[1]=modelview[1]*objx+modelview[5]*objy+modelview[9]*objz+modelview[13]; fTempo[1]=modelview[1]*objx+modelview[5]*objy+modelview[9]*objz+modelview[13];
fTempo[2]=modelview[2]*objx+modelview[6]*objy+modelview[10]*objz+modelview[14]; fTempo[2]=modelview[2]*objx+modelview[6]*objy+modelview[10]*objz+modelview[14];
fTempo[3]=modelview[3]*objx+modelview[7]*objy+modelview[11]*objz+modelview[15]; fTempo[3]=modelview[3]*objx+modelview[7]*objy+modelview[11]*objz+modelview[15];
//Projection transform, the final row of projection matrix is always [0 0 -1 0]
//so we optimize for that.
fTempo[4]=projection[0]*fTempo[0]+projection[4]*fTempo[1]+projection[8]*fTempo[2]+projection[12]*fTempo[3]; fTempo[4]=projection[0]*fTempo[0]+projection[4]*fTempo[1]+projection[8]*fTempo[2]+projection[12]*fTempo[3];
fTempo[5]=projection[1]*fTempo[0]+projection[5]*fTempo[1]+projection[9]*fTempo[2]+projection[13]*fTempo[3]; fTempo[5]=projection[1]*fTempo[0]+projection[5]*fTempo[1]+projection[9]*fTempo[2]+projection[13]*fTempo[3];
fTempo[6]=projection[2]*fTempo[0]+projection[6]*fTempo[1]+projection[10]*fTempo[2]+projection[14]*fTempo[3]; fTempo[6]=projection[2]*fTempo[0]+projection[6]*fTempo[1]+projection[10]*fTempo[2]+projection[14]*fTempo[3];
fTempo[7]=-fTempo[2]; fTempo[7]=projection[3]*fTempo[0]+projection[7]*fTempo[1]+projection[11]*fTempo[2]+projection[15]*fTempo[3];
//The result normalizes between -1 and 1 //The result normalizes between -1 and 1
if(fTempo[7]==0.0) //The w value if(fTempo[7]==0.0) //The w value
return 0; return 0;
@ -1948,7 +1942,7 @@ int unProject(GLdouble winx, GLdouble winy, GLdouble winz, GLdouble *modelview,
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
Vec Camera::projectedCoordinatesOf(const Vec& src, const Frame* frame) const Vec Camera::projectedCoordinatesOf(const Vec& src, const Frame* frame) const
{ {
GLdouble x,y,z; GLdouble x = 0.f, y = 0.f, z = 0.f;
static GLint viewport[4]; static GLint viewport[4];
getViewport(viewport); getViewport(viewport);
@ -1990,7 +1984,7 @@ Vec Camera::projectedCoordinatesOf(const Vec& src, const Frame* frame) const
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
Vec Camera::unprojectedCoordinatesOf(const Vec& src, const Frame* frame) const Vec Camera::unprojectedCoordinatesOf(const Vec& src, const Frame* frame) const
{ {
GLdouble x,y,z; GLdouble x = 0.f, y = 0.f, z = 0.f;
static GLint viewport[4]; static GLint viewport[4];
getViewport(viewport); getViewport(viewport);
unProject(src.x,src.y,src.z, modelViewMatrix_, projectionMatrix_, viewport, &x,&y,&z); unProject(src.x,src.y,src.z, modelViewMatrix_, projectionMatrix_, viewport, &x,&y,&z);
@ -2480,8 +2474,8 @@ void Camera::setFrustum(double frustum[6])
double B = (r+l)/(r-l); double B = (r+l)/(r-l);
double C = 2*n/(t-b); double C = 2*n/(t-b);
double D = (t+b)/(t-b); double D = (t+b)/(t-b);
float E = -(f+n)/(f-n); double E = -(f+n)/(f-n);
float F = -2*(f*n)/(f-n); double F = -2*(f*n)/(f-n);
projectionMatrix_[0] = A; projectionMatrix_[4] = 0; projectionMatrix_[8] = B ; projectionMatrix_[12] = 0; projectionMatrix_[0] = A; projectionMatrix_[4] = 0; projectionMatrix_[8] = B ; projectionMatrix_[12] = 0;
projectionMatrix_[1] = 0; projectionMatrix_[5] = C; projectionMatrix_[9] = D ; projectionMatrix_[13] = 0; projectionMatrix_[1] = 0; projectionMatrix_[5] = C; projectionMatrix_[9] = D ; projectionMatrix_[13] = 0;
projectionMatrix_[2] = 0; projectionMatrix_[6] = 0; projectionMatrix_[10] = E ; projectionMatrix_[14] = F; projectionMatrix_[2] = 0; projectionMatrix_[6] = 0; projectionMatrix_[10] = E ; projectionMatrix_[14] = F;
@ -2493,8 +2487,8 @@ void Camera::setFrustum(double frustum[6])
double B = -(r+l)/(r-l); double B = -(r+l)/(r-l);
double C = 2/(t-b); double C = 2/(t-b);
double D = -(t+b)/(t-b); double D = -(t+b)/(t-b);
float E = -(f+n)/(f-n); double E = -(f+n)/(f-n);
float F = -2/(f-n); double F = -2/(f-n);
projectionMatrix_[0] = A; projectionMatrix_[1] = 0; projectionMatrix_[2] = 0 ; projectionMatrix_[3] = 0; projectionMatrix_[0] = A; projectionMatrix_[1] = 0; projectionMatrix_[2] = 0 ; projectionMatrix_[3] = 0;
projectionMatrix_[4] = 0; projectionMatrix_[5] = C; projectionMatrix_[6] = 0 ; projectionMatrix_[7] = 0; projectionMatrix_[4] = 0; projectionMatrix_[5] = C; projectionMatrix_[6] = 0 ; projectionMatrix_[7] = 0;
projectionMatrix_[8] = 0; projectionMatrix_[9] = 0; projectionMatrix_[10] = F ; projectionMatrix_[11] = 0; projectionMatrix_[8] = 0; projectionMatrix_[9] = 0; projectionMatrix_[10] = F ; projectionMatrix_[11] = 0;
@ -2539,4 +2533,4 @@ void Camera::getFrustum(double frustum[6])
frustum[4] = n; frustum[4] = n;
frustum[5] = f; frustum[5] = f;
} }
}}//end of namespace

View File

@ -3,17 +3,13 @@
Copyright (c) 2018 GeometryFactory Sarl (France). Copyright (c) 2018 GeometryFactory Sarl (France).
Copyright (C) 2002-2014 Gilles Debunne. All rights reserved. Copyright (C) 2002-2014 Gilles Debunne. All rights reserved.
This file is part of a fork of the CGAL::QGLViewer library version 2.7.0. This file is part of a fork of the QGLViewer library version 2.7.0.
http://www.libqglviewer.com - contact@libqglviewer.com http://www.libqglviewer.com - contact@libqglviewer.com
This file may be used under the terms of the GNU General Public License This file may be used under the terms of the GNU General Public License
version 3.0 as published by the Free Software Foundation and version 3.0 as published by the Free Software Foundation and
appearing in the LICENSE file included in the packaging of this file. appearing in the LICENSE file included in the packaging of this file.
libCGAL::QGLViewer uses dual licensing. Commercial/proprietary software must
purchase a libCGAL::QGLViewer Commercial License.
This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

View File

@ -3,17 +3,13 @@
Copyright (c) 2018 GeometryFactory Sarl (France). Copyright (c) 2018 GeometryFactory Sarl (France).
Copyright (C) 2002-2014 Gilles Debunne. All rights reserved. Copyright (C) 2002-2014 Gilles Debunne. All rights reserved.
This file is part of a fork of the CGAL::QGLViewer library version 2.7.0. This file is part of a fork of the QGLViewer library version 2.7.0.
http://www.libqglviewer.com - contact@libqglviewer.com http://www.libqglviewer.com - contact@libqglviewer.com
This file may be used under the terms of the GNU General Public License This file may be used under the terms of the GNU General Public License
version 3.0 as published by the Free Software Foundation and version 3.0 as published by the Free Software Foundation and
appearing in the LICENSE file included in the packaging of this file. appearing in the LICENSE file included in the packaging of this file.
libCGAL::QGLViewer uses dual licensing. Commercial/proprietary software must
purchase a libCGAL::QGLViewer Commercial License.
This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
@ -35,8 +31,9 @@
#include <CGAL/Qt/manipulatedCameraFrame.h> #include <CGAL/Qt/manipulatedCameraFrame.h>
#include <CGAL/Qt/camera.h> #include <CGAL/Qt/camera.h>
using namespace CGAL::qglviewer; namespace CGAL{
using namespace std; namespace qglviewer{
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Constraint // // Constraint //
@ -301,3 +298,5 @@ void CameraConstraint::constrainRotation(Quaternion &rotation,
break; break;
} }
} }
}}//end namespace

View File

@ -3,17 +3,13 @@
Copyright (c) 2018 GeometryFactory Sarl (France). Copyright (c) 2018 GeometryFactory Sarl (France).
Copyright (C) 2002-2014 Gilles Debunne. All rights reserved. Copyright (C) 2002-2014 Gilles Debunne. All rights reserved.
This file is part of a fork of the CGAL::QGLViewer library version 2.7.0. This file is part of a fork of the QGLViewer library version 2.7.0.
http://www.libqglviewer.com - contact@libqglviewer.com http://www.libqglviewer.com - contact@libqglviewer.com
This file may be used under the terms of the GNU General Public License This file may be used under the terms of the GNU General Public License
version 3.0 as published by the Free Software Foundation and version 3.0 as published by the Free Software Foundation and
appearing in the LICENSE file included in the packaging of this file. appearing in the LICENSE file included in the packaging of this file.
libCGAL::QGLViewer uses dual licensing. Commercial/proprietary software must
purchase a libCGAL::QGLViewer Commercial License.
This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

View File

@ -3,17 +3,13 @@
Copyright (c) 2018 GeometryFactory Sarl (France). Copyright (c) 2018 GeometryFactory Sarl (France).
Copyright (C) 2002-2014 Gilles Debunne. All rights reserved. Copyright (C) 2002-2014 Gilles Debunne. All rights reserved.
This file is part of a fork of the CGAL::QGLViewer library version 2.7.0. This file is part of a fork of the QGLViewer library version 2.7.0.
http://www.libqglviewer.com - contact@libqglviewer.com http://www.libqglviewer.com - contact@libqglviewer.com
This file may be used under the terms of the GNU General Public License This file may be used under the terms of the GNU General Public License
version 3.0 as published by the Free Software Foundation and version 3.0 as published by the Free Software Foundation and
appearing in the LICENSE file included in the packaging of this file. appearing in the LICENSE file included in the packaging of this file.
libCGAL::QGLViewer uses dual licensing. Commercial/proprietary software must
purchase a libCGAL::QGLViewer Commercial License.
This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

View File

@ -3,17 +3,13 @@
Copyright (c) 2018 GeometryFactory Sarl (France). Copyright (c) 2018 GeometryFactory Sarl (France).
Copyright (C) 2002-2014 Gilles Debunne. All rights reserved. Copyright (C) 2002-2014 Gilles Debunne. All rights reserved.
This file is part of a fork of the CGAL::QGLViewer library version 2.7.0. This file is part of a fork of the QGLViewer library version 2.7.0.
http://www.libqglviewer.com - contact@libqglviewer.com http://www.libqglviewer.com - contact@libqglviewer.com
This file may be used under the terms of the GNU General Public License This file may be used under the terms of the GNU General Public License
version 3.0 as published by the Free Software Foundation and version 3.0 as published by the Free Software Foundation and
appearing in the LICENSE file included in the packaging of this file. appearing in the LICENSE file included in the packaging of this file.
libCGAL::QGLViewer uses dual licensing. Commercial/proprietary software must
purchase a libCGAL::QGLViewer Commercial License.
This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
@ -36,8 +32,9 @@
#include <CGAL/Qt/domUtils.h> #include <CGAL/Qt/domUtils.h>
#include <math.h> #include <math.h>
using namespace CGAL::qglviewer; namespace CGAL{
using namespace std; namespace qglviewer{
/*! Creates a default Frame. /*! Creates a default Frame.
@ -1137,7 +1134,7 @@ void Frame::alignWithFrame(const Frame *const frame, bool move,
rotate(rotation().inverse() * Quaternion(axis, angle) * orientation()); rotate(rotation().inverse() * Quaternion(axis, angle) * orientation());
// Try to align an other axis direction // Try to align an other axis direction
unsigned short d = (index[1] + 1) % 3; unsigned short d = (unsigned short)((index[1] + 1) % 3);
Vec dir((d == 0) ? 1.0 : 0.0, (d == 1) ? 1.0 : 0.0, (d == 2) ? 1.0 : 0.0); Vec dir((d == 0) ? 1.0 : 0.0, (d == 1) ? 1.0 : 0.0, (d == 2) ? 1.0 : 0.0);
dir = inverseTransformOf(dir); dir = inverseTransformOf(dir);
@ -1186,3 +1183,4 @@ void Frame::projectOnLine(const Vec &origin, const Vec &direction) {
proj.projectOnAxis(direction); proj.projectOnAxis(direction);
translate(shift - proj); translate(shift - proj);
} }
}}

View File

@ -3,17 +3,13 @@
Copyright (c) 2018 GeometryFactory Sarl (France). Copyright (c) 2018 GeometryFactory Sarl (France).
Copyright (C) 2002-2014 Gilles Debunne. All rights reserved. Copyright (C) 2002-2014 Gilles Debunne. All rights reserved.
This file is part of a fork of the CGAL::QGLViewer library version 2.7.0. This file is part of a fork of the QGLViewer library version 2.7.0.
http://www.libqglviewer.com - contact@libqglviewer.com http://www.libqglviewer.com - contact@libqglviewer.com
This file may be used under the terms of the GNU General Public License This file may be used under the terms of the GNU General Public License
version 3.0 as published by the Free Software Foundation and version 3.0 as published by the Free Software Foundation and
appearing in the LICENSE file included in the packaging of this file. appearing in the LICENSE file included in the packaging of this file.
libCGAL::QGLViewer uses dual licensing. Commercial/proprietary software must
purchase a libCGAL::QGLViewer Commercial License.
This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
@ -56,14 +52,14 @@ private Q_SLOTS:
{ {
if(currentlyFocused == imgHeight if(currentlyFocused == imgHeight
&& ratioCheckBox->isChecked()) && ratioCheckBox->isChecked())
{imgWidth->setValue(i*ratio);} {imgWidth->setValue(int(i*ratio));}
} }
void imgWidthValueChanged(int i) void imgWidthValueChanged(int i)
{ {
if(currentlyFocused == imgWidth if(currentlyFocused == imgWidth
&& ratioCheckBox->isChecked()) && ratioCheckBox->isChecked())
{imgHeight->setValue(i/ratio);} {imgHeight->setValue(int(i/ratio));}
} }
void onFocusChanged(QWidget*, QWidget* now) void onFocusChanged(QWidget*, QWidget* now)

View File

@ -3,17 +3,13 @@
Copyright (c) 2018 GeometryFactory Sarl (France). Copyright (c) 2018 GeometryFactory Sarl (France).
Copyright (C) 2002-2014 Gilles Debunne. All rights reserved. Copyright (C) 2002-2014 Gilles Debunne. All rights reserved.
This file is part of a fork of the CGAL::QGLViewer library version 2.7.0. This file is part of a fork of the QGLViewer library version 2.7.0.
http://www.libqglviewer.com - contact@libqglviewer.com http://www.libqglviewer.com - contact@libqglviewer.com
This file may be used under the terms of the GNU General Public License This file may be used under the terms of the GNU General Public License
version 3.0 as published by the Free Software Foundation and version 3.0 as published by the Free Software Foundation and
appearing in the LICENSE file included in the packaging of this file. appearing in the LICENSE file included in the packaging of this file.
libCGAL::QGLViewer uses dual licensing. Commercial/proprietary software must
purchase a libCGAL::QGLViewer Commercial License.
This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

View File

@ -3,17 +3,13 @@
Copyright (c) 2018 GeometryFactory Sarl (France). Copyright (c) 2018 GeometryFactory Sarl (France).
Copyright (C) 2002-2014 Gilles Debunne. All rights reserved. Copyright (C) 2002-2014 Gilles Debunne. All rights reserved.
This file is part of a fork of the CGAL::QGLViewer library version 2.7.0. This file is part of a fork of the QGLViewer library version 2.7.0.
http://www.libqglviewer.com - contact@libqglviewer.com http://www.libqglviewer.com - contact@libqglviewer.com
This file may be used under the terms of the GNU General Public License This file may be used under the terms of the GNU General Public License
version 3.0 as published by the Free Software Foundation and version 3.0 as published by the Free Software Foundation and
appearing in the LICENSE file included in the packaging of this file. appearing in the LICENSE file included in the packaging of this file.
libCGAL::QGLViewer uses dual licensing. Commercial/proprietary software must
purchase a libCGAL::QGLViewer Commercial License.
This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
@ -33,8 +29,9 @@
#include <CGAL/Qt/keyFrameInterpolator.h> #include <CGAL/Qt/keyFrameInterpolator.h>
#include <CGAL/Qt/domUtils.h> #include <CGAL/Qt/domUtils.h>
using namespace CGAL::qglviewer; namespace CGAL{
using namespace std; namespace qglviewer{
/*! Creates a KeyFrameInterpolator, with \p frame as associated frame(). /*! Creates a KeyFrameInterpolator, with \p frame as associated frame().
@ -584,5 +581,6 @@ void KeyFrameInterpolator::KeyFrame::flipOrientationIfNeeded(
if (Quaternion::dot(prev, q_) < 0.0) if (Quaternion::dot(prev, q_) < 0.0)
q_.negate(); q_.negate();
} }
#endif // DOXYGEN #endif // DOXYGEN
}}

View File

@ -3,17 +3,13 @@
Copyright (c) 2018 GeometryFactory Sarl (France). Copyright (c) 2018 GeometryFactory Sarl (France).
Copyright (C) 2002-2014 Gilles Debunne. All rights reserved. Copyright (C) 2002-2014 Gilles Debunne. All rights reserved.
This file is part of a fork of the CGAL::QGLViewer library version 2.7.0. This file is part of a fork of the QGLViewer library version 2.7.0.
http://www.libqglviewer.com - contact@libqglviewer.com http://www.libqglviewer.com - contact@libqglviewer.com
This file may be used under the terms of the GNU General Public License This file may be used under the terms of the GNU General Public License
version 3.0 as published by the Free Software Foundation and version 3.0 as published by the Free Software Foundation and
appearing in the LICENSE file included in the packaging of this file. appearing in the LICENSE file included in the packaging of this file.
libCGAL::QGLViewer uses dual licensing. Commercial/proprietary software must
purchase a libCGAL::QGLViewer Commercial License.
This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

View File

@ -3,17 +3,13 @@
Copyright (c) 2018 GeometryFactory Sarl (France). Copyright (c) 2018 GeometryFactory Sarl (France).
Copyright (C) 2002-2014 Gilles Debunne. All rights reserved. Copyright (C) 2002-2014 Gilles Debunne. All rights reserved.
This file is part of a fork of the CGAL::QGLViewer library version 2.7.0. This file is part of a fork of the QGLViewer library version 2.7.0.
http://www.libqglviewer.com - contact@libqglviewer.com http://www.libqglviewer.com - contact@libqglviewer.com
This file may be used under the terms of the GNU General Public License This file may be used under the terms of the GNU General Public License
version 3.0 as published by the Free Software Foundation and version 3.0 as published by the Free Software Foundation and
appearing in the LICENSE file included in the packaging of this file. appearing in the LICENSE file included in the packaging of this file.
libCGAL::QGLViewer uses dual licensing. Commercial/proprietary software must
purchase a libCGAL::QGLViewer Commercial License.
This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
@ -38,8 +34,8 @@
#include <QMouseEvent> #include <QMouseEvent>
using namespace CGAL::qglviewer; namespace CGAL{
using namespace std; namespace qglviewer{
/*! Default constructor. /*! Default constructor.
@ -488,3 +484,5 @@ ManipulatedCameraFrame::pitchYawQuaternion(int x, int y,
camera->screenWidth()); camera->screenWidth());
return rotY * rotX; return rotY * rotX;
} }
}}

View File

@ -3,17 +3,13 @@
Copyright (c) 2018 GeometryFactory Sarl (France). Copyright (c) 2018 GeometryFactory Sarl (France).
Copyright (C) 2002-2014 Gilles Debunne. All rights reserved. Copyright (C) 2002-2014 Gilles Debunne. All rights reserved.
This file is part of a fork of the CGAL::QGLViewer library version 2.7.0. This file is part of a fork of the QGLViewer library version 2.7.0.
http://www.libqglviewer.com - contact@libqglviewer.com http://www.libqglviewer.com - contact@libqglviewer.com
This file may be used under the terms of the GNU General Public License This file may be used under the terms of the GNU General Public License
version 3.0 as published by the Free Software Foundation and version 3.0 as published by the Free Software Foundation and
appearing in the LICENSE file included in the packaging of this file. appearing in the LICENSE file included in the packaging of this file.
libCGAL::QGLViewer uses dual licensing. Commercial/proprietary software must
purchase a libCGAL::QGLViewer Commercial License.
This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

View File

@ -3,17 +3,13 @@
Copyright (c) 2018 GeometryFactory Sarl (France). Copyright (c) 2018 GeometryFactory Sarl (France).
Copyright (C) 2002-2014 Gilles Debunne. All rights reserved. Copyright (C) 2002-2014 Gilles Debunne. All rights reserved.
This file is part of a fork of the CGAL::QGLViewer library version 2.7.0. This file is part of a fork of the QGLViewer library version 2.7.0.
http://www.libqglviewer.com - contact@libqglviewer.com http://www.libqglviewer.com - contact@libqglviewer.com
This file may be used under the terms of the GNU General Public License This file may be used under the terms of the GNU General Public License
version 3.0 as published by the Free Software Foundation and version 3.0 as published by the Free Software Foundation and
appearing in the LICENSE file included in the packaging of this file. appearing in the LICENSE file included in the packaging of this file.
libCGAL::QGLViewer uses dual licensing. Commercial/proprietary software must
purchase a libCGAL::QGLViewer Commercial License.
This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
@ -40,8 +36,9 @@
#include <QMouseEvent> #include <QMouseEvent>
using namespace CGAL::qglviewer; namespace CGAL{
using namespace std; namespace qglviewer{
/*! Default constructor. /*! Default constructor.
@ -592,3 +589,4 @@ ManipulatedFrame::deformedBallQuaternion(int x, int y, qreal cx, qreal cy,
return Quaternion(axis, angle); return Quaternion(axis, angle);
} }
#endif // DOXYGEN #endif // DOXYGEN
}}

View File

@ -3,17 +3,13 @@
Copyright (c) 2018 GeometryFactory Sarl (France). Copyright (c) 2018 GeometryFactory Sarl (France).
Copyright (C) 2002-2014 Gilles Debunne. All rights reserved. Copyright (C) 2002-2014 Gilles Debunne. All rights reserved.
This file is part of a fork of the CGAL::QGLViewer library version 2.7.0. This file is part of a fork of the QGLViewer library version 2.7.0.
http://www.libqglviewer.com - contact@libqglviewer.com http://www.libqglviewer.com - contact@libqglviewer.com
This file may be used under the terms of the GNU General Public License This file may be used under the terms of the GNU General Public License
version 3.0 as published by the Free Software Foundation and version 3.0 as published by the Free Software Foundation and
appearing in the LICENSE file included in the packaging of this file. appearing in the LICENSE file included in the packaging of this file.
libCGAL::QGLViewer uses dual licensing. Commercial/proprietary software must
purchase a libCGAL::QGLViewer Commercial License.
This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

View File

@ -3,17 +3,13 @@
Copyright (c) 2018 GeometryFactory Sarl (France). Copyright (c) 2018 GeometryFactory Sarl (France).
Copyright (C) 2002-2014 Gilles Debunne. All rights reserved. Copyright (C) 2002-2014 Gilles Debunne. All rights reserved.
This file is part of a fork of the CGAL::QGLViewer library version 2.7.0. This file is part of a fork of the QGLViewer library version 2.7.0.
http://www.libqglviewer.com - contact@libqglviewer.com http://www.libqglviewer.com - contact@libqglviewer.com
This file may be used under the terms of the GNU General Public License This file may be used under the terms of the GNU General Public License
version 3.0 as published by the Free Software Foundation and version 3.0 as published by the Free Software Foundation and
appearing in the LICENSE file included in the packaging of this file. appearing in the LICENSE file included in the packaging of this file.
libCGAL::QGLViewer uses dual licensing. Commercial/proprietary software must
purchase a libCGAL::QGLViewer Commercial License.
This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
@ -33,7 +29,9 @@
#include <CGAL/Qt/mouseGrabber.h> #include <CGAL/Qt/mouseGrabber.h>
using namespace CGAL::qglviewer; namespace CGAL{
namespace qglviewer{
// Static private variable // Static private variable
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
@ -95,3 +93,4 @@ void MouseGrabber::clearMouseGrabberPool(bool autoDelete) {
qDeleteAll(MouseGrabber::MouseGrabberPool()); qDeleteAll(MouseGrabber::MouseGrabberPool());
MouseGrabber::MouseGrabberPool().clear(); MouseGrabber::MouseGrabberPool().clear();
} }
}}

View File

@ -4,16 +4,12 @@
Copyright (C) 2002-2014 Gilles Debunne. All rights reserved. Copyright (C) 2002-2014 Gilles Debunne. All rights reserved.
This file is part of a fork of the QGLViewer library version 2.7.0. This file is part of a fork of the QGLViewer library version 2.7.0.
http://www.libqglviewer.com - contact@libqglviewer.com http://www.libqglviewer.com - contact@libqglviewer.com
This file may be used under the terms of the GNU General Public License This file may be used under the terms of the GNU General Public License
version 3.0 as published by the Free Software Foundation and version 3.0 as published by the Free Software Foundation and
appearing in the LICENSE file included in the packaging of this file. appearing in the LICENSE file included in the packaging of this file.
libQGLViewer uses dual licensing. Commercial/proprietary software must
purchase a libQGLViewer Commercial License.
This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
@ -218,7 +214,10 @@ public Q_SLOTS:
also setForegroundColor(). */ also setForegroundColor(). */
void setBackgroundColor(const QColor &color) { void setBackgroundColor(const QColor &color) {
backgroundColor_ = color; backgroundColor_ = color;
glClearColor(color.redF(), color.greenF(), color.blueF(), color.alphaF()); glClearColor(GLclampf(color.redF()),
GLclampf(color.greenF()),
GLclampf(color.blueF()),
GLclampf(color.alphaF()));
} }
/*! Sets the foregroundColor() of the viewer, used to draw visual hints. See /*! Sets the foregroundColor() of the viewer, used to draw visual hints. See
* also setBackgroundColor(). */ * also setBackgroundColor(). */

File diff suppressed because it is too large Load Diff

View File

@ -3,17 +3,13 @@
Copyright (c) 2018 GeometryFactory Sarl (France). Copyright (c) 2018 GeometryFactory Sarl (France).
Copyright (C) 2002-2014 Gilles Debunne. All rights reserved. Copyright (C) 2002-2014 Gilles Debunne. All rights reserved.
This file is part of a fork of the CGAL::QGLViewer library version 2.7.0. This file is part of a fork of the QGLViewer library version 2.7.0.
http://www.libqglviewer.com - contact@libqglviewer.com http://www.libqglviewer.com - contact@libqglviewer.com
This file may be used under the terms of the GNU General Public License This file may be used under the terms of the GNU General Public License
version 3.0 as published by the Free Software Foundation and version 3.0 as published by the Free Software Foundation and
appearing in the LICENSE file included in the packaging of this file. appearing in the LICENSE file included in the packaging of this file.
libCGAL::QGLViewer uses dual licensing. Commercial/proprietary software must
purchase a libCGAL::QGLViewer Commercial License.
This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

View File

@ -3,17 +3,13 @@
Copyright (c) 2018 GeometryFactory Sarl (France). Copyright (c) 2018 GeometryFactory Sarl (France).
Copyright (C) 2002-2014 Gilles Debunne. All rights reserved. Copyright (C) 2002-2014 Gilles Debunne. All rights reserved.
This file is part of a fork of the CGAL::QGLViewer library version 2.7.0. This file is part of a fork of the QGLViewer library version 2.7.0.
http://www.libqglviewer.com - contact@libqglviewer.com http://www.libqglviewer.com - contact@libqglviewer.com
This file may be used under the terms of the GNU General Public License This file may be used under the terms of the GNU General Public License
version 3.0 as published by the Free Software Foundation and version 3.0 as published by the Free Software Foundation and
appearing in the LICENSE file included in the packaging of this file. appearing in the LICENSE file included in the packaging of this file.
libCGAL::QGLViewer uses dual licensing. Commercial/proprietary software must
purchase a libCGAL::QGLViewer Commercial License.
This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

View File

@ -3,17 +3,13 @@
Copyright (c) 2018 GeometryFactory Sarl (France). Copyright (c) 2018 GeometryFactory Sarl (France).
Copyright (C) 2002-2014 Gilles Debunne. All rights reserved. Copyright (C) 2002-2014 Gilles Debunne. All rights reserved.
This file is part of a fork of the CGAL::QGLViewer library version 2.7.0. This file is part of a fork of the QGLViewer library version 2.7.0.
http://www.libqglviewer.com - contact@libqglviewer.com http://www.libqglviewer.com - contact@libqglviewer.com
This file may be used under the terms of the GNU General Public License This file may be used under the terms of the GNU General Public License
version 3.0 as published by the Free Software Foundation and version 3.0 as published by the Free Software Foundation and
appearing in the LICENSE file included in the packaging of this file. appearing in the LICENSE file included in the packaging of this file.
libCGAL::QGLViewer uses dual licensing. Commercial/proprietary software must
purchase a libCGAL::QGLViewer Commercial License.
This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
@ -36,8 +32,9 @@
#include <stdlib.h> // RAND_MAX #include <stdlib.h> // RAND_MAX
// All the methods are declared inline in Quaternion.h // All the methods are declared inline in Quaternion.h
using namespace CGAL::qglviewer; namespace CGAL{
using namespace std; namespace qglviewer{
/*! Constructs a Quaternion that will rotate from the \p from direction to the /*! Constructs a Quaternion that will rotate from the \p from direction to the
\p to direction. \p to direction.
@ -533,7 +530,7 @@ Quaternion Quaternion::squadTangent(const Quaternion &before,
} }
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
ostream &operator<<(ostream &o, const Quaternion &Q) { std::ostream &operator<<(std::ostream &o, const Quaternion &Q) {
return o << Q[0] << '\t' << Q[1] << '\t' << Q[2] << '\t' << Q[3]; return o << Q[0] << '\t' << Q[1] << '\t' << Q[2] << '\t' << Q[3];
} }
@ -559,3 +556,4 @@ Quaternion Quaternion::randomQuaternion() {
qreal t2 = 2.0 * CGAL_PI * (rand() / (qreal)RAND_MAX); qreal t2 = 2.0 * CGAL_PI * (rand() / (qreal)RAND_MAX);
return Quaternion(sin(t1) * r1, cos(t1) * r1, sin(t2) * r2, cos(t2) * r2); return Quaternion(sin(t1) * r1, cos(t1) * r1, sin(t2) * r2, cos(t2) * r2);
} }
}}

View File

@ -3,17 +3,13 @@
Copyright (c) 2018 GeometryFactory Sarl (France). Copyright (c) 2018 GeometryFactory Sarl (France).
Copyright (C) 2002-2014 Gilles Debunne. All rights reserved. Copyright (C) 2002-2014 Gilles Debunne. All rights reserved.
This file is part of a fork of the CGAL::QGLViewer library version 2.7.0. This file is part of a fork of the QGLViewer library version 2.7.0.
http://www.libqglviewer.com - contact@libqglviewer.com http://www.libqglviewer.com - contact@libqglviewer.com
This file may be used under the terms of the GNU General Public License This file may be used under the terms of the GNU General Public License
version 3.0 as published by the Free Software Foundation and version 3.0 as published by the Free Software Foundation and
appearing in the LICENSE file included in the packaging of this file. appearing in the LICENSE file included in the packaging of this file.
libCGAL::QGLViewer uses dual licensing. Commercial/proprietary software must
purchase a libCGAL::QGLViewer Commercial License.
This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

View File

@ -3,17 +3,13 @@
Copyright (c) 2018 GeometryFactory Sarl (France). Copyright (c) 2018 GeometryFactory Sarl (France).
Copyright (C) 2002-2014 Gilles Debunne. All rights reserved. Copyright (C) 2002-2014 Gilles Debunne. All rights reserved.
This file is part of a fork of the CGAL::QGLViewer library version 2.7.0. This file is part of a fork of the QGLViewer library version 2.7.0.
http://www.libqglviewer.com - contact@libqglviewer.com http://www.libqglviewer.com - contact@libqglviewer.com
This file may be used under the terms of the GNU General Public License This file may be used under the terms of the GNU General Public License
version 3.0 as published by the Free Software Foundation and version 3.0 as published by the Free Software Foundation and
appearing in the LICENSE file included in the packaging of this file. appearing in the LICENSE file included in the packaging of this file.
libCGAL::QGLViewer uses dual licensing. Commercial/proprietary software must
purchase a libCGAL::QGLViewer Commercial License.
This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
@ -36,8 +32,9 @@
// Most of the methods are declared inline in vec.h // Most of the methods are declared inline in vec.h
using namespace CGAL::qglviewer; namespace CGAL{
using namespace std; namespace qglviewer{
/*! Projects the Vec on the axis of direction \p direction that passes through /*! Projects the Vec on the axis of direction \p direction that passes through
the origin. the origin.
@ -178,6 +175,7 @@ void Vec::initFromDOMElement(const QDomElement &element) {
} }
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
ostream &operator<<(ostream &o, const Vec &v) { std::ostream &operator<<(std::ostream &o, const Vec &v) {
return o << v.x << '\t' << v.y << '\t' << v.z; return o << v.x << '\t' << v.y << '\t' << v.z;
} }
}}

View File

@ -3,17 +3,13 @@
Copyright (c) 2018 GeometryFactory Sarl (France). Copyright (c) 2018 GeometryFactory Sarl (France).
Copyright (C) 2002-2014 Gilles Debunne. All rights reserved. Copyright (C) 2002-2014 Gilles Debunne. All rights reserved.
This file is part of a fork of the CGAL::QGLViewer library version 2.7.0. This file is part of a fork of the QGLViewer library version 2.7.0.
http://www.libqglviewer.com - contact@libqglviewer.com http://www.libqglviewer.com - contact@libqglviewer.com
This file may be used under the terms of the GNU General Public License This file may be used under the terms of the GNU General Public License
version 3.0 as published by the Free Software Foundation and version 3.0 as published by the Free Software Foundation and
appearing in the LICENSE file included in the packaging of this file. appearing in the LICENSE file included in the packaging of this file.
libCGAL::QGLViewer uses dual licensing. Commercial/proprietary software must
purchase a libCGAL::QGLViewer Commercial License.
This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

View File

@ -1,20 +1,34 @@
Release History Release History
=============== ===============
Release 4.13 Release 4.13
------------ ------------
Release date: September 2018 Release date: September 2018
### Polygon Mesh Processing ### Installation
- Added a function in Polygon Mesh Processing to perform an extrusion of an open polygon mesh:
- `CGAL::Polygon_mesh_processing::extrude_mesh()` - The library CGAL_Qt5 now contains a fork of the version 2.7.0 of libQGLViewer.
The corresponding code is in the package GraphicsView.
The dependency for the external library libQGLViewer is therefore dropped for all demos.
### General
- A new function `CGAL::draw()` is added in the packages Polyhedral
Surface, Surface Mesh, Linear Cell Complex, 2D Triangulations, and 3D
Triangulations, enabling to draw the corresponding data structures.
### 2D and 3D Linear Geometry Kernel ### 2D and 3D Linear Geometry Kernel
- An operator() that takes a Ray_3 has been added to the concept - An operator() that takes a Ray_3 has been added to the concept
ConstructProjectedPoint 3. ConstructProjectedPoint 3.
### CGAL and Boost Property Maps
- Addition of a read-write property map to convert on-the-fly geometric
object from Cartesian kernels
### 2D Triangulations ### 2D Triangulations
- Added a new type of intersection to deal with insertion of a constraints - Added a new type of intersection to deal with insertion of a constraints
@ -37,9 +51,47 @@ Release date: September 2018
in the code but did not appear in the concepts). in the code but did not appear in the concepts).
### Polygon Mesh Processing ### Polygon Mesh Processing
- Added a function to apply a transformation to a mesh : - Added a function to apply a transformation to a mesh:
- `CGAL::Polygon_mesh_processing::transform()` - `CGAL::Polygon_mesh_processing::transform()`
- Fix a bug in `isotropic_remeshing()` making constrained vertices missing in the output
- Guarantee that constrained vertices are kept in the mesh after calling `isotropic_remeshing()`
(and not only the points associated to constrained vertices as it was before).
- Added a function in Polygon Mesh Processing to perform an extrusion of an open polygon mesh:
- `CGAL::Polygon_mesh_processing::extrude_mesh()`
### 3D Mesh Generation
- **Breaking change:** The template parameters of the class template
`Labeled_mesh_domain_3` have been simplified. The three constructors of
that class template have been replaced by a new unique constructor
using Boost named parameters. Three new static template member
functions that act as named constructors have been added:
- `create_gray_image_mesh_domain()`, to create a domain from a 3D
gray image,
- `create_labeled_image_mesh_domain()`, to create a domain from a 3D
labeled image, and
- `create_implicit_mesh_domain()`, to create a domain from an
implicit function.
- The class templates `Implicit_mesh_domain_3`,
`Gray_image_mesh_domain_3`, and `Labeled_image_mesh_domain_3` are now
deprecated.
- **Breaking change:** The headers
`<CGAL/Mesh_3/Implicit_to_labeled_function_wrapper.h>` and
`<CGAL/Mesh_3/Labeled_mesh_domain_3.h>`, that were deprecated since
CGAL 4.5, are now removed.
### CGAL and the Boost Graph Library (BGL)
- Add helper function `CGAL::is_valid_polygon_mesh` that checks the
validity of a polygon mesh using BGL functions.
- Improve the function `CGAL::Euler::collapse_edge` so that the target
vertex of the collapsed edge is always kept after the collapse.
Release 4.12 Release 4.12
------------ ------------
@ -214,9 +266,6 @@ Release date: April 2018
### CGAL and the Boost Graph Library (BGL) ### CGAL and the Boost Graph Library (BGL)
- Add helper function `CGAL::is_valid_polygon_mesh` that checks the
validity of a polygon mesh using BGL functions.
- Add helper function `CGAL::expand_face_selection_for_removal` that - Add helper function `CGAL::expand_face_selection_for_removal` that
expands a face selection to avoid creating a non manifold mesh when expands a face selection to avoid creating a non manifold mesh when
removing the selected faces. removing the selected faces.

View File

@ -863,10 +863,8 @@ endif()
if(NOT CGAL_HEADER_ONLY) if(NOT CGAL_HEADER_ONLY)
create_CGALconfig_files() create_CGALconfig_files()
else() else()
if(NOT EXISTS "${CMAKE_BINARY_DIR}/CGALConfig.cmake") configure_file("${CGAL_MODULES_DIR}/CGALConfig_binary_header_only.cmake.in"
configure_file("${CGAL_MODULES_DIR}/CGALConfig_binary_header_only.cmake.in" "${CMAKE_BINARY_DIR}/CGALConfig.cmake" @ONLY)
"${CMAKE_BINARY_DIR}/CGALConfig.cmake" @ONLY)
endif()
endif() endif()
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------

View File

@ -63,9 +63,6 @@ CGAL packages, some are only needed for demos.
- Qt5 (>= 5.3) - Qt5 (>= 5.3)
http://qt-project.org/ http://qt-project.org/
- libQGLViewer
http://www.libqglviewer.com/
- Geomview - Geomview
http://www.geomview.org/ http://www.geomview.org/
Not supported with Visual C++ Not supported with Visual C++

View File

@ -1,81 +0,0 @@
# - Try to find QGLViewer
# Once done this will define
#
# QGLVIEWER_FOUND - system has QGLViewer
# QGLVIEWER_INCLUDE_DIR - the QGLViewer include directory
# QGLVIEWER_LIBRARIES - Link these to use QGLViewer
# QGLVIEWER_DEFINITIONS - Compiler switches required for using QGLViewer
#
if(POLICY CMP0072)
# About the use of OpenGL
cmake_policy(SET CMP0072 NEW)
endif()
find_package(OpenGL QUIET)
find_package(Qt5 QUIET COMPONENTS OpenGL Xml)
# first look in user defined locations
find_path(QGLVIEWER_INCLUDE_DIR
NAMES QGLViewer/qglviewer.h
NO_DEFAULT_PATH
PATHS ENV QGLVIEWERROOT
/usr/local/include
)
find_library(QGLVIEWER_LIBRARY_RELEASE
NAMES qglviewer-qt5 qglviewer QGLViewer-qt5 QGLViewer QGLViewer2-qt5 QGLViewer2
NO_DEFAULT_PATH
PATHS ENV QGLVIEWERROOT
ENV LD_LIBRARY_PATH
ENV LIBRARY_PATH
/usr/local/lib
PATH_SUFFIXES QGLViewer QGLViewer/release
)
find_library(QGLVIEWER_LIBRARY_DEBUG
NAMES dqglviewer dQGLViewer-qt5 dQGLViewer dQGLViewer2-qt5 dQGLViewer2 QGLViewerd2-qt5 QGLViewerd2
NO_DEFAULT_PATH
PATHS /usr/local/lib
ENV QGLVIEWERROOT
ENV LD_LIBRARY_PATH
ENV LIBRARY_PATH
PATH_SUFFIXES QGLViewer QGLViewer/debug
)
#now try the standard paths
if (NOT QGLVIEWER_INCLUDE_DIR OR NOT QGLVIEWER_LIBRARY_RELEASE OR NOT QGLVIEWER_LIBRARY_DEBUG)
find_path(QGLVIEWER_INCLUDE_DIR
NAMES QGLViewer/qglviewer.h)
find_library(QGLVIEWER_LIBRARY_RELEASE
NAMES qglviewer-qt5 qglviewer QGLViewer-qt5 QGLViewer QGLViewer2-qt5 QGLViewer2)
find_library(QGLVIEWER_LIBRARY_DEBUG
NAMES dqglviewer dQGLViewer-qt5 dQGLViewer dQGLViewer2-qt5 dQGLViewer2 QGLViewerd2-qt5 QGLViewerd2)
endif()
if(QGLVIEWER_LIBRARY_RELEASE)
if(QGLVIEWER_LIBRARY_DEBUG)
set(QGLVIEWER_LIBRARIES_ Qt5::Xml Qt5::OpenGL ${OPENGL_LIBRARIES} optimized ${QGLVIEWER_LIBRARY_RELEASE} debug ${QGLVIEWER_LIBRARY_DEBUG})
else()
set(QGLVIEWER_LIBRARIES_ Qt5::Xml Qt5::OpenGL ${OPENGL_LIBRARIES} ${QGLVIEWER_LIBRARY_RELEASE})
endif()
set(QGLVIEWER_LIBRARIES ${QGLVIEWER_LIBRARIES_} CACHE FILEPATH "The QGLViewer library")
endif()
IF(QGLVIEWER_INCLUDE_DIR AND QGLVIEWER_LIBRARIES)
SET(QGLVIEWER_FOUND TRUE)
ENDIF(QGLVIEWER_INCLUDE_DIR AND QGLVIEWER_LIBRARIES)
IF(QGLVIEWER_FOUND)
IF(NOT QGLViewer_FIND_QUIETLY)
MESSAGE(STATUS "Found QGLViewer: ${QGLVIEWER_LIBRARIES}")
ENDIF(NOT QGLViewer_FIND_QUIETLY)
ELSE(QGLVIEWER_FOUND)
IF(QGLViewer_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find QGLViewer")
ENDIF(QGLViewer_FIND_REQUIRED)
ENDIF(QGLVIEWER_FOUND)

View File

@ -26,20 +26,6 @@ if(NOT USE_CGAL_FILE_INCLUDED)
include(${CMAKE_CURRENT_LIST_DIR}/CGAL_GeneratorSpecificSettings.cmake) include(${CMAKE_CURRENT_LIST_DIR}/CGAL_GeneratorSpecificSettings.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/CGAL_TweakFindBoost.cmake) include(${CMAKE_CURRENT_LIST_DIR}/CGAL_TweakFindBoost.cmake)
set(CGAL_INSTALLED_SCM_BRANCH_NAME ${CGAL_SCM_BRANCH_NAME})
set(CGAL_SCM_BRANCH_NAME "")
if( NOT "${CGAL_INSTALLED_SCM_BRANCH_NAME}" STREQUAL "" )
include(${CMAKE_CURRENT_LIST_DIR}/CGAL_SCM.cmake)
CGAL_detect_git(${CMAKE_SOURCE_DIR})
if ( NOT "${CGAL_SCM_BRANCH_NAME}" STREQUAL "" )
message ( STATUS "Code taken from Git branch: ${CGAL_SCM_BRANCH_NAME}" )
if ( NOT "${CGAL_SCM_BRANCH_NAME}" STREQUAL "${CGAL_INSTALLED_SCM_BRANCH_NAME}")
message (AUTHOR_WARNING "Branch '${CGAL_SCM_BRANCH_NAME}' does not match branch '${CGAL_INSTALLED_SCM_BRANCH_NAME}' from which CGAL has been installed. Please consider rebuilding CGAL from this branch.")
endif()
endif()
endif()
set( CGAL_LIBRARIES ) set( CGAL_LIBRARIES )
foreach ( component ${CGAL_REQUESTED_COMPONENTS} ) foreach ( component ${CGAL_REQUESTED_COMPONENTS} )

View File

@ -0,0 +1,42 @@
// Copyright (C) 2018 GeometryFactory Sarl
//
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 3 of the License,
// or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
// SPDX-License-Identifier: LGPL-3.0+
//
#ifndef CGAL_CARTESIAN_CONVERTER_FWD_H
#define CGAL_CARTESIAN_CONVERTER_FWD_H
/// \file Cartesian_converter_fwd.h
/// Forward declarations of the `Cartesian_converter` class.
#ifndef DOXYGEN_RUNNING
namespace CGAL {
namespace internal {
template < typename K1, typename K2 >
struct Default_converter;
}//internal
template < class K1, class K2,
class Converter = typename internal::Default_converter<K1, K2>::Type >
class Cartesian_converter;
} // CGAL
#endif
#endif /* CGAL_CARTESIAN_CONVERTER_FWD_H */

View File

@ -0,0 +1,33 @@
// Copyright (C) 2018 GeometryFactory Sarl
//
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 3 of the License,
// or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
// SPDX-License-Identifier: LGPL-3.0+
//
#ifndef CGAL_KERNEL_TRAITS_FWD_H
#define CGAL_KERNEL_TRAITS_FWD_H
/// \file Kernel_traits_fwd.h
/// Forward declarations of the `Kernel_traits` class.
#ifndef DOXYGEN_RUNNING
namespace CGAL {
template <class T> struct Kernel_traits;
} // CGAL
#endif
#endif // CGAL_KERNEL_TRAITS_FWD_H

View File

@ -107,6 +107,17 @@
# define BOOST_TT_HAS_POST_INCREMENT_HPP_INCLUDED # define BOOST_TT_HAS_POST_INCREMENT_HPP_INCLUDED
#endif #endif
// Macro used by Boost Parameter. Mesh_3 needs at least 12, before the
// Boost Parameter headers are included: <boost/parameter/config.hpp>
// defines the value to 8, if it is not yet defined.
// The CGAL BGL properties mechanism includes
// <boost/graph/named_function_params.hpp>, that includes
// <boost/parameter/name.hpp>, and maybe other Boost libraries may use
// Boost Parameter as well.
// That is why that is important to define that macro as early as possible,
// in <CGAL/config.h>
#define BOOST_PARAMETER_MAX_ARITY 12
// The following header file defines among other things BOOST_PREVENT_MACRO_SUBSTITUTION // The following header file defines among other things BOOST_PREVENT_MACRO_SUBSTITUTION
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/version.hpp> #include <boost/version.hpp>

View File

@ -95,6 +95,11 @@ updates `b` to be the bounding box of `b` and `c` and returns itself.
*/ */
Bbox_2& operator+=(const Bbox_2 &c); Bbox_2& operator+=(const Bbox_2 &c);
/*!
dilates the bounding box by a specified number of ULP.
*/
void dilate(int dist);
/// @} /// @}
}; /* end Bbox_2 */ }; /* end Bbox_2 */

View File

@ -109,6 +109,10 @@ updates `b` to be the bounding box of `b` and `c` and returns itself.
*/ */
Bbox_3& operator+=(const Bbox_3 &c); Bbox_3& operator+=(const Bbox_3 &c);
/*!
dilates the bounding box by a specified number of ULP.
*/
void dilate(int dist);
/// @} /// @}
}; /* end Bbox_3 */ }; /* end Bbox_3 */

View File

@ -61,7 +61,7 @@ public:
/*! /*!
introduces a weighted point with coordinates `x`, `y`, `z` and weight `0`. introduces a weighted point with coordinates `x`, `y`, `z` and weight `0`.
*/ */
Weighted_point_3(const Kernel::FT& x, const Kernel::FT& y, const Kernel::FT& Z); Weighted_point_3(const Kernel::FT& x, const Kernel::FT& y, const Kernel::FT& z);
/// @} /// @}

View File

@ -30,6 +30,7 @@
#include <CGAL/IO/io.h> #include <CGAL/IO/io.h>
#include <CGAL/Dimension.h> #include <CGAL/Dimension.h>
#include <CGAL/array.h> #include <CGAL/array.h>
#include <boost/math/special_functions/next.hpp>
namespace CGAL { namespace CGAL {
@ -76,6 +77,7 @@ public:
inline Bbox_2 operator+(const Bbox_2 &b) const; inline Bbox_2 operator+(const Bbox_2 &b) const;
inline Bbox_2& operator+=(const Bbox_2 &b); inline Bbox_2& operator+=(const Bbox_2 &b);
inline void dilate(int dist);
}; };
inline inline
@ -156,7 +158,17 @@ Bbox_2::operator+=(const Bbox_2& b)
rep[3] = (std::max)(ymax(), b.ymax()); rep[3] = (std::max)(ymax(), b.ymax());
return *this; return *this;
} }
inline
void
Bbox_2::dilate(int dist)
{
using boost::math::float_advance;
float_advance(rep[0],-dist);
float_advance(rep[1],-dist);
float_advance(rep[2],dist);
float_advance(rep[3],dist);
}
inline inline
bool bool
do_overlap(const Bbox_2 &bb1, const Bbox_2 &bb2) do_overlap(const Bbox_2 &bb1, const Bbox_2 &bb2)

View File

@ -31,6 +31,7 @@
#include <CGAL/IO/io.h> #include <CGAL/IO/io.h>
#include <CGAL/Dimension.h> #include <CGAL/Dimension.h>
#include <CGAL/array.h> #include <CGAL/array.h>
#include <boost/math/special_functions/next.hpp>
namespace CGAL { namespace CGAL {
@ -78,6 +79,8 @@ public:
Bbox_3 operator+(const Bbox_3& b) const; Bbox_3 operator+(const Bbox_3& b) const;
Bbox_3& operator+=(const Bbox_3& b); Bbox_3& operator+=(const Bbox_3& b);
void dilate(int dist);
}; };
inline inline
@ -176,6 +179,20 @@ Bbox_3::operator+=(const Bbox_3& b)
return *this; return *this;
} }
inline
void
Bbox_3::dilate(int dist)
{
using boost::math::float_advance;
float_advance(rep[0],-dist);
float_advance(rep[1],-dist);
float_advance(rep[2],-dist);
float_advance(rep[3],dist);
float_advance(rep[4],dist);
float_advance(rep[5],dist);
}
inline inline
bool bool
do_overlap(const Bbox_3& bb1, const Bbox_3& bb2) do_overlap(const Bbox_3& bb1, const Bbox_3& bb2)

View File

@ -26,6 +26,7 @@
#ifndef CGAL_KERNEL_TRAITS_H #ifndef CGAL_KERNEL_TRAITS_H
#define CGAL_KERNEL_TRAITS_H #define CGAL_KERNEL_TRAITS_H
#include <CGAL/Kernel_traits_fwd.h>
#include <boost/mpl/has_xxx.hpp> #include <boost/mpl/has_xxx.hpp>
#include <boost/mpl/if.hpp> #include <boost/mpl/if.hpp>

View File

@ -805,6 +805,7 @@ public:
typedef typename Rp::Construct_scaled_vector_3 Construct_scaled_vector_2; typedef typename Rp::Construct_scaled_vector_3 Construct_scaled_vector_2;
typedef typename Rp::Construct_triangle_3 Construct_triangle_2; typedef typename Rp::Construct_triangle_3 Construct_triangle_2;
typedef typename Rp::Construct_line_3 Construct_line_2; typedef typename Rp::Construct_line_3 Construct_line_2;
typedef typename Rp::Construct_bbox_3 Construct_bbox_2;
struct Less_xy_2 { struct Less_xy_2 {
typedef bool result_type; typedef bool result_type;
@ -989,6 +990,9 @@ public:
Construct_line_2 construct_line_2_object() const Construct_line_2 construct_line_2_object() const
{return Construct_line_2();} {return Construct_line_2();}
Construct_bbox_2 construct_bbox_2_object() const
{return Construct_bbox_2();}
Compute_scalar_product_2 compute_scalar_product_2_object() const Compute_scalar_product_2 compute_scalar_product_2_object() const
{return Compute_scalar_product_2();} {return Compute_scalar_product_2();}

View File

@ -51,7 +51,7 @@ template <class R>
bool bool
_test_2(const R& r) _test_2(const R& r)
{ {
return return
_test_cls_vector_2(r) _test_cls_vector_2(r)
&& _test_fct_vector_2(r) && _test_fct_vector_2(r)
&& _test_cls_point_2(r) && _test_cls_point_2(r)

View File

@ -45,7 +45,7 @@ bool _test_cls_weighted_point_2(const R& )
RT n2( 50 ); RT n2( 50 );
RT n4( 5); RT n4( 5);
FT iw = -1; FT iw = -1;
int int_w = 1;
CGAL::Point_2<R> p0(n1, n2, n4); CGAL::Point_2<R> p0(n1, n2, n4);
// constructions // constructions
@ -57,6 +57,7 @@ bool _test_cls_weighted_point_2(const R& )
CGAL::Weighted_point_2<R> wp4(iwp); // with R::Weighted_point_2 CGAL::Weighted_point_2<R> wp4(iwp); // with R::Weighted_point_2
CGAL::Weighted_point_2<R> wp5(wp3); // with CGAL::Weighted_point_2< R > CGAL::Weighted_point_2<R> wp5(wp3); // with CGAL::Weighted_point_2< R >
CGAL::Weighted_point_2<R> wp6(n1, n2); // with coordinates CGAL::Weighted_point_2<R> wp6(n1, n2); // with coordinates
CGAL::Weighted_point_2<R> wp7(p0, int_w);
use(wp0); use(wp4); use(wp5); use(wp0); use(wp4); use(wp5);
// assignement // assignement
@ -65,12 +66,18 @@ bool _test_cls_weighted_point_2(const R& )
std::cout << "."; std::cout << ".";
// accessors // accessors
CGAL::Point_2<R> p1 = wp2.point(); CGAL::Point_2<R> p1;
p1 = wp1.point();
p1 = wp2.point();
assert(p1 == p0); assert(p1 == p0);
p1 = wp3.point();
FT w = wp3.weight(); FT w = wp3.weight();
assert(w == iw); assert(w == iw);
w = wp7.weight();
// no need to test the other operations as they use Point_2 operations (which // no need to test the other operations as they use Point_2 operations (which
// are tested in _test_cls_point_2.h) // are tested in _test_cls_point_2.h)

View File

@ -48,11 +48,11 @@ SET(QT_USE_QTSVG TRUE)
SET(QT_USE_QTXML TRUE ) SET(QT_USE_QTXML TRUE )
INCLUDE(${QT_USE_FILE}) INCLUDE(${QT_USE_FILE})
ADD_DEFINITIONS(${QT_DEFINITIONS}) ADD_DEFINITIONS(${QT_DEFINITIONS})
SET (CGoGN_EXT_INCLUDES ${CGoGN_EXT_INCLUDES} ${QT_INCLUDE_DIR} ${QGLVIEWER_INCLUDE_DIR} ) SET (CGoGN_EXT_INCLUDES ${CGoGN_EXT_INCLUDES} ${QT_INCLUDE_DIR} )
SET (CGoGN_EXT_LIBS ${CGoGN_EXT_LIBS} ${QT_LIBRARIES} ${QGLVIEWER_LIBRARIES} ) SET (CGoGN_EXT_LIBS ${CGoGN_EXT_LIBS} ${QT_LIBRARIES} )
add_executable(cgogn_performance_2 performance_2.h cgogn_performance_2.h cgogn_performance_2.cpp) add_executable(cgogn_performance_2 performance_2.h cgogn_performance_2.h cgogn_performance_2.cpp)
target_link_libraries(cgogn_performance_2 algo assimp container nl topology utils Zinri z ${QT_LIBRARIES} ${QGLVIEWER_LIBRARIES} ) target_link_libraries(cgogn_performance_2 algo assimp container nl topology utils Zinri z ${QT_LIBRARIES} )
# Performance_2 # Performance_2
add_executable(performance_2 add_executable(performance_2
@ -68,6 +68,6 @@ add_executable(performance_2
target_link_libraries(performance_2 target_link_libraries(performance_2
${CGAL_LIBRARIES} ${CGAL_LIBRARIES}
surface_mesh surface_mesh
algo assimp container nl topology utils Zinri z ${QT_LIBRARIES} ${QGLVIEWER_LIBRARIES} algo assimp container nl topology utils Zinri z ${QT_LIBRARIES}
${OPENMESH_LIBRARIES} ${OPENMESH_LIBRARIES}
) )

View File

@ -37,11 +37,11 @@ add_definitions(-DINCLUDE_TEMPLATES)
# Performance_3 # Performance_3
add_executable(performance_3 performance_3.cpp) add_executable(performance_3 performance_3.cpp)
add_dependencies(performance_3 OpenVolumeMesh) add_dependencies(performance_3 OpenVolumeMesh)
target_link_libraries(performance_3 OpenVolumeMesh boost_timer boost_system ${CGAL_LIBRARIES} algo assimp container nl topology utils Zinri z xml2 ${QT_LIBRARIES} ${QGLVIEWER_LIBRARIES} ${MAP_VIEWER_LIBRARIES}) target_link_libraries(performance_3 OpenVolumeMesh boost_timer boost_system ${CGAL_LIBRARIES} algo assimp container nl topology utils Zinri z xml2 ${QT_LIBRARIES} ${MAP_VIEWER_LIBRARIES})
# CGoGN # CGoGN
add_executable(cgogn_performance_3 performance_3.h cgogn_performance_3.h cgogn_performance_3.cpp) add_executable(cgogn_performance_3 performance_3.h cgogn_performance_3.h cgogn_performance_3.cpp)
target_link_libraries(cgogn_performance_3 algo assimp container nl topology utils Zinri z xml2 ${QT_LIBRARIES} ${QGLVIEWER_LIBRARIES} ) target_link_libraries(cgogn_performance_3 algo assimp container nl topology utils Zinri z xml2 ${QT_LIBRARIES} )
# LCC_3 # LCC_3
add_executable(lcc_performance_3 performance_3.h lcc_performance_3.h lcc_performance_3.cpp) add_executable(lcc_performance_3 performance_3.h lcc_performance_3.h lcc_performance_3.cpp)

View File

@ -58,7 +58,6 @@ qt5_wrap_ui(uis MainWindow.ui CreateMesh.ui CreateMenger.ui
# qrc files (resources files, that contain icons, at least) # qrc files (resources files, that contain icons, at least)
qt5_add_resources (CGAL_Qt5_RESOURCE_FILES ./Linear_cell_complex_3.qrc) qt5_add_resources (CGAL_Qt5_RESOURCE_FILES ./Linear_cell_complex_3.qrc)
add_executable(Linear_cell_complex_3_demo add_executable(Linear_cell_complex_3_demo
Linear_cell_complex_3_demo.cpp MainWindow.cpp Linear_cell_complex_3_demo.cpp MainWindow.cpp
Viewer.cpp Linear_cell_complex_3_subdivision.cpp Viewer.cpp Linear_cell_complex_3_subdivision.cpp

View File

@ -25,6 +25,7 @@
#include <CGAL/Polyhedron_3_to_lcc.h> #include <CGAL/Polyhedron_3_to_lcc.h>
#include <CGAL/Triangulation_3_to_lcc.h> #include <CGAL/Triangulation_3_to_lcc.h>
#include <QSettings> #include <QSettings>
#include <QHeaderView>
#include <CGAL/Timer.h> #include <CGAL/Timer.h>
#include <CGAL/ipower.h> #include <CGAL/ipower.h>
#include "import_moka.h" #include "import_moka.h"

View File

@ -0,0 +1,15 @@
namespace CGAL {
/*!
\ingroup PkgDrawLinearCellComplex
Open a new window and draw `alcc`, a model of the `LinearCellComplex` concept. The function is blocking, that is the program continues as soon as the user closes the window. This function requires CGAL_Qt5, and is only available if the flag CGAL_USE_BASIC_VIEWER is defined at compile time.
\tparam LCC a model of the `LinearCellComplex` concept.
\param alcc the linear cell complex to draw.
*/
template<class LCC>
void draw(const LCC& alcc);
} /* namespace CGAL */

View File

@ -241,7 +241,7 @@ point: 1 0 0, color: 19
Before applying the sew operation, the eight vertices of the first cube are colored by `1`, and the eight vertices of the second cube by `19`. After the sew operation, there are eight vertices which are merged two by two, and due to the average functor, the color of the four resulting vertices is now 10. Then we insert a vertex in the center of the common 2-cell between the two cubes. The coordinates of this vertex are initialized with the barycenter of the 2-cell (-1,0.5,0.5), and its color is not initialized by the method, thus we set its color manually by using the result of \link LinearCellComplex::insert_barycenter_in_cell `insert_barycenter_in_cell<2>`\endlink which is a dart incident to the new vertex. Before applying the sew operation, the eight vertices of the first cube are colored by `1`, and the eight vertices of the second cube by `19`. After the sew operation, there are eight vertices which are merged two by two, and due to the average functor, the color of the four resulting vertices is now 10. Then we insert a vertex in the center of the common 2-cell between the two cubes. The coordinates of this vertex are initialized with the barycenter of the 2-cell (-1,0.5,0.5), and its color is not initialized by the method, thus we set its color manually by using the result of \link LinearCellComplex::insert_barycenter_in_cell `insert_barycenter_in_cell<2>`\endlink which is a dart incident to the new vertex.
\subsection Linear_cell_complexAutomaticAttributesManagement Automatic attributes management \subsection Linear_cell_complexAutomaticAttributesManagement Automatic Attribute Management
\anchor ssecAttributesManagement \anchor ssecAttributesManagement
The following example illustrates the use of the automatic attributes management for a linear cell complex. An off file is loaded into a 2D linear cell complex embedded in 3D. Then, a certain percentage of edges is removed from the linear cell complex. The same method is applied twice: the first time by using the automatic attributes management (which is the default behaviour) and the second time by calling first \link GenericMap::set_automatic_attributes_management `set_automatic_attributes_management(false)`\endlink to disable the automatic updating of attributes. The following example illustrates the use of the automatic attributes management for a linear cell complex. An off file is loaded into a 2D linear cell complex embedded in 3D. Then, a certain percentage of edges is removed from the linear cell complex. The same method is applied twice: the first time by using the automatic attributes management (which is the default behaviour) and the second time by calling first \link GenericMap::set_automatic_attributes_management `set_automatic_attributes_management(false)`\endlink to disable the automatic updating of attributes.
@ -250,6 +250,19 @@ We can observe that the second run is faster than the first one. Indeed, updatin
\cgalExample{Linear_cell_complex/linear_cell_complex_3_attributes_management.cpp} \cgalExample{Linear_cell_complex/linear_cell_complex_3_attributes_management.cpp}
\subsection Linear_cell_complexDraw Draw a Linear Cell Complex
\anchor ssecDrawLCC
A linear cell complex can be visualized by calling the `CGAL::draw()` function as shown in the following example. This function opens a new window showing the given linear cell complex. The function is blocking, that is the program continues as soon as the user closes the window.
\cgalExample{Linear_cell_complex/draw_linear_cell_complex.cpp}
This function requires CGAL_Qt5, and is only available if the flag CGAL_USE_BASIC_VIEWER is defined at compile time.
\cgalFigureBegin{fig_draw_lcc,draw_lcc.png}
Result of the run of the draw_linear_cell_complex program. A window shows two 3D cubes and allows to navigate through the 3D scene.
\cgalFigureEnd
\section Linear_cell_complexDesign Design and Implementation History \section Linear_cell_complexDesign Design and Implementation History
This package was developed by Guillaume Damiand, with the help of Andreas Fabri, S&eacute;bastien Loriot and Laurent Rineau. Monique Teillaud and Bernd G&auml;rtner contributed to the manual. This package was developed by Guillaume Damiand, with the help of Andreas Fabri, S&eacute;bastien Loriot and Laurent Rineau. Monique Teillaud and Bernd G&auml;rtner contributed to the manual.

View File

@ -19,6 +19,14 @@
/// \defgroup PkgLinearCellComplexOperations Operations for Linear Cell Complex /// \defgroup PkgLinearCellComplexOperations Operations for Linear Cell Complex
/// \ingroup PkgLinearCellComplex /// \ingroup PkgLinearCellComplex
/*! Draw.
\code
#include <CGAL/draw_linear_cell_complex.h>
\endcode
*/
/// \defgroup PkgDrawLinearCellComplex Draw a Linear Cell Complex
/// \ingroup PkgLinearCellComplex
/*! /*!
\addtogroup PkgLinearCellComplex \addtogroup PkgLinearCellComplex
@ -57,14 +65,17 @@
- `CGAL::Linear_cell_complex<d,d2,LCCTraits,Items,Alloc>` - `CGAL::Linear_cell_complex<d,d2,LCCTraits,Items,Alloc>`
## Global Functions ## ## Global Functions ##
### Constructions for Linear cell complex ### ### Constructions for Linear Cell Complex ###
- `CGAL::import_from_plane_graph<LCC>` - `CGAL::import_from_plane_graph<LCC>`
- `CGAL::import_from_triangulation_3<LCC,Triangulation>` - `CGAL::import_from_triangulation_3<LCC,Triangulation>`
- `CGAL::import_from_polyhedron_3<LCC,Polyhedron>` - `CGAL::import_from_polyhedron_3<LCC,Polyhedron>`
### Operations for Linear cell complex ### ### Operations for Linear Cell Complex ###
- `CGAL::compute_normal_of_cell_0<LCC>` - `CGAL::compute_normal_of_cell_0<LCC>`
- `CGAL::compute_normal_of_cell_2<LCC>` - `CGAL::compute_normal_of_cell_2<LCC>`
### Draw a Linear cell complex ###
- `CGAL::draw<LCC>`
*/ */

View File

@ -3,4 +3,5 @@
\example Linear_cell_complex/linear_cell_complex_3.cpp \example Linear_cell_complex/linear_cell_complex_3.cpp
\example Linear_cell_complex/linear_cell_complex_4.cpp \example Linear_cell_complex/linear_cell_complex_4.cpp
\example Linear_cell_complex/linear_cell_complex_3_attributes_management.cpp \example Linear_cell_complex/linear_cell_complex_3_attributes_management.cpp
\example Linear_cell_complex/draw_linear_cell_complex.cpp
*/ */

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -1,33 +0,0 @@
# This file must be included in your CMakeLists.txt to use the basic viewer
# You need to link the libraries in your executable by using
# TARGET_LINK_LIBRARIES( myexec ${BASIC_VIEWER_LIBRARIES})
if ( NOT CGAL_FOUND OR NOT CGAL_Qt5_FOUND)
message(STATUS "NOTICE: Libraries for basic viewer not found "
"(CGAL, Qt5, QGLViewer).")
endif( NOT CGAL_FOUND OR NOT CGAL_Qt5_FOUND)
include( ${CGAL_USE_FILE} )
set(CMAKE_INCLUDE_CURRENT_DIR ON)
FIND_PACKAGE(Qt5 REQUIRED COMPONENTS OpenGL Xml)
find_package(QGLViewer REQUIRED)
find_package(OpenGL REQUIRED)
add_definitions(${QT_DEFINITIONS})
add_definitions(-DQT_NO_KEYWORDS)
include_directories( ${QGLVIEWER_INCLUDE_DIR} )
add_definitions(${QGLVIEWER_DEFINITIONS})
set (BASIC_VIEWER_LIBRARIES ${QT_LIBRARIES} ${QGLVIEWER_LIBRARIES}
${OPENGL_gl_LIBRARY}) # ${OPENGL_glu_LIBRARY}
set(BASIC_VIEWER_MODULES Xml OpenGL)
ADD_DEFINITIONS("-DCGAL_USE_BASIC_VIEWER")
message(STATUS "Libraries for lcc_viewer found. You need to link them "
"in your executable by using "
"TARGET_LINK_LIBRARIES( myexec \${BASIC_VIEWER_LIBRARIES})")
set(USE_BASIC_VIEWER true)

View File

@ -9,14 +9,11 @@ if(NOT POLICY CMP0070 AND POLICY CMP0053)
cmake_policy(SET CMP0053 OLD) cmake_policy(SET CMP0053 OLD)
endif() endif()
# If you want to visualize a linear cell complex, you can use the following viewer find_package(CGAL COMPONENTS Qt5)
# based on qt. Just uncomment the following two lines, plus the lines qt5_use_modules below
# find_package(CGAL COMPONENTS Qt5) if(CGAL_Qt5_FOUND)
# include("CMakeBasicViewerQt.inc") add_definitions(-DCGAL_USE_BASIC_VIEWER -DQT_NO_KEYWORDS)
endif()
# If you don't want to visualize, use the following line (otherwise comment it)
find_package(CGAL QUIET)
# For Gprof. # For Gprof.
# ADD_DEFINITIONS("-pg") # ADD_DEFINITIONS("-pg")
@ -25,50 +22,31 @@ find_package(CGAL QUIET)
# To use valgrind, we must disable rounding math ckeck. # To use valgrind, we must disable rounding math ckeck.
# add_definition(-DCGAL_DISABLE_ROUNDING_MATH_CHECK) # add_definition(-DCGAL_DISABLE_ROUNDING_MATH_CHECK)
if ( CGAL_FOUND ) if (CGAL_FOUND)
include( ${CGAL_USE_FILE} ) include( ${CGAL_USE_FILE} )
include( CGAL_CreateSingleSourceCGALProgram ) include(CGAL_CreateSingleSourceCGALProgram)
include_directories(BEFORE ../../include) include_directories(BEFORE ../../include)
create_single_source_cgal_program( "linear_cell_complex_3.cpp" ) create_single_source_cgal_program("gmap_linear_cell_complex_3.cpp")
create_single_source_cgal_program( "linear_cell_complex_4.cpp" ) create_single_source_cgal_program("linear_cell_complex_3.cpp")
create_single_source_cgal_program(
"linear_cell_complex_3_with_colored_vertices.cpp" )
create_single_source_cgal_program(
"linear_cell_complex_3_with_mypoint.cpp" )
create_single_source_cgal_program("plane_graph_to_lcc_2.cpp")
create_single_source_cgal_program("linear_cell_complex_3_attributes_management.cpp") create_single_source_cgal_program("linear_cell_complex_3_attributes_management.cpp")
create_single_source_cgal_program("linear_cell_complex_3_operations.cpp")
create_single_source_cgal_program("linear_cell_complex_3_with_colored_vertices.cpp")
create_single_source_cgal_program("linear_cell_complex_3_with_mypoint.cpp")
create_single_source_cgal_program("linear_cell_complex_4.cpp")
create_single_source_cgal_program("plane_graph_to_lcc_2.cpp")
create_single_source_cgal_program("voronoi_2.cpp")
create_single_source_cgal_program("voronoi_3.cpp")
add_executable(voronoi_2 voronoi_2.cpp) create_single_source_cgal_program("draw_linear_cell_complex.cpp")
target_link_libraries(voronoi_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} if(CGAL_Qt5_FOUND)
${BASIC_VIEWER_LIBRARIES}) target_link_libraries(draw_linear_cell_complex PUBLIC CGAL::CGAL_Qt5)
if (USE_BASIC_VIEWER) endif()
qt5_use_modules(voronoi_2 ${BASIC_VIEWER_MODULES})
endif(USE_BASIC_VIEWER)
add_executable(voronoi_3 voronoi_3.cpp)
target_link_libraries(voronoi_3 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES}
${BASIC_VIEWER_LIBRARIES})
if (USE_BASIC_VIEWER)
qt5_use_modules(voronoi_3 ${BASIC_VIEWER_MODULES})
endif(USE_BASIC_VIEWER)
create_single_source_cgal_program( "gmap_linear_cell_complex_3.cpp" )
add_executable(linear_cell_complex_3_operations linear_cell_complex_3_operations.cpp)
target_link_libraries(linear_cell_complex_3_operations ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES}
${BASIC_VIEWER_LIBRARIES})
if (USE_BASIC_VIEWER)
qt5_use_modules(linear_cell_complex_3_operations ${BASIC_VIEWER_MODULES})
endif(USE_BASIC_VIEWER)
else() else()
message(STATUS "This program requires the CGAL library, " message(STATUS "This program requires the CGAL library, and will not be compiled.")
"and will not be compiled.")
endif() endif()

View File

@ -0,0 +1,29 @@
#include <CGAL/Linear_cell_complex_for_combinatorial_map.h>
#include <CGAL/draw_linear_cell_complex.h>
typedef CGAL::Linear_cell_complex_for_combinatorial_map<3> LCC;
typedef LCC::Dart_handle Dart_handle;
typedef LCC::Point Point;
int main()
{
LCC lcc;
Dart_handle dh1=
lcc.make_hexahedron(Point(0,0,0), Point(5,0,0),
Point(5,5,0), Point(0,5,0),
Point(0,5,4), Point(0,0,4),
Point(5,0,4), Point(5,5,4));
Dart_handle dh2=
lcc.make_hexahedron(Point(5,0,0), Point(10,0,0),
Point(10,5,0), Point(5,5,0),
Point(5,5,4), Point(5,0,4),
Point(10,0,4), Point(10,5,4));
lcc.sew<3>(lcc.beta(dh1, 1, 1, 2), lcc.beta(dh2, 2));
lcc.display_characteristics(std::cout)<<", valid="
<<lcc.is_valid()<<std::endl;
CGAL::draw(lcc);
return EXIT_SUCCESS;
}

View File

@ -2,11 +2,6 @@
#include <CGAL/Linear_cell_complex_for_generalized_map.h> #include <CGAL/Linear_cell_complex_for_generalized_map.h>
#include <vector> #include <vector>
/* If you want to use a viewer, you can use qglviewer. */
#ifdef CGAL_USE_BASIC_VIEWER
#include "linear_cell_complex_3_viewer_qt.h"
#endif
typedef CGAL::Linear_cell_complex_for_combinatorial_map<3> LCC_3_cmap; typedef CGAL::Linear_cell_complex_for_combinatorial_map<3> LCC_3_cmap;
typedef CGAL::Linear_cell_complex_for_generalized_map<3> LCC_3_gmap; typedef CGAL::Linear_cell_complex_for_generalized_map<3> LCC_3_gmap;
@ -54,10 +49,6 @@ void run_test()
lcc.template sew<3>(lcc.template opposite<2>(lcc.next(dh1)), lcc.template sew<3>(lcc.template opposite<2>(lcc.next(dh1)),
lcc.other_orientation(lcc.template opposite<2>(lcc.previous(dh3)))); lcc.other_orientation(lcc.template opposite<2>(lcc.previous(dh3))));
#ifdef CGAL_USE_BASIC_VIEWER
display_lcc(lcc);
#endif // CGAL_USE_BASIC_VIEWER
lcc.insert_cell_1_in_cell_2(lcc.next(dh1), lcc.insert_cell_1_in_cell_2(lcc.next(dh1),
Alpha1<LCC>::run(lcc, lcc.previous(dh1))); Alpha1<LCC>::run(lcc, lcc.previous(dh1)));
dh2=lcc.template opposite<2>(lcc.next(lcc.next dh2=lcc.template opposite<2>(lcc.next(lcc.next
@ -73,14 +64,9 @@ void run_test()
lcc.insert_cell_2_in_cell_3(path.begin(),path.end()); lcc.insert_cell_2_in_cell_3(path.begin(),path.end());
lcc.display_characteristics(std::cout) << ", valid=" lcc.display_characteristics(std::cout) << ", valid="
<< lcc.is_valid() << std::endl; << lcc.is_valid() << std::endl;
#ifdef CGAL_USE_BASIC_VIEWER
display_lcc(lcc);
#endif // CGAL_USE_BASIC_VIEWER
} }
int main() int main()
{ {
run_test<LCC_3_cmap>(); run_test<LCC_3_cmap>();

View File

@ -1,242 +0,0 @@
// Copyright (c) 2011 CNRS and LIRIS' Establishments (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 3 of the License,
// or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
// SPDX-License-Identifier: LGPL-3.0+
//
// Author(s) : Guillaume Damiand <guillaume.damiand@liris.cnrs.fr>
#ifndef CGAL_LCC_3_VIEWER_QT_H
#define CGAL_LCC_3_VIEWER_QT_H
#include "basic_viewer.h"
#include <CGAL/Linear_cell_complex.h>
#include <CGAL/Cartesian_converter.h>
#include <CGAL/Random.h>
typedef CGAL::Exact_predicates_inexact_constructions_kernel Local_kernel;
typedef Local_kernel::Point_3 Local_point;
typedef Local_kernel::Vector_3 Local_vector;
// Default color functor; user can change it to have its own face color
struct DefaultColorFunctor
{
template<typename LCC>
static CGAL::Color run(const LCC& alcc,
typename LCC::Dart_const_handle dh)
{
if (dh==alcc.null_handle) // use to get the mono color
return CGAL::Color(100, 125, 200); // R G B between 0-255
// Here dh is the smaller dart of its face
CGAL::Random random(alcc.darts().index(dh));
CGAL::Color res;
do
{
res=CGAL::Color(random.get_int(0,256),
random.get_int(0,256),
random.get_int(0,256));
}
while(res.red()==255 && res.green()==255 && res.blue()==255);
return res;
}
};
template<class LCC, int dim=LCC::ambient_dimension>
struct Geom_utils;
template<class LCC>
struct Geom_utils<LCC,3>
{
Local_point get_point(const LCC& lcc,
typename LCC::Vertex_attribute_const_handle vh)
{ return converter(lcc.point_of_vertex_attribute(vh)); }
Local_point get_point(const LCC& lcc, typename LCC::Dart_const_handle dh)
{ return converter(lcc.point(dh)); }
Local_vector get_vertex_normal(const LCC& lcc,
typename LCC::Dart_const_handle dh)
{
Local_vector n = converter(CGAL::compute_normal_of_cell_0<LCC>(lcc,dh));
n = n/(CGAL::sqrt(n*n));
return n;
}
protected:
CGAL::Cartesian_converter<typename LCC::Traits, Local_kernel> converter;
};
template<class LCC>
struct Geom_utils<LCC,2>
{
Local_point get_point(const LCC& lcc,
typename LCC::Vertex_attribute_const_handle vh)
{
Local_point p(converter(lcc.point_of_vertex_attribute(vh).x()),0,
converter(lcc.point_of_vertex_attribute(vh).y()));
return p;
}
Local_point get_point(const LCC& lcc, typename LCC::Dart_const_handle dh)
{ return get_point(lcc, lcc.vertex_attribute(dh)); }
Local_vector get_vertex_normal(const LCC&, typename LCC::Dart_const_handle)
{
Local_vector n(0,-1,0);
return n;
}
protected:
CGAL::Cartesian_converter<typename LCC::Traits, Local_kernel> converter;
};
// Viewer class for LCC
template<class LCC, class ColorFunctor>
class SimpleLCCViewerQt : public Basic_viewer
{
typedef Basic_viewer Base;
typedef typename LCC::Dart_const_handle Dart_const_handle;
public:
/// Construct the viewer.
/// @param alcc the lcc to view
/// @param title the title of the window
/// @param anofaces if true, do not draw faces (faces are not computed; this can be
/// usefull for very big LCC where this time could be long)
SimpleLCCViewerQt(const LCC& alcc, const char* title="", bool anofaces=false) :
Base(title),
lcc(alcc),
m_nofaces(anofaces)
{
compute_elements();
}
protected:
void compute_face(Dart_const_handle dh)
{
// We fill only closed faces.
Dart_const_handle cur=dh;
Dart_const_handle min=dh;
do
{
if (!lcc.is_next_exist(cur)) return; // open face=>not filled
if (cur<min) min=cur;
cur=lcc.next(cur);
}
while(cur!=dh);
CGAL::Color c=ColorFunctor::run(lcc, dh);
if (c.red()<60 || c.green()<60 || c.blue()<60)
mono_face_begin();
else
colored_face_begin(c);
cur=dh;
do
{
add_point_in_face(geomutils.get_point(lcc, cur),
geomutils.get_vertex_normal(lcc, cur));
cur=lcc.next(cur);
}
while(cur!=dh);
face_end();
}
void compute_edge(Dart_const_handle dh)
{
Local_point p1 = geomutils.get_point(lcc, dh);
Dart_const_handle d2 = lcc.other_extremity(dh);
if ( d2!=NULL )
{
Local_point p2 = geomutils.get_point(lcc, d2);
add_mono_segment(p1, p2);
}
}
void compute_vertex(Dart_const_handle dh, bool& empty)
{
Local_point p = geomutils.get_point(lcc, dh);
add_mono_point(p);
}
void compute_elements()
{
clear();
unsigned int markfaces = lcc.get_new_mark();
unsigned int markedges = lcc.get_new_mark();
unsigned int markvertices = lcc.get_new_mark();
bool empty = true;
for (typename LCC::Dart_range::const_iterator it=lcc.darts().begin(),
itend=lcc.darts().end(); it!=itend; ++it )
{
if ( !m_nofaces && !lcc.is_marked(it, markfaces) )
{
compute_face(it);
CGAL::mark_cell<LCC, 2>(lcc, it, markfaces);
}
if ( !lcc.is_marked(it, markedges) )
{
compute_edge(it);
CGAL::mark_cell<LCC, 1>(lcc, it, markedges);
}
if ( !lcc.is_marked(it, markvertices) )
{
compute_vertex(it, empty);
CGAL::mark_cell<LCC, 0>(lcc, it, markvertices);
}
}
lcc.free_mark(markfaces);
lcc.free_mark(markedges);
lcc.free_mark(markvertices);
}
virtual void keyPressEvent(QKeyEvent *e)
{
const Qt::KeyboardModifiers modifiers = e->modifiers();
Base::keyPressEvent(e);
}
protected:
const LCC& lcc;
bool m_nofaces;
Geom_utils<LCC> geomutils;
};
template<class LCC, class ColorFunctor=DefaultColorFunctor>
void display_lcc(const LCC& alcc,
const char* title="",
bool nofill=false)
{
int argc=1;
const char* argv[2]={"lccviewer","\0"};
QApplication app(argc,const_cast<char**>(argv));
SimpleLCCViewerQt<LCC, ColorFunctor> mainwindow(alcc, title, nofill);
mainwindow.show();
app.exec();
}
#endif // CGAL_LCC_3_VIEWER_QT_H

View File

@ -6,10 +6,6 @@
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
/* If you want to use a viewer, you can use qglviewer. */
#ifdef CGAL_USE_BASIC_VIEWER
#include "linear_cell_complex_3_viewer_qt.h"
#endif
// This example works both with cmap and gmap as combinatorial data structure. // This example works both with cmap and gmap as combinatorial data structure.
//typedef CGAL::Linear_cell_complex_for_combinatorial_map<2> LCC_2; //typedef CGAL::Linear_cell_complex_for_combinatorial_map<2> LCC_2;
@ -56,10 +52,6 @@ void display_voronoi(LCC_2& alcc, Dart_handle adart)
alcc.display_characteristics(std::cout) << ", valid=" alcc.display_characteristics(std::cout) << ", valid="
<< alcc.is_valid() << alcc.is_valid()
<< std::endl; << std::endl;
#ifdef CGAL_USE_BASIC_VIEWER
display_lcc(alcc);
#endif // CGAL_USE_BASIC_VIEWER
} }
template<typename LCC, typename TR> template<typename LCC, typename TR>

View File

@ -5,11 +5,6 @@
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
/* If you want to use a viewer, you can use one qglviewer. */
#ifdef CGAL_USE_BASIC_VIEWER
#include "linear_cell_complex_3_viewer_qt.h"
#endif
/* // If you want to use exact constructions. /* // If you want to use exact constructions.
#include <CGAL/Exact_predicates_exact_constructions_kernel.h> #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
typedef CGAL::Linear_cell_complex<3,3, typedef CGAL::Linear_cell_complex<3,3,
@ -59,10 +54,6 @@ void display_voronoi(LCC_3& alcc, Dart_handle adart)
alcc.display_characteristics(std::cout) << ", valid=" alcc.display_characteristics(std::cout) << ", valid="
<< alcc.is_valid() << alcc.is_valid()
<< std::endl; << std::endl;
#ifdef CGAL_USE_BASIC_VIEWER
display_lcc(alcc);
#endif // CGAL_USE_BASIC_VIEWER
} }
template<typename LCC, typename TR> template<typename LCC, typename TR>

View File

@ -0,0 +1,247 @@
// Copyright (c) 2018 CNRS and LIRIS' Establishments (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 3 of the License,
// or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
// SPDX-License-Identifier: LGPL-3.0+
//
// Author(s) : Guillaume Damiand <guillaume.damiand@liris.cnrs.fr>
#ifndef CGAL_DRAW_LCC_H
#define CGAL_DRAW_LCC_H
#include <CGAL/Qt/Basic_viewer_qt.h>
#ifdef CGAL_USE_BASIC_VIEWER
#include <CGAL/Random.h>
namespace CGAL
{
// Default color functor; user can change it to have its own face color
struct DefaultColorFunctorLCC
{
template<typename LCC>
static CGAL::Color run(const LCC& alcc,
typename LCC::Dart_const_handle dh)
{
if (dh==alcc.null_handle) // use to get the mono color
return CGAL::Color(100, 125, 200); // R G B between 0-255
CGAL::Random random((unsigned int)(alcc.darts().index(dh)));
return get_random_color(random);
}
};
template<class LCC, int dim=LCC::ambient_dimension>
struct Geom_utils;
template<class LCC>
struct Geom_utils<LCC, 3>
{
static typename LCC::Vector get_vertex_normal(const LCC& lcc,
typename LCC::Dart_const_handle dh)
{
typename LCC::Vector n = CGAL::compute_normal_of_cell_0<LCC>(lcc,dh);
n = n/(CGAL::sqrt(n*n));
return n;
}
};
template<class LCC>
struct Geom_utils<LCC, 2>
{
static typename LCC::Vector get_vertex_normal(const LCC&,
typename LCC::Dart_const_handle)
{
typename LCC::Vector res=CGAL::NULL_VECTOR;
return res;
}
};
// Viewer class for LCC
template<class LCC, class ColorFunctor>
class SimpleLCCViewerQt : public Basic_viewer_qt
{
typedef Basic_viewer_qt Base;
typedef typename LCC::Dart_const_handle Dart_const_handle;
typedef typename LCC::Traits Kernel;
typedef typename Kernel::Point Point;
typedef typename Kernel::Vector Vector;
public:
/// Construct the viewer.
/// @param alcc the lcc to view
/// @param title the title of the window
/// @param anofaces if true, do not draw faces (faces are not computed; this can be
/// usefull for very big object where this time could be long)
SimpleLCCViewerQt(QWidget* parent,
const LCC& alcc,
const char* title="Basic LCC Viewer",
bool anofaces=false,
const ColorFunctor& fcolor=ColorFunctor()) :
// First draw: vertices; edges, faces; multi-color; inverse normal
Base(parent, title, true, true, true, false, true),
lcc(alcc),
m_nofaces(anofaces),
m_fcolor(fcolor)
{
compute_elements();
}
protected:
void compute_face(Dart_const_handle dh)
{
// We fill only closed faces.
Dart_const_handle cur=dh;
Dart_const_handle min=dh;
do
{
if (!lcc.is_next_exist(cur)) return; // open face=>not filled
if (cur<min) min=cur;
cur=lcc.next(cur);
}
while(cur!=dh);
CGAL::Color c=m_fcolor.run(lcc, dh);
face_begin(c);
cur=dh;
do
{
add_point_in_face(lcc.point(cur),
Geom_utils<LCC>::get_vertex_normal(lcc, cur));
cur=lcc.next(cur);
}
while(cur!=dh);
face_end();
}
void compute_edge(Dart_const_handle dh)
{
Point p1 = lcc.point(dh);
Dart_const_handle d2 = lcc.other_extremity(dh);
if (d2!=NULL)
{ add_segment(p1, lcc.point(d2)); }
}
void compute_vertex(Dart_const_handle dh)
{ add_point(lcc.point(dh)); }
void compute_elements()
{
clear();
typename LCC::size_type markfaces = lcc.get_new_mark();
typename LCC::size_type markedges = lcc.get_new_mark();
typename LCC::size_type markvertices = lcc.get_new_mark();
for (typename LCC::Dart_range::const_iterator it=lcc.darts().begin(),
itend=lcc.darts().end(); it!=itend; ++it )
{
if ( !m_nofaces && !lcc.is_marked(it, markfaces) )
{
compute_face(it);
CGAL::mark_cell<LCC, 2>(lcc, it, markfaces);
}
if ( !lcc.is_marked(it, markedges) )
{
compute_edge(it);
CGAL::mark_cell<LCC, 1>(lcc, it, markedges);
}
if ( !lcc.is_marked(it, markvertices) )
{
compute_vertex(it);
CGAL::mark_cell<LCC, 0>(lcc, it, markvertices);
}
}
lcc.free_mark(markfaces);
lcc.free_mark(markedges);
lcc.free_mark(markvertices);
}
virtual void keyPressEvent(QKeyEvent *e)
{
// Test key pressed:
// const ::Qt::KeyboardModifiers modifiers = e->modifiers();
// if ((e->key()==Qt::Key_PageUp) && (modifiers==Qt::NoButton)) { ... }
// Call: * compute_elements() if the model changed, followed by
// * redraw() if some viewing parameters changed that implies some
// modifications of the buffers
// (eg. type of normal, color/mono)
// * update() just to update the drawing
// Call the base method to process others/classicals key
Base::keyPressEvent(e);
}
protected:
const LCC& lcc;
bool m_nofaces;
const ColorFunctor& m_fcolor;
};
template<class LCC, class ColorFunctor>
void draw(const LCC& alcc,
const char* title,
bool nofill,
const ColorFunctor& fcolor)
{
#if defined(CGAL_TEST_SUITE)
bool cgal_test_suite=true;
#else
bool cgal_test_suite=false;
#endif
if (!cgal_test_suite)
{
int argc=1;
const char* argv[2]={"lccviewer","\0"};
QApplication app(argc,const_cast<char**>(argv));
SimpleLCCViewerQt<LCC, ColorFunctor> mainwindow(app.activeWindow(),
alcc,
title,
nofill,
fcolor);
mainwindow.show();
app.exec();
}
}
template<class LCC>
void draw(const LCC& alcc, const char* title, bool nofill)
{
DefaultColorFunctorLCC c;
draw(alcc, title, nofill, c);
}
template<class LCC>
void draw(const LCC& alcc, const char* title)
{ draw(alcc, title, false); }
template<class LCC>
void draw(const LCC& alcc)
{ draw(alcc, "Basic LCC Viewer"); }
} // End namespace CGAL
#endif // CGAL_USE_BASIC_VIEWER
#endif // CGAL_DRAW_LCC_H

View File

@ -8,6 +8,7 @@ Distance_2
Distance_3 Distance_3
Filtered_kernel Filtered_kernel
Generalized_map Generalized_map
GraphicsView
HalfedgeDS HalfedgeDS
Hash_map Hash_map
Homogeneous_kernel Homogeneous_kernel

View File

@ -32,6 +32,7 @@
#include <CGAL/Mesh_optimization_return_code.h> #include <CGAL/Mesh_optimization_return_code.h>
#include <CGAL/iterator.h> #include <CGAL/iterator.h>
#include <CGAL/boost/parameter.h> #include <CGAL/boost/parameter.h>
#include <boost/parameter/preprocessor.hpp>
#include <fstream> #include <fstream>

View File

@ -3,6 +3,11 @@ namespace CGAL {
/*! /*!
\ingroup PkgMesh_3Domains \ingroup PkgMesh_3Domains
\deprecated The class template `Gray_image_mesh_domain_3` is deprecated
since CGAL-4.13, in favor of the class template `Labeled_mesh_domain_3` and
its static function
`Labeled_mesh_domain_3::create_gray_image_mesh_domain()`.
The class `Gray_image_mesh_domain_3` implements a domain described by a 3D The class `Gray_image_mesh_domain_3` implements a domain described by a 3D
gray image. A 3D gray image is a grid of voxels, gray image. A 3D gray image is a grid of voxels,
where each voxel is associated with a gray level value. where each voxel is associated with a gray level value.
@ -24,8 +29,7 @@ length of the diagonal of the bounding box (in world coordinates) and
\tparam Image is the type of the input image. \tparam Image is the type of the input image.
This parameter must be a model of the concept This parameter must be `CGAL::Image_3`.
`LabeledImage_3`.
\tparam BGT is a geometric traits class which provides \tparam BGT is a geometric traits class which provides
the basic operations to implement the basic operations to implement

View File

@ -0,0 +1,23 @@
namespace CGAL {
/*!
\ingroup PkgMesh_3Domains
The class `Image_3` is a C++ wrapper around the <a
href="http://inrimage.gforge.inria.fr/">InrImage library</a>. It holds a
shared pointer to a 3D image buffer.
*/
class Image_3 {
public:
/// The default-constructor. The object is invalid until a call to `read()`.
Image_3();
/// Open an 3D image file.
///
/// Returns `true` if the file was sucessfully loaded.
bool read(const char* file);
};
} /* end namespace CGAL */

View File

@ -3,6 +3,11 @@ namespace CGAL {
/*! /*!
\ingroup PkgMesh_3Domains \ingroup PkgMesh_3Domains
\deprecated The class template `Implicit_mesh_domain_3` is deprecated
since CGAL-4.13, in favor of the class template `Labeled_mesh_domain_3` and
its static function
`Labeled_mesh_domain_3::create_implicit_mesh_domain()`.
The class `Implicit_mesh_domain_3` implements a domain whose bounding surface is The class `Implicit_mesh_domain_3` implements a domain whose bounding surface is
described described
implicitly as the zero level set of a function. implicitly as the zero level set of a function.

View File

@ -18,7 +18,7 @@ The second one matches the locus of points satisfying f1(p)>0 and f2(p)<0 and f3
This parameter stands for a model of the concept ImplicitFunction described in the surface mesh generation package. This parameter stands for a model of the concept ImplicitFunction described in the surface mesh generation package.
The number types Function::FT and BGT::FT are required to match. The number types Function::FT and BGT::FT are required to match.
\sa `Implicit_mesh_domain_3`. \sa `Labeled_mesh_domain_3`.
*/ */
template<class Function> template<class Function>

View File

@ -3,6 +3,11 @@ namespace CGAL {
/*! /*!
\ingroup PkgMesh_3Domains \ingroup PkgMesh_3Domains
\deprecated The class template `Labeled_image_mesh_domain_3` is deprecated
since CGAL-4.13, in favor of the class template `Labeled_mesh_domain_3` and
its static function
`Labeled_mesh_domain_3::create_labeled_image_mesh_domain()`.
The class `Labeled_image_mesh_domain_3` implements a domain described by a 3D labeled image. A 3D The class `Labeled_image_mesh_domain_3` implements a domain described by a 3D labeled image. A 3D
labeled image is a grid of voxels, where each voxel is associated with an index labeled image is a grid of voxels, where each voxel is associated with an index
(a subdomain index) characterizing the subdomain in which the voxel lies. This (a subdomain index) characterizing the subdomain in which the voxel lies. This
@ -21,8 +26,7 @@ length of the diagonal of the bounding box (in world coordinates) and
\tparam Image is the type of the input image. \tparam Image is the type of the input image.
This parameter must be a model of the concept This parameter must be `CGAL::Image_3`.
`LabeledImage_3`.
\tparam BGT is a geometric traits class which provides \tparam BGT is a geometric traits class which provides
the basic operations to implement the basic operations to implement

View File

@ -11,7 +11,7 @@ Any boundary facet is labeled <a,b>, a<b, where a and b are the
tags of its incident subdomain. tags of its incident subdomain.
Thus, a boundary facet of the domain is labeled <0,b>, where b!=0. Thus, a boundary facet of the domain is labeled <0,b>, where b!=0.
This class includes a function that provides, the subdomain index of any This class includes a <em>labeling function</em> that provides, the subdomain index of any
query point. An intersection between a segment and bounding query point. An intersection between a segment and bounding
surfaces is detected when both segment endpoints are associated with different surfaces is detected when both segment endpoints are associated with different
values of subdomain indices. The intersection is then constructed by bisection. values of subdomain indices. The intersection is then constructed by bisection.
@ -20,18 +20,13 @@ The bisection stops when the query segment is shorter than an error bound
length of the diagonal of the bounding box (in world coordinates), or the radius of the bounding sphere, and length of the diagonal of the bounding box (in world coordinates), or the radius of the bounding sphere, and
a relative error bound passed as argument to the constructor of `Labeled_mesh_domain_3`. a relative error bound passed as argument to the constructor of `Labeled_mesh_domain_3`.
Implicit_mesh_domain_3 is a heir of Labeled_mesh_domain_3. It uses a satisfying labeling function if there is only one component to mesh. This class has a constructor taking a labeling function. It has also three
static template member functions that act as named constructors:
\tparam LabelingFunction is the type of the input function.<br />
This parameter stands for a model of the concept ImplicitFunction described in the surface mesh generation package.<br />
Labeling function f must return 0 if the point isn't located in any subdomain. Usually, the return type of labeling functions are integer.<br />
Let p be a Point.
<ul> <ul>
<li>f(p)=0 means that p is outside domain.</li> <li>`create_gray_image_mesh_domain()`, to create a domain from a 3D gray image,
<li>f(p)=a, a!=0 means that p is inside subdomain a.</li> <li>`create_labeled_image_mesh_domain()`, to create a domain from a 3D labeled image, and
<li>`create_implicit_mesh_domain()`, to create a domain from an implicit function.
</ul> </ul>
Implicit_multi_domain_to_labeling_function_wrapper is a good candidate for this template parameter
if there are several components to mesh.
\tparam BGT is a geometric traits class that provides \tparam BGT is a geometric traits class that provides
the basic operations to implement the basic operations to implement
@ -39,19 +34,229 @@ intersection tests and intersection computations
through a bisection method. This parameter must be instantiated through a bisection method. This parameter must be instantiated
with a model of the concept `BisectionGeometricTraits_3`. with a model of the concept `BisectionGeometricTraits_3`.
\cgalHeading{Labeling function}
A labeling function `f` must return `0` if the point isn't located in any subdomain. The return type of labeling functions is an integer.
Let `p` be a Point.
<ul>
<li>`f(p)=0` means that `p` is outside domain.</li>
<li>`f(p)=a`, `a!=0` means that `p` is inside subdomain `a`.</li>
</ul>
`CGAL::Implicit_multi_domain_to_labeling_function_wrapper` is a good candidate for this template parameter
if there are several components to mesh.
The function type can be any model of the concept `Callable` compatible with the signature `Subdomain_index(const Point_3&)`: it can be a function, a function object, a lambda expression... that takes a `%Point_3` as argument, and returns a type convertible to `Subdomain_index`.
\cgalModels MeshDomain_3 \cgalModels MeshDomain_3
\sa `Implicit_mesh_domain_3`
\sa `Implicit_multi_domain_to_labeling_function_wrapper` \sa `Implicit_multi_domain_to_labeling_function_wrapper`
\sa `CGAL::make_mesh_3()`. \sa `CGAL::make_mesh_3()`.
*/ */
template<class LabelingFunction, class BGT> template<typename BGT>
class Labeled_mesh_domain_3 class Labeled_mesh_domain_3
{ {
public: public:
/// \name Creation /// \name Types
///@{
/// The subdomain index of this model of `MeshDomain_3`.
typedef int Subdomain_index;
/// The type of object that stores the function using type-erasure
typedef CGAL::cpp11::function<Subdomain_index(const Point_3&)> Labeling_function;
///@}
/// \name Types imported from the geometric traits class
///@{
/// The point type of the geometric traits class
typedef typename Geom_traits::Point_3 Point_3;
/// The sphere type of the geometric traits class
typedef typename Geom_traits::Sphere_3 Sphere_3;
/// The iso-cuboid type of the geometric traits class
typedef typename Geom_traits::Iso_cuboid_3 Iso_cuboid_3;
/// The number type (a field type) of the geometric traits class
typedef typename Geom_traits::FT FT;
///@}
/// \name Creation
/// @{
/*! \brief Construction from a function, a bounding
object and a relative error bound.
This constructor uses named parameters (from the <em>Boost Parameter
Library</em>). They can be specified in any order.
\cgalHeading{Named Parameters}
- <b>`parameters::function` (mandatory)</b> the labeling function, compatible with `Labeling_function`.
- <b>`parameters::bounding_object` (mandatory)</b> the bounding object is either a bounding sphere (of type `Sphere_3`), a bounding box (type `Bbox_3`), or a bounding `Iso_cuboid_3`. It bounds the meshable space.
- <b>`parameters::relative_error_bound` (optional)</b> the relative error bound used to compute intersection points between the implicit surface and query segments. The
bisection is stopped when the length of the intersected segment is less than the product of `relative_error_bound` by the diameter of the bounding object. Its default value is `FT(1e-3)`.
\cgalHeading{Example}
From the example (\ref Mesh_3/mesh_implicit_domains_2.cpp):
\snippet Mesh_3/mesh_implicit_domains_2.cpp Domain creation
*/
template <typename ... A_i>
Labeled_mesh_domain_3(const A_i&...);
///@}
/// \name Creation of domains from implicit functions
/*!
\brief Construction from an implicit function
This static method is a <em>named constructor</em>. It constructs a domain
whose bounding surface is described implicitly as the zero level set of a
function. The domain to be discretized is assumed to be the domain where
the function has negative values.
The method takes as argument a bounding sphere which is required to
circumscribe the surface and to have its center inside the domain.
This constructor uses named parameters (from the <em>Boost Parameter
Library</em>). They can be specified in any order.
\cgalHeading{Named Parameters}
<ul>
<li> <b>`parameters::function` (mandatory)</b> the implicit function,
compatible with the signature `FT(Point_3)`: it takes a point as argument,
and returns a scalar value. That object must be model of `CopyConstructible`.
<li> <b>`parameters::bounding_object` (mandatory)</b> the bounding object is
either a bounding sphere (of type `Sphere_3`), a bounding box (type
`Bbox_3`), or a bounding `Iso_cuboid_3`. It must bounds the surface, and
its center must be inside the domain.
</ul>
\cgalHeading{Examples}
From the example (\ref Mesh_3/mesh_implicit_sphere.cpp), where the name of
the parameters is not specified, as they are given is the same order as the
parameters definition:
\snippet Mesh_3/mesh_implicit_sphere.cpp Domain creation
From the example (\ref Mesh_3/mesh_implicit_sphere_variable_size.cpp):
\snippet Mesh_3/mesh_implicit_sphere_variable_size.cpp Domain creation
*/
template <typename ... A_i>
static
Labeled_mesh_domain_3
create_implicit_mesh_domain(A_i&...);
/// \name Creation of domains from 3D images
/*!
\brief Construction from a 3D gray image
This static method is a <em>named constructor</em>. It constructs a domain
described by a 3D gray image. A 3D gray image is a grid of voxels,
where each voxel is associated with a gray level value. Unless otherwise specified by the parameter `image_values_to_subdom_indices`, the domain to
be discretized is the union of voxels that lie inside a surface
described by an isolevel value, called \a isovalue. The voxels lying
inside the domain have gray level values that are larger than the
isovalue.
The value of voxels is interpolated to a gray level value at any query point.
This constructor uses named parameters (from the <em>Boost Parameter
Library</em>). They can be specified in any order.
\cgalHeading{Named Parameters}
The parameters are optional unless otherwise specified.
<ul>
<li> <b>`parameters::image` (mandatory)</b> the input 3D image. Must
be a `CGAL::Image_3` object.
<li><b>`parameters::iso_value`</b> the isovalue, inside
`image`, of the surface describing the boundary of the object to be
meshed. Its default value is `0`.
<li><b>`parameters::image_values_to_subdom_indices`</b> a function or
a function object, compatible with the signature
`Subdomain_index(double)`. This function returns the subdomain index
corresponding to a pixel value. If this parameter is used, then the
parameter `iso_value` is ignored.
<li><b>`parameter::value_outside`</b> the value attached to voxels
outside of the domain to be meshed. It should be lower than
`iso_value`. Its default value is `0`.
<li><b>`parameter::relative_error_bound`</b> is the relative error
bound, relative to the diameter of the box of the image. Its default
value is `FT(1e-3)`. </ul>
\cgalHeading{Examples}
From the example (\ref Mesh_3/mesh_3D_gray_image.cpp), where the name
of the parameters is not specified, as they are given is the same
order as the parameters definition:
\snippet Mesh_3/mesh_3D_gray_image.cpp Domain creation
From the example (\ref Mesh_3/mesh_3D_gray_vtk_image.cpp):
\snippet Mesh_3/mesh_3D_gray_vtk_image.cpp Domain creation
*/
template <typename ... A_i>
static
Labeled_mesh_domain_3
create_gray_image_mesh_domain(A_i&...);
/*!
\brief Construction from a 3D labeled image
This static method is a <em>named constructor</em>. It constructs a
domain described by a 3D labeled image. A 3D labeled image is a grid
of voxels, where each voxel is associated with an index (a subdomain
index) characterizing the subdomain in which the voxel lies. The
domain to be discretized is the union of voxels that have non-zero
values.
This constructor uses named parameters (from the <em>Boost Parameter
Library</em>). They can be specified in any order.
\cgalHeading{Named Parameters}
The parameters are optional unless otherwise specified.
<ul>
<li> <b>`parameters::image` (mandatory)</b> the input 3D image. Must
be a `CGAL::Image_3` object.
<li><b>`parameter::value_outside`</b> the value attached to voxels
outside of the domain to be meshed. Its default value is `0`.
<li><b>`parameter::relative_error_bound`</b> is the relative error
bound, relative to the diameter of the box of the image. Its default
value is `FT(1e-3)`. </ul>
\cgalHeading{Example}
From the example (\ref Mesh_3/mesh_3D_image.cpp):
\snippet Mesh_3/mesh_3D_image.cpp Domain creation
*/
template <typename ... A_i>
static
Labeled_mesh_domain_3
create_labeled_image_mesh_domain(A_i&...);
/// \name Deprecated constructors
///
/// Those three constructors have been deprecated since CGAL-4.13, and
/// replaced by the constructor using the <em>Boost Parameter Library</em>.
///
/// @{ /// @{
/*! /*!
@ -61,8 +266,10 @@ public:
\param relative_error_bound is the relative error bound used to compute intersection points between the implicit surface and query segments. The \param relative_error_bound is the relative error bound used to compute intersection points between the implicit surface and query segments. The
bisection is stopped when the length of the intersected segment is less than the product of `relative_error_bound` by the radius of bisection is stopped when the length of the intersected segment is less than the product of `relative_error_bound` by the radius of
`bounding_sphere`. `bounding_sphere`.
\deprecated This constructor is deprecated since CGAL-4.13, and
replaced by the constructor using the <em>Boost Parameter Library</em>.
*/ */
Labeled_mesh_domain_3(const LabelingFunction& f, Labeled_mesh_domain_3(Labeling_function f,
const Sphere_3& bounding_sphere, const Sphere_3& bounding_sphere,
const FT& relative_error_bound = FT(1e-3)); const FT& relative_error_bound = FT(1e-3));
@ -73,8 +280,10 @@ Labeled_mesh_domain_3(const LabelingFunction& f,
\param relative_error_bound is the relative error bound used to compute intersection points between the implicit surface and query segments. The \param relative_error_bound is the relative error bound used to compute intersection points between the implicit surface and query segments. The
bisection is stopped when the length of the intersected segment is less than the product of `relative_error_bound` by the diagonal of bisection is stopped when the length of the intersected segment is less than the product of `relative_error_bound` by the diagonal of
`bounding_box`. `bounding_box`.
\deprecated This constructor is deprecated since CGAL-4.13, and
replaced by the constructor using the <em>Boost Parameter Library</em>.
*/ */
Labeled_mesh_domain_3(const LabelingFunction& f, Labeled_mesh_domain_3(Labeling_function f,
const Bbox_3& bbox, const Bbox_3& bbox,
const FT& relative_error_bound = FT(1e-3)); const FT& relative_error_bound = FT(1e-3));
@ -85,8 +294,10 @@ Labeled_mesh_domain_3(const LabelingFunction& f,
\param relative_error_bound is the relative error bound used to compute intersection points between the implicit surface and query segments. The \param relative_error_bound is the relative error bound used to compute intersection points between the implicit surface and query segments. The
bisection is stopped when the length of the intersected segment is less than the product of `relative_error_bound` by the diagonal of bisection is stopped when the length of the intersected segment is less than the product of `relative_error_bound` by the diagonal of
`bounding_box`. `bounding_box`.
\deprecated This constructor is deprecated since CGAL-4.13, and
replaced by the constructor using the <em>Boost Parameter Library</em>.
*/ */
Labeled_mesh_domain_3(const LabelingFunction& f, Labeled_mesh_domain_3(Labeling_function f,
const Iso_cuboid_3& bbox, const Iso_cuboid_3& bbox,
const FT& relative_error_bound = FT(1e-3)); const FT& relative_error_bound = FT(1e-3));

View File

@ -20,8 +20,7 @@ of the segment.
\sa `ImplicitSurfaceTraits_3` \sa `ImplicitSurfaceTraits_3`
\sa `IntersectionGeometricTraits_3` \sa `IntersectionGeometricTraits_3`
\sa `CGAL::Implicit_mesh_domain_3<Function,BGT>` \sa `CGAL::Labeled_mesh_domain_3<BGT>`
\sa `CGAL::Labeled_image_mesh_domain_3<Image,BGT>`
*/ */

View File

@ -1,80 +0,0 @@
/*!
\ingroup PkgMesh_3SecondaryConcepts
\cgalConcept
The concept `LabeledImage_3` describes the requirements for the second template
parameter of the class `CGAL::Labeled_image_mesh_domain_3<Image,BGT>`
which represents mesh domains defined by 3D labeled images. A 3D labeled
image is a 3D array of elements of an integral
type `Type`. `Type` can be `bool`, `char`, `short`,
`int`, or `long` (signed or not). Such an array is
associated to a 3D axis-aligned regular grid, in
\f$ \mathbb{R}^3\f$. A cell of this grid is denoted by <I>voxel</I>. A voxel is
an iso-cuboid of size `vx()`, `vy()`, and `vz()`.
\cgalHasModel `CGAL::Image_3<Kernel, T>`, for any \cgal kernel `K` and any integral type `T`
*/
class LabeledImage_3 {
public:
/// \name Types
/// @{
/*!
Type of voxel data. Must be an
integral type.
*/
typedef unspecified_type Type;
/*!
Ring number type.
*/
typedef unspecified_type RT;
/// @}
/// \name Operations
/// @{
/*!
First dimension of the 3D array,
i.e., the number of voxels along the x coordinate axis.
*/
int xdim();
/*!
Second dimension of the 3D array.
*/
int ydim();
/*!
Third dimension of the 3D array.
*/
int zdim();
/*!
Size of each voxel along x coordinate axis.
*/
RT vx();
/*!
Size of each voxel along y coordinate axis.
*/
RT vy();
/*!
Size of each voxel along z coordinate axis.
*/
RT vz();
/*!
Pointer to the first element of the 3D
image. The size of the array must be `xdim()`\f$ \times\f$`ydim()`\f$ \times\f$`zdim()`.
*/
const Type* data();
/// @}
}; /* end LabeledImage_3 */

View File

@ -30,9 +30,7 @@ if it includes points which are strictly inside
and strictly outside the domain (resp. the subdomain). and strictly outside the domain (resp. the subdomain).
\cgalHasModel `CGAL::Polyhedral_mesh_domain_3<Polyhedron,IGT,TriangleAccessor>` \cgalHasModel `CGAL::Polyhedral_mesh_domain_3<Polyhedron,IGT,TriangleAccessor>`
\cgalHasModel `CGAL::Implicit_mesh_domain_3<Function,BGT>` \cgalHasModel `CGAL::Labeled_mesh_domain_3<BGT>`
\cgalHasModel `CGAL::Labeled_image_mesh_domain_3<Image,BGT>`
\cgalHasModel `CGAL::Labeled_mesh_domain_3<LabelingFunction,BGT>`
\sa `MeshVertexBase_3` \sa `MeshVertexBase_3`
\sa `MeshCellBase_3` \sa `MeshCellBase_3`

View File

@ -881,9 +881,9 @@ image is composed of 1D curves, and must be defined as 1D-features in the
domain. domain.
The first modification is the type of the mesh domain. Instead of being The first modification is the type of the mesh domain. Instead of being
`Labeled_image_mesh_domain_3`, it is a `Labeled_mesh_domain_3`, it is a
`Mesh_domain_with_polyline_features_3` templated by a `Mesh_domain_with_polyline_features_3` templated by a
`Labeled_image_mesh_domain_3`. `Labeled_mesh_domain_3`.
\snippet Mesh_3/mesh_3D_image_with_features.cpp Domain definition \snippet Mesh_3/mesh_3D_image_with_features.cpp Domain definition

Some files were not shown because too many files have changed in this diff Show More