Merge master to solve conflicts.

This commit is contained in:
Maxime Gimeno 2018-06-13 09:40:56 +02:00
commit 8e7fc0b852
87 changed files with 1257 additions and 514 deletions

View File

@ -77,7 +77,8 @@ cd $ROOT
zsh $ROOT/Scripts/developer_scripts/test_merge_of_branch HEAD
#test dependencies
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
#parse current matrix and check that no package has been forgotten

View File

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

View File

@ -784,7 +784,7 @@ public:
* \return SMALLER if the curve is directed right;
* 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())
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.
*
* \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
* halfedges, that is `en = next(e, g)`, `ep = prev(e, g)`, and let
* `eno` and `epo` be their opposite halfedges, that is
* `eno = opposite(en, g)` and `epo = opposite(ep, g)`.
* Analoguously, for `e'` define `en'`, `ep'`, `eno'`, and `epo'`.
* After the collapse of edge `e` the following holds:
* - The edge `e` is no longer in `g`.
* - The faces incident to edge `e` are no longer in `g`.
* - `v0` is no longer in `g`.
* - 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'`)
*
* <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`).
* \returns vertex `v1`.
* \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>
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)
{
typedef boost::graph_traits< Graph > Traits;
typedef typename Traits::vertex_descriptor vertex_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 pt = opposite(prev(pq, 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 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 )
{
@ -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" ) ;
lP_Erased = true ;
}
}
}
}
@ -1158,19 +1109,20 @@ collapse_edge(typename boost::graph_traits<Graph>::edge_descriptor v0v1,
// << q.idx() << "->V" << target(qb, g).idx()
// << ") by erasing bottom face" ) ;
remove_face(opposite(qb, g),g);
if ( !lTopFaceExists )
{
//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 && !lQ_Erased )
if ( !lP_Erased )
{
//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));
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`,
* is not removed after the collapse.
*
*
* \tparam Graph must be a model of `MutableFaceGraph`
* \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.
*
* \returns vertex `v1`.
* \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.
* \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
// and its indicent edges
bool lP_Erased = false;
halfedge_descriptor edge =
next(edges_to_erase[0],g) == edges_to_erase[1]?
edges_to_erase[0]:edges_to_erase[1];
if (target(edge,g) == p)
lP_Erased = true;
if (target(edge,g) != p)
{
// q will be removed, swap it with p
internal::swap_vertices(p, q, g);
}
remove_center_vertex(edge,g);
return lP_Erased? q : p;
return q;
}
else
{
@ -1294,19 +1251,29 @@ collapse_edge(typename boost::graph_traits<Graph>::edge_descriptor v0v1,
join_vertex(pq,g);
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);
return lQ_Erased?p:q;
return q;
}
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_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);
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
/**

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_Collapse_edge.cpp" )
create_single_source_cgal_program( "test_graph_traits.cpp" )
create_single_source_cgal_program( "test_Properties.cpp" )
@ -105,6 +107,7 @@ create_single_source_cgal_program( "test_Properties.cpp" )
if(OpenMesh_FOUND)
target_link_libraries( test_clear 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_graph_traits 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));
}
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>
void
@ -400,6 +420,7 @@ test_Euler_operations()
remove_center_vertex_test<Graph>();
join_split_inverse<Graph>();
does_satisfy_link_condition<Graph>();
test_swap_edges<Graph>();
}
int main()

View File

@ -32,6 +32,7 @@
// provided you give a NT converter from A to B.
// There's a Homogeneous counterpart.
#include <CGAL/Cartesian_converter_fwd.h>
#include <CGAL/basic.h>
#include <CGAL/NT_converter.h>
#include <CGAL/Enum_converter.h>
@ -91,7 +92,7 @@ struct Converting_visitor : boost::static_visitor<> {
template < class K1, class K2,
// 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
{
typedef Enum_converter Base;

View File

@ -1948,7 +1948,7 @@ int unProject(GLdouble winx, GLdouble winy, GLdouble winz, GLdouble *modelview,
CGAL_INLINE_FUNCTION
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];
getViewport(viewport);
@ -1990,7 +1990,7 @@ Vec Camera::projectedCoordinatesOf(const Vec& src, const Frame* frame) const
CGAL_INLINE_FUNCTION
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];
getViewport(viewport);
unProject(src.x,src.y,src.z, modelViewMatrix_, projectionMatrix_, viewport, &x,&y,&z);
@ -2480,8 +2480,8 @@ void Camera::setFrustum(double frustum[6])
double B = (r+l)/(r-l);
double C = 2*n/(t-b);
double D = (t+b)/(t-b);
float E = -(f+n)/(f-n);
float F = -2*(f*n)/(f-n);
double E = -(f+n)/(f-n);
double F = -2*(f*n)/(f-n);
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_[2] = 0; projectionMatrix_[6] = 0; projectionMatrix_[10] = E ; projectionMatrix_[14] = F;
@ -2493,8 +2493,8 @@ void Camera::setFrustum(double frustum[6])
double B = -(r+l)/(r-l);
double C = 2/(t-b);
double D = -(t+b)/(t-b);
float E = -(f+n)/(f-n);
float F = -2/(f-n);
double E = -(f+n)/(f-n);
double F = -2/(f-n);
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_[8] = 0; projectionMatrix_[9] = 0; projectionMatrix_[10] = F ; projectionMatrix_[11] = 0;

View File

@ -1137,7 +1137,7 @@ void Frame::alignWithFrame(const Frame *const frame, bool move,
rotate(rotation().inverse() * Quaternion(axis, angle) * orientation());
// 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);
dir = inverseTransformOf(dir);

View File

@ -56,14 +56,14 @@ private Q_SLOTS:
{
if(currentlyFocused == imgHeight
&& ratioCheckBox->isChecked())
{imgWidth->setValue(i*ratio);}
{imgWidth->setValue(int(i*ratio));}
}
void imgWidthValueChanged(int i)
{
if(currentlyFocused == imgWidth
&& ratioCheckBox->isChecked())
{imgHeight->setValue(i/ratio);}
{imgHeight->setValue(int(i/ratio));}
}
void onFocusChanged(QWidget*, QWidget* now)

View File

@ -219,7 +219,10 @@ public Q_SLOTS:
also setForegroundColor(). */
void setBackgroundColor(const QColor &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
* also setBackgroundColor(). */

View File

@ -494,10 +494,10 @@ void CGAL::QGLViewer::postDraw() {
}
// Restore foregroundColor
float color[4];
color[0] = foregroundColor().red() / 255.0f;
color[1] = foregroundColor().green() / 255.0f;
color[2] = foregroundColor().blue() / 255.0f;
GLfloat color[4];
color[0] = GLfloat(foregroundColor().red()) / 255.0f;
color[1] = GLfloat(foregroundColor().green()) / 255.0f;
color[2] = GLfloat(foregroundColor().blue()) / 255.0f;
color[3] = 1.0f;
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, color);
glDisable(GL_LIGHTING);
@ -819,7 +819,7 @@ CGAL_INLINE_FUNCTION
void CGAL::QGLViewer::renderText(double x, double y, double z, const QString &str,
const QFont &font) {
const Vec proj = camera_->projectedCoordinatesOf(Vec(x, y, z));
renderText(proj.x, proj.y, str, font);
renderText(int(proj.x), int(proj.y), str, font);
}
#endif
@ -2818,7 +2818,7 @@ void CGAL::QGLViewer::getWheelActionBinding(MouseHandler handler, MouseAction ac
return;
}
key = ::Qt::Key(-1);
key = ::Qt::Key_unknown;
modifiers = ::Qt::NoModifier;
}
@ -3095,7 +3095,7 @@ void CGAL::QGLViewer::drawVisualHints() {
QMatrix4x4 mvMatrix;
for(int i=0; i < 16; i++)
{
mvMatrix.data()[i] = camera()->orientation().inverse().matrix()[i];
mvMatrix.data()[i] = float(camera()->orientation().inverse().matrix()[i]);
}
rendering_program.setUniformValue("mvp_matrix", mvpMatrix);
rendering_program.setUniformValue("color", QColor(::Qt::lightGray));
@ -3118,7 +3118,7 @@ void CGAL::QGLViewer::drawVisualHints() {
camera()->setType(CGAL::qglviewer::Camera::ORTHOGRAPHIC);
for(int i=0; i < 16; i++)
{
mvMatrix.data()[i] = camera()->orientation().inverse().matrix()[i];
mvMatrix.data()[i] = float(camera()->orientation().inverse().matrix()[i]);
}
mvpMatrix.setToIdentity();
mvpMatrix.ortho(-1,1,-1,1,-1,1);
@ -3152,8 +3152,8 @@ void CGAL::QGLViewer::drawVisualHints() {
std::vector<float> vertices;
for(int i=0; i< 4; ++i)
{
float x = (pow(-1, i)*(1-i/2));
float y = (pow(-1, i)*(i/2));
float x = float(std::pow(-1, i)*(1-i/2));
float y = float(std::pow(-1, i)*(i/2));
vertices.push_back(x);
vertices.push_back(y);
vertices.push_back(0);
@ -3168,9 +3168,11 @@ void CGAL::QGLViewer::drawVisualHints() {
mvpMatrix.setToIdentity();
mvpMatrix.ortho(-1,1,-1,1,-1,1);
size=30*devicePixelRatio();
rendering_program.setUniformValue("mvp_matrix", mvpMatrix);
glViewport((camera()->projectedCoordinatesOf(camera()->pivotPoint()).x-size/2)*devicePixelRatio(), (height() - camera()->projectedCoordinatesOf(camera()->pivotPoint()).y-size/2)*devicePixelRatio(), size, size);
glScissor ((camera()->projectedCoordinatesOf(camera()->pivotPoint()).x-size/2)*devicePixelRatio(), (height() - camera()->projectedCoordinatesOf(camera()->pivotPoint()).y-size/2)*devicePixelRatio(), size, size);
rendering_program.setUniformValue("mvp_matrix", mvpMatrix);
glViewport(GLint((camera()->projectedCoordinatesOf(camera()->pivotPoint()).x-size/2)*devicePixelRatio()),
GLint((height() - camera()->projectedCoordinatesOf(camera()->pivotPoint()).y-size/2)*devicePixelRatio()), size, size);
glScissor (GLint((camera()->projectedCoordinatesOf(camera()->pivotPoint()).x-size/2)*devicePixelRatio()),
GLint((height() - camera()->projectedCoordinatesOf(camera()->pivotPoint()).y-size/2)*devicePixelRatio()), size, size);
rendering_program.setUniformValue("color", QColor(::Qt::black));
glLineWidth(3.0);
glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(4));
@ -3215,18 +3217,21 @@ CGAL_INLINE_FUNCTION
void CGAL::QGLViewer::drawArrow(double r,double R, int prec, CGAL::qglviewer::Vec from,
CGAL::qglviewer::Vec to, CGAL::qglviewer::Vec color,
std::vector<float> &data) {
using std::cos;
using std::sin;
using std::acos;
CGAL::qglviewer::Vec temp = to-from;
QVector3D dir = QVector3D(temp.x, temp.y, temp.z);
QVector3D dir = QVector3D(float(temp.x), float(temp.y), float(temp.z));
QMatrix4x4 mat;
mat.setToIdentity();
mat.translate(from.x, from.y, from.z);
mat.translate(float(from.x), float(from.y), float(from.z));
mat.scale(dir.length());
dir.normalize();
float angle = 0.0;
if(std::sqrt((dir.x()*dir.x()+dir.y()*dir.y())) > 1)
angle = 90.0f;
else
angle =acos(dir.y()/std::sqrt(dir.x()*dir.x()+dir.y()*dir.y()+dir.z()*dir.z()))*180.0/CGAL_PI;
angle = float(acos(dir.y()/std::sqrt(dir.lengthSquared()))*180.0/CGAL_PI);
QVector3D axis;
axis = QVector3D(dir.z(), 0, -dir.x());
@ -3269,7 +3274,7 @@ void CGAL::QGLViewer::drawArrow(double r,double R, int prec, CGAL::qglviewer::Ve
data.push_back((float)color.y);
data.push_back((float)color.z);
//point C1
D = (d+360/prec)*CGAL_PI/180.0;
D = float((d+360/prec)*CGAL_PI/180.0);
p = QVector4D(Rf* sin(D), 0.66f, Rf* cos(D), 1.f);
n = QVector4D(sin(D), sin(a), cos(D), 1.0);
pR = mat*p;
@ -3293,7 +3298,7 @@ void CGAL::QGLViewer::drawArrow(double r,double R, int prec, CGAL::qglviewer::Ve
for(int d = 0; d<360; d+= 360/prec)
{
//point A1
double D = d*CGAL_PI/180.0;
float D = float(d*CGAL_PI/180.0);
QVector4D p(rf*sin(D), 0.66f, rf*cos(D), 1.f);
QVector4D n(sin(D), 0.f, cos(D), 1.f);
QVector4D pR = mat*p;
@ -3305,9 +3310,9 @@ void CGAL::QGLViewer::drawArrow(double r,double R, int prec, CGAL::qglviewer::Ve
data.push_back(nR.x());
data.push_back(nR.y());
data.push_back(nR.z());
data.push_back(color.x);
data.push_back(color.y);
data.push_back(color.z);
data.push_back(float(color.x));
data.push_back(float(color.y));
data.push_back(float(color.z));
//point B1
p = QVector4D(rf * sin(D),0,rf*cos(D), 1.0);
n = QVector4D(sin(D), 0, cos(D), 1.0);
@ -3321,11 +3326,11 @@ void CGAL::QGLViewer::drawArrow(double r,double R, int prec, CGAL::qglviewer::Ve
data.push_back(nR.x());
data.push_back(nR.y());
data.push_back(nR.z());
data.push_back(color.x);
data.push_back(color.y);
data.push_back(color.z);
data.push_back(float(color.x));
data.push_back(float(color.y));
data.push_back(float(color.z));
//point C1
D = (d+360/prec)*CGAL_PI/180.0;
D = float((d+360/prec)*CGAL_PI/180.0);
p = QVector4D(rf * sin(D),0,rf*cos(D), 1.0);
n = QVector4D(sin(D), 0, cos(D), 1.0);
pR = mat*p;
@ -3336,11 +3341,11 @@ void CGAL::QGLViewer::drawArrow(double r,double R, int prec, CGAL::qglviewer::Ve
data.push_back(nR.x());
data.push_back(nR.y());
data.push_back(nR.z());
data.push_back(color.x);
data.push_back(color.y);
data.push_back(color.z);
data.push_back(float(color.x));
data.push_back(float(color.y));
data.push_back(float(color.z));
//point A2
D = (d+360/prec)*CGAL_PI/180.0;
D = float((d+360/prec)*CGAL_PI/180.0);
p = QVector4D(rf * sin(D),0,rf*cos(D), 1.0);
n = QVector4D(sin(D), 0, cos(D), 1.0);
@ -3352,9 +3357,9 @@ void CGAL::QGLViewer::drawArrow(double r,double R, int prec, CGAL::qglviewer::Ve
data.push_back(nR.x());
data.push_back(nR.y());
data.push_back(nR.z());
data.push_back((float)color.x);
data.push_back((float)color.y);
data.push_back((float)color.z);
data.push_back(float(color.x));
data.push_back(float(color.y));
data.push_back(float(color.z));
//point B2
p = QVector4D(rf * sin(D), 0.66f, rf*cos(D), 1.f);
n = QVector4D(sin(D), 0, cos(D), 1.0);
@ -3366,11 +3371,11 @@ void CGAL::QGLViewer::drawArrow(double r,double R, int prec, CGAL::qglviewer::Ve
data.push_back(nR.x());
data.push_back(nR.y());
data.push_back(nR.z());
data.push_back((float)color.x);
data.push_back((float)color.y);
data.push_back((float)color.z);
data.push_back(float(color.x));
data.push_back(float(color.y));
data.push_back(float(color.z));
//point C2
D = d*CGAL_PI/180.0;
D = float(d*CGAL_PI/180.0);
p = QVector4D(rf * sin(D), 0.66f, rf*cos(D), 1.f);
n = QVector4D(sin(D), 0.f, cos(D), 1.f);
pR = mat*p;
@ -3381,9 +3386,9 @@ void CGAL::QGLViewer::drawArrow(double r,double R, int prec, CGAL::qglviewer::Ve
data.push_back(nR.x());
data.push_back(nR.y());
data.push_back(nR.z());
data.push_back(color.x);
data.push_back(color.y);
data.push_back(color.z);
data.push_back(float(color.x));
data.push_back(float(color.y));
data.push_back(float(color.z));
}
}
@ -3404,7 +3409,7 @@ void CGAL::QGLViewer::drawAxis(qreal length) {
rendering_program_light.bind();
vaos[AXIS].bind();
vbos[Axis].bind();
vbos[Axis].allocate(data.data(), static_cast<int>(data.size()) * sizeof(float));
vbos[Axis].allocate(data.data(), static_cast<int>(data.size() * sizeof(float)));
rendering_program_light.enableAttributeArray("vertex");
rendering_program_light.setAttributeBuffer("vertex",GL_FLOAT,0,3,
static_cast<int>(9*sizeof(float)));
@ -3433,22 +3438,22 @@ void CGAL::QGLViewer::drawGrid(qreal size, int nbSubdivisions) {
std::vector<float> v_Grid;
for (int i=0; i<=nbSubdivisions; ++i)
{
const float pos = size*(2.0*i/nbSubdivisions-1.0);
const float pos = float(size*(2.0*i/nbSubdivisions-1.0));
v_Grid.push_back(pos);
v_Grid.push_back(-size);
v_Grid.push_back(0.0);
v_Grid.push_back(float(-size));
v_Grid.push_back(0.f);
v_Grid.push_back(pos);
v_Grid.push_back(+size);
v_Grid.push_back(0.0);
v_Grid.push_back(float(+size));
v_Grid.push_back(0.f);
v_Grid.push_back(-size);
v_Grid.push_back(float(-size));
v_Grid.push_back(pos);
v_Grid.push_back(0.0);
v_Grid.push_back(0.f);
v_Grid.push_back( size);
v_Grid.push_back( float(size));
v_Grid.push_back( pos);
v_Grid.push_back( 0.0);
v_Grid.push_back( 0.f);
}
rendering_program.bind();
vaos[GRID].bind();
@ -3472,7 +3477,7 @@ void CGAL::QGLViewer::drawGrid(qreal size, int nbSubdivisions) {
rendering_program_light.bind();
vaos[GRID_AXIS].bind();
vbos[Grid_axis].bind();
vbos[Grid_axis].allocate(d_axis.data(), static_cast<int>(d_axis.size()) * sizeof(float));
vbos[Grid_axis].allocate(d_axis.data(), static_cast<int>(d_axis.size() * sizeof(float)));
rendering_program_light.enableAttributeArray("vertex");
rendering_program_light.setAttributeBuffer("vertex",GL_FLOAT,0,3,
static_cast<int>(9*sizeof(float)));
@ -4015,7 +4020,10 @@ QImage* CGAL::QGLViewer::takeSnapshot( CGAL::qglviewer::SnapShotBackground back
for (int j=0; j<nbY; j++)
{
fbo.bind();
glClearColor(backgroundColor().redF(), backgroundColor().greenF(), backgroundColor().blueF(), alpha);
glClearColor(GLfloat(backgroundColor().redF()),
GLfloat(backgroundColor().greenF()),
GLfloat(backgroundColor().blueF()),
alpha);
double frustum[6];
frustum[0]= -xMin + i*deltaX;
frustum[1]= -xMin + (i+1)*deltaX ;

View File

@ -18,6 +18,11 @@ Release date: September 2018
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
- Added a new type of intersection to deal with insertion of a constraints
@ -43,6 +48,10 @@ Release date: September 2018
- Added a function to apply a transformation to a mesh:
- `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).
### 3D Mesh Generation
- **Breaking change:** The template parameters of the class template
@ -71,6 +80,10 @@ Release date: September 2018
- 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
------------

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

@ -61,7 +61,7 @@ public:
/*!
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

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

View File

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

View File

@ -183,8 +183,7 @@ be a `CGAL::Image_3` object.
<li><b>`parameters::image_values_to_subdom_indices`</b> a function or
a function object, compatible with the signature
`Subdomain_index(word_type)`, where the type `word_type` is the type
of words of the 3D image. This function returns the subdomain index
`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.

View File

@ -34,8 +34,9 @@ struct Image_to_multiple_iso_level_sets {
const Set& set;
Image_to_multiple_iso_level_sets(const Set& set) : set(set) {}
int operator()(float v) const {
return int(std::distance(set.begin(), set.lower_bound(v)));
int operator()(double v) const {
return int(std::distance(set.begin(),
set.lower_bound(float(v))));
}
};

View File

@ -1252,11 +1252,6 @@ private:
facet.first->set_facet_surface_center(facet.second,surface_center);
facet_m.first->set_facet_surface_center(facet_m.second,surface_center);
}
else
{
facet.first->set_facet_surface_center(facet.second,Bare_point());
facet_m.first->set_facet_surface_center(facet_m.second,Bare_point());
}
}
return surface;
@ -1687,9 +1682,27 @@ private:
/**
* Returns the least square plane from v, using adjacent surface points
*/
Plane_3 get_least_square_surface_plane(const Vertex_handle& v,
Bare_point& ref_point,
Surface_patch_index index = Surface_patch_index()) const;
boost::optional<Plane_3>
get_least_square_surface_plane(const Vertex_handle& v,
Bare_point& ref_point,
Surface_patch_index index = Surface_patch_index()) const;
/**
* @brief Project \c p on surface, using incident facets of \c v
* @param p The point to project
* @param v The vertex from which p was moved
* @param index The index of the surface patch where v lies, if known.
* @return a boost::optional with the projected point if the projection
* was possible, or boost::none
*
* \c p is projected as follows using normal of least square fitting plane
* on \c v incident surface points. If \c index is specified, only
* surface points that are on the same surface patch are used to compute
* the fitting plane.
*/
boost::optional<Bare_point>
project_on_surface_if_possible(const Bare_point& p, const Vertex_handle& v,
Surface_patch_index index = Surface_patch_index()) const;
/**
* @brief Returns the projection of \c p, using direction of
@ -2667,7 +2680,6 @@ C3T3_helpers<C3T3,MD>::
rebuild_restricted_delaunay(OutdatedCells& outdated_cells,
Moving_vertices_set& moving_vertices)
{
typename Gt::Equal_3 equal = tr_.geom_traits().equal_3_object();
typename OutdatedCells::iterator first_cell = outdated_cells.begin();
typename OutdatedCells::iterator last_cell = outdated_cells.end();
Update_c3t3 updater(domain_,c3t3_);
@ -2766,15 +2778,16 @@ rebuild_restricted_delaunay(OutdatedCells& outdated_cells,
it != vertex_to_proj.end() ;
++it )
{
Bare_point new_pos = project_on_surface(wp2p_((*it)->point()),*it);
boost::optional<Bare_point> opt_new_pos =
project_on_surface(wp2p_((*it)->point()),*it);
if ( ! equal(new_pos, Bare_point()) )
if ( opt_new_pos )
{
//freezing needs 'erase' to be done before the vertex is actually destroyed
// Update moving vertices (it becomes new_vertex)
moving_vertices.erase(*it);
Vertex_handle new_vertex = update_mesh(p2wp_(new_pos),*it);
Vertex_handle new_vertex = update_mesh(p2wp_(*opt_new_pos),*it);
c3t3_.set_dimension(new_vertex,2);
moving_vertices.insert(new_vertex);
@ -2873,15 +2886,16 @@ rebuild_restricted_delaunay(ForwardIterator first_cell,
it != vertex_to_proj.end() ;
++it )
{
Bare_point new_pos = project_on_surface(wp2p_((it->first)->point()),it->first,it->second);
boost::optional<Bare_point> opt_new_pos =
project_on_surface(wp2p_((it->first)->point()),it->first,it->second);
if ( ! equal(new_pos, Bare_point()) )
if ( opt_new_pos )
{
//freezing needs 'erase' to be done before the vertex is actually destroyed
// Update moving vertices (it becomes new_vertex)
moving_vertices.erase(it->first);
Vertex_handle new_vertex = update_mesh(p2wp_(new_pos), it->first);
Vertex_handle new_vertex = update_mesh(p2wp_(*opt_new_pos), it->first);
c3t3_.set_dimension(new_vertex,2);
moving_vertices.insert(new_vertex);
@ -3333,7 +3347,7 @@ project_on_surface_aux(const Bare_point& p,
template <typename C3T3, typename MD>
typename C3T3_helpers<C3T3,MD>::Plane_3
boost::optional<typename C3T3_helpers<C3T3,MD>::Plane_3>
C3T3_helpers<C3T3,MD>::
get_least_square_surface_plane(const Vertex_handle& v,
Bare_point& reference_point,
@ -3373,7 +3387,7 @@ get_least_square_surface_plane(const Vertex_handle& v,
// In some cases point is not a real surface point
if ( surface_point_vector.empty() )
return Plane_3();
return boost::none;
// Compute least square fitting plane
Plane_3 plane;
@ -3399,25 +3413,39 @@ C3T3_helpers<C3T3,MD>::
project_on_surface(const Bare_point& p,
const Vertex_handle& v,
Surface_patch_index index) const
{
boost::optional<Bare_point> opt_point =
project_on_surface_if_possible(p, v, index);
if(opt_point) return *opt_point;
else return p;
}
template <typename C3T3, typename MD>
boost::optional<typename C3T3_helpers<C3T3,MD>::Bare_point>
C3T3_helpers<C3T3,MD>::
project_on_surface_if_possible(const Bare_point& p,
const Vertex_handle& v,
Surface_patch_index index) const
{
typename Gt::Equal_3 equal = tr_.geom_traits().equal_3_object();
// return domain_.project_on_surface(p);
// Get plane
Bare_point reference_point(CGAL::ORIGIN);
Plane_3 plane = get_least_square_surface_plane(v,reference_point, index);
Bare_point reference_point;
boost::optional<Plane_3> opt_plane =
get_least_square_surface_plane(v,reference_point, index);
if ( equal(reference_point, CGAL::ORIGIN) )
return p;
if(!opt_plane) return boost::none;
// Project
if ( ! equal(p, wp2p_(v->point())) )
return project_on_surface_aux(p,
wp2p_(v->point()),
plane.orthogonal_vector());
opt_plane->orthogonal_vector());
else
return project_on_surface_aux(p,
reference_point,
plane.orthogonal_vector());
opt_plane->orthogonal_vector());
}

View File

@ -461,6 +461,18 @@ refine_mesh(std::string dump_after_refine_surface_prefix)
% r_tr.number_of_vertices()
% nbsteps % cells_mesher_.debug_info()
% (nbsteps / timer.time());
if(refinement_stage == REFINE_FACETS &&
facets_mesher_.is_algorithm_done())
{
facets_mesher_.scan_edges();
refinement_stage = REFINE_FACETS_AND_EDGES;
}
if(refinement_stage == REFINE_FACETS_AND_EDGES &&
facets_mesher_.is_algorithm_done())
{
facets_mesher_.scan_vertices();
refinement_stage = REFINE_FACETS_AND_EDGES_AND_VERTICES;
}
++nbsteps;
}
std::cerr << std::endl;

View File

@ -545,7 +545,7 @@ polylines_to_protect
{{ { pix10, Point_3(), Domain_type(), 0, false },
{ pix11, Point_3(), Domain_type(), 0, false } }} }};
std::map<Image_word_type, int> pixel_values_set;
std::map<Domain_type, int> pixel_values_set;
for(int ii = 0; ii < 2; ++ii) {
for(int jj = 0; jj < 2; ++jj) {
const Pixel& pixel = square[ii][jj].pixel;
@ -902,7 +902,7 @@ case_1_2_1:
}
else {
// case of two colors with one pixel green and three red
Image_word_type value_alone;
Domain_type value_alone;
if(pixel_values_set.begin()->second == 1) {
value_alone = pixel_values_set.begin()->first;
} else {

View File

@ -44,14 +44,17 @@ if ( CGAL_FOUND )
create_single_source_cgal_program( "test_meshing_polyhedron.cpp" )
create_single_source_cgal_program( "test_meshing_polylines_only.cpp" )
create_single_source_cgal_program( "test_meshing_polyhedron_with_features.cpp" )
create_single_source_cgal_program( "test_meshing_verbose.cpp" )
create_single_source_cgal_program( "test_meshing_unit_tetrahedron.cpp" )
create_single_source_cgal_program( "test_meshing_with_default_edge_size.cpp" )
create_single_source_cgal_program( "test_meshing_determinism.cpp" )
create_single_source_cgal_program( "test_c3t3_extract_subdomains_boundaries.cpp" )
create_single_source_cgal_program( "test_mesh_3_issue_1554.cpp" )
create_single_source_cgal_program( "test_mesh_polyhedral_domain_with_features_deprecated.cpp" )
create_single_source_cgal_program( "test_meshing_with_one_step.cpp" )
foreach(target
test_meshing_verbose
test_meshing_polyhedron_with_features
test_meshing_utilities.h
test_mesh_implicit_domains

View File

@ -1,3 +1,7 @@
// Mesh_3 bug: The surface of c3t3 has holes
//
// https://github.com/CGAL/cgal/issues/1554
//
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Mesh_triangulation_3.h>

View File

@ -72,13 +72,20 @@ struct Polyhedron_with_features_tester : public Tester<K>
CGAL_USE(polyhedra);
// Set mesh criteria
#ifndef CGAL_MESH_3_VERBOSE
Edge_criteria edge_criteria(0.2);
Facet_criteria facet_criteria(30, 0.2, 0.02);
Cell_criteria cell_criteria(3, 0.2);
#else // a different set of criteria, for the test of CGAL_MESH_3_VERBOSE
Edge_criteria edge_criteria(0.3);
Facet_criteria facet_criteria(30, 0.3, 0.03);
Cell_criteria cell_criteria(3, 0.4);
#endif
Mesh_criteria criteria(edge_criteria, facet_criteria, cell_criteria);
// Mesh generation
C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria,
CGAL::parameters::manifold(),
CGAL::parameters::no_exude(),
CGAL::parameters::no_perturb());

View File

@ -0,0 +1,5 @@
#define CGAL_MESH_3_VERBOSE 1
#include "test_meshing_polyhedron_with_features.cpp"
// This comment is for the shell script cgal_test
// int main() { return 0; }

View File

@ -0,0 +1,78 @@
#define CGAL_MESH_3_VERBOSE 1
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Mesh_triangulation_3.h>
#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
#include <CGAL/Mesh_criteria_3.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/boost/graph/helpers.h>
#include <CGAL/Polyhedral_mesh_domain_3.h>
#include <CGAL/make_mesh_3.h>
#include <CGAL/refine_mesh_3.h>
// Domain
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Surface_mesh<K::Point_3> Polyhedron;
typedef CGAL::Polyhedral_mesh_domain_3<Polyhedron, K> Mesh_domain;
typedef CGAL::Sequential_tag Concurrency_tag;
// Triangulation
typedef CGAL::Mesh_triangulation_3<Mesh_domain,
CGAL::Default,
Concurrency_tag>::type Tr;
typedef CGAL::Mesh_complex_3_in_triangulation_3<Tr> C3t3;
// Criteria
typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;
typedef CGAL::Mesh_3::Mesher_3<C3t3,
Mesh_criteria,
Mesh_domain> Mesher;
// To avoid verbose function and named parameters call
using namespace CGAL::parameters;
int main(int argc, char*argv[])
{
const char* fname = (argc>1)?argv[1]:"data/sphere.off";
// Create input polyhedron
Polyhedron polyhedron;
std::ifstream input(fname);
input >> polyhedron;
if(input.fail()){
std::cerr << "Error: Cannot read file " << fname << std::endl;
return EXIT_FAILURE;
}
input.close();
if (!CGAL::is_triangle_mesh(polyhedron)){
std::cerr << "Input geometry is not triangulated." << std::endl;
return EXIT_FAILURE;
}
// Create domain
Mesh_domain domain(polyhedron);
// Mesh criteria (no cell_size set)
Mesh_criteria criteria(facet_angle=25, facet_size=0.2, facet_distance=0.01,
cell_size = 0.2, cell_radius_edge_ratio=3);
// Mesh generation
C3t3 c3t3;
CGAL::internal::Mesh_3::C3t3_initializer<C3t3,
Mesh_domain,
Mesh_criteria,
false>()(c3t3, domain, criteria, false);
Mesher mesher(c3t3, domain, criteria,CGAL::FACET_VERTICES_ON_SAME_SURFACE_PATCH);
mesher.initialize();
while ( ! mesher.is_algorithm_done() ) mesher.one_step();
assert(c3t3.triangulation().number_of_vertices() > 200);
// Output
std::ofstream medit_file("out.mesh");
c3t3.output_to_medit(medit_file);
medit_file.close();
return EXIT_SUCCESS;
}

View File

@ -6,9 +6,9 @@ In this package, all functions optional parameters are implemented as BGL option
named parameters (see \ref BGLNamedParameters for more information on how to use them).
Since the parameters of the various polygon mesh processing functions defined
in this package are redundant, their long descriptions are centralized below.
The sequence of named parameters should start with `CGAL::parameters::`.
The sequence of named parameters starts with `CGAL::parameters::`.
`CGAL::parameters::all_default()` can be used to indicate
that default values of optional named parameters must be used.
that default values of optional named parameters shall be used.
In the following, we assume that the following types are provided as template parameters
of polygon mesh processing functions and classes. Note that, for some of these functions,
@ -45,7 +45,7 @@ is the property map containing the index of each face of the input polygon mesh.
`boost::graph_traits<PolygonMesh>::%face_descriptor` as key type and the value type:
\code typename boost::property_traits<typename boost::property_map<PolygonMesh, CGAL::face_index_t>::type>::value_type \endcode
<b>Default:</b> \code boost::get(CGAL::face_index, pmesh)\endcode
If this internal property map exists, its values should be initialized.
If this internal property map exists, its values must be initialized.
\cgalNPEnd
\cgalNPBegin{edge_is_constrained_map} \anchor PMP_edge_is_constrained_map
@ -54,7 +54,7 @@ being marked or not. In `isotropic_remeshing()` and `connected_components()`,
the marked edges are constrained.\n
<b>Type:</b> a class model of `ReadWritePropertyMap` with
`boost::graph_traits<PolygonMesh>::%edge_descriptor` as key type and
`bool` as value type. It should be default constructible.\n
`bool` as value type. It must be default constructible.\n
<b>Default:</b> a default property map where no edge is constrained
\cgalNPEnd
\cgalNPTableEnd
@ -63,7 +63,7 @@ In addition to these named parameters, this package offers the following named p
\cgalNPTableBegin
\cgalNPBegin{geom_traits} \anchor PMP_geom_traits
is the geometric traits instance in which the mesh processing operation should be performed.\n
is the geometric traits instance used for the mesh processing operation.\n
<b>Type:</b> a Geometric traits class.\n
<b>Default</b>:
\code typename CGAL::Kernel_traits<
@ -85,7 +85,7 @@ inserted several times.\n
is the property map containing the number of feature edges being incident to the vertices of the polygon mesh `pmesh`.\n
<b>Type:</b> a class model of `ReadWritePropertyMap` with
`boost::graph_traits<PolygonMesh>::%vertex_descriptor` as key type and
`int` as value type. It should be default constructible.\n
`int` as value type. It must be default constructible.\n
<b>Default:</b> \code boost::get(CGAL::vertex_feature_degree_t(), pmesh) \endcode
\cgalNPEnd
@ -95,7 +95,7 @@ Constrained vertices may be replaced by new vertices, but the number and locatio
of vertices remain unchanged.\n
<b>Type:</b> a class model of `ReadWritePropertyMap` with
`boost::graph_traits<PolygonMesh>::%vertex_descriptor` as key type and
`bool` as value type. It should be default constructible.\n
`bool` as value type. It must be default constructible.\n
<b>Default:</b> a default property map where no vertex is constrained is provided.
\cgalNPEnd
@ -188,21 +188,21 @@ enables the use of the Delaunay triangulation facet search space for hole fillin
\cgalNPEnd
\cgalNPBegin{use_random_uniform_sampling} \anchor PMP_use_random_uniform_sampling
is a parameter used in `sample_triangle_mesh()` to indicate if points should be picked
is a parameter used in `sample_triangle_mesh()` to indicate that the points are picked
in a random uniform way.\n
<b>Type:</b> `bool` \n
<b>Default:</b> `true`
\cgalNPEnd
\cgalNPBegin{use_grid_sampling} \anchor PMP_use_grid_sampling
is a parameter used in `sample_triangle_mesh()` to indicate if points should be picked
in on a grid in each face.\n
is a parameter used in `sample_triangle_mesh()` to indicate that the points are picked
on a grid in each face.\n
<b>Type:</b> `bool` \n
<b>Default:</b> `false`
\cgalNPEnd
\cgalNPBegin{use_monte_carlo_sampling} \anchor PMP_use_monte_carlo_sampling
is a parameter used in `sample_triangle_mesh()` to indicate if points should be picked
is a parameter used in `sample_triangle_mesh()` to indicate that the points are picked
using a Monte-Carlo approach.\n
<b>Type:</b> `bool` \n
<b>Default:</b> `false`
@ -210,21 +210,21 @@ using a Monte-Carlo approach.\n
\cgalNPBegin{sample_edges} \anchor PMP_sample_edges
is a parameter used in `sample_triangle_mesh()` to indicate if a dedicated sampling
of edges should be done.\n
of edges is done.\n
<b>Type:</b> `bool` \n
<b>Default:</b> `true`
\cgalNPEnd
\cgalNPBegin{sample_vertices} \anchor PMP_sample_vertices
is a parameter used in `sample_triangle_mesh()` to indicate if triangle vertices should
be copied in the output iterator.\n
is a parameter used in `sample_triangle_mesh()` to indicate that triangle vertices are
copied in the output iterator.\n
<b>Type:</b> `bool` \n
<b>Default:</b> `true`
\cgalNPEnd
\cgalNPBegin{sample_faces} \anchor PMP_sample_faces
is a parameter used in `sample_triangle_mesh()` to indicate if the interior of faces
should be considered for the sampling.\n
is considered for the sampling.\n
<b>Type:</b> `bool` \n
<b>Default:</b> `true`
\cgalNPEnd
@ -281,7 +281,7 @@ Monte-Carlo methods.\n
\cgalNPEnd
\cgalNPBegin{do_project} \anchor PMP_do_project
is a parameter used in `random_perturbation()` to set whether vertices should be re-projected
is a parameter used in `random_perturbation()` to set whether vertices are re-projected
to the input surface after their geometric perturbation.\n
<b>Type:</b> `bool` \n
<b>Default:</b> `true`
@ -304,7 +304,7 @@ Parameter used in orientation functions to choose between an outward or inward o
\cgalNPBegin{do_overlap_test_of_bounded_sides} \anchor PMP_do_overlap_test_of_bounded_sides
Parameter used in intersection test functions to indicate whether overlapping tests of bounded sides
of close meshes should be done in addition to surface intersection tests.
of close meshes are done in addition to surface intersection tests.
\n
\b Type : `bool` \n
\b Default value is `false`

View File

@ -571,11 +571,11 @@ and store them in property maps provided by the class `Surface_mesh`.
\cgalExample{Polygon_mesh_processing/compute_normals_example.cpp}
\subsubsection NormalsExampleP Normals Computation for a Poyhedron_3
\subsubsection NormalsExampleP Normals Computation for a Polyhedron_3
The following example illustrates how to
compute the normals to faces and vertices
and store them in ordered or unordered maps as the class `Polyhedron` does
and store them in ordered or unordered maps as the class `Polyhedron_3` does
not provide storage for the normals.
\cgalExample{Polygon_mesh_processing/compute_normals_example_Polyhedron.cpp}

View File

@ -12,3 +12,5 @@ Surface_mesh_deformation
AABB_tree
Triangulation_2
Spatial_sorting
Generator

View File

@ -51,7 +51,7 @@ namespace CGAL {
* \cgalNamedParamsBegin
* \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `PolygonMesh`\cgalParamEnd
* `CGAL::vertex_point_t` must be available in `PolygonMesh`\cgalParamEnd
* \cgalParamBegin{geom_traits} an instance of a geometric traits class,
* providing the functor `Construct_bbox_3` and the function
* `Construct_bbox_3 construct_bbox_3_object()`. `Construct_bbox_3`
@ -101,7 +101,7 @@ namespace CGAL {
* \cgalNamedParamsBegin
* \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `PolygonMesh`\cgalParamEnd
* `CGAL::vertex_point_t` must be available in `PolygonMesh`\cgalParamEnd
* \cgalParamBegin{geom_traits} an instance of a geometric traits class,
* providing the functor `Construct_bbox_3` and the function
* `Construct_bbox_3 construct_bbox_3_object()`. `Construct_bbox_3`
@ -144,7 +144,7 @@ namespace CGAL {
* \cgalNamedParamsBegin
* \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `PolygonMesh`\cgalParamEnd
* `CGAL::vertex_point_t` must be available in `PolygonMesh`\cgalParamEnd
* \cgalParamBegin{geom_traits} an instance of a geometric traits class,
* providing the functor `Construct_bbox_3` and the function
* `Construct_bbox_3 construct_bbox_3_object()`. `Construct_bbox_3`
@ -188,7 +188,7 @@ namespace CGAL {
* \cgalNamedParamsBegin
* \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `PolygonMesh`\cgalParamEnd
* `CGAL::vertex_point_t` must be available in `PolygonMesh`\cgalParamEnd
* \cgalParamBegin{geom_traits} an instance of a geometric traits class,
* providing the functor `Construct_bbox_3` and the function
* `Construct_bbox_3 construct_bbox_3_object()`. `Construct_bbox_3`

View File

@ -155,7 +155,7 @@ namespace Polygon_mesh_processing {
* @tparam PolygonMesh model of `HalfedgeGraph`. If `PolygonMesh`
* has an internal property map
* for `CGAL::face_index_t` and no `face_index_map` is given
* as a named parameter, then the internal one should be initialized
* as a named parameter, then the internal one must be initialized
* @tparam FaceRange range of
`boost::graph_traits<PolygonMesh>::%face_descriptor`, model of `Range`.
Its iterator type is `InputIterator`.

View File

@ -109,7 +109,7 @@ void sum_normals(const PM& pmesh,
* \cgalNamedParamsBegin
* \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `PolygonMesh`\cgalParamEnd
* `CGAL::vertex_point_t` must be available in `PolygonMesh`\cgalParamEnd
* \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `Kernel`\cgalParamEnd
* \cgalNamedParamsEnd
*
@ -168,7 +168,7 @@ compute_face_normal(typename boost::graph_traits<PolygonMesh>::face_descriptor f
* \cgalNamedParamsBegin
* \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `PolygonMesh`\cgalParamEnd
* `CGAL::vertex_point_t` must be available in `PolygonMesh`\cgalParamEnd
* \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `Kernel`\cgalParamEnd
* \cgalNamedParamsEnd
*
@ -205,7 +205,7 @@ compute_face_normals(const PolygonMesh& pmesh
* \cgalNamedParamsBegin
* \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `PolygonMesh`\cgalParamEnd
* `CGAL::vertex_point_t` must be available in `PolygonMesh`\cgalParamEnd
* \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `Kernel`\cgalParamEnd
* \cgalNamedParamsEnd
*
@ -285,7 +285,7 @@ compute_vertex_normal(typename boost::graph_traits<PolygonMesh>::vertex_descript
* \cgalNamedParamsBegin
* \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `PolygonMesh`\cgalParamEnd
* `CGAL::vertex_point_t` must be available in `PolygonMesh`\cgalParamEnd
* \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `Kernel`\cgalParamEnd
* \cgalNamedParamsEnd
*
@ -331,7 +331,7 @@ compute_vertex_normals(const PolygonMesh& pmesh
* \cgalNamedParamsBegin
* \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `PolygonMesh`\cgalParamEnd
* `CGAL::vertex_point_t` must be available in `PolygonMesh`\cgalParamEnd
* \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `Kernel`\cgalParamEnd
* \cgalNamedParamsEnd
*

View File

@ -183,7 +183,7 @@ connected_component(typename boost::graph_traits<PolygonMesh>::face_descriptor s
* \ingroup keep_connected_components_grp
* computes for each face the index of the corresponding connected component.
*
* A property map for `CGAL::face_index_t` should be either available as an internal property map
* A property map for `CGAL::face_index_t` must be either available as an internal property map
* to `pmesh` or provided as one of the \ref pmp_namedparameters "Named Parameters".
*
* \tparam PolygonMesh a model of `FaceListGraph`
@ -269,7 +269,7 @@ void keep_connected_components(PolygonMesh& pmesh
* Keep `nb_components_to_keep` largest connected components.
*
* Property maps for `CGAL::face_index_t` and `CGAL::vertex_index_t`
* should be either available as internal property maps
* must be either available as internal property maps
* to `pmesh` or provided as \ref pmp_namedparameters "Named Parameters".
*
* \tparam PolygonMesh a model of `FaceListGraph` and `MutableFaceGraph`
@ -352,7 +352,7 @@ std::size_t keep_largest_connected_components(PolygonMesh& pmesh,
* removes connected components with less than a given number of faces.
*
* Property maps for `CGAL::face_index_t` and `CGAL::vertex_index_t`
* should be either available as internal property maps
* must be either available as internal property maps
* to `pmesh` or provided as \ref pmp_namedparameters "Named Parameters".
*
* \tparam PolygonMesh a model of `FaceListGraph` and `MutableFaceGraph`
@ -567,7 +567,7 @@ void keep_or_remove_connected_components(PolygonMesh& pmesh
* then the behavior of this function is undefined.
*
* Property maps for `CGAL::vertex_index_t`
* should be either available as internal property map
* must be either available as internal property map
* to `pmesh` or provided as \ref pmp_namedparameters "Named Parameters".
*
* \tparam PolygonMesh a model of `FaceListGraph` and `MutableFaceGraph`
@ -610,7 +610,7 @@ void keep_connected_components(PolygonMesh& pmesh
* then the behavior of this function is undefined.
*
* Property maps for `CGAL::vertex_index_t`
* should be either available as internal property map
* must be either available as internal property map
* to `pmesh` or provided as \ref pmp_namedparameters "Named Parameters".
*
*
@ -651,7 +651,7 @@ void remove_connected_components(PolygonMesh& pmesh
* and removes the other connected components and all isolated vertices.
*
* Property maps for `CGAL::face_index_t` and `CGAL::vertex_index_t`
* should be either available as internal property maps
* must be either available as internal property maps
* to `pmesh` or provided as \ref pmp_namedparameters "Named Parameters".
*
* \note If the removal of the connected components makes `pmesh` a non-manifold surface,
@ -709,7 +709,7 @@ void remove_connected_components(PolygonMesh& pmesh
* and removes the other connected components and all isolated vertices.
*
* Property maps for `CGAL::face_index_t` and `CGAL::vertex_index_t`
* should be either available as internal property maps
* must be either available as internal property maps
* to `pmesh` or provided as \ref pmp_namedparameters "Named Parameters".
*
* \note If the removal of the connected components makes `pmesh` a non-manifold surface,

View File

@ -144,7 +144,7 @@ bool recursive_does_bound_a_volume(const TriangleMesh& tm,
* \cgalParamBegin{vertex_point_map}
* the property map with the points associated to the vertices of `tm`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `TriangleMesh`
* `CGAL::vertex_point_t` must be available in `TriangleMesh`
* \cgalParamEnd
* \cgalParamBegin{face_index_map}
* a property map containing the index of each face of `tm`.
@ -453,7 +453,7 @@ boolean_operation( TriangleMesh& tm1,
* \cgalParamBegin{vertex_point_map}
* the property map with the points associated to the vertices of `tm1` (`tm2`).
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `TriangleMesh`
* `CGAL::vertex_point_t` must be available in `TriangleMesh`
* \cgalParamEnd
* \cgalParamBegin{edge_is_constrained_map} a property map containing the
* constrained-or-not status of each edge of `tm1` (`tm2`).
@ -470,7 +470,7 @@ boolean_operation( TriangleMesh& tm1,
* \cgalParamBegin{vertex_point_map}
* the property map with the points associated to the vertices of `tm_out`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `TriangleMesh`
* `CGAL::vertex_point_t` must be available in `TriangleMesh`
* \cgalParamEnd
* \cgalParamBegin{edge_is_constrained_map} a property map containing the
* constrained-or-not status of each edge of `tm_out`. An edge of `tm_out` is constrained
@ -597,7 +597,7 @@ corefine_and_compute_difference( TriangleMesh& tm1,
* \cgalParamBegin{vertex_point_map}
* the property map with the points associated to the vertices of `tm1` (`tm2`).
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `TriangleMesh`
* `CGAL::vertex_point_t` must be available in `TriangleMesh`
* \cgalParamEnd
* \cgalParamBegin{edge_is_constrained_map} a property map containing the
* constrained-or-not status of each edge of `tm1` (`tm2`)
@ -690,7 +690,7 @@ namespace experimental {
* \cgalParamBegin{vertex_point_map}
* the property map with the points associated to the vertices of `tm`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `TriangleMesh`
* `CGAL::vertex_point_t` must be available in `TriangleMesh`
* \cgalParamEnd
* \cgalParamBegin{edge_is_constrained_map} a property map containing the
* constrained-or-not status of each edge of `tm`
@ -756,7 +756,7 @@ namespace experimental {
* \cgalParamBegin{vertex_point_map}
* the property map with the points associated to the vertices of `tm`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `TriangleMesh`
* `CGAL::vertex_point_t` must be available in `TriangleMesh`
* \cgalParamEnd
* \cgalParamBegin{edge_is_constrained_map} a property map containing the
* constrained-or-not status of each edge of `tm`

View File

@ -252,7 +252,7 @@ template<typename GT,
* or from the geometric traits class deduced from the point property map
* of `PolygonMesh`.
* \tparam EdgeIsFeatureMap a model of `ReadWritePropertyMap` with `boost::graph_traits<PolygonMesh>::%edge_descriptor`
* as key type and `bool` as value type. It should be default constructible.
* as key type and `bool` as value type. It must be default constructible.
* \tparam NamedParameters a sequence of \ref pmp_namedparameters "Named Parameters"
*
* \param pmesh the polygon mesh
@ -380,7 +380,7 @@ namespace internal
* computing a
* surface patch id for each face.
*
* A property map for `CGAL::face_index_t`should be either available
* A property map for `CGAL::face_index_t` must be either available
* as an internal property map to `pmesh` or provided as one of the Named Parameters.
*
* \tparam PolygonMesh a model of `FaceGraph`

View File

@ -244,7 +244,7 @@ sample_triangles(const FaceRange& triangles,
* \cgalParamBegin{vertex_point_map} the property map with the points
* associated to the vertices of `tm`. If this parameter is omitted,
* an internal property map for `CGAL::vertex_point_t`
* should be available for `TriangleMesh`.
* must be available for `TriangleMesh`.
* \cgalParamEnd
* \cgalParamBegin{geom_traits} a model of `PMPDistanceTraits`. \cgalParamEnd
* \cgalParamBegin{use_random_uniform_sampling}
@ -611,8 +611,8 @@ double approximate_Hausdorff_distance(
*
* \cgalNamedParamsBegin
* \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `tm2`
* If this parameter is omitted, an internal property map for CGAL::vertex_point_t should be available in `TriangleMesh`
* and in all places where vertex_point_map is used.
* If this parameter is omitted, an internal property map for `CGAL::vertex_point_t` must be available in `TriangleMesh`
* and in all places where `vertex_point_map` is used.
* \cgalParamEnd
* \cgalNamedParamsEnd
* The function `CGAL::parameters::all_default()` can be used to indicate to use the default values for
@ -671,7 +671,7 @@ double approximate_symmetric_Hausdorff_distance(
* \cgalNamedParamsBegin
* \cgalParamBegin{vertex_point_map}
* the property map with the points associated to the vertices of `tm`. If this parameter is omitted,
* an internal property map for `CGAL::vertex_point_t` should be available for the
* an internal property map for `CGAL::vertex_point_t` must be available for the
vertices of `tm` \cgalParamEnd
* \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `PMPDistanceTraits`\cgalParamEnd
* \cgalNamedParamsEnd
@ -708,7 +708,7 @@ double max_distance_to_triangle_mesh(const PointRange& points,
* \cgalNamedParamsBegin
* \cgalParamBegin{vertex_point_map}
* the property map with the points associated to the vertices of `tm`. If this parameter is omitted,
* an internal property map for `CGAL::vertex_point_t` should be available for the
* an internal property map for `CGAL::vertex_point_t` must be available for the
vertices of `tm` \cgalParamEnd
* \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `PMPDistanceTraits`. \cgalParamEnd
* \cgalNamedParamsEnd

View File

@ -96,7 +96,7 @@ namespace internal {
\cgalNamedParamsBegin
\cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `tmesh`.
If this parameter is omitted, an internal property map for
`CGAL::vertex_point_t` should be available in `TriangleMesh`\cgalParamEnd
`CGAL::vertex_point_t` must be available in `TriangleMesh`\cgalParamEnd
\cgalParamBegin{fairing_continuity} tangential continuity of the output surface patch. The larger `fairing_continuity` gets, the more fixed vertices are required \cgalParamEnd
\cgalParamBegin{sparse_linear_solver} an instance of the sparse linear solver used for fairing \cgalParamEnd
\cgalNamedParamsEnd

View File

@ -331,8 +331,6 @@ namespace internal {
{
tag_halfedges_status(face_range); //called first
constrain_patch_corners(face_range);
BOOST_FOREACH(face_descriptor f, face_range)
{
if (is_degenerate_triangle_face(halfedge(f,mesh_),mesh_,vpmap_,GeomTraits())){
@ -663,29 +661,30 @@ namespace internal {
vertex_descriptor va = source(he, mesh_);
vertex_descriptor vb = target(he, mesh_);
bool swap_done = false;
if (is_on_patch_border(va) && !is_on_patch_border(vb))
bool is_va_constrained = is_constrained(va) || is_on_patch_border(va);
bool is_vb_constrained = is_constrained(vb) || is_on_patch_border(vb);
// do not collapse edge with two constrained vertices
if (is_va_constrained && is_vb_constrained) continue;
bool can_swap = !is_vb_constrained;
if (is_va_constrained)
{
he = opposite(he, mesh_);
va = source(he, mesh_);
vb = target(he, mesh_);
swap_done = true;
CGAL_assertion(is_on_patch_border(vb) && !is_on_patch_border(va));
e=edge(he, mesh_);
std::swap(va, vb);
can_swap=false;
}
if(!collapse_does_not_invert_face(he))
{
if (!swap_done//if swap has already been done, don't re-swap
&& collapse_does_not_invert_face(opposite(he, mesh_)))
if (can_swap//if swap allowed (no constrained vertices)
&& collapse_does_not_invert_face(opposite(he, mesh_)))
{
he = opposite(he, mesh_);
va = source(he, mesh_);
vb = target(he, mesh_);
if (is_on_patch_border(va) && !is_on_patch_border(vb))
continue;//we cannot swap again. It would lead to a face inversion
else if (is_corner(va) && !is_corner(vb))
continue;//idem
e=edge(he, mesh_);
std::swap(va, vb);
}
else
continue;//both directions invert a face
@ -693,9 +692,7 @@ namespace internal {
CGAL_assertion(collapse_does_not_invert_face(he));
CGAL_assertion(is_collapse_allowed(e));
if (degree(va, mesh_) < 3
|| degree(vb, mesh_) < 3
|| !CGAL::Euler::does_satisfy_link_condition(e, mesh_))//necessary to collapse
if (!CGAL::Euler::does_satisfy_link_condition(e, mesh_))//necessary to collapse
continue;
//check that collapse would not create an edge with length > high
@ -710,9 +707,9 @@ namespace internal {
break;
}
}
//before collapsing va into vb, check that it does not break a corner
//if it is allowed, perform the collapse
if (collapse_ok && !is_constrained(va) && !is_corner(va))
// before collapsing va into vb, check that it does not break a corner
// or a constrained vertex
if (collapse_ok)
{
//"collapse va into vb along e"
// remove edges incident to va and vb, because their lengths will change
@ -728,12 +725,13 @@ namespace internal {
}
//before collapse
halfedge_descriptor he_opp= opposite(he, mesh_);
bool mesh_border_case = is_on_border(he);
bool mesh_border_case_opp = is_on_border(opposite(he, mesh_));
halfedge_descriptor ep_p = prev(opposite(he, mesh_), mesh_);
bool mesh_border_case_opp = is_on_border(he_opp);
halfedge_descriptor ep_p = prev(he_opp, mesh_);
halfedge_descriptor epo_p = opposite(ep_p, mesh_);
halfedge_descriptor en = next(he, mesh_);
halfedge_descriptor en_p = next(opposite(he, mesh_), mesh_);
halfedge_descriptor en_p = next(he_opp, mesh_);
Halfedge_status s_ep_p = status(ep_p);
Halfedge_status s_epo_p = status(epo_p);
Halfedge_status s_ep = status(prev(he, mesh_));
@ -743,34 +741,33 @@ namespace internal {
//do it before collapse is performed to be sure everything is valid
if (!mesh_border_case)
merge_status(en, s_epo, s_ep);
if (!mesh_border_case_opp)
if (!mesh_border_case_opp && s_ep_p!=PATCH_BORDER)
merge_status(en_p, s_epo_p, s_ep_p);
halfedge_and_opp_removed(he);
if (!mesh_border_case)
halfedge_and_opp_removed(prev(he, mesh_));
if (!mesh_border_case_opp)
halfedge_and_opp_removed(prev(opposite(he, mesh_), mesh_));
//constrained case
bool constrained_case = is_constrained(va) || is_constrained(vb);
if (constrained_case)
{
CGAL_assertion(is_constrained(va) ^ is_constrained(vb));//XOR
set_constrained(va, false);
set_constrained(vb, false);
if (s_ep_p!=PATCH_BORDER)
halfedge_and_opp_removed(prev(he_opp, mesh_));
else{
// swap edges so as to keep constained edges:
// replace en_p by epo_p and ep_p by eno_p
::CGAL::internal::swap_edges(en_p, epo_p, mesh_);
CGAL_assertion(is_valid(mesh_));
}
}
//perform collapse
Point target_point = get(vpmap_, vb);
CGAL_assertion(target(halfedge(e, mesh_), mesh_) == vb);
vertex_descriptor vkept = CGAL::Euler::collapse_edge(e, mesh_);
put(vpmap_, vkept, target_point);
CGAL_assertion(is_valid(mesh_));
CGAL_assertion(vkept == vb);//is the constrained point still here
++nb_collapses;
//fix constrained case
if (constrained_case)//we have made sure that collapse goes to constrained vertex
set_constrained(vkept, true);
CGAL_assertion((is_constrained(vkept) || is_on_patch_border(vb)) == (is_va_constrained || is_vb_constrained));
fix_degenerate_faces(vkept, short_edges, sq_low);
#ifdef CGAL_PMP_REMESHING_DEBUG
@ -944,10 +941,10 @@ namespace internal {
else if (is_on_patch(v))
{
Vector_3 vn = PMP::compute_vertex_normal(v, mesh_
, PMP::parameters::vertex_point_map(vpmap_)
.geom_traits(GeomTraits()));
put(propmap_normals, v, vn);
Vector_3 vn = PMP::compute_vertex_normal(v, mesh_
, PMP::parameters::vertex_point_map(vpmap_)
.geom_traits(GeomTraits()));
put(propmap_normals, v, vn);
Vector_3 move = CGAL::NULL_VECTOR;
unsigned int star_size = 0;
@ -1369,10 +1366,6 @@ private:
{
return get(vcmap_, v);
}
void set_constrained(const vertex_descriptor& v, const bool b)
{
put(vcmap_, v, b);
}
bool is_isolated(const vertex_descriptor& v) const
{
return halfedges_around_target(v, mesh_).empty();
@ -1415,43 +1408,6 @@ private:
return PMP::compute_face_normal(f, mesh_, parameters::vertex_point_map(vpmap_));
}
template <typename FaceRange>
void constrain_patch_corners(const FaceRange& face_range)
{
boost::container::flat_set<vertex_descriptor> visited;
BOOST_FOREACH(face_descriptor f, face_range)
{
BOOST_FOREACH(halfedge_descriptor h,
halfedges_around_face(halfedge(f, mesh_), mesh_))
{
vertex_descriptor vt = target(h, mesh_);
//treat target(h, mesh_)
if (visited.find(vt) != visited.end())
continue;//already treated
if (status(h) == PATCH)//h not on patch boundary
continue; //so neither is target(h, mesh_)
//count incident MESH_BORDER edges
unsigned int nb_incident_borders = 0;
BOOST_FOREACH(halfedge_descriptor hv,
halfedges_around_target(h, mesh_))
{
CGAL_assertion(vt == target(hv, mesh_));
if ( (status(hv) == PATCH_BORDER && status(opposite(hv, mesh_)) == MESH_BORDER)
|| (status(hv) == MESH_BORDER && status(opposite(hv, mesh_)) == PATCH_BORDER))
nb_incident_borders++;
}
if (nb_incident_borders == 1) //this is a special corner
set_constrained(vt, true);
visited.insert(vt);
}
}
}
template<typename FaceRange>
void tag_halfedges_status(const FaceRange& face_range)
{

View File

@ -383,7 +383,7 @@ struct Throw_at_first_output {
* \cgalNamedParamsBegin
* \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `TriangleMesh`\cgalParamEnd
* `CGAL::vertex_point_t` must be available in `TriangleMesh`\cgalParamEnd
* \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `PMPSelfIntersectionTraits` \cgalParamEnd
* \cgalNamedParamsEnd
* \return `out`
@ -503,7 +503,7 @@ compute_face_face_intersection(const FaceRange& face_range1,
* \cgalNamedParamsBegin
* \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `tm`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `TriangleMesh`\cgalParamEnd
* `CGAL::vertex_point_t` must be available in `TriangleMesh`\cgalParamEnd
* \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `PMPSelfIntersectionTraits` \cgalParamEnd
* \cgalNamedParamsEnd
* \return `out`
@ -627,7 +627,7 @@ compute_face_polyline_intersection( const FaceRange& face_range,
* \cgalNamedParamsBegin
* \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `tm`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `TriangleMesh`\cgalParamEnd
* `CGAL::vertex_point_t` must be available in `TriangleMesh`\cgalParamEnd
* \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `PMPSelfIntersectionTraits` \cgalParamEnd
* \cgalNamedParamsEnd
* \return `out`
@ -934,7 +934,7 @@ compute_polylines_polylines_intersection(const PolylineRange& polylines1,
* \cgalNamedParamsBegin
* \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `TriangleMesh`\cgalParamEnd
* `CGAL::vertex_point_t` must be available in `TriangleMesh`\cgalParamEnd
* \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `PMPSelfIntersectionTraits` \cgalParamEnd
* \cgalNamedParamsEnd
* \return `out`
@ -983,7 +983,7 @@ compute_face_face_intersection(const TriangleMesh& tm1,
* \cgalNamedParamsBegin
* \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `TriangleMesh`\cgalParamEnd
* `CGAL::vertex_point_t` must be available in `TriangleMesh`\cgalParamEnd
* \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `PMPSelfIntersectionTraits` \cgalParamEnd
* \cgalNamedParamsEnd
* \return `out`
@ -1189,7 +1189,7 @@ bool do_intersect(const Polyline& polyline1,
* \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `tm1` (tm2`).
* \attention The two property maps must have the same `value_type`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `TriangleMesh`\cgalParamEnd
* `CGAL::vertex_point_t` must be available in `TriangleMesh`\cgalParamEnd
* \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `PMPSelfIntersectionTraits` \cgalParamEnd
* \cgalParamBegin{do_overlap_test_of_bounded_sides} if set to `true` tests also the overlap of the bounded sides of `tm1` and `tm2`.
* If `false` (default), only the intersection of surface triangles are tested.
@ -1273,7 +1273,7 @@ bool do_intersect(const TriangleMesh& tm1,
* \cgalNamedParamsBegin
* \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `tm`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `TriangleMesh`\cgalParamEnd
* `CGAL::vertex_point_t` must be available in `TriangleMesh`\cgalParamEnd
* \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `PMPSelfIntersectionTraits` \cgalParamEnd
* \cgalNamedParamsEnd
*
@ -1329,7 +1329,7 @@ bool do_intersect(const TriangleMesh& tm,
* \cgalNamedParamsBegin
* \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `tn`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `TriangleMesh`\cgalParamEnd
* `CGAL::vertex_point_t` must be available in `TriangleMesh`\cgalParamEnd
* \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `PMPSelfIntersectionTraits` \cgalParamEnd
* \cgalNamedParamsEnd
*
@ -1550,13 +1550,13 @@ struct Mesh_callback
* \cgalParamEnd
* \cgalNamedParamsEnd
* \param nps an optional range of `vertex_point_map` named parameters containing the `VertexPointMap` of each mesh in `range`, in the same order.
* If this parameter is omitted, then an internal property map for `CGAL::vertex_point_t` should be available for every mesh in the range.
* If this parameter is omitted, then an internal property map for `CGAL::vertex_point_t` must be available for every mesh in the range.
* All the vertex point maps must be of the same type.
*
* \cgalNamedParamsBegin
* \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of a mesh.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in the triangle mesh type used in the range
* `CGAL::vertex_point_t` must be available in the triangle mesh type used in the range
* \cgalParamEnd
* \cgalNamedParamsEnd
*/

View File

@ -73,7 +73,7 @@ public:
* \cgalNamedParamsBegin
* \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `PolygonMesh`\cgalParamEnd
* `CGAL::vertex_point_t` must be available in `PolygonMesh`\cgalParamEnd
* \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `Kernel`\cgalParamEnd
* \cgalNamedParamsEnd
*
@ -154,7 +154,7 @@ public:
* \cgalNamedParamsBegin
* \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `PolygonMesh`\cgalParamEnd
* `CGAL::vertex_point_t` must be available in `PolygonMesh`\cgalParamEnd
* \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `Kernel`\cgalParamEnd
* \cgalNamedParamsEnd
*
@ -217,7 +217,7 @@ public:
* \cgalNamedParamsBegin
* \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `PolygonMesh`\cgalParamEnd
* `CGAL::vertex_point_t` must be available in `PolygonMesh`\cgalParamEnd
* \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `Kernel`\cgalParamEnd
* \cgalNamedParamsEnd
*
@ -293,7 +293,7 @@ public:
* \cgalNamedParamsBegin
* \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `TriangleMesh`\cgalParamEnd
* `CGAL::vertex_point_t` must be available in `TriangleMesh`\cgalParamEnd
* \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `Kernel`\cgalParamEnd
* \cgalNamedParamsEnd
*
@ -367,7 +367,7 @@ public:
* \cgalNamedParamsBegin
* \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `TriangleMesh`\cgalParamEnd
* `CGAL::vertex_point_t` must be available in `TriangleMesh`\cgalParamEnd
* \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `Kernel` \cgalParamEnd
* \cgalNamedParamsEnd
*
@ -426,7 +426,7 @@ public:
* \cgalNamedParamsBegin
* \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `TriangleMesh`\cgalParamEnd
* `CGAL::vertex_point_t` must be available in `TriangleMesh`\cgalParamEnd
* \cgalParamBegin{geom_traits}an instance of a geometric traits class, model of `Kernel`\cgalParamEnd
* \cgalNamedParamsEnd
*
@ -479,7 +479,7 @@ public:
* \cgalNamedParamsBegin
* \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `TriangleMesh`\cgalParamEnd
* `CGAL::vertex_point_t` must be available in `TriangleMesh`\cgalParamEnd
* \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `Kernel`\cgalParamEnd
* \cgalNamedParamsEnd
*

View File

@ -456,7 +456,7 @@ void recursive_orient_volume_ccs( TriangleMesh& tm,
* \cgalParamBegin{vertex_point_map}
* the property map with the points associated to the vertices of `tm`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `TriangleMesh`
* `CGAL::vertex_point_t` must be available in `TriangleMesh`
* \cgalParamEnd
* \cgalParamBegin{face_index_map}
* a property map containing the index of each face of `tm`.
@ -561,7 +561,7 @@ void orient(TriangleMesh& tm)
* \cgalParamBegin{vertex_point_map}
* the property map with the points associated to the vertices of `tm`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `TriangleMesh`
* `CGAL::vertex_point_t` must be available in `TriangleMesh`
* \cgalParamEnd
* \cgalParamBegin{face_index_map}
* a property map containing the index of each face of `tm`.

View File

@ -135,7 +135,7 @@ namespace internal {
* constrained-or-not status of each vertex of `tmesh`. A constrained vertex
* cannot be modified at all during perturbation
* \cgalParamEnd
* \cgalParamBegin{do_project} a boolean that sets whether vertices should be reprojected
* \cgalParamBegin{do_project} a boolean that sets whether vertices are reprojected
* on the input surface after their coordinates random perturbation
* \cgalParamEnd
* \cgalParamBegin{random_seed} a non-negative integer value to seed the random

View File

@ -57,7 +57,7 @@ namespace Polygon_mesh_processing {
\cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `tmesh`
Instance of a class model of `ReadWritePropertyMap`.
If this parameter is omitted, an internal property map for
`CGAL::vertex_point_t` should be available in `TriangleMesh`
`CGAL::vertex_point_t` must be available in `TriangleMesh`
\cgalParamEnd
\cgalParamBegin{density_control_factor} factor to control density of the output mesh,
where larger values lead to denser refinements.

View File

@ -63,7 +63,7 @@ namespace Polygon_mesh_processing {
* If `0` is passed then only the edge-flip, tangential relaxation, and projection steps will be done.
* @param np optional sequence of \ref pmp_namedparameters "Named Parameters" among the ones listed below
*
* @pre if constraints protection is activated, the constrained edges should
* @pre if constraints protection is activated, the constrained edges must
* not be longer than 4/3*`target_edge_length`
*
* \cgalNamedParamsBegin

View File

@ -676,7 +676,7 @@ std::size_t remove_null_edges(
/// \cgalNamedParamsBegin
/// \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh`. The type of this map is model of `ReadWritePropertyMap`.
/// If this parameter is omitted, an internal property map for
/// `CGAL::vertex_point_t` should be available in `TriangleMesh`
/// `CGAL::vertex_point_t` must be available in `TriangleMesh`
/// \cgalParamEnd
/// \cgalParamBegin{geom_traits} a geometric traits class instance.
/// The traits class must provide the nested type `Point_3`,

View File

@ -253,7 +253,7 @@ self_intersections( const FaceRange& face_range,
* \cgalNamedParamsBegin
* \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `TriangleMesh`\cgalParamEnd
* `CGAL::vertex_point_t` must be available in `TriangleMesh`\cgalParamEnd
* \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `PMPSelfIntersectionTraits` \cgalParamEnd
* \cgalNamedParamsEnd
*
@ -312,7 +312,7 @@ self_intersections(const TriangleMesh& tmesh, OutputIterator out)
* \cgalNamedParamsBegin
* \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `TriangleMesh`\cgalParamEnd
* `CGAL::vertex_point_t` must be available in `TriangleMesh`\cgalParamEnd
* \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `PMPSelfIntersectionTraits` \cgalParamEnd
* \cgalNamedParamsEnd
@ -403,7 +403,7 @@ OutputIterator self_intersections(const FaceRange& face_range,
* \cgalNamedParamsBegin
* \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `tmesh`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `TriangleMesh`\cgalParamEnd
* `CGAL::vertex_point_t` must be available in `TriangleMesh`\cgalParamEnd
* \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `PMPSelfIntersectionTraits` \cgalParamEnd
* \cgalNamedParamsEnd
*
@ -445,11 +445,11 @@ bool does_self_intersect(const TriangleMesh& tmesh
* \cgalNamedParamsBegin
* \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `tmesh`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `TriangleMesh`\cgalParamEnd
* `CGAL::vertex_point_t` must be available in `TriangleMesh`\cgalParamEnd
* \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `SelfIntersectionTraits` \cgalParamEnd
* \cgalNamedParamsEnd
*
* @return true if the faces in `face_range` self-intersects
* @return true if the faces in `face_range` self-intersect
*/
template <class FaceRange,
class TriangleMesh,

View File

@ -503,7 +503,7 @@ void stitch_borders(PolygonMesh& pmesh,
/// \cgalNamedParamsBegin
/// \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh`.
/// If this parameter is omitted, an internal property map for
/// `CGAL::vertex_point_t` should be available in `PolygonMesh`\cgalParamEnd
/// `CGAL::vertex_point_t` must be available in `PolygonMesh`\cgalParamEnd
/// \cgalNamedParamsEnd
///
template <typename PolygonMesh, class CGAL_PMP_NP_TEMPLATE_PARAMETERS>

View File

@ -44,7 +44,7 @@ namespace Polygon_mesh_processing{
* * \cgalNamedParamsBegin
* \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `mesh`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `PolygonMesh`\cgalParamEnd
* `CGAL::vertex_point_t` must be available in `PolygonMesh`\cgalParamEnd
* \cgalNamedParamsEnd
*
*/

View File

@ -412,7 +412,7 @@ public:
* \cgalNamedParamsBegin
* \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `PolygonMesh`\cgalParamEnd
* `CGAL::vertex_point_t` must be available in `PolygonMesh`\cgalParamEnd
* \cgalParamBegin{geom_traits} a geometric traits class instance \cgalParamEnd
* \cgalNamedParamsEnd
*
@ -464,7 +464,7 @@ bool triangulate_face(typename boost::graph_traits<PolygonMesh>::face_descriptor
* \cgalNamedParamsBegin
* \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `PolygonMesh`\cgalParamEnd
* `CGAL::vertex_point_t` must be available in `PolygonMesh`\cgalParamEnd
* \cgalParamBegin{geom_traits} a geometric traits class instance \cgalParamEnd
* \cgalNamedParamsEnd
*
@ -511,7 +511,7 @@ bool triangulate_faces(FaceRange face_range, PolygonMesh& pmesh)
* \cgalNamedParamsBegin
* \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` should be available in `PolygonMesh`\cgalParamEnd
* `CGAL::vertex_point_t` must be available in `PolygonMesh`\cgalParamEnd
* \cgalParamBegin{geom_traits} a geometric traits class instance \cgalParamEnd
* \cgalNamedParamsEnd
*

View File

@ -64,7 +64,7 @@ namespace Polygon_mesh_processing {
\cgalNamedParamsBegin
\cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh`.
If this parameter is omitted, an internal property map for
`CGAL::vertex_point_t` should be available in `PolygonMesh`\cgalParamEnd
`CGAL::vertex_point_t` must be available in `PolygonMesh`\cgalParamEnd
\cgalParamBegin{use_delaunay_triangulation} if `true`, use the Delaunay triangulation facet search space \cgalParamEnd
\cgalParamBegin{geom_traits} a geometric traits class instance \cgalParamEnd
\cgalNamedParamsEnd

View File

@ -20,10 +20,10 @@ polyhedron_demo_plugin(polylines_io_plugin Polylines_io_plugin)
target_link_libraries(polylines_io_plugin PUBLIC scene_polylines_item)
polyhedron_demo_plugin(selection_io_plugin Selection_io_plugin)
target_link_libraries(selection_io_plugin PUBLIC scene_polyhedron_selection_item)
target_link_libraries(selection_io_plugin PUBLIC scene_polyhedron_selection_item selection_plugin)
polyhedron_demo_plugin(selection_io_sm_plugin Selection_io_plugin)
target_link_libraries(selection_io_sm_plugin PUBLIC scene_surface_mesh_selection_item)
target_link_libraries(selection_io_sm_plugin PUBLIC scene_surface_mesh_selection_item selection_sm_plugin)
polyhedron_demo_plugin(stl_plugin STL_io_plugin)
target_link_libraries(stl_plugin PUBLIC scene_polyhedron_item scene_surface_mesh_item scene_polygon_soup_item)

View File

@ -642,9 +642,12 @@ private:
CGAL_IMAGE_IO_CASE(img->image(), this->launchAdders<Word>(seg_img, seg_img->name()))
Volume_plane_intersection* i
= new Volume_plane_intersection(double(img->xdim()) * img->vx()-1,
double(img->ydim()) * img->vy()-1,
double(img->zdim()) * img->vz()-1);
= new Volume_plane_intersection(img->xdim() * img->vx()-1,
img->ydim() * img->vy()-1,
img->zdim() * img->vz()-1,
img->image()->tx,
img->image()->ty,
img->image()->tz);
this->intersection_id = scene->addItem(i);
scene->changeGroup(i, group);
group->lockChild(i);
@ -667,9 +670,9 @@ private:
switchReaderConverter< Word >(minmax);
Volume_plane<x_tag> *x_item = new Volume_plane<x_tag>();
Volume_plane<y_tag> *y_item = new Volume_plane<y_tag>();
Volume_plane<z_tag> *z_item = new Volume_plane<z_tag>();
Volume_plane<x_tag> *x_item = new Volume_plane<x_tag>(img->image()->tx,img->image()->ty, img->image()->tz);
Volume_plane<y_tag> *y_item = new Volume_plane<y_tag>(img->image()->tx,img->image()->ty, img->image()->tz);
Volume_plane<z_tag> *z_item = new Volume_plane<z_tag>(img->image()->tx,img->image()->ty, img->image()->tz);
x_item->setProperty("img",qVariantFromValue((void*)seg_img));
y_item->setProperty("img",qVariantFromValue((void*)seg_img));

View File

@ -379,7 +379,7 @@ Meshing_thread* cgal_code_mesh_3(const Image* pImage,
Linear_interpolator<Kernel, Image_word_type>(),
0,
0,
iso_value,
Image_word_type(iso_value),
(std::max)(10, int(10 * (std::min)((std::min)(pImage->vx(),
pImage->vy()),
pImage->vz())

View File

@ -59,8 +59,10 @@ struct z_tag {};
template<typename Tag>
class Volume_plane : public Volume_plane_interface, public Tag {
private :
float tx, ty, tz;
public:
Volume_plane();
Volume_plane(float tx, float ty, float tz);
void invalidateOpenGLBuffers()
{
@ -75,20 +77,20 @@ public:
void compute_bbox(x_tag)const
{
_bbox = Bbox(0,0,0,
0, (adim_ - 1) * yscale_, (bdim_ - 1) * zscale_);
_bbox = Bbox(tx,ty,tz,
tx, ty+(adim_ - 1) * yscale_, tz+(bdim_ - 1) * zscale_);
}
void compute_bbox(y_tag)const
{
_bbox = Bbox(0,0,0,
(adim_ - 1) * xscale_, 0, (bdim_ - 1) * zscale_);
_bbox = Bbox(tx,ty,tz,
tx+(adim_ - 1) * xscale_, ty, tz+(bdim_ - 1) * zscale_);
}
void compute_bbox(z_tag)const
{
_bbox = Bbox(0,0,0,
(adim_ - 1) * xscale_, (bdim_ - 1) * yscale_, 0);
_bbox = Bbox(tx,ty,tz,
tx+(adim_ - 1) * xscale_,ty+ (bdim_ - 1) * yscale_, tz);
}
void setData(unsigned int adim, unsigned int bdim, unsigned int cdim,
@ -380,8 +382,9 @@ const char* Volume_plane<T>::fragmentShader_bordures_source =
template<typename T>
Volume_plane<T>::Volume_plane()
: Volume_plane_interface(new CGAL::qglviewer::ManipulatedFrame)
Volume_plane<T>::Volume_plane(float tx, float ty, float tz)
: Volume_plane_interface(new CGAL::qglviewer::ManipulatedFrame),
tx(tx), ty(ty), tz(tz)
{
const CGAL::qglviewer::Vec offset = static_cast<CGAL::Three::Viewer_interface*>(CGAL::QGLViewer::QGLViewerPool().first())->offset();
mFrame_->setPosition(offset.x, offset.y, offset.z);
@ -432,6 +435,7 @@ void Volume_plane<T>::draw(Viewer_interface *viewer) const {
mvp.data()[i] = (float)mat[i];
f.data()[i] = (float)mFrame_->matrix()[i];
}
mvp.translate(QVector3D(tx, ty, tz));
program_bordures.bind();
@ -645,7 +649,7 @@ bool Volume_plane<T>::eventFilter(QObject *, QEvent *event)
//is the picked point on the sphere ?
for (int i=0; i<4; ++i)
{
center = CGAL::qglviewer::Vec(c_spheres[i*3], c_spheres[i*3+1], c_spheres[i*3+2]);
center = CGAL::qglviewer::Vec(c_spheres[i*3]+tx, c_spheres[i*3+1]+ty, c_spheres[i*3+2]+tz);
if(
(center.x - pos.x) * (center.x - pos.x) +
(center.y - pos.y) * (center.y - pos.y) +

View File

@ -6,13 +6,16 @@
#include <QApplication>
struct Volume_plane_intersection_priv
{
Volume_plane_intersection_priv(float x, float y, float z, Volume_plane_intersection* parent)
: a(NULL), b(NULL), c(NULL), x(x), y(y), z(z) , item(parent)
Volume_plane_intersection_priv(float x, float y, float z,
float tx, float ty, float tz,
Volume_plane_intersection* parent)
: a(NULL), b(NULL), c(NULL), x(x), y(y), z(z),
tx(tx), ty(ty), tz(tz), item(parent)
{
item->are_buffers_filled = false;
}
Volume_plane_interface *a, *b, *c;
float x, y, z;
float x, y, z, tx, ty, tz;
enum VAOs{
AArray = 0,
@ -50,29 +53,29 @@ void Volume_plane_intersection_priv::computeElements()
c_vertex.resize(0);
const CGAL::qglviewer::Vec offset = static_cast<CGAL::Three::Viewer_interface*>(CGAL::QGLViewer::QGLViewerPool().first())->offset();
a_vertex.push_back(0.0-offset.x);
a_vertex.push_back(0.0-offset.y);
a_vertex.push_back(0.0-offset.z);
a_vertex.push_back(x -offset.x);
a_vertex.push_back(0.0-offset.y);
a_vertex.push_back(0.0-offset.z);
a_vertex.push_back(0.0-offset.x+tx);
a_vertex.push_back(0.0-offset.y+ty);
a_vertex.push_back(0.0-offset.z+tz);
a_vertex.push_back(x -offset.x+tx);
a_vertex.push_back(0.0-offset.y+ty);
a_vertex.push_back(0.0-offset.z+tz);
b_vertex.push_back(0.0-offset.x);
b_vertex.push_back(0.0-offset.y);
b_vertex.push_back(0.0-offset.z);
b_vertex.push_back(0.0-offset.x);
b_vertex.push_back(y -offset.y);
b_vertex.push_back(0.0-offset.z);
b_vertex.push_back(0.0-offset.x+tx);
b_vertex.push_back(0.0-offset.y+ty);
b_vertex.push_back(0.0-offset.z+tz);
b_vertex.push_back(0.0-offset.x+tx);
b_vertex.push_back(y -offset.y+ty);
b_vertex.push_back(0.0-offset.z+tz);
c_vertex.push_back(0.0-offset.x);
c_vertex.push_back(0.0-offset.y);
c_vertex.push_back(0.0-offset.z);
c_vertex.push_back(0.0-offset.x);
c_vertex.push_back(0.0-offset.y);
c_vertex.push_back(z -offset.z);
c_vertex.push_back(0.0-offset.x+tx);
c_vertex.push_back(0.0-offset.y+ty);
c_vertex.push_back(0.0-offset.z+tz);
c_vertex.push_back(0.0-offset.x+tx);
c_vertex.push_back(0.0-offset.y+ty);
c_vertex.push_back(z -offset.z+tz);
item->_bbox = Scene_item::Bbox( 0, 0, 0,
x, y, z);
item->_bbox = Scene_item::Bbox( tx, ty, tz,
tz+x, ty+y, tz+z);
QApplication::restoreOverrideCursor();
}
@ -188,9 +191,10 @@ void Volume_plane_intersection::draw(Viewer_interface* viewer) const {
viewer->glDepthRange(0.00001,1.0);
}
Volume_plane_intersection::Volume_plane_intersection(float x, float y, float z)
Volume_plane_intersection::Volume_plane_intersection(float x, float y, float z,
float tx, float ty, float tz)
:Scene_item(Volume_plane_intersection_priv::NumberOfVbos, Volume_plane_intersection_priv::NumberOfVaos),
d(new Volume_plane_intersection_priv(x,y,z,this))
d(new Volume_plane_intersection_priv(x,y,z,tx,ty,tz,this))
{
setColor(QColor(255, 128, 0));
setName("Volume plane intersection");

View File

@ -18,7 +18,7 @@ class Volume_plane_intersection
typedef std::pair<Volume_plane_interface*, Volume_plane_interface*> Interface_pair;
Q_OBJECT
public:
Volume_plane_intersection(float x, float y, float z);
Volume_plane_intersection(float x, float y, float z, float tx, float ty, float tz);
~Volume_plane_intersection();
bool isFinite() const { return true; }

View File

@ -4,6 +4,7 @@
#include <QVector>
#include <QMessageBox>
#include <QBitmap>
#include <QTabBar>
#include <CGAL/boost/graph/helpers.h>
#include <CGAL/boost/graph/Euler_operations.h>
#include <CGAL/Three/Scene_item.h>

View File

@ -87,11 +87,13 @@ polyhedron_demo_plugin(polyhedron_stitching_plugin Polyhedron_stitching_plugin)
target_link_libraries(polyhedron_stitching_plugin PUBLIC scene_polyhedron_item scene_surface_mesh_item scene_polylines_item)
qt5_wrap_ui( selectionUI_FILES Selection_widget.ui)
polyhedron_demo_plugin(selection_plugin Selection_plugin ${selectionUI_FILES})
add_library(selection_plugin SHARED Selection_plugin.cpp ${selectionUI_FILES})
#polyhedron_demo_plugin(selection_plugin Selection_plugin ${selectionUI_FILES})
target_link_libraries(selection_plugin PUBLIC scene_polyhedron_selection_item scene_points_with_normal_item scene_polylines_item)
qt5_wrap_ui( selectionUI_FILES Selection_widget.ui)
polyhedron_demo_plugin(selection_sm_plugin Selection_plugin ${selectionUI_FILES})
add_library(selection_sm_plugin SHARED Selection_plugin.cpp ${selectionUI_FILES})
#polyhedron_demo_plugin(selection_sm_plugin Selection_plugin ${selectionUI_FILES})
target_link_libraries(selection_sm_plugin PUBLIC scene_surface_mesh_selection_item scene_points_with_normal_item scene_polylines_item)
target_compile_definitions(selection_sm_plugin PUBLIC "-DUSE_SURFACE_MESH" )

View File

@ -641,7 +641,10 @@ protected:
if(!poly.empty())
for(std::size_t j=0; j<poly.size()-1; ++j)
{
painter->drawLine(poly[j].x(), poly[j].y(), poly[j+1].x(), poly[j+1].y());
painter->drawLine(int(poly[j].x()),
int(poly[j].y()),
int(poly[j+1].x()),
int(poly[j+1].y()));
}
}
painter->end();

View File

@ -1,3 +1,4 @@
#include <QAction>
#include <QApplication>
#include <QMessageBox>
#include <QMainWindow>

View File

@ -162,9 +162,6 @@ typedef CGAL::Surface_mesh_deformation<SMesh, CGAL::Default, CGAL::Default, CGAL
,CGAL::Default, CGAL::Default, CGAL::Default,
Array_based_vertex_point_map<SMesh> > Deform_sm_mesh;
typedef Deform_mesh::Point Point;
typedef Deform_sm_mesh::Point SM_Point;
/// For storing associated data with a group of control vertices
template<typename Mesh>
class Control_vertices_data

View File

@ -34,6 +34,10 @@ public:
double vy() const { return im_.vy(); }
double vz() const { return im_.vz(); }
double tx() const { return im_.image()->tx; }
double ty() const { return im_.image()->ty; }
double tz() const { return im_.image()->tz; }
private:
unsigned char non_null_neighbor_data(std::size_t i,
std::size_t j,
@ -320,7 +324,6 @@ Vertex_buffer_helper::push_normal(std::size_t i, std::size_t j, std::size_t k)
void
Vertex_buffer_helper::push_vertex(std::size_t i, std::size_t j, std::size_t k)
{
const CGAL::qglviewer::Vec offset = static_cast<CGAL::Three::Viewer_interface*>(CGAL::QGLViewer::QGLViewerPool().first())->offset();
indices_.insert(std::make_pair(compute_position(i,j,k),
vertices_.size()/3));
//resize the "border vertices"
@ -338,9 +341,9 @@ Vertex_buffer_helper::push_vertex(std::size_t i, std::size_t j, std::size_t k)
if (dk == double(data_.zdim()))
dk = double(data_.zdim())-0.5;
vertices_.push_back( (di - 0.5) * data_.vx()+offset.x);
vertices_.push_back( (dj - 0.5) * data_.vy()+offset.y);
vertices_.push_back( (dk - 0.5) * data_.vz()+offset.z);
vertices_.push_back( (di - 0.5) * data_.vx() + data_.tx());
vertices_.push_back( (dj - 0.5) * data_.vy() + data_.ty());
vertices_.push_back( (dk - 0.5) * data_.vz() + data_.tz());
}
void
@ -675,12 +678,12 @@ Scene_image_item::compute_bbox() const
if(!m_image)
_bbox = Bbox();
else
_bbox = Bbox(0,
0,
0,
(double(m_image->xdim()-1)) * m_image->vx(),
(double(m_image->ydim()-1)) * m_image->vy(),
(double(m_image->zdim()-1)) * m_image->vz());
_bbox = Bbox(m_image->image()->tx,
m_image->image()->ty,
m_image->image()->tz,
m_image->image()->tx+(m_image->xdim()-1) * m_image->vx(),
m_image->image()->ty+(m_image->ydim()-1) * m_image->vy(),
m_image->image()->tz+(m_image->zdim()-1) * m_image->vz());
}
void
@ -845,7 +848,7 @@ void Scene_image_item::changed()
void Scene_image_item_priv::draw_Bbox(Scene_item::Bbox bbox, std::vector<float> *vertices)
{
const CGAL::qglviewer::Vec offset = static_cast<CGAL::Three::Viewer_interface*>(CGAL::QGLViewer::QGLViewerPool().first())->offset();
const CGAL::qglviewer::Vec offset = static_cast<CGAL::Three::Viewer_interface*>(CGAL::QGLViewer::QGLViewerPool().first())->offset();
vertices->push_back(bbox.xmin()+offset.x);
vertices->push_back(bbox.ymin()+offset.y);
vertices->push_back(bbox.zmin()+offset.z);

View File

@ -184,16 +184,18 @@ void CGAL::Three::Scene_item::attribBuffers(CGAL::Three::Viewer_interface* viewe
if(is_selected) c = c.lighter(120);
viewer->getShaderProgram(program_name)->setAttributeValue
("color_facets",
c.redF(),
c.greenF(),
c.blueF());
GLfloat(c.redF()),
GLfloat(c.greenF()),
GLfloat(c.blueF()));
}
else if(program_name == PROGRAM_WITH_TEXTURED_EDGES)
{
if(is_selected) c = c.lighter(50);
viewer->getShaderProgram(program_name)->setUniformValue
("color_lines",
QVector3D(c.redF(), c.greenF(), c.blueF()));
QVector3D(float(c.redF()),
float(c.greenF()),
float(c.blueF())));
}
viewer->getShaderProgram(program_name)->release();
}

View File

@ -248,6 +248,9 @@ typedef Polygon_soup::Polygon_3 Facet;
void
Scene_polygon_soup_item_priv::triangulate_polygon(Polygons_iterator pit, int polygon_id) const
{
const CGAL::qglviewer::Vec off = static_cast<CGAL::Three::Viewer_interface*>(CGAL::QGLViewer::QGLViewerPool().first())->offset();
EPICK::Vector_3 offset(off.x,off.y,off.z);
//Computes the normal of the facet
const Point_3& pa = soup->points[pit->at(0)];
const Point_3& pb = soup->points[pit->at(1)];
@ -267,7 +270,7 @@ Scene_polygon_soup_item_priv::triangulate_polygon(Polygons_iterator pit, int pol
do {
FT::PointAndId pointId;
pointId.point = soup->points[pit->at(it)];
pointId.point = soup->points[pit->at(it)]+offset;
pointId.id = pit->at(it);
pointIds.push_back(pointId);
} while( ++it != it_end );

View File

@ -480,7 +480,7 @@ Scene_polyhedron_item_priv::triangulate_facet(Scene_polyhedron_item::Facet_itera
diagonal = item->diagonalBbox();
else
diagonal = 0.0;
FT triangulation(fit,normal,poly,diagonal);
FT triangulation(fit,normal,poly,diagonal,offset);
if(triangulation.cdt->dimension() != 2 )
{
@ -515,9 +515,9 @@ Scene_polyhedron_item_priv::triangulate_facet(Scene_polyhedron_item::Facet_itera
if(is_multicolor || !no_flat || !is_recent)
{
push_back_xyz(ffit->vertex(0)->point()+offset, positions_facets);
push_back_xyz(ffit->vertex(1)->point()+offset, positions_facets);
push_back_xyz(ffit->vertex(2)->point()+offset, positions_facets);
push_back_xyz(ffit->vertex(0)->point(), positions_facets);
push_back_xyz(ffit->vertex(1)->point(), positions_facets);
push_back_xyz(ffit->vertex(2)->point(), positions_facets);
if(!draw_two_sides)
{
push_back_xyz(normal, normals_flat);

View File

@ -421,13 +421,16 @@ void
Scene_polyhedron_selection_item_priv::triangulate_facet(fg_face_descriptor fit,const Vector normal,
std::vector<float> &p_facets,std::vector<float> &p_normals ) const
{
const CGAL::qglviewer::Vec off = static_cast<CGAL::Three::Viewer_interface*>(CGAL::QGLViewer::QGLViewerPool().first())->offset();
Kernel::Vector_3 offset(off.x,off.y,off.z);
typedef FacetTriangulator<Face_graph, Kernel, fg_vertex_descriptor> FT;
double diagonal;
if(item->poly_item->diagonalBbox() != std::numeric_limits<double>::infinity())
diagonal = item->poly_item->diagonalBbox();
else
diagonal = 0.0;
FT triangulation(fit,normal,poly,diagonal);
FT triangulation(fit,normal,poly,diagonal, offset);
//iterates on the internal faces to add the vertices to the positions
//and the normals to the appropriate vectors
for(FT::CDT::Finite_faces_iterator
@ -2251,7 +2254,7 @@ void Scene_polyhedron_selection_item::select_boundary()
QString
Scene_polyhedron_selection_item::toolTip() const
{
if(!poly_item->polyhedron())
if(!poly_item || !poly_item->polyhedron())
return QString();
return QObject::tr("<p>Selection <b>%1</b> (mode: %5, color: %6)</p>"

View File

@ -894,7 +894,9 @@ Scene_surface_mesh_item_priv::triangulate_facet(face_descriptor fd,
diagonal = item->diagonalBbox();
else
diagonal = 0.0;
FT triangulation(fd,normal,smesh_,diagonal);
const CGAL::qglviewer::Vec off = static_cast<CGAL::Three::Viewer_interface*>(CGAL::QGLViewer::QGLViewerPool().first())->offset();
EPICK::Vector_3 offset(off.x,off.y,off.z);
FT triangulation(fd,normal,smesh_,diagonal, offset);
//iterates on the internal faces
for(FT::CDT::Finite_faces_iterator
ffit = triangulation.cdt->finite_faces_begin(),
@ -913,16 +915,16 @@ Scene_surface_mesh_item_priv::triangulate_facet(face_descriptor fd,
else
color = 0;
addFlatData(ffit->vertex(0)->point(),
addFlatData(ffit->vertex(0)->point()-offset,
(*fnormals)[fd],
color,
name);
addFlatData(ffit->vertex(1)->point(),
addFlatData(ffit->vertex(1)->point()-offset,
(*fnormals)[fd],
color,
name);
addFlatData(ffit->vertex(2)->point(),
addFlatData(ffit->vertex(2)->point()-offset,
(*fnormals)[fd],
color,
name);

View File

@ -23,15 +23,15 @@ void TextRenderer::draw(CGAL::Three::Viewer_interface *viewer)
if(viewer->testDisplayId(src.x, src.y, src.z))
{
if(item->is_3D())
rect = QRect(camera->projectedCoordinatesOf(src).x-item->width()/2,
camera->projectedCoordinatesOf(src).y-item->height()/2,
item->width(),
item->height());
rect = QRect(int(camera->projectedCoordinatesOf(src).x-item->width()/2),
int(camera->projectedCoordinatesOf(src).y-item->height()/2),
int(item->width()),
int(item->height()));
else
rect = QRect(src.x-item->width()/2,
src.y-item->height()/2,
item->width(),
item->height());
rect = QRect(int(src.x-item->width()/2),
int(src.y-item->height()/2),
int(item->width()),
int(item->height()));
painter->setFont(item->font());
painter->setPen(QPen(item->color()));
@ -48,18 +48,18 @@ void TextRenderer::draw(CGAL::Three::Viewer_interface *viewer)
{
if(item->is_always_visible() || viewer->testDisplayId(src.x, src.y, src.z))
{
rect = QRect(camera->projectedCoordinatesOf(src).x-item->width()/2,
camera->projectedCoordinatesOf(src).y-item->height()/2,
item->width(),
item->height());
rect = QRect(int(camera->projectedCoordinatesOf(src).x-item->width()/2),
int(camera->projectedCoordinatesOf(src).y-item->height()/2),
int(item->width()),
int(item->height()));
}
}
else
{
rect = QRect(src.x-item->width()/2,
src.y-item->height()/2,
item->width(),
item->height());
rect = QRect(int(src.x-item->width()/2),
int(src.y-item->height()/2),
int(item->width()),
int(item->height()));
}
painter->setFont(item->font());
painter->setPen(QPen(item->color()));

View File

@ -721,7 +721,10 @@ void Viewer::drawVisualHints()
//Prints the displayMessage
QFont font = QFont();
QFontMetrics fm(font);
TextItem *message_text = new TextItem(10 + fm.width(d->message)/2, height()-20, 0, d->message, false, QFont(), Qt::gray );
TextItem *message_text = new TextItem(float(10 + fm.width(d->message)/2),
float(height()-20),
0, d->message, false,
QFont(), Qt::gray );
if (d->_displayMessage)
{
d->textRenderer->addText(message_text);
@ -933,7 +936,10 @@ void Viewer::paintGL()
else
{
d->painter->beginNativePainting();
glClearColor(backgroundColor().redF(), backgroundColor().greenF(), backgroundColor().blueF(), 1.0);
glClearColor(GLfloat(backgroundColor().redF()),
GLfloat(backgroundColor().greenF()),
GLfloat(backgroundColor().blueF()),
1.f);
glClearDepth(1.0f);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
//set the default frustum
@ -992,8 +998,8 @@ void Viewer_impl::showDistance(QPoint pixel)
// fills the buffers
std::vector<float> v;
v.resize(6);
v[0] = APoint.x; v[1] = APoint.y; v[2] = APoint.z;
v[3] = BPoint.x; v[4] = BPoint.y; v[5] = BPoint.z;
v[0] = float(APoint.x); v[1] = float(APoint.y); v[2] = float(APoint.z);
v[3] = float(BPoint.x); v[4] = float(BPoint.y); v[5] = float(BPoint.z);
rendering_program_dist.bind();
vao.bind();
buffer.bind();
@ -1007,12 +1013,21 @@ void Viewer_impl::showDistance(QPoint pixel)
double dist = std::sqrt((BPoint.x-APoint.x)*(BPoint.x-APoint.x) + (BPoint.y-APoint.y)*(BPoint.y-APoint.y) + (BPoint.z-APoint.z)*(BPoint.z-APoint.z));
QFont font;
font.setBold(true);
TextItem *ACoord = new TextItem(APoint.x, APoint.y, APoint.z,QString("A(%1,%2,%3)").arg(APoint.x-viewer->offset().x).arg(APoint.y-viewer->offset().y).arg(APoint.z-viewer->offset().z), true, font, Qt::red, true);
TextItem *ACoord = new TextItem(float(APoint.x),
float(APoint.y),
float(APoint.z),
QString("A(%1,%2,%3)").arg(APoint.x-viewer->offset().x).arg(APoint.y-viewer->offset().y).arg(APoint.z-viewer->offset().z), true, font, Qt::red, true);
distance_text.append(ACoord);
TextItem *BCoord = new TextItem(BPoint.x, BPoint.y, BPoint.z,QString("B(%1,%2,%3)").arg(BPoint.x-viewer->offset().x).arg(BPoint.y-viewer->offset().y).arg(BPoint.z-viewer->offset().z), true, font, Qt::red, true);
TextItem *BCoord = new TextItem(float(BPoint.x),
float(BPoint.y),
float(BPoint.z),
QString("B(%1,%2,%3)").arg(BPoint.x-viewer->offset().x).arg(BPoint.y-viewer->offset().y).arg(BPoint.z-viewer->offset().z), true, font, Qt::red, true);
distance_text.append(BCoord);
CGAL::qglviewer::Vec centerPoint = 0.5*(BPoint+APoint);
TextItem *centerCoord = new TextItem(centerPoint.x, centerPoint.y, centerPoint.z,QString(" distance: %1").arg(dist), true, font, Qt::red, true);
TextItem *centerCoord = new TextItem(float(centerPoint.x),
float(centerPoint.y),
float(centerPoint.z),
QString(" distance: %1").arg(dist), true, font, Qt::red, true);
distance_text.append(centerCoord);
Q_FOREACH(TextItem* ti, distance_text)

View File

@ -215,9 +215,9 @@ void compute_displayed_ids(Mesh& mesh,
}
}
QVector3D point(
get(ppmap, displayed_vertices[0]).x() + offset.x,
get(ppmap, displayed_vertices[0]).y() + offset.y,
get(ppmap, displayed_vertices[0]).z() + offset.z);
float(get(ppmap, displayed_vertices[0]).x() + offset.x),
float(get(ppmap, displayed_vertices[0]).y() + offset.y),
float(get(ppmap, displayed_vertices[0]).z() + offset.z));
//test if we want to erase or not
BOOST_FOREACH(TextItem* text_item, *targeted_ids)
@ -342,7 +342,10 @@ void compute_displayed_ids(Mesh& mesh,
Point pos=Point(get(ppmap, vh).x()+offset.x,
get(ppmap, vh).y()+offset.y,
get(ppmap, vh).z()+offset.z);
TextItem* text_item = new TextItem(pos.x(), pos.y(), pos.z(), QString("%1").arg(get(vidmap, vh)), true, font, Qt::red);
TextItem* text_item = new TextItem(float(pos.x()),
float(pos.y()),
float(pos.z()),
QString("%1").arg(get(vidmap, vh)), true, font, Qt::red);
vitems->append(text_item);
targeted_ids->push_back(text_item);
}
@ -354,7 +357,10 @@ void compute_displayed_ids(Mesh& mesh,
pos.y()+offset.y,
pos.z()+offset.z);
TextItem* text_item = new TextItem(pos.x(), pos.y(), pos.z(), QString("%1").arg(get(hidmap, h)/2), true, font, Qt::green);
TextItem* text_item = new TextItem(float(pos.x()),
float(pos.y()),
float(pos.z()),
QString("%1").arg(get(hidmap, h)/2), true, font, Qt::green);
eitems->append(text_item);
}
@ -373,7 +379,10 @@ void compute_displayed_ids(Mesh& mesh,
Point pos(x/total+offset.x,
y/total+offset.y,
z/total+offset.z);
TextItem* text_item = new TextItem(pos.x(), pos.y(), pos.z(), QString("%1").arg(get(fidmap,f)), true, font, Qt::blue);
TextItem* text_item = new TextItem(float(pos.x()),
float(pos.y()),
float(pos.z()),
QString("%1").arg(get(fidmap,f)), true, font, Qt::blue);
fitems->append(text_item);
}
}
@ -398,9 +407,9 @@ bool printVertexIds(const Mesh& mesh,
BOOST_FOREACH(typename boost::graph_traits<Mesh>::vertex_descriptor vh, vertices(mesh))
{
const Point& p = get(ppmap, vh);
vitems->append(new TextItem((float)p.x() + offset.x,
(float)p.y() + offset.y,
(float)p.z() + offset.z,
vitems->append(new TextItem(float(p.x() + offset.x),
float(p.y() + offset.y),
float(p.z() + offset.z),
QString("%1").arg(get(idmap, vh)), true, font, Qt::red));
}
@ -433,9 +442,9 @@ bool printEdgeIds(const Mesh& mesh,
{
const Point& p1 = get(ppmap, source(e, mesh));
const Point& p2 = get(ppmap, target(e, mesh));
eitems->append(new TextItem((float)(p1.x() + p2.x()) / 2 + offset.x,
(float)(p1.y() + p2.y()) / 2 + offset.y,
(float)(p1.z() + p2.z()) / 2 + offset.z,
eitems->append(new TextItem(float((p1.x() + p2.x()) / 2 + offset.x),
float((p1.y() + p2.y()) / 2 + offset.y),
float((p1.z() + p2.z()) / 2 + offset.z),
QString("%1").arg(get(idmap, halfedge(e, mesh)) / 2), true, font, Qt::green));
}
//add the QList to the render's pool
@ -473,9 +482,9 @@ bool printFaceIds(const Mesh& mesh,
total += 1.f;
}
fitems->append(new TextItem((float)x / total + offset.x,
(float)y / total + offset.y,
(float)z / total + offset.z,
fitems->append(new TextItem(float(x / total + offset.x),
float(y / total + offset.y),
float(z / total + offset.z),
QString("%1").arg(get(idmap, fh)), true, font, Qt::blue));
}
//add the QList to the render's pool

View File

@ -50,15 +50,16 @@ public:
//Constructor
FacetTriangulator(typename boost::graph_traits<Mesh>::face_descriptor fd,
const Vector& normal,
const Vector& normal,
Mesh *poly,
const double item_diag)
const double item_diag,
Vector offset = Vector(0,0,0))
{
std::vector<PointAndId> idPoints;
BOOST_FOREACH(halfedge_descriptor he_circ, halfedges_around_face( halfedge(fd, *poly), *poly))
{
PointAndId idPoint;
idPoint.point = get(boost::vertex_point,*poly,source(he_circ, *poly));
idPoint.point = get(boost::vertex_point,*poly,source(he_circ, *poly))+offset;
idPoint.id = source(he_circ, *poly);
idPoints.push_back(idPoint);
@ -70,13 +71,14 @@ public:
const std::vector<typename Kernel::Point_3>& more_points,
const Vector& normal,
Mesh *poly,
const double item_diag)
const double item_diag,
Vector offset = Vector(0,0,0))
{
std::vector<PointAndId> idPoints;
BOOST_FOREACH(halfedge_descriptor he_circ, halfedges_around_face( halfedge(fd, *poly), *poly))
{
PointAndId idPoint;
idPoint.point = get(boost::vertex_point,*poly,source(he_circ, *poly));
idPoint.point = get(boost::vertex_point,*poly,source(he_circ, *poly))+offset;
idPoint.id = source(he_circ, *poly);
idPoints.push_back(idPoint);

View File

@ -36,6 +36,9 @@
#include <utility> // defines std::pair
#include <CGAL/Cartesian_converter_fwd.h>
#include <CGAL/Kernel_traits_fwd.h>
namespace CGAL {
/// \cond SKIP_DOXYGEN
@ -469,7 +472,7 @@ struct Constant_property_map
};
/// \ingroup PkgProperty_map
/// Read-write Property map turning a set (such a `std::set`,
/// Read-write property map turning a set (such a `std::set`,
/// `boost::unordered_set`, `std::unordered_set`) into a property map
/// associating a Boolean to the value type of the set. The function `get` will
/// return `true` if the key is inside the set and `false` otherwise. The `put`
@ -515,6 +518,50 @@ make_boolean_property_map(Set& set_)
return Boolean_property_map<Set>(set_);
}
/// \ingroup PkgProperty_map
/// Read-write property map doing on-the-fly conversions between two default constructible \cgal %Cartesian kernels.
/// Its value type is `GeomObject` and its key type is the same as `Vpm`.
/// `GeomObject` must be a geometric object from a \cgal kernel.
/// `Vpm` is a model `of ReadWritePropertyMap` and its value type must be
/// a geometric object of the same type as `GeomObject` but possibly from
/// another kernel.
/// Conversions between the two geometric objects are done using `Cartesian_converter`.
/// \cgalModels `ReadWritePropertyMap`
template<class GeomObject, class Vpm>
struct Cartesian_converter_property_map
{
typedef typename boost::property_traits<Vpm>::key_type key_type;
typedef GeomObject value_type;
typedef value_type reference;
typedef boost::read_write_property_map_tag category;
Vpm vpm;
typedef typename Kernel_traits<GeomObject>::type K2;
typedef typename Kernel_traits<typename boost::property_traits<Vpm>::value_type>::type K1;
Cartesian_converter_property_map(Vpm vpm):vpm(vpm){}
friend value_type get(const Cartesian_converter_property_map<GeomObject, Vpm>& pm, const key_type& k)
{
return
CGAL::Cartesian_converter<K1, K2>()(get(pm.vpm, k));
}
friend void put(Cartesian_converter_property_map<GeomObject, Vpm>& pm, const key_type& k, const value_type& v)
{
put(pm.vpm, k, CGAL::Cartesian_converter<K2, K1>()(v));
}
};
/// \ingroup PkgProperty_map
/// returns `Cartesian_converter_property_map<GeomObject, Vpm>(vpm)`
template<class GeomObject, class Vpm>
Cartesian_converter_property_map<GeomObject, Vpm>
make_cartesian_converter_property_map(Vpm vpm)
{
return Cartesian_converter_property_map<GeomObject, Vpm>(vpm);
}
} // namespace CGAL

View File

@ -55,6 +55,8 @@ create_single_source_cgal_program( "dynamic_property_map.cpp" )
create_single_source_cgal_program( "dynamic_properties_test.cpp" )
create_single_source_cgal_program( "kernel_converter_properties_test.cpp" )
if(OpenMesh_FOUND)
target_link_libraries( dynamic_properties_test PRIVATE ${OPENMESH_LIBRARIES} )
endif()

View File

@ -0,0 +1,37 @@
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/Quotient.h>
#include <CGAL/MP_Float.h>
#include <CGAL/Cartesian_converter.h>
#include <CGAL/property_map.h>
typedef CGAL::Simple_cartesian<double> K1;
typedef CGAL::Simple_cartesian<CGAL::Quotient<CGAL::MP_Float> > K2;
typedef K1::Point_3 Point_3;
template <typename Mesh>
void
test()
{
Mesh m;
CGAL::make_triangle(Point_3(2,0,0),Point_3(1,0,0),Point_3(1,1,0),m);
typedef typename boost::property_map<Mesh, CGAL::vertex_point_t >::type VPMap;
VPMap vmap = get(CGAL::vertex_point, m);
CGAL::Cartesian_converter_property_map<K2::Point_3, VPMap> kcmap =CGAL::make_cartesian_converter_property_map<K2::Point_3>(vmap);
CGAL_assertion(get(kcmap, *vertices(m).begin()) == CGAL::Point_3<K2>(2,0,0));
put(kcmap, *vertices(m).begin(), CGAL::Point_3<K2>(0,2,3));
CGAL_assertion(get(kcmap, *vertices(m).begin()) == CGAL::Point_3<K2>(0,2,3));
}
int main()
{
typedef CGAL::Surface_mesh<Point_3> SM;
test<SM>();
return 0;
}

View File

@ -28,6 +28,12 @@
#ifndef CGAL_ASSERTIONS_BEHAVIOUR_H
#define CGAL_ASSERTIONS_BEHAVIOUR_H
// workaround against the definition of EXIT in <opencv2/core/internal.hpp>
#ifdef EXIT
# undef EXIT
#endif
namespace CGAL {
enum Failure_behaviour { ABORT, EXIT, EXIT_WITH_SUCCESS, CONTINUE,

View File

@ -10,6 +10,8 @@ do
echo "0 otherwise."
exit 0
;;
--check_headers) DO_CHECK_HEADERS="True"
;;
--*) echo "bad option $1"
;;
*) DOX_PATH="$1"
@ -29,6 +31,9 @@ do
done
cmake -DCGAL_HEADER_ONLY=FALSE -DCGAL_ENABLE_CHECK_HEADERS=TRUE -DDOXYGEN_EXECUTABLE="$DOX_PATH" -DCGAL_COPY_DEPENDENCIES=TRUE -DCMAKE_CXX_FLAGS="-std=c++11" ..
if [ -n "$DO_CHECK_HEADERS" ]; then
make -j$(nproc --all) -k check_headers
fi
make -j$(nproc --all) -k packages_dependencies
echo " Checks finished"
for pkg_path in $CGAL_ROOT/*

View File

@ -146,13 +146,17 @@ class Fuzzy_sphere< Search_traits_adapter<K,PM,Base_traits> >
public:
// constructors
Fuzzy_sphere(const SearchTraits& traits_=SearchTraits()):Base(traits_){}
Fuzzy_sphere(const typename Base_traits::Point_d& center, FT radius, FT epsilon=FT(0),const SearchTraits& traits_=SearchTraits()) :
Base(center,radius,epsilon,traits_) {}
Fuzzy_sphere(const typename SearchTraits::Point_d& center, FT radius, FT epsilon=FT(0),
const SearchTraits& traits_=SearchTraits(),
// Constructor for any point type that is not `SearchTraits::Point_d`
template <typename Point> // boost::disable_if requires a template argument to work
Fuzzy_sphere(const Point& center, FT radius, FT epsilon=FT(0),const SearchTraits& traits_=SearchTraits(),
typename boost::disable_if<
boost::is_same<typename Base_traits::Point_d,
typename SearchTraits::Point_d> >::type* = 0)
boost::is_same<typename SearchTraits::Point_d,
Point> >::type* = 0)
: Base(center,radius,epsilon,traits_) {}
Fuzzy_sphere(const typename SearchTraits::Point_d& center, FT radius, FT epsilon=FT(0),
const SearchTraits& traits_=SearchTraits())
: Base(get(traits_.point_property_map(),center),radius,epsilon,traits_) {}
};

View File

@ -33,6 +33,7 @@
#include <boost/mpl/has_xxx.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/utility/enable_if.hpp>
namespace CGAL{
@ -111,11 +112,23 @@ public:
// This is needed because of an undocumented requirement of
// Orthogonal_k_neighbor_search and Orthogonal_incremental_neighbor_search:
// Traits::Construct_cartesian_const_iterator should be callable
// on the query point type
typename Base_traits::Cartesian_const_iterator_d operator()(const typename Base_traits::Point_d& p) const
// on the query point type. If the query point type is the same as
// Point_with_info, we disable it.
template <typename Point> // boost::disable_if requires a template argument to work
typename Base_traits::Cartesian_const_iterator_d operator()(const Point& p,
typename boost::disable_if<
boost::is_same<Point_with_info,
Point> >::type* = 0
) const
{ return Base::operator() (p); }
typename Base_traits::Cartesian_const_iterator_d operator()(const typename Base_traits::Point_d& p, int) const
template <typename Point> // boost::disable_if requires a template argument to work
typename Base_traits::Cartesian_const_iterator_d operator()(const Point& p, int,
typename boost::disable_if<
boost::is_same<Point_with_info,
Point> >::type* = 0
) const
{ return Base::operator() (p,0); }
};

View File

@ -0,0 +1,38 @@
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Kd_tree.h>
#include <CGAL/point_generators_2.h>
#include <CGAL/algorithm.h>
#include <CGAL/Fuzzy_sphere.h>
#include <CGAL/Search_traits_2.h>
#include <CGAL/property_map.h>
typedef CGAL::Simple_cartesian<double> Kernel;
typedef Kernel::Point_2 Point_2;
typedef CGAL::Random_points_in_disc_2<Point_2> Random_points;
typedef CGAL::Identity_property_map<Point_2> Point_map;
typedef CGAL::Search_traits_2<Kernel> Search_base;
typedef CGAL::Search_traits_adapter<Point_2, Point_map, Search_base> Search_traits;
typedef CGAL::Fuzzy_sphere<Search_traits> Fuzzy_circle;
typedef CGAL::Kd_tree<Search_traits> Tree;
int main ()
{
Random_points rdpts;
std::vector<Point_2> pts;
for (std::size_t i = 0; i < 50; ++ i)
pts.push_back (*(rdpts ++));
Tree tree (pts.begin(), pts.end());
Point_2 center(0., 0.);
Fuzzy_circle circle (center, 0.5);
std::vector<Point_2> result;
tree.search(std::back_inserter(result), circle);
std::cout << "The points in the fuzzy circle centered at (0., 0.) ";
std::cout << "with fuzzy radius (0.5) are: " << std::endl;
for (std::size_t i = 0; i < result.size(); ++ i)
std::cout << " * " << result[i] << std::endl;
return 0;
}

View File

@ -769,15 +769,15 @@ void Volume::display_marchin_cube()
const unsigned int nbt = facets.size() / 9;
for(unsigned int i=begin;i<nbt;i++)
{
const Point a(facets[9*i], facets[9*i+1], facets[9*i+2]);
const Point b(facets[9*i+3], facets[9*i+4], facets[9*i+5]);
const Point c(facets[9*i+6], facets[9*i+7], facets[9*i+8]);
const Point_3 a(facets[9*i], facets[9*i+1], facets[9*i+2]);
const Point_3 b(facets[9*i+3], facets[9*i+4], facets[9*i+5]);
const Point_3 c(facets[9*i+6], facets[9*i+7], facets[9*i+8]);
const Triangle_3 t(a,b,c);
const Vector u = t[1] - t[0];
const Vector v = t[2] - t[0];
Vector n = CGAL::cross_product(u,v);
n = n / std::sqrt(n*n);
m_surface_mc.push_back(Facet(t,n,values_list->item(value_id)));
m_surface_mc.push_back(Facet_(t,n,values_list->item(value_id)));
}
nbs_of_mc_triangles[value_id]=m_surface_mc.size();
mc_timer.start();
@ -791,7 +791,7 @@ void Volume::display_marchin_cube()
list_draw_marching_cube_is_valid = false;
}
CGAL::Bbox_3 bbox(0,0,0,0,0,0);
for(std::vector<Facet>::const_iterator
for(std::vector<Facet_>::const_iterator
it = m_surface_mc.begin(), end = m_surface_mc.end();
it != end; ++it)
{
@ -876,7 +876,7 @@ void Volume::display_surface_mesher_result()
if(mw->searchSeedsCheckBox->isChecked())
{
typedef std::vector<std::pair<Point, double> > Seeds;
typedef std::vector<std::pair<Point_3, double> > Seeds;
Seeds seeds;
{
std::cerr << "Search seeds...\n";
@ -905,13 +905,13 @@ void Volume::display_surface_mesher_result()
it != end; ++it)
{
seeds_out << it->first << std::endl;
CGAL::Random_points_on_sphere_3<Point> random_points_on_sphere_3(it->second);
CGAL::Random_points_on_sphere_3<Point_3> random_points_on_sphere_3(it->second);
Oracle::Intersect_3 intersect = oracle.intersect_3_object();
for(int i = 0; i < 20; ++i)
{
const Point test = it->first + (*random_points_on_sphere_3++ - CGAL::ORIGIN);
const Point_3 test = it->first + (*random_points_on_sphere_3++ - CGAL::ORIGIN);
CGAL::Object o = intersect(surface, Segment_3(it->first, test));
if (const Point* intersection = CGAL::object_cast<Point>(&o)) {
if (const Point_3* intersection = CGAL::object_cast<Point_3>(&o)) {
segments_out << "2 " << it->first << " " << *intersection << std::endl;
del.insert(*intersection);
}
@ -1043,8 +1043,8 @@ void Volume::display_surface_mesher_result()
const int index = fit->second;
// here "left" means nothing
const Point left_circumcenter = cell->circumcenter();
const Point right_circumcenter = cell->neighbor(index)->circumcenter();
const Point_3 left_circumcenter = cell->circumcenter();
const Point_3 right_circumcenter = cell->neighbor(index)->circumcenter();
const Triangle_3 t =
Triangle_3(cell->vertex(del.vertex_triple_index(index, 0))->point(),
@ -1056,13 +1056,13 @@ void Volume::display_surface_mesher_result()
n = n / std::sqrt(n*n);
if(mw->labellizedRadioButton->isChecked())
{
m_surface.push_back(Facet(t,
m_surface.push_back(Facet_(t,
n,
values_list->search((std::max)(surface(left_circumcenter),
surface(right_circumcenter)))));
}
else {
m_surface.push_back(Facet(t,n,cell->vertex(del.vertex_triple_index(index, 0))->point().element_index()));
m_surface.push_back(Facet_(t,n,cell->vertex(del.vertex_triple_index(index, 0))->point().element_index()));
}
}
@ -1072,7 +1072,7 @@ void Volume::display_surface_mesher_result()
}
CGAL::Bbox_3 bbox(0,0,0,0,0,0);
for(std::vector<Facet>::const_iterator
for(std::vector<Facet_>::const_iterator
it = m_surface.begin(), end = m_surface.end();
it != end; ++it)
{
@ -1253,8 +1253,8 @@ void Volume::draw()
end = del.finite_edges_end();
eit != end; ++eit)
{
const Point p1 = eit->first->vertex(eit->second)->point();
const Point p2 = eit->first->vertex(eit->third)->point();
const Point_3 p1 = eit->first->vertex(eit->second)->point();
const Point_3 p2 = eit->first->vertex(eit->third)->point();
::glVertex3d(p1.x(),p1.y(),p1.z());
::glVertex3d(p2.x(),p2.y(),p2.z());
}
@ -1354,9 +1354,9 @@ void Volume::gl_draw_surface()
if(c2t3.face_status(facet_cell, facet_index) == C2t3::NOT_IN_COMPLEX) {
continue;
}
const Point& a = facet_cell->vertex(del.vertex_triple_index(facet_index, 0))->point();
const Point& b = facet_cell->vertex(del.vertex_triple_index(facet_index, 1))->point();
const Point& c = facet_cell->vertex(del.vertex_triple_index(facet_index, 2))->point();
const Point_3& a = facet_cell->vertex(del.vertex_triple_index(facet_index, 0))->point();
const Point_3& b = facet_cell->vertex(del.vertex_triple_index(facet_index, 1))->point();
const Point_3& c = facet_cell->vertex(del.vertex_triple_index(facet_index, 2))->point();
Vector n = CGAL::cross_product(b-a,c-a);
n = n / std::sqrt(n*n); // unit normal
if(m_inverse_normals) {
@ -1443,9 +1443,9 @@ void Volume::gl_draw_surface()
else
continue; // go to next facet
}
const Point& a = opposite_cell->vertex(del.vertex_triple_index(opposite_index, 0))->point();
const Point& b = opposite_cell->vertex(del.vertex_triple_index(opposite_index, 1))->point();
const Point& c = opposite_cell->vertex(del.vertex_triple_index(opposite_index, 2))->point();
const Point_3& a = opposite_cell->vertex(del.vertex_triple_index(opposite_index, 0))->point();
const Point_3& b = opposite_cell->vertex(del.vertex_triple_index(opposite_index, 1))->point();
const Point_3& c = opposite_cell->vertex(del.vertex_triple_index(opposite_index, 2))->point();
Vector n = CGAL::cross_product(b-a,c-a);
n = n / std::sqrt(n*n); // unit normal
if(m_inverse_normals) {
@ -1480,7 +1480,7 @@ void Volume::gl_draw_surface(Iterator begin, Iterator end, const QTreeWidgetItem
unsigned int counter = 0;
for(Iterator it = begin; it != end; ++it)
{
const Facet& f = *it;
const Facet_& f = *it;
if(f.get<2>() != i) continue;
@ -1492,9 +1492,9 @@ void Volume::gl_draw_surface(Iterator begin, Iterator end, const QTreeWidgetItem
::glNormal3d(n.x(),n.y(),n.z());
const Triangle_3& t = f.get<0>();
const Point& a = t[0];
const Point& b = t[1];
const Point& c = t[2];
const Point_3& a = t[0];
const Point_3& b = t[1];
const Point_3& c = t[2];
::glVertex3d(a.x(),a.y(),a.z());
::glVertex3d(b.x(),b.y(),b.z());

View File

@ -43,7 +43,7 @@ struct Kernel : public Kernel1 {
};
typedef Kernel::FT FT;
typedef Kernel::Point_3 Point;
typedef Kernel::Point_3 Point_3;
typedef Kernel::Sphere_3 Sphere;
typedef Kernel::Vector_3 Vector;
typedef Kernel::Triangle_3 Triangle_3;
@ -51,9 +51,10 @@ typedef Kernel::Segment_3 Segment_3;
// typedef CGAL::Triple<Triangle_3,Vector,const QTreeWidgetItem*> Facet;
typedef boost::tuple<Triangle_3,Vector,const QTreeWidgetItem*> Facet;
typedef boost::tuple<Triangle_3,Vector,const QTreeWidgetItem*> Facet_;
typedef CBinary_image_3<FT,Point> Binary_image;
typedef CBinary_image_3<FT,Point_3> Binary_image;
class QTreeWidgetItem;
@ -112,7 +113,7 @@ private:
bool use_gouraud;
bool show_bbox;
std::vector<Facet> m_surface;
std::vector<Facet_> m_surface;
Tr del; // 3D-Delaunay triangulation
C2t3 c2t3; // 2D complex in 3D triangulation
@ -132,7 +133,7 @@ private:
int sm_total_time;
#ifdef CGAL_SURFACE_MESH_DEMO_USE_MARCHING_CUBE
std::vector<Facet> m_surface_mc;
std::vector<Facet_> m_surface_mc;
MarchingCubes<unsigned char> mc ;
std::vector<int> nbs_of_mc_triangles;
std::vector<GLint> lists_draw_surface_mc;

View File

@ -6,8 +6,9 @@
#include <CGAL/Regular_triangulation_3.h>
#include <CGAL/Triangulation_vertex_base_with_info_3.h>
#include <CGAL/functional.h>
#include <iostream>
#include <functional>
#include <utility>
#include <vector>
@ -139,9 +140,9 @@ struct Tester
}
struct Auto_count
: public std::unary_function<const Weighted_point&,
std::pair<Weighted_point,
unsigned> >
: public CGAL::unary_function<const Weighted_point&,
std::pair<Weighted_point,
unsigned> >
{
mutable unsigned i;
Auto_count() : i(0){}