merge from next

This commit is contained in:
Sébastien Loriot 2012-07-30 10:25:24 +00:00
commit 5b59f2ad8d
139 changed files with 3347 additions and 328 deletions

54
.gitattributes vendored
View File

@ -541,13 +541,13 @@ Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/algebraic/points -te
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/algebraic/split -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/algebraic/vertex -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/algebraic/xcurves -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/assertions -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/assertions.pt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/assertions.xcv -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/compare -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/compare_y_at_x -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/compare_y_at_x.pt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/compare_y_at_x.xcv -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/errors -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/errors.pt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/errors.xcv -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/intersect -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/intersect.pt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/intersect.xcv -text
@ -564,14 +564,14 @@ Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/split.xcv -te
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/vertex -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/vertex.pt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/vertex.xcv -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/assertions -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/assertions.pt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/assertions.xcv -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/compare_y_at_x -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/compare_y_at_x_left -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/compare_y_at_x_right -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/constructor -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/constructor.xcv -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/errors -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/errors.pt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/errors.xcv -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/intersect -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/intersect.pt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/intersect.xcv -text
@ -624,6 +624,7 @@ Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_line_arcs/s
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_line_arcs/vertex -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_line_arcs/vertex.pt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_line_arcs/xcurves -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_lines/assertions -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_lines/compare -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_lines/compare.pt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_lines/compare_y_at_x -text
@ -631,7 +632,6 @@ Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_lines/const
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_lines/constructor.cv -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_lines/constructor.xcv -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_lines/curves -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_lines/errors -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_lines/intersect -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_lines/intersect.pt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_lines/intersect.xcv -text
@ -650,6 +650,9 @@ Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_lines/verte
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_lines/xcurves -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/compare -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/compare.pt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/assertions -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/assertions.pt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/assertions.xcv -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/compare -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/compare.pt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/compare_y_at_x -text
@ -659,9 +662,6 @@ Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/constructor -
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/constructor.cv -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/constructor.xcv -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/curves -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/errors -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/errors.pt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/errors.xcv -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/intersect -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/is_vertical -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/is_vertical.xcv -text
@ -690,12 +690,12 @@ Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/paramet
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/points -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/split -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/xcurves -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/assertions -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/assertions.pt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/assertions.xcv -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/compare_y_at_x -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/compare_y_at_x_left -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/curves -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/errors -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/errors.pt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/errors.xcv -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/intersect -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/intersect.pt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/intersect.xcv -text
@ -712,12 +712,12 @@ Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/split.xc
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/vertex -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/vertex.pt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/xcurves -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/assertions -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/assertions.pt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/assertions.xcv -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/compare_y_at_x -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/compare_y_at_x_left -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/curves -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/errors -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/errors.pt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/errors.xcv -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/intersect -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/intersect.pt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/intersect.xcv -text
@ -753,12 +753,12 @@ Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segme
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/queries/test02.txt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/queries/test10.txt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/xcurves/test10.txt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/assertions -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/assertions.pt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/assertions.xcv -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/compare_y_at_x -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/compare_y_at_x.pt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/compare_y_at_x.xcv -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/errors -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/errors.pt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/errors.xcv -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/intersect -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/intersect.pt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/intersect.xcv -text
@ -789,12 +789,12 @@ Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/split
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/vertex -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/xcurves -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/are_mergeable -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/assertions -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/assertions.pt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/assertions.xcv -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/compare_y_at_x -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/compare_y_at_x_left -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/curves -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/errors -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/errors.pt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/errors.xcv -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/intersect -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/intersect.pt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/intersect.xcv -text
@ -2974,11 +2974,13 @@ Nef_3/test/Nef_3/data/cube+vee.off -text svneol=unset#application/octet-stream
Nef_3/test/Nef_3/data/cube+veeee.off -text svneol=unset#application/octet-stream
Nef_3/test/Nef_3/data/cube+vertex.off -text svneol=unset#application/octet-stream
Nef_3/test/Nef_3/data/cube.off -text svneol=unset#application/octet-stream
Nef_3/test/Nef_3/data/icosahedron.off -text
Nef_3/test/Nef_3/data/nine_planes.off -text svneol=unset#application/octet-stream
Nef_3/test/Nef_3/data/octa.off -text svneol=unset#application/octet-stream
Nef_3/test/Nef_3/data/star.off -text svneol=unset#application/octet-stream
Nef_3/test/Nef_3/data/wrongly_oriented_cube.off -text
Nef_3/test/Nef_3/nary.cpp -text
Nef_3/test/Nef_3/nef_union_error_llvm.cpp -text
Nef_S2/doc_tex/Nef_S2/fig/complex.gif -text svneol=unset#image/gif
Nef_S2/doc_tex/Nef_S2/fig/complex.pdf -text svneol=unset#application/pdf
Nef_S2/doc_tex/Nef_S2/fig/halfspace.gif -text svneol=unset#image/gif
@ -3195,6 +3197,14 @@ Polyhedron/demo/Polyhedron/Deform_mesh.ui -text
Polyhedron/demo/Polyhedron/MainWindow.ui -text
Polyhedron/demo/Polyhedron/Polyhedron_3.qrc -text
Polyhedron/demo/Polyhedron/Polyhedron_demo_corefinement_plugin.cpp -text
Polyhedron/demo/Polyhedron/Polyhedron_demo_normal_estimation_plugin.cpp -text
Polyhedron/demo/Polyhedron/Polyhedron_demo_normal_estimation_plugin.ui -text
Polyhedron/demo/Polyhedron/Polyhedron_demo_off_to_xyz_plugin.cpp -text
Polyhedron/demo/Polyhedron/Polyhedron_demo_point_set_outliers_removal_plugin.cpp -text
Polyhedron/demo/Polyhedron/Polyhedron_demo_point_set_outliers_removal_plugin.ui -text
Polyhedron/demo/Polyhedron/Polyhedron_demo_point_set_simplification_plugin.ui -text
Polyhedron/demo/Polyhedron/Polyhedron_demo_point_set_smoothing_plugin.cpp -text
Polyhedron/demo/Polyhedron/Polyhedron_demo_poisson_plugin.ui -text
Polyhedron/demo/Polyhedron/Remeshing_dialog.ui -text
Polyhedron/demo/Polyhedron/Scene_combinatorial_map_item.cpp -text
Polyhedron/demo/Polyhedron/Scene_combinatorial_map_item.h -text

2
.gitignore vendored
View File

@ -535,6 +535,7 @@ Mesh_2/test/Mesh_2/CMakeLists.txt
Mesh_2/test/Mesh_2/Makefile
Mesh_2/test/Mesh_2/bench_double_map
Mesh_2/test/Mesh_2/cgal_test_with_cmake
Mesh_2/test/Mesh_2/conform_plus
Mesh_2/test/Mesh_2/depends
Mesh_2/test/Mesh_2/my_makefile
Mesh_2/test/Mesh_2/semantic.cache
@ -542,6 +543,7 @@ Mesh_2/test/Mesh_2/test_conforming
Mesh_2/test/Mesh_2/test_double_map
Mesh_2/test/Mesh_2/test_filtred_container
Mesh_2/test/Mesh_2/test_meshing
Mesh_2/test/Mesh_2/test_meshing_user_bug_test_case
Mesh_2/test/Mesh_2/test_vertex_and_face_bases
Mesh_3/*.tags.xml
Mesh_3/.*.deps

View File

@ -47,7 +47,13 @@ int main()
// computes closest point and primitive id
Point_and_primitive_id pp = tree.closest_point_and_primitive(query);
std::cout << "closest point: " << pp.first << std::endl;
Point closest_point = pp.first;
Polyhedron::Face_handle f = pp.second; // closest primitive id
std::cout << "closest point: " << closest_point << std::endl;
std::cout << "closest triangle: ( "
<< f->halfedge()->vertex()->point() << " , "
<< f->halfedge()->next()->vertex()->point() << " , "
<< f->halfedge()->next()->next()->vertex()->point()
<< " )" << std::endl;
return EXIT_SUCCESS;
}

View File

@ -125,7 +125,6 @@ namespace CGAL
Point_and_primitive_id closest_point(const Point& query) const
{
typedef typename Add_decorated_point<Traits, typename Traits::Primitive::Id>::Point_3 Decorated_point;
Neighbor_search search(*m_p_tree, query, 1);
return Point_and_primitive_id(static_cast<Point>(search.begin()->first), search.begin()->first.id());
}

View File

@ -90,7 +90,6 @@ namespace CGAL {
const K& k)
{
typedef typename K::Point_3 Point_3;
typedef typename K::Vector_3 Vector_3;
typedef typename K::FT FT;
typename K::Compute_squared_distance_3 sq_distance =

View File

@ -187,7 +187,6 @@ nearest_point_3(const typename K::Point_3& origin,
const K& k)
{
typedef typename K::Point_3 Point_3;
typedef typename K::Vector_3 Vector_3;
typedef typename K::FT FT;
typename K::Compute_squared_distance_3 sq_distance =

View File

@ -57,7 +57,6 @@ namespace CGAL {
template <class AK>
bool intersect(const typename AK::Polynomial_1_3 & p1,
const typename AK::Polynomial_1_3 & p2) {
typedef typename AK::Polynomial_1_3 Polynomial_1_3;
typedef typename AK::RT RT;
CGAL_kernel_precondition(!(same_solutions<RT>(p1,p2)));
@ -76,7 +75,6 @@ namespace CGAL {
line_from_2_planes(const typename AK::Polynomial_1_3 & p1,
const typename AK::Polynomial_1_3 & p2)
{
typedef typename AK::Polynomial_1_3 Polynomial_1_3;
typedef typename AK::Polynomials_for_line_3 Polynomials_for_line_3;
typedef typename AK::FT FT;
CGAL_kernel_precondition(intersect<AK>(p1,p2));
@ -112,7 +110,6 @@ namespace CGAL {
inline
bool intersect(const typename AK::Polynomial_for_spheres_2_3 & s1,
const typename AK::Polynomial_for_spheres_2_3 & s2) {
typedef typename AK::Polynomial_1_3 Polynomial_1_3;
typedef typename AK::FT FT;
typedef typename AK::Root_of_2 Root_of_2;
@ -145,7 +142,6 @@ namespace CGAL {
inline
bool tangent(const typename AK::Polynomial_for_spheres_2_3 & s1,
const typename AK::Polynomial_for_spheres_2_3 & s2) {
typedef typename AK::Polynomial_1_3 Polynomial_1_3;
typedef typename AK::RT RT;
typedef typename AK::Root_of_2 Root_of_2;
@ -335,7 +331,6 @@ namespace CGAL {
OutputIterator res )
{
typedef typename AK::RT RT;
typedef typename AK::Root_for_spheres_2_3 Root_for_spheres_2_3;
typedef typename AK::Polynomials_for_line_3 Polynomials_for_line_3;
// we put as a precondition that the polynomial for spheres represents
// a sphere and not an isolated point or an empty_space
@ -519,11 +514,9 @@ template < class AK, class OutputIterator >
const typename AK::Polynomials_for_line_3 & l,
OutputIterator res )
{
typedef typename AK::RT RT;
typedef typename AK::Root_for_spheres_2_3 Root_for_spheres_2_3;
typedef typename AK::Polynomial_for_spheres_2_3 Polynomial_for_spheres_2_3;
typedef typename AK::Polynomial_1_3 Polynomial_1_3;
typedef typename AK::Polynomials_for_line_3 Polynomials_for_line_3;
const Polynomial_for_spheres_2_3 &s1 = e1.first;
const Polynomial_1_3 &p1 = e1.second;

View File

@ -39,7 +39,6 @@ namespace CGAL {
const typename AK::Polynomial_1_3 & e3,
OutputIterator res )
{
typedef typename AK::RT RT;
typedef typename AK::FT FT;
typedef typename AK::Root_for_spheres_2_3 Root_for_spheres_2_3;
CGAL_kernel_precondition(!(same_solutions<FT>(e1,e2) || same_solutions<FT>(e1,e3) ||

View File

@ -77,7 +77,7 @@ INTERSECT=8
SPLIT=9
ARE_MERGEABLE=10
MERGE=11
ERRORS=12
ASSERTIONS=12
CONSTRUCTOR=13
COMPARE_X_AT_LIMIT=14
COMPARE_X_NEAR_LIMIT=15
@ -334,7 +334,7 @@ execute_commands_old_structure()
commands_indicator[SPLIT]=1
commands_indicator[ARE_MERGEABLE]=1
commands_indicator[MERGE]=1
commands_indicator[ERRORS]=1
commands_indicator[ASSERTIONS]=1
commands_indicator[CONSTRUCTOR]=1
i=1
if [ $# -gt 2 ] ; then
@ -400,10 +400,10 @@ execute_commands_old_structure()
data/empty.zero data/$1/merge.xcv \
data/empty.zero data/$1/merge $2
fi
if [ ${commands_indicator[$ERRORS]} -ne 0 ] ; then
if [ ${commands_indicator[$ASSERTIONS]} -ne 0 ] ; then
run_trapped_test test_traits \
data/$1/errors.pt data/$1/errors.xcv \
data/empty.zero data/$1/errors $2
data/$1/assertions.pt data/$1/assertions.xcv \
data/empty.zero data/$1/assertions $2
fi
if [ ${commands_indicator[$CONSTRUCTOR]} -ne 0 ] ; then
run_trapped_test test_traits \
@ -440,7 +440,7 @@ execute_commands_new_structure()
commands_indicator[SPLIT]=0
commands_indicator[ARE_MERGEABLE]=0
commands_indicator[MERGE]=0
commands_indicator[ERRORS]=0
commands_indicator[ASSERTIONS]=0
commands_indicator[CONSTRUCTOR]=0
i=1
if [ $# -gt 2 ] ; then
@ -523,9 +523,9 @@ execute_commands_new_structure()
run_trapped_test test_traits data/$1/points \
data/$1/xcurves data/$1/curves data/$1/merge $2
fi
if [ ${commands_indicator[$ERRORS]} -ne 0 ] ; then
if [ ${commands_indicator[$ASSERTIONS]} -ne 0 ] ; then
run_trapped_test test_traits data/$1/points \
data/$1/xcurves data/$1/curves data/$1/errors $2
data/$1/xcurves data/$1/curves data/$1/assertions $2
fi
if [ ${commands_indicator[$CONSTRUCTOR]} -ne 0 ] ; then
run_trapped_test test_traits data/$1/points \
@ -863,7 +863,7 @@ test_non_caching_segment_traits()
else
execute_commands_old_structure segments non_caching_segment_traits \
VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT CONSTRUCTOR \
COMPARE_Y_AT_X_RIGHT ARE_MERGEABLE ERRORS
COMPARE_Y_AT_X_RIGHT ARE_MERGEABLE ASSERTIONS
execute_commands_new_structure segments segment_traits \
IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT
@ -987,7 +987,7 @@ test_line_arc_traits()
else
execute_commands_old_structure circular_lines line_arc_traits \
VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT \
ERRORS COMPARE_Y_AT_X_RIGHT MERGE ARE_MERGEABLE
ASSERTIONS COMPARE_Y_AT_X_RIGHT MERGE ARE_MERGEABLE
execute_commands_new_structure circular_lines line_arc_traits \
IS_VERTICAL COMPARE_Y_AT_X
@ -1015,7 +1015,7 @@ test_circular_arc_traits()
else
execute_commands_old_structure circular_arcs circular_arc_traits \
VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT \
ERRORS COMPARE_Y_AT_X_RIGHT MERGE ARE_MERGEABLE
ASSERTIONS COMPARE_Y_AT_X_RIGHT MERGE ARE_MERGEABLE
execute_commands_new_structure circular_arcs circular_arc_traits \
VERTEX IS_VERTICAL COMPARE_Y_AT_X
@ -1035,7 +1035,7 @@ test_circular_line_arc_traits()
else
execute_commands_old_structure circular_line_arcs circular_line_arc_traits \
VERTEX IS_VERTICAL CONSTRUCTOR COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT \
ERRORS COMPARE_Y_AT_X_RIGHT MERGE ARE_MERGEABLE
ASSERTIONS COMPARE_Y_AT_X_RIGHT MERGE ARE_MERGEABLE
execute_commands_new_structure circular_line_arcs circular_line_arc_traits \
IS_VERTICAL COMPARE_Y_AT_X
@ -1095,7 +1095,7 @@ test_bezier_traits()
else
execute_commands_old_structure bezier bezier_traits \
COMPARE_Y_AT_X_LEFT COMPARE_Y_AT_X_RIGHT SPLIT \
CONSTRUCTOR ERRORS ARE_MERGEABLE
CONSTRUCTOR ASSERTIONS ARE_MERGEABLE
fi
clean_tests
}
@ -1113,7 +1113,7 @@ test_spherical_arc_traits()
execute_commands_old_structure spherical_arcs spherical_arc_traits \
COMPARE_Y_AT_X_LEFT COMPARE_Y_AT_X_RIGHT INTERSECT \
CONSTRUCTOR \
COMPARE MAKE_X_MONOTONE SPLIT MERGE ERRORS ARE_MERGEABLE
COMPARE MAKE_X_MONOTONE SPLIT MERGE ASSERTIONS ARE_MERGEABLE
execute_commands_new_structure spherical_arcs spherical_arc_traits \
INTERSECT \

View File

@ -74,7 +74,7 @@ void ASphapeIpelet::protected_run(int fn)
Iso_rectangle_2 bbox=read_active_objects(
read_active_objects(
CGAL::dispatch_or_drop_output<Point_2,Circle_2>(std::back_inserter(pt_list),
std::back_inserter(cir_list))
);

View File

@ -119,7 +119,6 @@ void MdelaunayIpelet::protected_run(int fn)
//WE MAY COUNT SEVERAL TIME SAME TRIANGLE WITH THE FOLLOWING METHOD
//iterate over adjacent point in the regular triangulation and compute a new wpoint for those having one commun parent from delaunay
for (RegularI::Finite_edges_iterator it=rti.finite_edges_begin();it!=rti.finite_edges_end();++it){
VertexI ff=it->first->vertex(Delaunay::cw(it->second));
Point_2 pt0_ori0=it->first->vertex(Delaunay::cw(it->second))->info().front();
Point_2 pt0_ori1=it->first->vertex(Delaunay::cw(it->second))->info().back();
Point_2 pt1_ori0=it->first->vertex(Delaunay::ccw(it->second))->info().front();

View File

@ -56,8 +56,7 @@ void ConvexpartitionIpelet::protected_run(int fn)
}
std::list<Polygon_2> pol_list;
Iso_rectangle_2 bbox=
read_active_objects( CGAL::dispatch_or_drop_output<Polygon_2>( std::back_inserter(pol_list) ) );
read_active_objects( CGAL::dispatch_or_drop_output<Polygon_2>( std::back_inserter(pol_list) ) );

View File

@ -496,7 +496,7 @@ public:
typedef typename std::multimap<double,std::pair<Type_circ_arc,const Point_2*> >::iterator Map_theta_iterator;
Map_theta_iterator s_it=map_theta.insert(
std::make_pair(get_theta(*source,circle),std::make_pair(OSRC,source)));
Map_theta_iterator t_it=map_theta.insert(
/*Map_theta_iterator t_it=*/map_theta.insert(
std::make_pair(get_theta(*target,circle),std::make_pair(OTRG,target)));
for (typename std::vector<Circular_arc_2>::iterator it_arc=arc_list.begin();it_arc!=arc_list.end();++it_arc){

View File

@ -502,7 +502,8 @@ public:
typedef typename std::multimap<double,std::pair<Type_circ_arc,const Point_2*> >::iterator Map_theta_iterator;
Map_theta_iterator s_it=map_theta.insert(
std::make_pair(get_theta(*source,circle),std::make_pair(OSRC,source)));
Map_theta_iterator t_it=map_theta.insert(
/* Map_theta_iterator t_it=*/
map_theta.insert(
std::make_pair(get_theta(*target,circle),std::make_pair(OTRG,target)));
for (typename std::vector<Circular_arc_2>::iterator it_arc=arc_list.begin();it_arc!=arc_list.end();++it_arc){

View File

@ -225,7 +225,6 @@ public:
std::istream &
operator>>(std::istream & is, Circular_arc_point_3<SK> &p)
{
typedef typename SK::Root_of_2 Root_of_2;
typedef typename SK::Root_for_spheres_2_3 Root_for_spheres_2_3;
Root_for_spheres_2_3 r;

View File

@ -58,7 +58,6 @@ namespace CGAL {
has_on(const typename SK::Line_3 &a,
const typename SK::Circular_arc_point_3 &p)
{
typedef typename SK::Algebraic_kernel Algebraic_kernel;
typedef typename SK::Polynomials_for_line_3 Equation;
Equation equation = get_equation<SK>(a);
return p.rep().coordinates().is_on_line(equation);

View File

@ -185,7 +185,6 @@ namespace CGAL {
const typename SK::Circular_arc_3 & ca,
OutputIterator res)
{
typedef typename SK::Point_3 Point_3;
typedef typename SK::Circular_arc_point_3 Circular_arc_point_3;
typedef std::vector<CGAL::Object> solutions_container;
typedef std::pair<Circular_arc_point_3, unsigned> Solution;

View File

@ -151,7 +151,6 @@ namespace CGAL {
typedef typename SK::Point_3 Point_3;
typedef typename SK::Circular_arc_point_3 Circular_arc_point_3;
typedef typename SK::Line_3 Line_3;
typedef typename SK::Line_arc_3 Line_arc_3;
Point_3 inters_p;
Line_3 inters_l;

View File

@ -51,7 +51,6 @@ namespace CGAL {
typename SK::Polynomial_for_spheres_2_3
get_equation( const typename SK::Sphere_3 & s )
{
typedef typename SK::RT RT;
typedef typename SK::Point_3 Point_3;
typedef typename SK::Algebraic_kernel Algebraic_kernel;
Point_3 center = s.center();
@ -297,7 +296,6 @@ namespace CGAL {
typedef typename SK::Circle_3 Circle_3;
typedef typename SK::Point_3 Point_3;
typedef typename SK::Algebraic_kernel Algebraic_kernel;
typedef std::vector< Object > solutions_container;
CGAL_kernel_precondition(!s1.is_degenerate());
CGAL_kernel_precondition(!s2.is_degenerate());
CGAL_kernel_precondition(!s3.is_degenerate());
@ -445,7 +443,6 @@ namespace CGAL {
typedef typename SK::Root_for_spheres_2_3 Root_for_spheres_2_3;
typedef typename SK::Circular_arc_point_3 Circular_arc_point_3;
typedef typename SK::Polynomials_for_circle_3 Equation_circle;
typedef typename SK::Circle_3 Circle_3;
typedef typename SK::Algebraic_kernel Algebraic_kernel;
if(non_oriented_equal<SK>(c1,c2)) {
*res++ = make_object(c1);
@ -475,7 +472,6 @@ namespace CGAL {
typedef typename SK::Circular_arc_point_3 Circular_arc_point_3;
typedef typename SK::Polynomials_for_circle_3 Equation_circle;
typedef typename SK::Polynomials_for_line_3 Equation_line;
typedef typename SK::Circle_3 Circle_3;
typedef typename SK::Algebraic_kernel Algebraic_kernel;
CGAL_kernel_precondition(!l.is_degenerate());
Equation_circle e1 = get_equation<SK>(c);

View File

@ -615,7 +615,6 @@ std::ostream& operator << ( std::ostream& os, const ConicCPA2<_PT,_DA>& c)
template< class _PT, class _DA>
std::istream& operator >> ( std::istream& is, ConicCPA2<_PT,_DA>& c)
{
typedef ConicCPA2<_PT,_DA> Conic;
typedef typename _DA::FT FT;
FT r, s, t, u, v, w;

View File

@ -1365,8 +1365,6 @@ struct Lazy_construction<LK, AC, EC, E2A_, true> {
template<BOOST_PP_ENUM_PARAMS(n, class L)> \
result_type \
operator()( BOOST_PP_ENUM(n, CGAL_LARGS, _) ) const { \
BOOST_PP_REPEAT(n, CGAL_TYPEMAP_EC, L) \
BOOST_PP_REPEAT(n, CGAL_TYPEMAP_AC, L) \
typedef Lazy< AT, ET, EFT, E2A> Handle; \
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); \
Protect_FPU_rounding<Protection> P; \

View File

@ -261,7 +261,7 @@ public:
set_prev( h->next(), h);
}
void set_vertex_in_vertex_loop( Halfedge_handle h, Vertex_handle v,
void set_vertex_in_vertex_loop( Halfedge_handle , Vertex_handle ,
Tag_false) const {}
void set_vertex_in_vertex_loop( Halfedge_handle h, Vertex_handle v,
Tag_true) const {
@ -282,7 +282,7 @@ public:
set_vertex_in_vertex_loop( h, v, Supports_halfedge_vertex());
}
void set_face_in_face_loop( Halfedge_handle h, Face_handle f,
void set_face_in_face_loop( Halfedge_handle , Face_handle ,
Tag_false) const {}
void set_face_in_face_loop( Halfedge_handle h, Face_handle f,
Tag_true) const {

View File

@ -489,10 +489,14 @@ message( "== Generate version files (DONE) ==\n")
#
#--------------------------------------------------------------------------------------------------
message("== Detect external libraries ==")
message("== Set up flags ==")
include(CGAL_SetupFlags)
message("== Set up flags (DONE) ==\n")
message("== Detect external libraries ==")
macro( add_config_flag flag )
if ( ${flag} )
@ -767,10 +771,10 @@ endif()
# Set CGAL_LIBRARY_NAME, CGAL_Qt3_LIBRARY_NAME and so on. Those variables
# are the name of CGAL libraries, without the path. Used in the generation
# of the installed CGALConfig.cmake
get_filename_component(CGAL_LIBRARY_NAME "${CGAL_LIBRARY}" NAME CACHE)
get_filename_component(CGAL_LIBRARY_NAME "${CGAL_LIBRARY}" NAME)
hide_variable(CGAL_LIBRARY_NAME)
foreach(lib ${CGAL_CONFIGURED_LIBRARIES})
get_filename_component(CGAL_${lib}_LIBRARY_NAME "${CGAL_${lib}_LIBRARY}" NAME CACHE)
get_filename_component(CGAL_${lib}_LIBRARY_NAME "${CGAL_${lib}_LIBRARY}" NAME)
hide_variable(CGAL_${lib}_LIBRARY_NAME)
endforeach()

View File

@ -5,6 +5,7 @@
# QT3_DEFINITIONS - definitions to use when
# compiling code that uses Qt.
# QT3_FOUND - If false, don't try to use Qt.
# QT3_VERSION_STRING - the version of Qt found
#
# If you need the multithreaded version of Qt, set QT3_MT_REQUIRED to TRUE
#
@ -17,7 +18,7 @@
# These are around for backwards compatibility
# they will be set
# QT3_WRAP_CPP, set true if3 QT_MOC_EXECUTABLE is found
# QT3_WRAP_CPP, set true if QT3_MOC_EXECUTABLE is found
# QT3_WRAP_UI set true if QT3_UIC_EXECUTABLE is found
FILE(GLOB GLOB_PATHS_BIN /usr/lib/qt-3*/bin /sw/lib/qt3*/bin)
@ -40,8 +41,8 @@ FIND_PATH(QT3_INCLUDE_DIR qt.h
# if qglobal.h is not in the qt_include_dir then set
# QT3_INCLUDE_DIR to NOTFOUND
IF(NOT EXISTS ${QT3_INCLUDE_DIR}/qglobal.h)
SET(QT3_INCLUDE_DIR QT3_INCLUDE_DIR-NOTFOUND CACHE PATH "path to qt3 include directory" FORCE)
SET(QT3_INCLUDE_DIR QT3_INCLUDE_DIR-NOTFOUND CACHE PATH "path to qt3 include directory" FORCE) # double-set to work-around cmake 2.6 bug
SET(QT3_INCLUDE_DIR QT3_INCLUDE_DIR-NOTFOUND CACHE PATH "path to Qt3 include directory" FORCE)
SET(QT3_INCLUDE_DIR QT3_INCLUDE_DIR-NOTFOUND CACHE PATH "path to Qt3 include directory" FORCE) # double-set to work-around cmake 2.6 bug
ENDIF(NOT EXISTS ${QT3_INCLUDE_DIR}/qglobal.h)
IF(QT3_INCLUDE_DIR)
@ -53,7 +54,6 @@ IF(QT3_INCLUDE_DIR)
# Under windows the qt library (MSVC) has the format qt-mtXYZ where XYZ is the
# version X.Y.Z, so we need to remove the dots from version
STRING(REGEX REPLACE "\\." "" qt_version_str_lib "${qt_version_str}")
ELSE(QT3_INCLUDE_DIR)
ENDIF(QT3_INCLUDE_DIR)
FILE(GLOB GLOB_PATHS_LIB /usr/lib/qt-3*/lib/)
@ -99,9 +99,6 @@ ELSE (QT3_MT_REQUIRED)
)
ENDIF (QT3_MT_REQUIRED)
IF(QT3_QT_LIBRARY)
ELSE(QT3_QT_LIBRARY)
ENDIF(QT3_QT_LIBRARY)
FIND_LIBRARY(QT3_QASSISTANTCLIENT_LIBRARY
@ -122,58 +119,59 @@ FIND_LIBRARY(QT3_QASSISTANTCLIENT_LIBRARY
# qt 3 should prefer QTDIR over the PATH
FIND_PROGRAM(QT3_MOC_EXECUTABLE
NAMES moc moc-qt3
NAMES moc-qt3 moc
HINTS
$ENV{QTDIR}/bin
PATHS
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/include/Qt"
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/include/Qt"
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/include/Qt"
$ENV{QTDIR}/bin
${GLOB_PATHS_BIN}
$ENV{PATH}
/usr/local/qt/bin
/usr/lib/qt/bin
/usr/lib/qt3/bin
/usr/share/qt3/bin
C:/Progra~1/qt/bin
/usr/X11R6/bin
NO_DEFAULT_PATH
)
IF(QT3_MOC_EXECUTABLE)
SET ( QT3_WRAP_CPP "YES")
ELSE(QT3_MOC_EXECUTABLE)
ENDIF(QT3_MOC_EXECUTABLE)
# qt 3 should prefer QTDIR over the PATH
FIND_PROGRAM(QT3_UIC_EXECUTABLE uic
FIND_PROGRAM(QT3_UIC_EXECUTABLE
NAMES uic-qt3 uic
HINTS
$ENV{QTDIR}/bin
PATHS
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/include/Qt"
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/include/Qt"
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/include/Qt"
$ENV{QTDIR}/bin
${GLOB_PATHS_BIN}
$ENV{PATH}
/usr/local/qt/bin
/usr/lib/qt/bin
/usr/lib/qt3/bin
/usr/share/qt3/bin
C:/Progra~1/qt/bin
/usr/X11R6/bin
NO_DEFAULT_PATH
)
IF(QT3_UIC_EXECUTABLE)
SET ( QT3_WRAP_UI "YES")
ELSE(QT3_UIC_EXECUTABLE)
ENDIF(QT3_UIC_EXECUTABLE)
IF (WIN32)
FIND_LIBRARY(QT3_QTMAIN_LIBRARY qtmain
HINTS
$ENV{QTDIR}/lib
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/lib"
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/lib"
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/lib"
PATHS
"$ENV{ProgramFiles}/qt/lib"
$ENV{QTDIR}/lib "C:/Program Files/qt/lib"
"C:/Program Files/qt/lib"
DOC "This Library is only needed by and included with Qt3 on MSWindows. It should be NOTFOUND, undefined or IGNORE otherwise."
)
ENDIF (WIN32)

View File

@ -87,7 +87,7 @@ template <class K>
typename Line_2_Iso_rectangle_2_pair<K>::Intersection_results
Line_2_Iso_rectangle_2_pair<K>::intersection_type() const
{
typedef typename K::Line_2 line_t;
//typedef typename K::Line_2 line_t;
if (_known)
return _result;
// The non const this pointer is used to cast away const.

View File

@ -81,7 +81,6 @@ template <class K>
typename Point_2_Triangle_2_pair<K>::Intersection_results
Point_2_Triangle_2_pair<K>::intersection_type() const
{
typedef typename K::Line_2 line_t;
if (_known)
return _result;
// The non const this pointer is used to cast away const.
@ -93,6 +92,7 @@ Point_2_Triangle_2_pair<K>::intersection_type() const
}
return _result;
/*
typedef typename K::Line_2 line_t;
line_t l(_trian->vertex(0), _trian->vertex(1));
if (l.has_on_positive_side(_trian->vertex(2))) {
for (int i=0; i<3; i++) {

View File

@ -99,7 +99,7 @@ Ray_2_Ray_2_pair<K>::intersection_type() const
return _result;
case Line_2_Line_2_pair<K>::LINE:
{
typedef typename K::RT RT;
//typedef typename K::RT RT;
const typename K::Vector_2 &dir1 = _ray1->direction().to_vector();
const typename K::Vector_2 &dir2 = _ray2->direction().to_vector();
if (CGAL_NTS abs(dir1.x()) > CGAL_NTS abs(dir1.y())) {

View File

@ -101,7 +101,7 @@ Ray_2_Segment_2_pair<K>::intersection_type() const
? POINT : NO_INTERSECTION;
return _result;
case Line_2_Line_2_pair<K>::LINE: {
typedef typename K::RT RT;
//typedef typename K::RT RT;
const typename K::Point_2 &start1 = _seg->source();
const typename K::Point_2 &end1 = _seg->target();
const typename K::Point_2 &start2 = _ray->source();

View File

@ -322,7 +322,7 @@ Segment_2_Segment_2_pair<K>::intersection_type() const
break;
case Line_2_Line_2_pair<K>::LINE:
{
typedef typename K::RT RT;
//typedef typename K::RT RT;
typename K::Point_2 const &start1 = _seg1->source();
typename K::Point_2 const &end1 = _seg1->target();
typename K::Point_2 const &start2 = _seg2->source();

View File

@ -202,7 +202,6 @@ intersection(const typename K::Line_3 &l1,
const K&)
{
typedef typename K::FT FT;
typedef typename K::Line_3 Line_3;
typedef typename K::Point_3 Point_3;
typedef typename K::Vector_3 Vector_3;
@ -237,8 +236,6 @@ do_intersect(const typename K::Line_3 &l1,
const typename K::Line_3 &l2,
const K&)
{
typedef typename K::FT FT;
typedef typename K::Line_3 Line_3;
typedef typename K::Point_3 Point_3;
typedef typename K::Vector_3 Vector_3;
@ -630,9 +627,7 @@ intersection(const typename K::Plane_3 &p,
const typename K::Sphere_3 &s,
const K&)
{
typedef typename K::Sphere_3 Sphere_3;
typedef typename K::Circle_3 Circle_3;
typedef typename K::Plane_3 Plane_3;
typedef typename K::Point_3 Point_3;
typedef typename K::FT FT;
const FT d2 = CGAL::square(p.a()*s.center().x() +
@ -656,10 +651,6 @@ do_intersect(const typename K::Plane_3 &p,
const typename K::Sphere_3 &s,
const K&)
{
typedef typename K::Sphere_3 Sphere_3;
typedef typename K::Circle_3 Circle_3;
typedef typename K::Plane_3 Plane_3;
typedef typename K::Point_3 Point_3;
typedef typename K::FT FT;
const FT d2 = CGAL::square(p.a()*s.center().x() +
p.b()*s.center().y() +
@ -697,7 +688,6 @@ intersection(const typename K::Sphere_3 &s1,
const K& k)
{
typedef typename K::Plane_3 Plane_3;
typedef typename K::Sphere_3 Sphere_3;
if(s1.center() == s2.center()) {
if(s1.squared_radius() == s2.squared_radius()) {
if(is_zero(s1.squared_radius())) return make_object(s1.center());
@ -716,7 +706,6 @@ do_intersect(const typename K::Sphere_3 &s1,
const K& k)
{
typedef typename K::Plane_3 Plane_3;
typedef typename K::Sphere_3 Sphere_3;
if(s1.center() == s2.center()) {
return s1.squared_radius() == s2.squared_radius();
}
@ -1095,7 +1084,6 @@ intersection(const typename K::Line_3 &line,
typedef typename K::Point_3 Point_3;
typedef typename K::Vector_3 Vector_3;
typedef typename K::Segment_3 Segment_3;
typedef typename K::RT RT;
typedef typename K::FT FT;
bool all_values = true;
FT _min = 0, _max = 0; // initialization to stop compiler warning
@ -1169,7 +1157,6 @@ intersection(const typename K::Ray_3 &ray,
typedef typename K::Point_3 Point_3;
typedef typename K::Vector_3 Vector_3;
typedef typename K::Segment_3 Segment_3;
typedef typename K::RT RT;
typedef typename K::FT FT;
bool all_values = true;
FT _min = 0, _max = 0; // initialization to prevent compiler warning
@ -1241,7 +1228,6 @@ intersection(const typename K::Segment_3 &seg,
typedef typename K::Point_3 Point_3;
typedef typename K::Vector_3 Vector_3;
typedef typename K::Segment_3 Segment_3;
typedef typename K::RT RT;
typedef typename K::FT FT;
FT _min = 0, _max;
@ -1320,7 +1306,6 @@ intersection(
min_points[1] = (icub2.min)();
max_points[0] = (icub1.max)();
max_points[1] = (icub2.max)();
typedef typename K::FT FT;
const int DIM = 3;
int min_idx[DIM];
int max_idx[DIM];

View File

@ -39,7 +39,6 @@ do_intersect(const typename K::Triangle_3 &tr,
const K & k)
{
typedef typename K::Triangle_3 Triangle;
typedef typename K::Point_3 Point;
CGAL_kernel_precondition( ! k.is_degenerate_3_object() (tr) );
CGAL_kernel_precondition( ! k.is_degenerate_3_object() (tet) );

View File

@ -43,7 +43,6 @@ t3r3_intersection_coplanar_aux(const typename K::Point_3& p,
// preconditions:
// + p,v,a,b are coplanar
typedef typename K::Point_3 Point_3;
typedef typename K::Vector_3 Vector_3;
typedef typename K::FT FT;

View File

@ -42,7 +42,6 @@ t3s3_intersection_coplanar_aux(const typename K::Point_3& p,
// preconditions:
// + p,q,a,b are coplanar
typedef typename K::Point_3 Point_3;
typedef typename K::Vector_3 Vector_3;
typedef typename K::FT FT;

View File

@ -78,7 +78,7 @@ void jama_polynomial_compute_roots(const double *begin, const double *end,
double lb, double ub,
std::vector<double> &roots)
{
std::size_t degree= end-begin-1;
std::ptrdiff_t degree= end-begin-1;
switch( degree) {
case -1:
case 0:
@ -104,7 +104,7 @@ void jama_polynomial_compute_cleaned_roots(const double *begin, const double *en
double lb, double ub,
std::vector<double> &roots)
{
std::size_t degree= end-begin-1;
std::ptrdiff_t degree= end-begin-1;
switch( degree) {
case -1:
case 0:

View File

@ -393,7 +393,7 @@ void Turkowski_polynomial_compute_roots(const double *begin, const double *end,
std::vector<double> &roots)
{
std::size_t degree= end-begin-1;
std::ptrdiff_t degree= end-begin-1;
switch( degree) {
case -1:
case 0:
@ -426,7 +426,7 @@ void Turkowski_polynomial_compute_cleaned_roots(const double *begin, const doubl
double lb, double ub,
std::vector<double> &roots)
{
std::size_t degree= end-begin-1;
std::ptrdiff_t degree= end-begin-1;
switch( degree) {
case -1:
case 0:

View File

@ -1,6 +1,6 @@
#!/bin/zsh
cd $HOME/CGAL/trunk/Maintenance/infrastructure/cgal.geometryfactory.com/
cd $HOME/CGAL/next/Maintenance/infrastructure/cgal.geometryfactory.com/
crontab -l >| crontab
svn add -q crontab
[ -n "`svn st crontab`" ] && svn ci -m 'updated crontab (automated commit)' crontab

View File

@ -1,6 +1,6 @@
export QTDIR=/usr/lib/qt-3.3
source /home/lrineau/CGAL/MPFI-RS/setup-rs
source /home/lrineau/CGAL/RS-3.1/setup-rs
PATH=/usr/local/packages/qt4.7/bin:$PATH
PATH=$HOME/CGAL/path-cmake-2.6:$PATH

View File

@ -87,7 +87,7 @@ export QGLVIEWERROOT
COLLECT_DEMOS_BINARIES=y
export COLLECT_DEMOS_BINARIES
source /cygdrive/c/cgal/RSCube/setup-rs-32
source /cygdrive/c/cgal/RS-3.1/setup-rs-32
BOOST_LIBRARYDIR='C:/cgal/boost-release-branch/stage/lib'
BOOST_INCLUDEDIR='C:/cgal/boost-release-branch'

View File

@ -99,5 +99,5 @@ export GMP_LIB_DIR MPFR_LIB_DIR
export CGAL_TAUCS_DIR
export QGLVIEWERROOT
source /cygdrive/c/cgal/RSCube/setup-rs-64
source /cygdrive/c/cgal/RS-3.1/setup-rs-64

View File

@ -422,12 +422,6 @@ public:
zone.fh = triangulation_ref_impl().locate(p, zone.locate_type, zone.i, edge.first);
const Face_handle n = f->neighbor(i);
CGAL_assertion_msg(zone.locate_type != Tr::FACE ||
zone.fh == f || zone.fh == n,
"Your data set contains at least a vertex that is "
"very close to \n"
" a constrained edge! "
"Mesh_2 cannot mesh that sort of data set.");
const bool f_does_conflict = (zone.locate_type == Tr::EDGE) ||
triangulation_ref_impl().test_conflict(p, f);

View File

@ -0,0 +1,63 @@
// Bug reported by a user against CGAL-4.0.2
// A single triangle cannot be meshed!
//
// The bug report is in the message:
// Date: Wed, 25 Jul 2012 02:20:13 -0700 (PDT)
// From: gerth <gert.hutter@gmail.com>
// To: cgal-discuss@inria.fr
// Subject: [cgal-discuss] Delauny_Mesher gives a CGAL::Assertion_exception
//
// The fault was a buggy assertion added in the following revision:
// -----------------------------------------------------------------------
// r66359 | lrineau | 2011-11-16 18:58:22 +0100 (Wed, 16 Nov 2011) | 3 lines
//
// Add an assertion that checks that a point constructed as the midpoint of an
// edge is located either on the edge or inside one of the two incident faces.
//
// -----------------------------------------------------------------------
// And the assertion message was:
// terminate called after throwing an instance of 'CGAL::Assertion_exception'
// what(): CGAL ERROR: assertion violation!
// Expr: zone.locate_type != Tr::FACE || zone.fh == f || zone.fh == n
// File: /home/lrineau/wc/Mesh_2/test/Mesh_2/../../include/CGAL/Mesh_2/Refine_edges.h
// Line: 430
// Explanation: Your data set contains at least a vertex that is very close to
// a constrained edge! Mesh_2 cannot mesh that sort of data set.
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
#include <CGAL/Delaunay_mesher_2.h>
#include <CGAL/Delaunay_mesh_face_base_2.h>
#include <CGAL/Delaunay_mesh_size_criteria_2.h>
#include <iostream>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Triangulation_vertex_base_2<K> Vb;
typedef CGAL::Delaunay_mesh_face_base_2<K> Fb;
typedef CGAL::Triangulation_data_structure_2<Vb, Fb> Tds;
typedef CGAL::Constrained_Delaunay_triangulation_2<K, Tds> CDT;
typedef CGAL::Delaunay_mesh_size_criteria_2<CDT> Criteria;
typedef CDT::Vertex_handle Vertex_handle;
typedef CDT::Point Point;
int main()
{
CDT cdt;
Vertex_handle va = cdt.insert(Point(0,0));
Vertex_handle vb = cdt.insert(Point(-3.5240345245692879,-12.4));
Vertex_handle vc = cdt.insert(Point(-9.3417057867627591,2.6237986627966166));
cdt.insert_constraint(va, vb);
cdt.insert_constraint(vb, vc);
cdt.insert_constraint(vc, va);
std::cout << "Number of vertices: " << cdt.number_of_vertices() << std::endl;
std::cout << "Meshing the triangulation..." << std::endl;
CGAL::refine_Delaunay_mesh_2(cdt, Criteria(0.125, 1.0));
std::cout << "Number of vertices: " << cdt.number_of_vertices() << std::endl;
}

View File

@ -0,0 +1,34 @@
OFF
12 20 0
-0.5257310271 0.0000000000 -0.8506510258
0.5257310271 0.0000000000 -0.8506510258
0.5257310271 0.0000000000 0.8506510258
-0.5257310271 0.0000000000 0.8506510258
-0.8506510258 -0.5257310271 0.0000000000
-0.8506510258 0.5257310271 0.0000000000
0.8506510258 0.5257310271 0.0000000000
0.8506510258 -0.5257310271 0.0000000000
0.0000000000 -0.8506510258 0.5257310271
0.0000000000 -0.8506510258 -0.5257310271
0.0000000000 0.8506510258 -0.5257310271
0.0000000000 0.8506510258 0.5257310271
3 1 9 0
3 10 1 0
3 5 10 0
3 4 5 0
3 9 4 0
3 8 2 3
3 4 8 3
3 5 4 3
3 11 5 3
3 2 11 3
3 11 2 6
3 10 11 6
3 1 10 6
3 7 1 6
3 2 7 6
3 11 10 5
3 9 8 4
3 7 2 8
3 9 7 8
3 1 7 9

View File

@ -0,0 +1,40 @@
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/Nef_polyhedron_3.h>
#include <CGAL/IO/Nef_polyhedron_iostream_3.h>
#include <iostream>
#include <fstream>
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
typedef CGAL::Polyhedron_3<CGAL::Simple_cartesian<double> > Polyhedron_d;
typedef CGAL::Nef_polyhedron_3<Kernel> Nef_polyhedron;
typedef Kernel::Vector_3 Vector_3;
typedef Kernel::Aff_transformation_3 Aff_transformation_3;
int main(int argc, char** argv) {
Polyhedron P1;
Polyhedron P2;
Polyhedron P3;
std::ifstream f1("data/icosahedron.off");
f1 >> P1;
std::ifstream f2("data/icosahedron.off");
f2 >> P2;
Nef_polyhedron N1(P1);
Nef_polyhedron N2(P2);
Aff_transformation_3 aff(CGAL::TRANSLATION, Vector_3(1,1,0,1));
N2.transform(aff);
std::cout << N1.number_of_volumes() << std::endl;
std::cout << N2.number_of_volumes() << std::endl;
N1+=N2; // model-dependent crash here
std::cout << N1.number_of_volumes() << std::endl;
N1.closure().convert_to_polyhedron(P3);
return 0;
}

View File

@ -3,6 +3,7 @@
#include <CGAL/basic.h>
#include <CGAL/Interval_nt.h>
#include <iostream>
#include <cassert>
typedef CGAL::Interval_nt_advanced NT_adv;
typedef CGAL::Interval_nt<> NT;

View File

@ -135,6 +135,7 @@ if(CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
Scene_c2t3_item.cpp
Scene_nef_polyhedron_item.cpp
Show_point_dialog.cpp
Scene_points_with_normal_item.cpp
)
# AUXILIARY LIBRARIES
@ -202,6 +203,10 @@ if(CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
Scene_nef_rendering.cpp)
target_link_libraries(scene_nef_polyhedron_item demo_framework scene_polyhedron_item)
add_library(scene_points_with_normal_item SHARED
Scene_points_with_normal_item.cpp Scene_points_with_normal_item.moc)
target_link_libraries(scene_points_with_normal_item demo_framework)
foreach( lib
demo_framework
scene_basic_objects
@ -308,6 +313,9 @@ if(CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
polyhedron_demo_plugin(off_plugin Polyhedron_demo_off_plugin)
target_link_libraries(off_plugin scene_polyhedron_item scene_polygon_soup_item)
polyhedron_demo_plugin(xyz_plugin Polyhedron_demo_xyz_plugin)
target_link_libraries(xyz_plugin scene_points_with_normal_item)
polyhedron_demo_plugin(polylines_io_plugin Polyhedron_demo_polylines_io_plugin)
target_link_libraries(polylines_io_plugin scene_polylines_item)
@ -317,11 +325,14 @@ if(CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
polyhedron_demo_plugin(triangulate_facets_plugin Polyhedron_demo_triangulate_facets_plugin)
target_link_libraries(triangulate_facets_plugin scene_polyhedron_item)
polyhedron_demo_plugin(off_to_nef_plugin Polyhedron_demo_off_to_nef_plugin EXCLUDE_FROM_ALL)
polyhedron_demo_plugin(off_to_nef_plugin Polyhedron_demo_off_to_nef_plugin)
target_link_libraries(off_to_nef_plugin scene_nef_polyhedron_item)
polyhedron_demo_plugin(off_to_xyz_plugin Polyhedron_demo_off_to_xyz_plugin)
target_link_libraries(off_to_xyz_plugin scene_points_with_normal_item)
polyhedron_demo_plugin(convex_hull_plugin Polyhedron_demo_convex_hull_plugin)
target_link_libraries(convex_hull_plugin scene_polyhedron_item)
target_link_libraries(convex_hull_plugin scene_polyhedron_item scene_points_with_normal_item)
polyhedron_demo_plugin(kernel_plugin Polyhedron_demo_kernel_plugin)
target_link_libraries(kernel_plugin scene_polyhedron_item)
@ -332,7 +343,38 @@ if(CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
if(EIGEN3_FOUND OR TAUCS_FOUND)
polyhedron_demo_plugin(parameterization_plugin Polyhedron_demo_parameterization_plugin)
target_link_libraries(parameterization_plugin scene_polyhedron_item scene_textured_polyhedron_item )
else(EIGEN3_FOUND OR TAUCS_FOUND)
message(STATUS "NOTICE: Neither TAUCS nor Eigen 3.1 (or greater) libraries have been found. Parameterization will not be available.")
endif(EIGEN3_FOUND OR TAUCS_FOUND)
if(TAUCS_FOUND OR EIGEN3_FOUND)
qt4_wrap_ui( poissonUI_FILES Polyhedron_demo_poisson_plugin.ui)
polyhedron_demo_plugin(poisson_plugin Polyhedron_demo_poisson_plugin Polyhedron_demo_poisson_plugin_impl.cpp ${poissonUI_FILES})
target_link_libraries(poisson_plugin scene_polyhedron_item scene_points_with_normal_item)
else(TAUCS_FOUND OR EIGEN3_FOUND)
message(STATUS "NOTICE: Neither TAUCS nor Eigen 3.1 (or greater) libraries have been found. Poisson reconstruction will not be available.")
endif(TAUCS_FOUND OR EIGEN3_FOUND)
# Link with BLAS and LAPACK only (optional), for Jet Fitting
if (NOT EIGEN3_FOUND AND LAPACK_FOUND)
include( ${LAPACK_USE_FILE} )
endif()
if(EIGEN3_FOUND OR LAPACK_FOUND)
qt4_wrap_ui( normal_estimationUI_FILES Polyhedron_demo_normal_estimation_plugin.ui)
polyhedron_demo_plugin(normal_estimation_plugin Polyhedron_demo_normal_estimation_plugin ${normal_estimationUI_FILES})
target_link_libraries(normal_estimation_plugin scene_points_with_normal_item)
polyhedron_demo_plugin(point_set_smoothing_plugin Polyhedron_demo_point_set_smoothing_plugin)
target_link_libraries(point_set_smoothing_plugin scene_points_with_normal_item)
polyhedron_demo_plugin(point_set_average_spacing_plugin Polyhedron_demo_point_set_average_spacing_plugin)
target_link_libraries(point_set_average_spacing_plugin scene_points_with_normal_item)
else(EIGEN3_FOUND OR LAPACK_FOUND)
message(STATUS "NOTICE: Nor Eigen 3.1 (or greater) nor LAPACK library were found. Normal estimation and smoothing will not be available.")
endif(EIGEN3_FOUND OR LAPACK_FOUND)
polyhedron_demo_plugin(self_intersection_plugin Polyhedron_demo_self_intersection_plugin)
target_link_libraries(self_intersection_plugin scene_polyhedron_item)
@ -361,6 +403,14 @@ if(CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
polyhedron_demo_plugin(cut_plugin Polyhedron_demo_cut_plugin)
target_link_libraries(cut_plugin scene_polyhedron_item scene_basic_objects)
qt4_wrap_ui(point_set_simplificationUI_FILES Polyhedron_demo_point_set_simplification_plugin.ui)
polyhedron_demo_plugin(point_set_simplification_plugin Polyhedron_demo_point_set_simplification_plugin ${point_set_simplificationUI_FILES})
target_link_libraries(point_set_simplification_plugin scene_points_with_normal_item)
qt4_wrap_ui( ps_outliers_removal_UI_FILES Polyhedron_demo_point_set_outliers_removal_plugin.ui)
polyhedron_demo_plugin(point_set_outliers_removal_plugin Polyhedron_demo_point_set_outliers_removal_plugin ${ps_outliers_removal_UI_FILES})
target_link_libraries(point_set_outliers_removal_plugin scene_points_with_normal_item)
else (CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)

View File

@ -21,6 +21,11 @@
#include <QColorDialog>
#include <QClipboard>
#include <QCloseEvent>
#include <QInputDialog>
#include <QTreeView>
#include <QMap>
#include <stdexcept>
#ifdef QT_SCRIPT_LIB
# include <QScriptValue>
@ -109,8 +114,13 @@ MainWindow::MainWindow(QWidget* parent)
ui = new Ui::MainWindow;
ui->setupUi(this);
// remove the Load Script menu entry, when the demo has not been compiled with QT_SCRIPT_LIB
#if !defined(QT_SCRIPT_LIB)
ui->menuBar->removeAction(ui->actionLoad_Script);
#endif
// Save some pointers from ui, for latter use.
treeView = ui->treeView;
sceneView = ui->sceneView;
viewer = ui->viewer;
// do not save the state of the viewer (anoying)
@ -119,23 +129,23 @@ MainWindow::MainWindow(QWidget* parent)
// setup scene
scene = new Scene(this);
viewer->setScene(scene);
treeView->setModel(scene);
sceneView->setModel(scene);
// setup the treeview: delegation and columns sizing...
treeView->setItemDelegate(new SceneDelegate(this));
sceneView->setItemDelegate(new SceneDelegate(this));
treeView->header()->setStretchLastSection(false);
treeView->header()->setResizeMode(Scene::NameColumn, QHeaderView::Stretch);
treeView->header()->setResizeMode(Scene::NameColumn, QHeaderView::Stretch);
treeView->header()->setResizeMode(Scene::ColorColumn, QHeaderView::ResizeToContents);
treeView->header()->setResizeMode(Scene::RenderingModeColumn, QHeaderView::Fixed);
treeView->header()->setResizeMode(Scene::ABColumn, QHeaderView::Fixed);
treeView->header()->setResizeMode(Scene::VisibleColumn, QHeaderView::Fixed);
sceneView->header()->setStretchLastSection(false);
sceneView->header()->setResizeMode(Scene::NameColumn, QHeaderView::Stretch);
sceneView->header()->setResizeMode(Scene::NameColumn, QHeaderView::Stretch);
sceneView->header()->setResizeMode(Scene::ColorColumn, QHeaderView::ResizeToContents);
sceneView->header()->setResizeMode(Scene::RenderingModeColumn, QHeaderView::Fixed);
sceneView->header()->setResizeMode(Scene::ABColumn, QHeaderView::Fixed);
sceneView->header()->setResizeMode(Scene::VisibleColumn, QHeaderView::Fixed);
treeView->resizeColumnToContents(Scene::ColorColumn);
treeView->resizeColumnToContents(Scene::RenderingModeColumn);
treeView->resizeColumnToContents(Scene::ABColumn);
treeView->resizeColumnToContents(Scene::VisibleColumn);
sceneView->resizeColumnToContents(Scene::ColorColumn);
sceneView->resizeColumnToContents(Scene::RenderingModeColumn);
sceneView->resizeColumnToContents(Scene::ABColumn);
sceneView->resizeColumnToContents(Scene::VisibleColumn);
// setup connections
connect(scene, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex & )),
@ -160,20 +170,20 @@ MainWindow::MainWindow(QWidget* parent)
connect(scene, SIGNAL(updated_bbox()),
this, SLOT(updateViewerBBox()));
connect(treeView->selectionModel(),
connect(sceneView->selectionModel(),
SIGNAL(selectionChanged ( const QItemSelection & , const QItemSelection & ) ),
this, SLOT(updateInfo()));
connect(treeView->selectionModel(),
connect(sceneView->selectionModel(),
SIGNAL(selectionChanged ( const QItemSelection & , const QItemSelection & ) ),
this, SLOT(updateDisplayInfo()));
connect(treeView->selectionModel(),
connect(sceneView->selectionModel(),
SIGNAL(selectionChanged ( const QItemSelection & , const QItemSelection & ) ),
this, SLOT(selectionChanged()));
treeView->setContextMenuPolicy(Qt::CustomContextMenu);
connect(treeView, SIGNAL(customContextMenuRequested(const QPoint & )),
sceneView->setContextMenuPolicy(Qt::CustomContextMenu);
connect(sceneView, SIGNAL(customContextMenuRequested(const QPoint & )),
this, SLOT(showSceneContextMenu(const QPoint &)));
connect(viewer, SIGNAL(selected(int)),
@ -302,8 +312,34 @@ MainWindow::MainWindow(QWidget* parent)
}
// debugger->action(QScriptEngineDebugger::InterruptAction)->trigger();
#endif
// setup menu filtering
connect(ui->menuOperations, SIGNAL(aboutToShow()), this, SLOT(filterOperations()));
}
void MainWindow::filterOperations()
{
Q_FOREACH(const PluginNamePair& p, plugins) {
if(p.first->applicable()) {
Q_FOREACH(QAction* action, p.first->actions()) {
action->setVisible(true);
}
} else {
Q_FOREACH(QAction* action, p.first->actions()) {
action->setVisible(false);
}
}
}
// do a pass over all menus in Operations and hide them when they are empty
Q_FOREACH(QAction* action, ui->menuOperations->actions()) {
if(QMenu* menu = action->menu()) {
action->setVisible(!(menu->isEmpty()));
}
}
}
#ifdef QT_SCRIPT_LIB
void MainWindow::evaluate_script(QString script,
const QString& /*filename*/,
@ -351,6 +387,12 @@ void MainWindow::enableScriptDebugger(bool b /* = true */)
"the Qt Script Debugger is not available."));
}
namespace {
bool actionsByName(QAction* x, QAction* y) {
return x->text() < y->text();
}
}
void MainWindow::loadPlugins()
{
Q_FOREACH(QObject *obj, QPluginLoader::staticInstances())
@ -395,11 +437,21 @@ void MainWindow::loadPlugins()
}
}
}
// sort the operations menu by name
QList<QAction*> actions = ui->menuOperations->actions();
qSort(actions.begin(), actions.end(), actionsByName);
ui->menuOperations->clear();
ui->menuOperations->addActions(actions);
}
bool MainWindow::hasPlugin(QString pluginName)
bool MainWindow::hasPlugin(const QString& pluginName) const
{
return plugins.contains(pluginName);
Q_FOREACH(const PluginNamePair& p, plugins) {
if(p.second == pluginName) return true;
}
return false;
}
bool MainWindow::initPlugin(QObject* obj)
@ -410,7 +462,7 @@ bool MainWindow::initPlugin(QObject* obj)
if(plugin) {
// Call plugin's init() method
plugin->init(this, this->scene, this);
plugins << obj->objectName();
plugins << qMakePair(plugin, obj->objectName());
#ifdef QT_SCRIPT_LIB
QScriptValue objectValue =
script_engine->newQObject(obj);
@ -437,8 +489,6 @@ bool MainWindow::initIOPlugin(QObject* obj)
Polyhedron_demo_io_plugin_interface* plugin =
qobject_cast<Polyhedron_demo_io_plugin_interface*>(obj);
if(plugin) {
// std::cerr << "I/O plugin\n";
plugins << obj->objectName();
io_plugins << plugin;
return true;
}
@ -562,7 +612,7 @@ void MainWindow::updateViewerBBox()
void MainWindow::reload_item() {
QAction* sender_action = qobject_cast<QAction*>(sender());
if(!sender_action) return;
bool ok;
int item_index = sender_action->data().toInt(&ok);
QObject* item_object = scene->item(item_index);
@ -578,103 +628,100 @@ void MainWindow::reload_item() {
<< "that is not a Scene_item*\n";
return;
}
QString filename = item->property("source filename").toString();
if(filename.isEmpty()) {
QString loader_name = item->property("loader_name").toString();
if(filename.isEmpty() || loader_name.isEmpty()) {
std::cerr << "Cannot reload item: "
<< "the item has not filename attached\n";
<< "the item has no \"source filename\" or no \"loader_name\" attached attached\n";
return;
}
Polyhedron_demo_io_plugin_interface* fileloader = find_loader(loader_name);
QFileInfo fileinfo(filename);
if(! (fileinfo.isFile() && fileinfo.isReadable()) ) {
std::cerr << "Cannot reload item: "
<< "cannot read file " << qPrintable(filename) << " \n";
return;
}
Scene_item* new_item = load_item(fileinfo);
if(!new_item) {
std::cerr << "Cannot reload item: "
<< "file " << qPrintable(filename) << " is not an item\n";
return;
}
Scene_item* new_item = load_item(fileinfo, fileloader);
new_item->setName(item->name());
new_item->setColor(item->color());
new_item->setRenderingMode(item->renderingMode());
new_item->setVisible(item->visible());
new_item->setProperty("source filename", item->property("source filename"));
new_item->changed();
scene->replaceItem(item_index, new_item);
delete item;
}
Scene_item* MainWindow::load_item(QFileInfo fileinfo) const {
Scene_item* item = 0;
Q_FOREACH(Polyhedron_demo_io_plugin_interface* plugin,
io_plugins)
{
if(plugin->canLoad()) {
item = plugin->load(fileinfo);
if(item) break; // go out of the loop
Polyhedron_demo_io_plugin_interface* MainWindow::find_loader(const QString& loader_name) const {
Q_FOREACH(Polyhedron_demo_io_plugin_interface* io_plugin,
io_plugins) {
if(io_plugin->name() == loader_name) {
return io_plugin;
}
}
return item;
throw std::invalid_argument(QString("No loader found with the name %1 available")
.arg(loader_name).toStdString()) ;
}
void MainWindow::open(QString filename, bool no_popup)
void MainWindow::open(QString filename)
{
#ifdef QT_SCRIPT_LIB
QString program;
if(filename.startsWith("javascript:")) {
program=filename.right(filename.size() - 11);
}
if(filename.startsWith("qtscript:")) {
program=filename.right(filename.size() - 9);
}
if(filename.endsWith(".js")) {
QFile script_file(filename);
script_file.open(QIODevice::ReadOnly);
program = script_file.readAll();
}
if(!program.isEmpty())
{
{
QTextStream(stderr) << "Execution of script \""
<< filename << "\"\n";
// << filename << "\", with following content:\n"
// << program;
}
evaluate_script(program, filename);
return;
}
#endif
QFileInfo fileinfo(filename);
Scene_item* item = 0;
if(fileinfo.isFile() && fileinfo.isReadable()) {
item = load_item(fileinfo);
if(item) {
Scene::Item_id index = scene->addItem(item);
item->setProperty("source filename", fileinfo.absoluteFilePath());
QSettings settings;
settings.setValue("OFF open directory",
fileinfo.absoluteDir().absolutePath());
this->addToRecentFiles(filename);
selectSceneItem(index);
}
else {
if(no_popup) return;
QMessageBox::critical(this,
tr("Cannot open file"),
tr("File %1 has not a known file format.")
.arg(filename));
QString suffix=fileinfo.suffix();
QRegExp extension_rx(tr("\\(\\*.(%1)\\)").arg(suffix));//match (*.XXX) where XXX is the extension of the input file
QRegExp allfiles_rx("\\(\\*?\\.?(\\*)\\)"); //match (*) and (*.*)
// collect all io_plugins and offer them to load if the file extension match one name filter
// also collect all available plugin in case of a no extension match
QStringList selected_items;
QStringList all_items;
Q_FOREACH(Polyhedron_demo_io_plugin_interface* io_plugin, io_plugins) {
all_items << io_plugin->name();
QStringList split_filters = io_plugin->nameFilters().split(";;");
Q_FOREACH(const QString& filter, split_filters) {
if ( extension_rx.indexIn(filter) !=-1 || allfiles_rx.indexIn(filter) !=-1 ){
selected_items << io_plugin->name();
break;
}
}
}
else {
if(no_popup) return;
QMessageBox::critical(this,
tr("Cannot open file"),
tr("File %1 is not a readable file.")
.arg(filename));
bool ok;
QString loader_name;
switch( selected_items.size() )
{
case 1:
loader_name=selected_items.first();
ok=true;
break;
case 0:
loader_name=QInputDialog::getItem(this, tr("Select a loader"), tr("Available loaders for %1 :").arg(fileinfo.fileName()), all_items, 0, false, &ok);
break;
default:
loader_name=QInputDialog::getItem(this, tr("Select a loader"), tr("Available loaders for %1 :").arg(fileinfo.fileName()), selected_items, 0, false, &ok);
}
if(!ok || loader_name.isEmpty()) { return; }
Scene_item* scene_item = load_item(filename, find_loader(loader_name));
selectSceneItem(scene->addItem(scene_item));
}
Scene_item* MainWindow::load_item(QFileInfo fileinfo, Polyhedron_demo_io_plugin_interface* loader) {
Scene_item* item = NULL;
if(!fileinfo.isFile() || !fileinfo.isReadable()) {
throw std::invalid_argument(QString("File %1 is not a readable file.")
.arg(fileinfo.absoluteFilePath()).toStdString());
}
item = loader->load(fileinfo);
if(!item) {
throw std::logic_error(QString("Could not load item from file %1 using plugin %2")
.arg(fileinfo.absoluteFilePath()).arg(loader->name()).toStdString());
}
item->setProperty("source filename", fileinfo.absoluteFilePath());
item->setProperty("loader_name", loader->name());
return item;
}
void MainWindow::selectSceneItem(int i)
@ -682,7 +729,7 @@ void MainWindow::selectSceneItem(int i)
if(i < 0) return;
if(i >= scene->numberOfEntries()) return;
treeView->selectionModel()->select(scene->createSelection(i),
sceneView->selectionModel()->select(scene->createSelection(i),
QItemSelectionModel::ClearAndSelect);
}
@ -701,27 +748,27 @@ void MainWindow::unSelectSceneItem(int i)
void MainWindow::addSceneItemInSelection(int i)
{
treeView->selectionModel()->select(scene->createSelection(i),
sceneView->selectionModel()->select(scene->createSelection(i),
QItemSelectionModel::Select);
scene->itemChanged(i);
}
void MainWindow::removeSceneItemFromSelection(int i)
{
treeView->selectionModel()->select(scene->createSelection(i),
sceneView->selectionModel()->select(scene->createSelection(i),
QItemSelectionModel::Deselect);
scene->itemChanged(i);
}
void MainWindow::selectAll()
{
treeView->selectionModel()->select(scene->createSelectionAll(),
sceneView->selectionModel()->select(scene->createSelectionAll(),
QItemSelectionModel::ClearAndSelect);
}
int MainWindow::getSelectedSceneItemIndex() const
{
QModelIndexList selectedRows = treeView->selectionModel()->selectedRows();
QModelIndexList selectedRows = sceneView->selectionModel()->selectedRows();
if(selectedRows.size() != 1)
return -1;
else
@ -730,7 +777,7 @@ int MainWindow::getSelectedSceneItemIndex() const
QList<int> MainWindow::getSelectedSceneItemIndices() const
{
QModelIndexList selectedRows = treeView->selectionModel()->selectedRows();
QModelIndexList selectedRows = sceneView->selectionModel()->selectedRows();
QList<int> result;
Q_FOREACH(QModelIndex index, selectedRows) {
result << index.row();
@ -802,8 +849,8 @@ void MainWindow::showSceneContextMenu(const QPoint& p) {
if(!sender) return;
int index = -1;
if(sender == treeView) {
QModelIndex modelIndex = treeView->indexAt(p);
if(sender == sceneView) {
QModelIndex modelIndex = sceneView->indexAt(p);
if(!modelIndex.isValid()) return;
index = modelIndex.row();
@ -867,39 +914,85 @@ void MainWindow::closeEvent(QCloseEvent *event)
event->accept();
}
void MainWindow::load_script(QFileInfo info)
{
#if defined(QT_SCRIPT_LIB)
QString program;
QString filename = info.absoluteFilePath();
QFile script_file(filename);
script_file.open(QIODevice::ReadOnly);
program = script_file.readAll();
if(!program.isEmpty())
{
QTextStream(stderr)
<< "Execution of script \""
<< filename << "\"\n";
evaluate_script(program, filename);
}
#endif
}
void MainWindow::on_actionLoad_Script_triggered()
{
#if defined(QT_SCRIPT_LIB)
QString filename = QFileDialog::getSaveFileName(
this,
tr("Select a script to run..."),
".",
"QTScripts (*.js);;All Files (*)");
load_script(QFileInfo(filename));
#endif
}
void MainWindow::on_actionLoad_triggered()
{
QStringList filters;
// we need to special case our way out of this
filters << "All Files (*)";
QStringList extensions;
typedef QMap<QString, Polyhedron_demo_io_plugin_interface*> FilterPluginMap;
FilterPluginMap filterPluginMap;
Q_FOREACH(Polyhedron_demo_io_plugin_interface* plugin, io_plugins) {
if(plugin->canLoad()) {
Q_FOREACH(QString filter, plugin->nameFilters()) {
if(!filter.isEmpty()) {
QRegExp re1("\\((.+)\\)");
if(re1.indexIn(filter) != -1) {
QString filter_extensions = re1.cap(1);
extensions += filter_extensions.simplified().split(" ");
}
filters << filter;
}
QStringList split_filters = plugin->nameFilters().split(";;");
Q_FOREACH(const QString& filter, split_filters) {
FilterPluginMap::iterator it = filterPluginMap.find(filter);
if(it != filterPluginMap.end()) {
qDebug() << "Duplicate Filter: " << it.value();
qDebug() << "This filter will not be available.";
} else {
filterPluginMap[filter] = plugin;
}
filters << filter;
}
}
QStringList sorted_extensions = extensions.toSet().toList();
filters << tr("All files (*)");
filters.push_front(QString("All know files (%1)")
.arg(sorted_extensions.join(" ")));
QSettings settings;
QString directory = settings.value("OFF open directory",
QDir::current().dirName()).toString();
QStringList filenames =
QFileDialog::getOpenFileNames(this,
tr("Open File..."),
directory,
filters.join(";;"));
if(!filenames.isEmpty()) {
Q_FOREACH(QString filename, filenames) {
QFileDialog dialog(this);
dialog.setNameFilters(filters);
if(dialog.exec() != QDialog::Accepted) { return; }
FilterPluginMap::iterator it =
filterPluginMap.find(dialog.selectedNameFilter());
Polyhedron_demo_io_plugin_interface* selectedPlugin = NULL;
if(it != filterPluginMap.end()) {
selectedPlugin = it.value();
}
Q_FOREACH(const QString& filename, dialog.selectedFiles()) {
Scene_item* item = NULL;
if(selectedPlugin) {
QFileInfo info(filename);
item = load_item(info, selectedPlugin);
Scene::Item_id index = scene->addItem(item);
selectSceneItem(index);
this->addToRecentFiles(filename);
} else {
open(filename);
}
}
@ -907,7 +1000,7 @@ void MainWindow::on_actionLoad_triggered()
void MainWindow::on_actionSaveAs_triggered()
{
QModelIndexList selectedRows = treeView->selectionModel()->selectedRows();
QModelIndexList selectedRows = sceneView->selectionModel()->selectedRows();
if(selectedRows.size() != 1)
return;
Scene_item* item = scene->item(getSelectedSceneItemIndex());
@ -973,7 +1066,7 @@ void MainWindow::on_actionDuplicate_triggered()
void MainWindow::on_actionShowHide_triggered()
{
Q_FOREACH(QModelIndex index, treeView->selectionModel()->selectedRows())
Q_FOREACH(QModelIndex index, sceneView->selectionModel()->selectedRows())
{
int i = index.row();
Scene_item* item = scene->item(i);

View File

@ -18,6 +18,7 @@ class Viewer;
class QTreeView;
class QMenu;
class Polyhedron_demo_io_plugin_interface;
class Polyhedron_demo_plugin_interface;
class Scene_item;
@ -41,9 +42,26 @@ public:
public slots:
void updateViewerBBox();
void open(QString filename, bool no_popup = false);
Scene_item* load_item(QFileInfo) const;
void open(QString);
/// Find an IO plugin.
/// @throws `std::invalid_argument` if no loader with that argument can be found
/// @returns the IO plugin associated with `loader_name`
Polyhedron_demo_io_plugin_interface* find_loader(const QString& loader_name) const;
/// Load an item with a given loader.
///
/// @throws `std::logic_error` if loading does not succeed or
/// `std::invalid_argument` if `fileinfo` specifies an invalid file
Scene_item* load_item(QFileInfo fileinfo, Polyhedron_demo_io_plugin_interface*);
/// Reloads an item. Expects to be called by a QAction with the
/// index of the item to be reloaded as data attached to the action.
/// The index must identify a valid `Scene_item`.
void reload_item();
void load_script(QFileInfo);
void selectSceneItem(int i);
void showSelectedPoint(double, double, double);
@ -66,7 +84,7 @@ public slots:
void error(QString);
void message(QString, QString, QString = QString("normal"));
bool hasPlugin(QString);
bool hasPlugin(const QString&) const;
void enableScriptDebugger(bool = true);
protected slots:
@ -91,6 +109,7 @@ protected slots:
void on_actionLoad_triggered();
bool on_actionErase_triggered();
void on_actionDuplicate_triggered();
void on_actionLoad_Script_triggered();
// Show/Hide
void on_actionShowHide_triggered();
@ -112,6 +131,8 @@ protected slots:
void on_action_Copy_camera_triggered();
void on_action_Paste_camera_triggered();
void filterOperations();
protected:
void loadPlugins();
bool initPlugin(QObject*);
@ -128,10 +149,13 @@ private:
Scene* scene;
Viewer* viewer;
QTreeView* treeView;
QTreeView* sceneView;
Ui::MainWindow* ui;
QVector<Polyhedron_demo_io_plugin_interface*> io_plugins;
QStringList plugins;
// typedef to make Q_FOREACH work
typedef QPair<Polyhedron_demo_plugin_interface*, QString> PluginNamePair;
QVector<PluginNamePair > plugins;
#ifdef QT_SCRIPT_LIB
QScriptEngine* script_engine;
public:

View File

@ -50,6 +50,8 @@
<addaction name="actionDuplicate"/>
<addaction name="actionSaveAs"/>
<addaction name="separator"/>
<addaction name="actionLoad_Script"/>
<addaction name="separator"/>
<addaction name="actionQuit"/>
</widget>
<widget class="QMenu" name="menuEdit">
@ -209,7 +211,7 @@
</layout>
</item>
<item>
<widget class="QTreeView" name="treeView">
<widget class="QTreeView" name="sceneView">
<property name="editTriggers">
<set>QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked</set>
</property>
@ -623,6 +625,11 @@
<string>Ctrl+A</string>
</property>
</action>
<action name="actionLoad_Script">
<property name="text">
<string>Load Script</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>

View File

@ -1,10 +1,39 @@
#include "MainWindow.h"
#include <QApplication>
#include <QMessageBox>
#include <CGAL/Qt/resources.h>
#include <stdexcept>
class Polyhedron_demo : public QApplication
{
public:
Polyhedron_demo(int& argc, char **argv) : QApplication(argc, argv) {}
bool notify(QObject* receiver, QEvent* event)
{
try {
return QApplication::notify(receiver, event);
} catch (std::exception &e) {
// find the mainwindow to spawn an error message
Q_FOREACH (QWidget *widget, QApplication::topLevelWidgets()) {
if(MainWindow* mw = qobject_cast<MainWindow*>(widget)) {
QMessageBox::critical(
mw,
tr("Unhandled exception"),
e.what());
break;
}
}
} catch (...) {
qFatal("Unknown exception encountered. Aborting.");
}
return false;
}
};
int main(int argc, char **argv)
{
QApplication app(argc, argv);
Polyhedron_demo app(argc, argv);
app.setOrganizationDomain("geometryfactory.com");
app.setOrganizationName("GeometryFactory");
app.setApplicationName("Polyhedron_3 demo");
@ -29,7 +58,7 @@ int main(int argc, char **argv)
mainWindow.enableScriptDebugger();
args.removeAt(0);
}
mainWindow.open("autostart.js", true);
mainWindow.load_script(QFileInfo("autostart.js"));
#endif
Q_FOREACH(QString filename, args) {
mainWindow.open(filename);

View File

@ -4,6 +4,7 @@
#include <QStringList>
#include "Scene_polyhedron_item.h"
#include "Scene_points_with_normal_item.h"
#include "Polyhedron_type.h"
#include "Polyhedron_demo_plugin_helper.h"
@ -24,6 +25,12 @@ public:
return QStringList() << "actionConvexHull";
}
bool applicable() const {
return
qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex())) ||
qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
}
public slots:
void on_actionConvexHull_triggered();
@ -34,29 +41,36 @@ void Polyhedron_demo_convex_hull_plugin::on_actionConvexHull_triggered()
{
const Scene_interface::Item_id index = scene->mainSelectionIndex();
Scene_polyhedron_item* item =
Scene_polyhedron_item* poly_item =
qobject_cast<Scene_polyhedron_item*>(scene->item(index));
if(item)
Scene_points_with_normal_item* pts_item =
qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
if(poly_item || pts_item)
{
Polyhedron* pMesh = item->polyhedron();
// wait cursor
QApplication::setOverrideCursor(Qt::WaitCursor);
QTime time;
time.start();
std::cout << "Convex hull...";
// add convex hull as new polyhedron
Polyhedron *pConvex_hull = new Polyhedron;
CGAL::convex_hull_3(pMesh->points_begin(),pMesh->points_end(),*pConvex_hull);
if ( poly_item ){
Polyhedron* pMesh = poly_item->polyhedron();
CGAL::convex_hull_3(pMesh->points_begin(),pMesh->points_end(),*pConvex_hull);
}
else{
CGAL::convex_hull_3(pts_item->point_set()->begin(),pts_item->point_set()->end(),*pConvex_hull);
}
std::cout << "ok (" << time.elapsed() << " ms)" << std::endl;
Scene_polyhedron_item* new_item = new Scene_polyhedron_item(pConvex_hull);
new_item->setName(tr("%1 (convex hull)").arg(item->name()));
new_item->setName(tr("%1 (convex hull)").arg(scene->item(index)->name()));
new_item->setColor(Qt::magenta);
new_item->setRenderingMode(item->renderingMode());
new_item->setRenderingMode(FlatPlusEdges);
scene->addItem(new_item);
// default cursor

View File

@ -28,7 +28,9 @@ class Polyhedron_demo_corefinement_plugin :
public:
bool applicable() const {
return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
}
QList<QAction*> actions() const {
return QList<QAction*>() << actionPolyhedronCorefinement_3;

View File

@ -160,6 +160,10 @@ public:
virtual ~Polyhedron_demo_cut_plugin();
bool applicable() const {
return true;
}
void init(QMainWindow* mainWindow, Scene_interface* scene_interface,
Messages_interface* m);
QList<QAction*> actions() const;

View File

@ -73,6 +73,16 @@ public:
return QList<QAction*>() << actionToggleEdit;
}
//! Applicable if any of the currently selected items is either a Polyhedron or an Edit polyhedron
bool applicable() const {
Q_FOREACH(Scene_interface::Item_id i, scene->selectionIndices())
{
if(qobject_cast<Scene_polyhedron_item*>(scene->item(i))
|| qobject_cast<Scene_edit_polyhedron_item*>(scene->item(i)))
return true;
}
return false;
}
public slots:
void on_actionToggleEdit_triggered(bool);
void start_deform();

View File

@ -21,6 +21,13 @@ public:
QStringList actionsNames() const {
return QStringList() << "actionInsideOut";
}
bool applicable() const {
const Scene_interface::Item_id index = scene->mainSelectionIndex();
return qobject_cast<Scene_polyhedron_item*>(scene->item(index))
|| qobject_cast<Scene_polygon_soup_item*>(scene->item(index));
}
public slots:
void on_actionInsideOut_triggered();

View File

@ -33,7 +33,9 @@ class Polyhedron_demo_intersection_plugin :
public:
bool applicable() const {
return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
}
QList<QAction*> actions() const {
return QList<QAction*>() << actionPolyhedronIntersection_3;

View File

@ -9,9 +9,10 @@ class Scene_item;
class Polyhedron_demo_io_plugin_interface
{
public:
virtual QString name() const = 0;
virtual ~Polyhedron_demo_io_plugin_interface() {}
virtual QStringList nameFilters() const = 0;
virtual QString nameFilters() const = 0;
virtual bool canLoad() const = 0;
virtual Scene_item* load(QFileInfo fileinfo) = 0;

View File

@ -36,6 +36,11 @@ public:
QStringList actionsNames() const {
return QStringList() << "actionKernel";
}
bool applicable() const {
return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
}
public slots:
void on_actionKernel_triggered();

View File

@ -42,6 +42,10 @@ public:
QList<QAction*> actions() const {
return QList<QAction*>() << actionMesh_3;
}
bool applicable() const {
return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
}
public slots:
void mesh_3();

View File

@ -133,7 +133,7 @@ public:
// Indicate if rendering mode is supported
bool supportsRenderingMode(RenderingMode m) const {
return (m != Gouraud); // CHECK THIS!
return (m != Gouraud && m!=PointsPlusNormals); // CHECK THIS!
}
void draw() const {

View File

@ -26,6 +26,9 @@ public:
return QStringList() << "actionSimplify";
}
bool applicable() const {
return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
}
public slots:
void on_actionSimplify_triggered();

View File

@ -30,6 +30,11 @@ public:
<< "actionMinkowskiSum";
}
bool applicable() const {
return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()))
|| qobject_cast<Scene_nef_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
}
// QList<QAction*> actions() const {
// QMenu* menu = new QMenu(tr("Boolean operations"), mw);
// QAction* action_to_nef = new QAction(tr("Convert to nef polyhedron"), mw);

View File

@ -0,0 +1,201 @@
#include "config.h"
#include "Scene_points_with_normal_item.h"
#include "Polyhedron_demo_plugin_helper.h"
#include "Polyhedron_demo_plugin_interface.h"
#include <CGAL/pca_estimate_normals.h>
#include <CGAL/jet_estimate_normals.h>
#include <CGAL/mst_orient_normals.h>
#include <CGAL/Timer.h>
#include <CGAL/Memory_sizer.h>
#include <QObject>
#include <QAction>
#include <QMainWindow>
#include <QApplication>
#include <QtPlugin>
#include <QInputDialog>
#include <QMessageBox>
#include "ui_Polyhedron_demo_normal_estimation_plugin.h"
class Polyhedron_demo_normal_estimation_plugin :
public QObject,
public Polyhedron_demo_plugin_helper
{
Q_OBJECT
Q_INTERFACES(Polyhedron_demo_plugin_interface)
QAction* actionNormalEstimation;
QAction* actionNormalInversion;
public:
void init(QMainWindow* mainWindow, Scene_interface* scene_interface) {
actionNormalEstimation = new QAction(tr("Normal estimation of point set"), mainWindow);
actionNormalEstimation->setObjectName("actionNormalEstimation");
actionNormalInversion = new QAction(tr("Inverse normal orientation"), mainWindow);
actionNormalInversion->setObjectName("actionNormalInversion");
Polyhedron_demo_plugin_helper::init(mainWindow, scene_interface);
}
QList<QAction*> actions() const {
return QList<QAction*>() << actionNormalEstimation << actionNormalInversion;
}
bool applicable() const {
return qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
}
public slots:
void on_actionNormalEstimation_triggered();
void on_actionNormalInversion_triggered();
}; // end PS_demo_smoothing_plugin
class Point_set_demo_normal_estimation_dialog : public QDialog, private Ui::NormalEstimationDialog
{
Q_OBJECT
public:
Point_set_demo_normal_estimation_dialog(QWidget* /*parent*/ = 0)
{
setupUi(this);
}
QString directionMethod() const { return m_inputDirection->currentText(); }
int directionNbNeighbors() const { return m_inputNbNeighborsDirection->value(); }
QString orientationMethod() const { return m_inputOrientation->currentText(); }
int orientationNbNeighbors() const { return m_inputNbNeighborsOrientation->value(); }
};
void Polyhedron_demo_normal_estimation_plugin::on_actionNormalInversion_triggered()
{
const Scene_interface::Item_id index = scene->mainSelectionIndex();
Scene_points_with_normal_item* item =
qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
if(item)
{
// Gets point set
Point_set* points = item->point_set();
if(points == NULL)
return;
for(Point_set::iterator it = points->begin(); it != points->end(); ++it){
it->normal() = -1 * it->normal();
}
}
}
void Polyhedron_demo_normal_estimation_plugin::on_actionNormalEstimation_triggered()
{
const Scene_interface::Item_id index = scene->mainSelectionIndex();
Scene_points_with_normal_item* item =
qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
if(item)
{
// Gets point set
Point_set* points = item->point_set();
if(points == NULL)
return;
// Gets options
Point_set_demo_normal_estimation_dialog dialog;
if(!dialog.exec())
return;
QApplication::setOverrideCursor(Qt::WaitCursor);
// First point to delete
Point_set::iterator first_unoriented_point = points->end();
//***************************************
// normal estimation
//***************************************
if (dialog.directionMethod() == "plane")
{
CGAL::Timer task_timer; task_timer.start();
std::cerr << "Estimates normal direction by PCA (k=" << dialog.directionNbNeighbors() <<")...\n";
// Estimates normals direction.
CGAL::pca_estimate_normals(points->begin(), points->end(),
CGAL::make_normal_of_point_with_normal_pmap(points->begin()),
dialog.directionNbNeighbors());
// Mark all normals as unoriented
first_unoriented_point = points->begin();
long memory = CGAL::Memory_sizer().virtual_size();
std::cerr << "Estimates normal direction: " << task_timer.time() << " seconds, "
<< (memory>>20) << " Mb allocated"
<< std::endl;
}
else if (dialog.directionMethod() == "quadric")
{
CGAL::Timer task_timer; task_timer.start();
std::cerr << "Estimates normal direction by Jet Fitting (k=" << dialog.directionNbNeighbors() <<")...\n";
// Estimates normals direction.
CGAL::jet_estimate_normals(points->begin(), points->end(),
CGAL::make_normal_of_point_with_normal_pmap(points->begin()),
dialog.directionNbNeighbors());
// Mark all normals as unoriented
first_unoriented_point = points->begin();
long memory = CGAL::Memory_sizer().virtual_size();
std::cerr << "Estimates normal direction: " << task_timer.time() << " seconds, "
<< (memory>>20) << " Mb allocated"
<< std::endl;
}
//***************************************
// normal orientation
//***************************************
CGAL::Timer task_timer; task_timer.start();
std::cerr << "Orient normals with a Minimum Spanning Tree (k=" << dialog.orientationNbNeighbors() << ")...\n";
// Tries to orient normals
first_unoriented_point =
CGAL::mst_orient_normals(points->begin(), points->end(),
CGAL::make_normal_of_point_with_normal_pmap(points->begin()),
dialog.orientationNbNeighbors());
int nb_unoriented_normals = std::distance(first_unoriented_point, points->end());
long memory = CGAL::Memory_sizer().virtual_size();
std::cerr << "Orient normals: " << nb_unoriented_normals << " point(s) with an unoriented normal are selected ("
<< task_timer.time() << " seconds, "
<< (memory>>20) << " Mb allocated)"
<< std::endl;
// Selects points with an unoriented normal
points->select(points->begin(), points->end(), false);
points->select(first_unoriented_point, points->end(), true);
// Updates scene
scene->itemChanged(index);
QApplication::restoreOverrideCursor();
// Warns user
if (nb_unoriented_normals > 0)
{
QMessageBox::information(NULL,
tr("Points with an unoriented normal"),
tr("%1 point(s) with an unoriented normal are selected.\nPlease orient them or remove them before running Poisson reconstruction.")
.arg(nb_unoriented_normals));
}
}
}
Q_EXPORT_PLUGIN2(Polyhedron_demo_normal_estimation_plugin, Polyhedron_demo_normal_estimation_plugin)
#include "Polyhedron_demo_normal_estimation_plugin.moc"

View File

@ -0,0 +1,132 @@
<ui version="4.0" >
<class>NormalEstimationDialog</class>
<widget class="QDialog" name="NormalEstimationDialog" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>311</width>
<height>120</height>
</rect>
</property>
<property name="windowTitle" >
<string>Normal estimation</string>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>Direction:</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QComboBox" name="m_inputDirection" >
<item>
<property name="text" >
<string>quadric</string>
</property>
</item>
<item>
<property name="text" >
<string>plane</string>
</property>
</item>
</widget>
</item>
<item row="0" column="2" >
<widget class="QSpinBox" name="m_inputNbNeighborsDirection" >
<property name="suffix" >
<string> neighbors</string>
</property>
<property name="minimum" >
<number>6</number>
</property>
<property name="maximum" >
<number>9999</number>
</property>
<property name="value" >
<number>18</number>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>Orientation:</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QComboBox" name="m_inputOrientation" >
<item>
<property name="text" >
<string>MST</string>
</property>
</item>
</widget>
</item>
<item row="1" column="2" >
<widget class="QSpinBox" name="m_inputNbNeighborsOrientation" >
<property name="suffix" >
<string> neighbors</string>
</property>
<property name="minimum" >
<number>6</number>
</property>
<property name="maximum" >
<number>9999</number>
</property>
<property name="value" >
<number>18</number>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2" >
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>NormalEstimationDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel" >
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>NormalEstimationDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel" >
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel" >
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -13,18 +13,15 @@ class Polyhedron_demo_off_plugin :
Q_INTERFACES(Polyhedron_demo_io_plugin_interface)
public:
QStringList nameFilters() const;
QString name() const { return "Polyhedron_demo_off_plugin"; }
QString nameFilters() const { return "OFF files (*.off)"; }
bool canLoad() const;
Scene_item* load(QFileInfo fileinfo);
bool canSave(const Scene_item*);
bool save(const Scene_item*, QFileInfo fileinfo);
};
QStringList Polyhedron_demo_off_plugin::nameFilters() const {
return QStringList() << "OFF files (*.off)";
}
bool Polyhedron_demo_off_plugin::canLoad() const {
return true;
}

View File

@ -12,7 +12,8 @@ class Polyhedron_demo_off_to_nef_plugin :
Q_INTERFACES(Polyhedron_demo_io_plugin_interface)
public:
QStringList nameFilters() const;
QString name() const { return "Polyhedron_demo_off_to_nef_plugin"; }
QString nameFilters() const { return "OFF files, into nef (*.off)"; }
bool canLoad() const;
Scene_item* load(QFileInfo fileinfo);
@ -20,10 +21,6 @@ public:
bool save(const Scene_item*, QFileInfo fileinfo);
};
QStringList Polyhedron_demo_off_to_nef_plugin::nameFilters() const {
return QStringList() << "OFF files, into nef (*.off)";
}
bool Polyhedron_demo_off_to_nef_plugin::canLoad() const {
return true;
}
@ -46,12 +43,12 @@ Polyhedron_demo_off_to_nef_plugin::load(QFileInfo fileinfo) {
return item;
}
bool Polyhedron_demo_off_to_nef_plugin::canSave(const Scene_item* item)
bool Polyhedron_demo_off_to_nef_plugin::canSave(const Scene_item*)
{
return false;
}
bool Polyhedron_demo_off_to_nef_plugin::save(const Scene_item* item, QFileInfo fileinfo)
bool Polyhedron_demo_off_to_nef_plugin::save(const Scene_item*, QFileInfo)
{
return false;
}

View File

@ -0,0 +1,57 @@
#include "Scene_points_with_normal_item.h"
#include "Polyhedron_demo_io_plugin_interface.h"
#include <fstream>
class Polyhedron_demo_off_to_xyz_plugin :
public QObject,
public Polyhedron_demo_io_plugin_interface
{
Q_OBJECT
Q_INTERFACES(Polyhedron_demo_io_plugin_interface)
public:
QString name() const { return "Polyhedron_demo_off_to_xyz_plugin"; }
QString nameFilters() const { return "OFF files as Point set (*.off)"; }
bool canLoad() const;
Scene_item* load(QFileInfo fileinfo);
bool canSave(const Scene_item*);
bool save(const Scene_item*, QFileInfo fileinfo);
};
bool Polyhedron_demo_off_to_xyz_plugin::canLoad() const {
return true;
}
Scene_item*
Polyhedron_demo_off_to_xyz_plugin::load(QFileInfo fileinfo) {
std::ifstream in(fileinfo.filePath().toUtf8());
if(!in)
std::cerr << "Error!\n";
Scene_points_with_normal_item* item = new Scene_points_with_normal_item();
if(!item->read_off_point_set(in))
{
delete item;
return 0;
}
item->setName(fileinfo.baseName());
return item;
}
bool Polyhedron_demo_off_to_xyz_plugin::canSave(const Scene_item*)
{
return false;
}
bool Polyhedron_demo_off_to_xyz_plugin::save(const Scene_item*, QFileInfo)
{
return false;
}
#include <QtPlugin>
Q_EXPORT_PLUGIN2(Polyhedron_demo_off_to_xyz_plugin, Polyhedron_demo_off_to_xyz_plugin)
#include "Polyhedron_demo_off_to_xyz_plugin.moc"

View File

@ -22,6 +22,15 @@ public:
void init(QMainWindow* mainWindow,
Scene_interface* scene_interface,
Messages_interface* m);
bool applicable() const {
Q_FOREACH(Scene_interface::Item_id index, scene->selectionIndices()) {
if(qobject_cast<Scene_polygon_soup_item*>(scene->item(index)))
return true;
}
return false;
}
QList<QAction*> actions() const;
public slots:

View File

@ -37,6 +37,10 @@ public:
<< "actionDCP";
}
bool applicable() const {
return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
}
public slots:
void on_actionMVC_triggered();
void on_actionDCP_triggered();

View File

@ -38,6 +38,11 @@ public:
<< "actionFitLine";
}
bool applicable() const {
return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
}
public slots:
void on_actionFitPlane_triggered();
void on_actionFitLine_triggered();

View File

@ -18,6 +18,15 @@ public:
virtual void init(QMainWindow* mw, Scene_interface* sc, Messages_interface*) {
init(mw, sc);
};
//! Checks the current state of the `Scene` or `MainWindow` and decides
//! if the plugin can function, given that state. It's actions are
//! visible in contextmenus, if this returns true, not visible
//! otherwise.
//!
//! @returns \c true, if the plugin is applicable, \c false
//! otherwise
virtual bool applicable() const = 0;
virtual QList<QAction*> actions() const = 0;
};

View File

@ -0,0 +1,109 @@
#include "config.h"
#include "Scene_points_with_normal_item.h"
#include "Polyhedron_demo_plugin_helper.h"
#include "Polyhedron_demo_plugin_interface.h"
#include <CGAL/compute_average_spacing.h>
#include <CGAL/Timer.h>
#include <CGAL/Memory_sizer.h>
#include <QObject>
#include <QAction>
#include <QMainWindow>
#include <QApplication>
#include <QtPlugin>
#include <QInputDialog>
#include <QMessageBox>
class Polyhedron_demo_point_set_average_spacing_plugin :
public QObject,
public Polyhedron_demo_plugin_helper
{
Q_OBJECT
Q_INTERFACES(Polyhedron_demo_plugin_interface)
private:
QAction* actionAverageSpacing;
public:
void init(QMainWindow* mainWindow, Scene_interface* scene_interface) {
actionAverageSpacing = new QAction(tr("Point set average spacing"), mainWindow);
actionAverageSpacing->setObjectName("actionAverageSpacing");
Polyhedron_demo_plugin_helper::init(mainWindow, scene_interface);
}
QList<QAction*> actions() const {
return QList<QAction*>() << actionAverageSpacing;
}
//! Applicable if the currently selected item is a
//! points_with_normal_item.
bool applicable() const {
return qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
}
public slots:
void on_actionAverageSpacing_triggered();
}; // end Polyhedron_demo_point_set_average_spacing_plugin
void Polyhedron_demo_point_set_average_spacing_plugin::on_actionAverageSpacing_triggered()
{
const Scene_interface::Item_id index = scene->mainSelectionIndex();
Scene_points_with_normal_item* item =
qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
if(item)
{
// Gets point set
Point_set* points = item->point_set();
if(points == NULL)
return;
// Gets options
bool ok;
const int nb_neighbors =
QInputDialog::getInteger((QWidget*)mw,
tr("Average Spacing"), // dialog title
tr("Number of neighbors:"), // field label
6, // default value = 1 ring
6, // min
1000, // max
1, // step
&ok);
if(!ok)
return;
QApplication::setOverrideCursor(Qt::WaitCursor);
CGAL::Timer task_timer; task_timer.start();
std::cerr << "Average spacing (k=" << nb_neighbors <<")...\n";
// Computes average spacing
double average_spacing = CGAL::compute_average_spacing(
points->begin(), points->end(),
nb_neighbors);
// Print result
Kernel::Sphere_3 bsphere = points->bounding_sphere();
double radius = std::sqrt(bsphere.squared_radius());
long memory = CGAL::Memory_sizer().virtual_size();
std::cerr << "Average spacing = " << average_spacing
<< " = " << average_spacing/radius << " * point set radius ("
<< task_timer.time() << " seconds, "
<< (memory>>20) << " Mb allocated)"
<< std::endl;
QApplication::restoreOverrideCursor();
QMessageBox::information(NULL,
tr("Average Spacing"),
tr("Average Spacing = %1 = %2 * point set radius")
.arg(average_spacing)
.arg(average_spacing/radius));
}
}
Q_EXPORT_PLUGIN2(Polyhedron_demo_point_set_average_spacing_plugin, Polyhedron_demo_point_set_average_spacing_plugin)
#include "Polyhedron_demo_point_set_average_spacing_plugin.moc"

View File

@ -0,0 +1,117 @@
#include "config.h"
#include "Scene_points_with_normal_item.h"
#include "Polyhedron_demo_plugin_helper.h"
#include "Polyhedron_demo_plugin_interface.h"
#include <CGAL/remove_outliers.h>
#include <CGAL/Timer.h>
#include <CGAL/Memory_sizer.h>
#include <QObject>
#include <QAction>
#include <QMainWindow>
#include <QApplication>
#include <QtPlugin>
#include <QInputDialog>
#include <QMessageBox>
#include "ui_Polyhedron_demo_point_set_outliers_removal_plugin.h"
class Polyhedron_demo_point_set_outliers_removal_plugin :
public QObject,
public Polyhedron_demo_plugin_helper
{
Q_OBJECT
Q_INTERFACES(Polyhedron_demo_plugin_interface)
private:
QAction* actionOutlierRemoval;
public:
void init(QMainWindow* mainWindow, Scene_interface* scene_interface) {
actionOutlierRemoval = new QAction(tr("Point set outliers selection"), mainWindow);
actionOutlierRemoval->setObjectName("actionOutlierRemoval");
Polyhedron_demo_plugin_helper::init(mainWindow, scene_interface);
}
//! Applicate for Point_sets with normals.
bool applicable() const {
return qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
}
QList<QAction*> actions() const {
return QList<QAction*>() << actionOutlierRemoval;
}
public slots:
void on_actionOutlierRemoval_triggered();
}; // end Polyhedron_demo_point_set_outliers_removal_plugin
class Point_set_demo_outlier_removal_dialog : public QDialog, private Ui::OutlierRemovalDialog
{
Q_OBJECT
public:
Point_set_demo_outlier_removal_dialog(QWidget * /*parent*/ = 0)
{
setupUi(this);
}
double percentage() const { return m_inputPercentage->value(); }
int nbNeighbors() const { return m_inputNbNeighbors->value(); }
};
void Polyhedron_demo_point_set_outliers_removal_plugin::on_actionOutlierRemoval_triggered()
{
const Scene_interface::Item_id index = scene->mainSelectionIndex();
Scene_points_with_normal_item* item =
qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
if(item)
{
// Gets point set
Point_set* points = item->point_set();
if(points == NULL)
return;
// Gets options
Point_set_demo_outlier_removal_dialog dialog;
if(!dialog.exec())
return;
const double removed_percentage = dialog.percentage(); // percentage of points to remove
const int nb_neighbors = dialog.nbNeighbors();
QApplication::setOverrideCursor(Qt::WaitCursor);
CGAL::Timer task_timer; task_timer.start();
std::cerr << "Select outliers (" << removed_percentage <<"%)...\n";
// Computes outliers
Point_set::iterator first_point_to_remove =
CGAL::remove_outliers(points->begin(), points->end(),
nb_neighbors,
removed_percentage);
int nb_points_to_remove = std::distance(first_point_to_remove, points->end());
long memory = CGAL::Memory_sizer().virtual_size();
std::cerr << "Simplification: " << nb_points_to_remove << " point(s) are selected ("
<< task_timer.time() << " seconds, "
<< (memory>>20) << " Mb allocated)"
<< std::endl;
// Selects points to delete
points->select(points->begin(), points->end(), false);
points->select(first_point_to_remove, points->end(), true);
// Updates scene
scene->itemChanged(index);
QApplication::restoreOverrideCursor();
}
}
Q_EXPORT_PLUGIN2(Polyhedron_demo_point_set_outliers_removal_plugin, Polyhedron_demo_point_set_outliers_removal_plugin)
#include "Polyhedron_demo_point_set_outliers_removal_plugin.moc"

View File

@ -0,0 +1,109 @@
<ui version="4.0" >
<class>OutlierRemovalDialog</class>
<widget class="QDialog" name="OutlierRemovalDialog" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>331</width>
<height>120</height>
</rect>
</property>
<property name="windowTitle" >
<string>Outlier Removal</string>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>Removed percentage:</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QDoubleSpinBox" name="m_inputPercentage" >
<property name="suffix" >
<string> %</string>
</property>
<property name="minimum" >
<double>0.010000000000000</double>
</property>
<property name="maximum" >
<double>100.000000000000000</double>
</property>
<property name="singleStep" >
<double>0.100000000000000</double>
</property>
<property name="value" >
<double>5.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>Neighbors</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QSpinBox" name="m_inputNbNeighbors" >
<property name="minimum" >
<number>6</number>
</property>
<property name="maximum" >
<number>9999</number>
</property>
<property name="value" >
<number>24</number>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>OutlierRemovalDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel" >
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>OutlierRemovalDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel" >
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel" >
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -0,0 +1,143 @@
#include "config.h"
#include "Scene_points_with_normal_item.h"
#include "Polyhedron_demo_plugin_helper.h"
#include "Polyhedron_demo_plugin_interface.h"
#include <CGAL/grid_simplify_point_set.h>
#include <CGAL/random_simplify_point_set.h>
#include <CGAL/compute_average_spacing.h>
#include <CGAL/Timer.h>
#include <CGAL/Memory_sizer.h>
#include <QObject>
#include <QAction>
#include <QMainWindow>
#include <QApplication>
#include <QtPlugin>
#include <QMessageBox>
#include "ui_Polyhedron_demo_point_set_simplification_plugin.h"
class Polyhedron_demo_point_set_simplification_plugin :
public QObject,
public Polyhedron_demo_plugin_helper
{
Q_OBJECT
Q_INTERFACES(Polyhedron_demo_plugin_interface)
QAction* actionSimplify;
public:
void init(QMainWindow* mainWindow, Scene_interface* scene_interface) {
actionSimplify = new QAction(tr("Point set simplification selection"), mainWindow);
actionSimplify->setObjectName("actionSimplify");
Polyhedron_demo_plugin_helper::init(mainWindow, scene_interface);
}
bool applicable() const {
return qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
}
QList<QAction*> actions() const {
return QList<QAction*>() << actionSimplify;
}
public slots:
void on_actionSimplify_triggered();
}; // end Polyhedron_demo_point_set_simplification_plugin
class Point_set_demo_point_set_simplification_dialog : public QDialog, private Ui::PointSetSimplificationDialog
{
Q_OBJECT
public:
Point_set_demo_point_set_simplification_dialog(QWidget * /*parent*/ = 0)
{
setupUi(this);
}
QString simplificationMethod() const { return m_simplificationMethod->currentText(); }
float randomSimplificationPercentage() const { return m_randomSimplificationPercentage->value(); }
float gridCellSize() const { return m_gridCellSize->value(); }
};
void Polyhedron_demo_point_set_simplification_plugin::on_actionSimplify_triggered()
{
const Scene_interface::Item_id index = scene->mainSelectionIndex();
Scene_points_with_normal_item* item =
qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
if(item)
{
// Gets point set
Point_set* points = item->point_set();
if(points == NULL)
return;
// Gets options
Point_set_demo_point_set_simplification_dialog dialog;
if(!dialog.exec())
return;
QApplication::setOverrideCursor(Qt::WaitCursor);
CGAL::Timer task_timer; task_timer.start();
// First point to delete
Point_set::iterator first_point_to_remove = points->end();
if (dialog.simplificationMethod() == "Random")
{
std::cerr << "Random point cloud simplification (" << dialog.randomSimplificationPercentage() <<"%)...\n";
// Computes points to remove by random simplification
first_point_to_remove =
CGAL::random_simplify_point_set(points->begin(), points->end(),
dialog.randomSimplificationPercentage());
}
else if (dialog.simplificationMethod() == "Grid Clustering")
{
std::cerr << "Point cloud simplification by clustering (cell size = " << dialog.gridCellSize() <<" * average spacing)...\n";
// Computes average spacing
double average_spacing = CGAL::compute_average_spacing(
points->begin(), points->end(),
6 /* knn = 1 ring */);
// Computes points to remove by Grid Clustering
first_point_to_remove =
CGAL::grid_simplify_point_set(points->begin(), points->end(),
dialog.gridCellSize()*average_spacing);
}
int nb_points_to_remove = std::distance(first_point_to_remove, points->end());
long memory = CGAL::Memory_sizer().virtual_size();
std::cerr << "Simplification: " << nb_points_to_remove << " point(s) are selected for removal ("
<< task_timer.time() << " seconds, "
<< (memory>>20) << " Mb allocated)"
<< std::endl;
// Selects points to delete
points->select(points->begin(), points->end(), false);
points->select(first_point_to_remove, points->end(), true);
// Updates scene
scene->itemChanged(index);
QApplication::restoreOverrideCursor();
// Warns user
if (nb_points_to_remove > 0)
{
QMessageBox::information(NULL,
tr("Points selected from removal"),
tr("%1 point(s) are selected for removal.\nYou may remove them with the \"Delete selection\" menu item.")
.arg(nb_points_to_remove));
}
}
}
Q_EXPORT_PLUGIN2(Polyhedron_demo_point_set_simplification_plugin, Polyhedron_demo_point_set_simplification_plugin)
#include "Polyhedron_demo_point_set_simplification_plugin.moc"

View File

@ -0,0 +1,142 @@
<ui version="4.0" >
<class>PointSetSimplificationDialog</class>
<widget class="QDialog" name="PointSetSimplificationDialog" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>403</width>
<height>153</height>
</rect>
</property>
<property name="windowTitle" >
<string>Simplification</string>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>Method:</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QComboBox" name="m_simplificationMethod" >
<item>
<property name="text" >
<string>Random</string>
</property>
</item>
<item>
<property name="text" >
<string>Grid Clustering</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>Points to Remove Randomly</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QDoubleSpinBox" name="m_randomSimplificationPercentage" >
<property name="suffix" >
<string> %</string>
</property>
<property name="decimals" >
<number>2</number>
</property>
<property name="minimum" >
<double>0.100000000000000</double>
</property>
<property name="maximum" >
<double>100.000000000000000</double>
</property>
<property name="singleStep" >
<double>0.100000000000000</double>
</property>
<property name="value" >
<double>50.000000000000000</double>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>Grid Cell Size</string>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QDoubleSpinBox" name="m_gridCellSize" >
<property name="suffix" >
<string> * average spacing</string>
</property>
<property name="decimals" >
<number>2</number>
</property>
<property name="minimum" >
<double>0.100000000000000</double>
</property>
<property name="maximum" >
<double>10.000000000000000</double>
</property>
<property name="singleStep" >
<double>0.100000000000000</double>
</property>
<property name="value" >
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2" >
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>PointSetSimplificationDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel" >
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>PointSetSimplificationDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel" >
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel" >
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -0,0 +1,84 @@
#include "config.h"
#include "Scene_points_with_normal_item.h"
#include "Polyhedron_demo_plugin_helper.h"
#include "Polyhedron_demo_plugin_interface.h"
#include <QObject>
#include <QAction>
#include <QMainWindow>
#include <QApplication>
#include <QtPlugin>
#include <QInputDialog>
#include <CGAL/jet_smooth_point_set.h>
class Polyhedron_demo_point_set_smoothing_plugin :
public QObject,
public Polyhedron_demo_plugin_helper
{
Q_OBJECT
Q_INTERFACES(Polyhedron_demo_plugin_interface)
QAction* actionJetSmoothing;
public:
void init(QMainWindow* mainWindow, Scene_interface* scene_interface) {
actionJetSmoothing = new QAction(tr("Point set jet smoothing"), mainWindow);
actionJetSmoothing->setObjectName("actionJetSmoothing");
Polyhedron_demo_plugin_helper::init(mainWindow, scene_interface);
}
QList<QAction*> actions() const {
return QList<QAction*>() << actionJetSmoothing;
}
bool applicable() const {
return qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
}
public slots:
void on_actionJetSmoothing_triggered();
}; // end Polyhedron_demo_point_set_smoothing_plugin
void Polyhedron_demo_point_set_smoothing_plugin::on_actionJetSmoothing_triggered()
{
const Scene_interface::Item_id index = scene->mainSelectionIndex();
Scene_points_with_normal_item* item =
qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
if(item)
{
Point_set* points = item->point_set();
if(!points) return;
// Gets options
bool ok;
const unsigned int nb_neighbors =
QInputDialog::getInteger((QWidget*)mw,
tr("Jet Smoothing"), // dialog title
tr("Number of neighbors:"), // field label
24, // default value = fast
6, // min
1000, // max
1, // step
&ok);
if(!ok) return;
QApplication::setOverrideCursor(Qt::WaitCursor);
CGAL::jet_smooth_point_set(points->begin(), points->end(), nb_neighbors);
points->invalidate_bounds();
// update scene
scene->itemChanged(index);
QApplication::restoreOverrideCursor();
}
}
Q_EXPORT_PLUGIN2(Polyhedron_demo_point_set_smoothing_plugin, Polyhedron_demo_point_set_smoothing_plugin)
#include "Polyhedron_demo_point_set_smoothing_plugin.moc"

View File

@ -0,0 +1,128 @@
#include "config.h"
#include "Scene_points_with_normal_item.h"
#include "Polyhedron_demo_plugin_helper.h"
#include "Polyhedron_demo_plugin_interface.h"
#include "Scene_polyhedron_item.h"
#include <QObject>
#include <QAction>
#include <QMainWindow>
#include <QApplication>
#include <QtPlugin>
#include <QInputDialog>
#include "ui_Polyhedron_demo_poisson_plugin.h"
// Poisson reconstruction method:
// Reconstructs a surface mesh from a point set and returns it as a polyhedron.
Polyhedron* poisson_reconstruct(const Point_set& points,
Kernel::FT sm_angle, // Min triangle angle (degrees).
Kernel::FT sm_radius, // Max triangle size w.r.t. point set average spacing.
Kernel::FT sm_distance, // Approximation error w.r.t. point set average spacing.
const QString& solver); // solver name
class Polyhedron_demo_poisson_plugin :
public QObject,
public Polyhedron_demo_plugin_helper
{
Q_OBJECT
Q_INTERFACES(Polyhedron_demo_plugin_interface)
QAction* actionPoissonReconstruction;
public:
void init(QMainWindow* mainWindow, Scene_interface* scene_interface) {
actionPoissonReconstruction = new QAction(tr("Poisson reconstruction"), mainWindow);
actionPoissonReconstruction->setObjectName("actionPoissonReconstruction");
Polyhedron_demo_plugin_helper::init(mainWindow, scene_interface);
}
//! Applicate for Point_sets with normals.
bool applicable() const {
return qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
}
QList<QAction*> actions() const {
return QList<QAction*>() << actionPoissonReconstruction;
}
public slots:
void on_actionPoissonReconstruction_triggered();
}; // end class Polyhedron_demo_poisson_plugin
class Polyhedron_demo_poisson_plugin_dialog : public QDialog, private Ui::PoissonDialog
{
Q_OBJECT
public:
Polyhedron_demo_poisson_plugin_dialog(QWidget* /*parent*/ = 0)
{
setupUi(this);
#ifdef CGAL_TAUCS_ENABLED
m_inputSolver->addItem("Taucs");
#endif
#ifdef CGAL_EIGEN3_ENABLED
m_inputSolver->addItem("Eigen - built-in simplicial LDLt");
m_inputSolver->addItem("Eigen - built-in CG");
#endif
}
double triangleAngle() const { return m_inputAngle->value(); }
double triangleRadius() const { return m_inputRadius->value(); }
double triangleError() const { return m_inputDistance->value(); }
QString solver() const { return m_inputSolver->currentText(); }
};
void Polyhedron_demo_poisson_plugin::on_actionPoissonReconstruction_triggered()
{
const Scene_interface::Item_id index = scene->mainSelectionIndex();
Scene_points_with_normal_item* point_set_item =
qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
if(point_set_item)
{
// Gets point set
Point_set* points = point_set_item->point_set();
if(!points) return;
// Gets options
Polyhedron_demo_poisson_plugin_dialog dialog;
if(!dialog.exec())
return;
const double sm_angle = dialog.triangleAngle();
const double sm_radius = dialog.triangleRadius();
const double sm_distance = dialog.triangleError();
const QString sm_solver = dialog.solver();
QApplication::setOverrideCursor(Qt::WaitCursor);
// Reconstruct point set as a polyhedron
Polyhedron* pRemesh = poisson_reconstruct(*points, sm_angle, sm_radius, sm_distance, sm_solver);
if(pRemesh)
{
// Add polyhedron to scene
Scene_polyhedron_item* new_item = new Scene_polyhedron_item(pRemesh);
new_item->setName(tr("%1 Poisson (%2 %3 %4)")
.arg(point_set_item->name())
.arg(sm_angle)
.arg(sm_radius)
.arg(sm_distance));
new_item->setColor(Qt::lightGray);
scene->addItem(new_item);
// Hide point set
point_set_item->setVisible(false);
scene->itemChanged(index);
}
QApplication::restoreOverrideCursor();
}
}
Q_EXPORT_PLUGIN2(Polyhedron_demo_poisson_plugin, Polyhedron_demo_poisson_plugin)
#include "Polyhedron_demo_poisson_plugin.moc"

View File

@ -0,0 +1,156 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PoissonDialog</class>
<widget class="QDialog" name="PoissonDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>376</width>
<height>170</height>
</rect>
</property>
<property name="windowTitle">
<string>Poisson reconstruction</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Min triangle angle:</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QDoubleSpinBox" name="m_inputAngle">
<property name="suffix">
<string> °</string>
</property>
<property name="minimum">
<double>1.000000000000000</double>
</property>
<property name="maximum">
<double>30.000000000000000</double>
</property>
<property name="value">
<double>20.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Max triangle size:</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QDoubleSpinBox" name="m_inputRadius">
<property name="suffix">
<string> * average spacing</string>
</property>
<property name="decimals">
<number>0</number>
</property>
<property name="minimum">
<double>1.000000000000000</double>
</property>
<property name="maximum">
<double>1000.000000000000000</double>
</property>
<property name="singleStep">
<double>1.000000000000000</double>
</property>
<property name="value">
<double>100.000000000000000</double>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Approximation error:</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QDoubleSpinBox" name="m_inputDistance">
<property name="suffix">
<string> * average spacing</string>
</property>
<property name="decimals">
<number>6</number>
</property>
<property name="minimum">
<double>0.010000000000000</double>
</property>
<property name="maximum">
<double>100.000000000000000</double>
</property>
<property name="singleStep">
<double>0.010000000000000</double>
</property>
<property name="value">
<double>0.250000000000000</double>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Solver:</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QComboBox" name="m_inputSolver">
<property name="toolTip">
<string extracomment="Name of the sparse solver"/>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>PoissonDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>177</x>
<y>123</y>
</hint>
<hint type="destinationlabel">
<x>53</x>
<y>125</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>PoissonDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>257</x>
<y>119</y>
</hint>
<hint type="destinationlabel">
<x>257</x>
<y>143</y>
</hint>
</hints>
</connection>
</connections>
</ui>

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