Merge branch 'master' into Aos_2-approximate_unbounded-efif

This commit is contained in:
Efi Fogel 2025-10-22 20:08:00 +03:00
commit 8e8ad1a824
135 changed files with 5925 additions and 1967 deletions

View File

@ -63,7 +63,7 @@ struct Parabola_segment_2 : public Parabola_2< Gt >
} }
int compute_k(const FT tt, const FT STEP) const { int compute_k(const FT tt, const FT STEP) const {
return int(CGAL::to_double(CGAL::sqrt(tt / STEP))); return int(CGAL::to_double(CGAL::approximate_sqrt(tt / STEP)));
} }
// s0 and s1 define a desired drawing "range" // s0 and s1 define a desired drawing "range"

View File

@ -509,8 +509,7 @@ the requirement for traversal of all faces in a graph.
/// I/O Functions for the \ref IOStream3MF /// I/O Functions for the \ref IOStream3MF
/// \ingroup PkgBGLIOFct /// \ingroup PkgBGLIOFct
/// \defgroup PkgBGLIOFctDeprecated I/O Functions (Deprecated)
/// \ingroup PkgBGLIOFct
/*! /*!
\addtogroup PkgBGLPropertiesDynamic \addtogroup PkgBGLPropertiesDynamic

View File

@ -247,36 +247,7 @@ bool read_OFF(const std::string& fname,
} // namespace IO } // namespace IO
#ifndef CGAL_NO_DEPRECATED_CODE
/*!
\ingroup PkgBGLIOFctDeprecated
\deprecated This function is deprecated since \cgal 5.3, `CGAL::IO::read_OFF()` should be used instead.
*/
template <typename Graph, typename CGAL_NP_TEMPLATE_PARAMETERS>
CGAL_DEPRECATED bool read_off(std::istream& is, Graph& g, const CGAL_NP_CLASS& np = parameters::default_values())
{
return IO::read_OFF(is, g, np);
}
/*!
\ingroup PkgBGLIOFctDeprecated
\deprecated This function is deprecated since \cgal 5.3, `CGAL::IO::read_OFF()` should be used instead.
*/
template <typename Graph, typename CGAL_NP_TEMPLATE_PARAMETERS>
CGAL_DEPRECATED bool read_off(const char* fname, Graph& g, const CGAL_NP_CLASS& np = parameters::default_values())
{
return IO::read_OFF(fname, g, np);
}
template <typename Graph>
CGAL_DEPRECATED bool read_off(const std::string& fname, Graph& g)
{
return read_off(fname.c_str(), g, parameters::default_values());
}
#endif // CGAL_NO_DEPRECATED_CODE
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
@ -453,31 +424,6 @@ bool write_OFF(const std::string& fname,
} // namespace IO } // namespace IO
#ifndef CGAL_NO_DEPRECATED_CODE
/*!
\ingroup PkgBGLIOFctDeprecated
\deprecated This function is deprecated since \cgal 5.3, `CGAL::IO::write_OFF()` should be used instead.
*/
template <typename Graph, typename CGAL_NP_TEMPLATE_PARAMETERS>
CGAL_DEPRECATED bool write_off(std::ostream& os, const Graph& g, const CGAL_NP_CLASS& np = parameters::default_values())
{
return IO::write_OFF(os, g, np);
}
/*!
\ingroup PkgBGLIOFctDeprecated
\deprecated This function is deprecated since \cgal 5.3, `CGAL::IO::write_OFF()` should be used instead.
*/
template <typename Graph, typename CGAL_NP_TEMPLATE_PARAMETERS>
CGAL_DEPRECATED bool write_off(const char* fname, const Graph& g, const CGAL_NP_CLASS& np = parameters::default_values())
{
return IO::write_OFF(fname, g, np);
}
#endif // CGAL_NO_DEPRECATED_CODE
} // namespace CGAL } // namespace CGAL

View File

@ -529,20 +529,7 @@ bool write_VTP(const std::string& fname, const Graph& g, const CGAL_NP_CLASS& np
} // namespace IO } // namespace IO
#ifndef CGAL_NO_DEPRECATED_CODE
/*!
\ingroup PkgBGLIOFctDeprecated
\deprecated This function is deprecated since \cgal 5.3, `CGAL::IO::write_VTP()` should be used instead.
*/
template <typename Graph, typename CGAL_NP_TEMPLATE_PARAMETERS>
CGAL_DEPRECATED bool write_vtp(std::ostream& os, const Graph& g, const CGAL_NP_CLASS& np = parameters::default_values())
{
return IO::write_VTP(os, g, np);
}
#endif // CGAL_NO_DEPRECATED_CODE
} // namespace CGAL } // namespace CGAL

View File

@ -111,20 +111,7 @@ bool write_WRL(const std::string& fname, const Graph& g, const CGAL_NP_CLASS& np
} // namespace IO } // namespace IO
#ifndef CGAL_NO_DEPRECATED_CODE
/*!
\ingroup PkgBGLIOFctDeprecated
\deprecated This function is deprecated since \cgal 5.3, `CGAL::IO::write_WRL()` should be used instead.
*/
template <typename Graph, typename CGAL_NP_TEMPLATE_PARAMETERS>
CGAL_DEPRECATED bool write_wrl(std::ostream& os, const Graph& g, const CGAL_NP_CLASS& np = parameters::default_values())
{
return IO::write_WRL(os, g, np);
}
#endif // CGAL_NO_DEPRECATED_CODE
} // namespace CGAL } // namespace CGAL

View File

@ -871,7 +871,54 @@ private:
*/ */
template <typename Graph> template <typename Graph>
class Face_around_face_circulator class Face_around_face_circulator
{}; #ifndef DOXYGEN_RUNNING
: public boost::iterator_adaptor<
Face_around_face_circulator<Graph> // Derived
, Halfedge_around_face_circulator<Graph> // Base
, typename boost::graph_traits<Graph>::face_descriptor // Value
, Bidirectional_circulator_tag // CategoryOrTraversal
, typename boost::graph_traits<Graph>::face_descriptor // Reference
>
#endif
{
internal::Opposite_face<Graph> fct;
typedef typename boost::graph_traits<Graph>::halfedge_descriptor halfedge_descriptor;
public:
#ifndef DOXYGEN_RUNNING
typedef std::size_t size_type;
#endif
Face_around_face_circulator()
{}
Face_around_face_circulator(halfedge_descriptor h, const Graph& g)
: Face_around_face_circulator::iterator_adaptor_(Halfedge_around_face_circulator<Graph>(h,g)), fct(g)
{}
#ifndef DOXYGEN_RUNNING
explicit operator bool() const
{
return (! (this->base_reference() == nullptr));
}
bool operator== (void*) const
{
return this->base_reference()== nullptr;
}
bool operator!= (void*) const
{
return this->base_reference()!= nullptr;
}
private:
friend class boost::iterator_core_access;
typename boost::graph_traits<Graph>::face_descriptor dereference() const { return fct(*this->base_reference()); }
#endif
};
/** /**
* \ingroup PkgBGLIterators * \ingroup PkgBGLIterators

View File

@ -38,7 +38,6 @@ create_single_source_cgal_program("test_graph_traits.cpp")
create_single_source_cgal_program("test_Properties.cpp") create_single_source_cgal_program("test_Properties.cpp")
create_single_source_cgal_program("bench_read_from_stream_vs_add_face_and_add_faces.cpp") create_single_source_cgal_program("bench_read_from_stream_vs_add_face_and_add_faces.cpp")
create_single_source_cgal_program("graph_traits_inheritance.cpp" ) create_single_source_cgal_program("graph_traits_inheritance.cpp" )
create_single_source_cgal_program("test_deprecated_io.cpp")
find_package(OpenMesh QUIET) find_package(OpenMesh QUIET)
if(OpenMesh_FOUND) if(OpenMesh_FOUND)
@ -69,8 +68,6 @@ if (VTK_FOUND AND VTK_LIBRARIES)
message(STATUS "VTK ${VTK_VERSION} found ${VTK_LIBRARIES}") message(STATUS "VTK ${VTK_VERSION} found ${VTK_LIBRARIES}")
target_link_libraries(test_bgl_read_write PRIVATE ${VTK_LIBRARIES}) target_link_libraries(test_bgl_read_write PRIVATE ${VTK_LIBRARIES})
target_compile_definitions(test_bgl_read_write PRIVATE -DCGAL_USE_VTK -DNOMINMAX) target_compile_definitions(test_bgl_read_write PRIVATE -DCGAL_USE_VTK -DNOMINMAX)
target_link_libraries(test_deprecated_io PRIVATE ${VTK_LIBRARIES})
target_compile_definitions(test_deprecated_io PRIVATE -DCGAL_USE_VTK -DNOMINMAX)
else() else()
message(STATUS "Tests that use VTK will not be compiled.") message(STATUS "Tests that use VTK will not be compiled.")
endif() #VTK_FOUND endif() #VTK_FOUND

View File

@ -18,6 +18,7 @@ typedef GraphTraits::edge_descriptor edge_descriptor;
typedef GraphTraits::out_edge_iterator out_edge_iterator; typedef GraphTraits::out_edge_iterator out_edge_iterator;
typedef GraphTraits::in_edge_iterator in_edge_iterator; typedef GraphTraits::in_edge_iterator in_edge_iterator;
typedef CGAL::Face_around_face_circulator<Polyhedron> face_around_face_circulator;
typedef CGAL::Halfedge_around_face_circulator<Polyhedron> halfedge_around_face_circulator; typedef CGAL::Halfedge_around_face_circulator<Polyhedron> halfedge_around_face_circulator;
typedef CGAL::Halfedge_around_target_circulator<Polyhedron> halfedge_around_target_circulator; typedef CGAL::Halfedge_around_target_circulator<Polyhedron> halfedge_around_target_circulator;
typedef CGAL::Vertex_around_target_circulator<Polyhedron> vertex_around_target_circulator; typedef CGAL::Vertex_around_target_circulator<Polyhedron> vertex_around_target_circulator;
@ -32,6 +33,7 @@ typedef CGAL::Vertex_around_target_iterator<Polyhedron> vertex_around_target_ite
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
BOOST_CONCEPT_ASSERT((CGAL::Concepts::BidirectionalCirculator<face_around_face_circulator>));
BOOST_CONCEPT_ASSERT((CGAL::Concepts::BidirectionalCirculator<halfedge_around_face_circulator>)); BOOST_CONCEPT_ASSERT((CGAL::Concepts::BidirectionalCirculator<halfedge_around_face_circulator>));
BOOST_CONCEPT_ASSERT((CGAL::Concepts::BidirectionalCirculator<halfedge_around_target_circulator>)); BOOST_CONCEPT_ASSERT((CGAL::Concepts::BidirectionalCirculator<halfedge_around_target_circulator>));
BOOST_CONCEPT_ASSERT((CGAL::Concepts::BidirectionalCirculator<vertex_around_target_circulator>)); BOOST_CONCEPT_ASSERT((CGAL::Concepts::BidirectionalCirculator<vertex_around_target_circulator>));
@ -62,6 +64,14 @@ int main(int argc, char* argv[])
}while(hafc != done); }while(hafc != done);
} }
{
face_around_face_circulator fafc(hd,P), done(fafc);
do {
++fafc;
}while(fafc != done);
}
{ {
halfedge_around_target_circulator havc(hd,P), done(havc); halfedge_around_target_circulator havc(hd,P), done(havc);
vertex_descriptor vd = target(hd,P); vertex_descriptor vd = target(hd,P);

View File

@ -1,59 +0,0 @@
#include <CGAL/Installation/internal/disable_deprecation_warnings_and_errors.h>
#include <fstream>
#include <iostream>
#include <CGAL/Surface_mesh.h>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/boost/graph/generators.h>
#include <CGAL/boost/graph/IO/OFF.h>
#include <CGAL/boost/graph/IO/VTK.h>
#include <CGAL/boost/graph/IO/WRL.h>
typedef CGAL::Simple_cartesian<double> Kernel;
typedef Kernel::Point_3 Point_3;
typedef CGAL::Surface_mesh<Point_3> SM;
int main()
{
// OFF
SM sm_in, sm_out;
Point_3 p0(0,0,0), p1(1,0,0), p2(0,1,0);
CGAL::make_triangle(p0, p1, p2, sm_out);
bool ok = CGAL::write_off("tmp_deprecated.off", sm_out);
assert(ok);
ok = CGAL::read_off("tmp_deprecated.off", sm_in);
assert(ok);
assert(num_vertices(sm_in) == 3 && num_faces(sm_in) == 1);
sm_in.clear();
std::ofstream os("tmp_deprecated.off");
ok = CGAL::write_off(os, sm_out);
assert(ok);
os.close();
std::ifstream is("tmp_deprecated.off");
ok = CGAL::read_off(is, sm_in);
assert(ok);
assert(num_vertices(sm_in) == 3 && num_faces(sm_in) == 1);
is.close();
sm_in.clear();
#ifdef CGAL_USE_VTK
//vtk
os.open("tmp_deprecated.vtp");
ok = CGAL::write_vtp(os, sm_out);
assert(ok);
os.close();
ok = CGAL::IO::read_VTP("tmp_deprecated.vtp", sm_in);
assert(ok);
assert(num_vertices(sm_in) == 3 && num_faces(sm_in) == 1);
sm_in.clear();
#endif
//wrl
os.open("tmp_deprecated.wrl");
ok = CGAL::write_wrl(os, sm_out);
assert(ok);
os.close();
return EXIT_SUCCESS;
}

View File

@ -29,12 +29,10 @@
#include <CGAL/export/CORE.h> #include <CGAL/export/CORE.h>
#ifdef CGAL_TEST_SUITE #ifdef CGAL_CORE_DEBUG
// disabled for the testsuite to avoid `w`
#define CGAL_CORE_warning_msg(X ,Y)
// if (!(X)) CGAL_error_msg(Y)
#else
#define CGAL_CORE_warning_msg(X ,Y) CGAL_warning_msg(X ,Y) #define CGAL_CORE_warning_msg(X ,Y) CGAL_warning_msg(X ,Y)
#else
#define CGAL_CORE_warning_msg(X ,Y)
#endif #endif

View File

@ -6,10 +6,10 @@
var current_version_local = 'master' var current_version_local = 'master'
var all_versions = [ var all_versions = [
'master', 'master',
'6.1-beta1', '6.1-beta2',
'6.0.1', '6.0.2',
'latest', 'latest',
'5.6.2', '5.6.3',
'5.5.5', '5.5.5',
'5.4.5', '5.4.5',
'5.3.2', '5.3.2',

View File

@ -6,10 +6,10 @@
var current_version_local = 'master' var current_version_local = 'master'
var all_versions = [ var all_versions = [
'master', 'master',
'6.1-beta1', '6.1-beta2',
'6.0.1', '6.0.2',
'latest', 'latest',
'5.6.2', '5.6.3',
'5.5.5', '5.5.5',
'5.4.5', '5.4.5',
'5.3.2', '5.3.2',

View File

@ -6,10 +6,10 @@
var current_version_local = 'master' var current_version_local = 'master'
var all_versions = [ var all_versions = [
'master', 'master',
'6.1-beta1', '6.1-beta2',
'6.0.1', '6.0.2',
'latest', 'latest',
'5.6.2', '5.6.3',
'5.5.5', '5.5.5',
'5.4.5', '5.4.5',
'5.3.2', '5.3.2',

View File

@ -0,0 +1,221 @@
// Copyright (c) 2025 GeometryFactory (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org)
//
// $URL$
// $Id$
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
//
//
// Author(s) : Andreas Fabri
#ifndef CGAL_INTERNAL_STATIC_FILTERS_ORIENTATION_4_H
#define CGAL_INTERNAL_STATIC_FILTERS_ORIENTATION_4_H
#include <CGAL/Profile_counter.h>
#include <CGAL/Filtered_kernel/internal/Static_filters/Static_filter_error.h>
#include <CGAL/determinant.h>
#include <cmath>
namespace CGAL { namespace internal { namespace Static_filters_predicates {
template < typename K_base >
class Orientation_4
: public K_base::Orientation_4
{
typedef typename K_base::Orientation Orientation;
typedef typename K_base::Point_4 Point_4;
typedef typename K_base::Orientation_4 Base;
public:
using Base::operator();
Orientation
operator()(const Point_4 &p, const Point_4 &q,
const Point_4 &r, const Point_4 &s,
const Point_4 &t) const
{
CGAL_BRANCH_PROFILER_3("semi-static failures/attempts/calls to : Orientation_4", tmp);
double p0, p1, p2, p3, q0, q1, q2, q3, r0, r1, r2, r3, s0, s1, s2, s3, t0, t1, t2, t3;
if (fit_in_double(p.c0(), p0) && fit_in_double(p.c1(), p1) &&
fit_in_double(p.c2(), p2) && fit_in_double(p.c3(), p3) &&
fit_in_double(q.c0(), q0) && fit_in_double(q.c1(), q1) &&
fit_in_double(q.c2(), q2) && fit_in_double(q.c3(), q3) &&
fit_in_double(r.c0(), r0) && fit_in_double(r.c1(), r1) &&
fit_in_double(r.c2(), r2) && fit_in_double(r.c3(), r3) &&
fit_in_double(s.c0(), s0) && fit_in_double(s.c1(), s1) &&
fit_in_double(s.c2(), s2) && fit_in_double(s.c3(), s3) &&
fit_in_double(t.c0(), t0) && fit_in_double(t.c1(), t1) &&
fit_in_double(t.c2(), t2) && fit_in_double(t.c3(), t3) )
{
CGAL_assertion_code(Orientation should_be = Base::operator()(p, q, r, s, t));
double m01;
m01 = (q0 - p0);
double m02;
m02 = (r0 - p0);
double m03;
m03 = (s0 - p0);
double m04;
m04 = (t0 - p0);
double m11;
m11 = (q1 - p1);
double m12;
m12 = (r1 - p1);
double m13;
m13 = (s1 - p1);
double m14;
m14 = (t1 - p1);
double m21;
m21 = (q2 - p2);
double m22;
m22 = (r2 - p2);
double m23;
m23 = (s2 - p2);
double m24;
m24 = (t2 - p2);
double m31;
m31 = (q3 - p3);
double m32;
m32 = (r3 - p3);
double m33;
m33 = (s3 - p3);
double m34;
m34 = (t3 - p3);
double det;
det = ::CGAL::determinant( m01, m02, m03, m04, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34 );
double eps;
double max1 = CGAL::abs(m01);
double am = CGAL::abs(m02);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m03);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m11);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m12);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m13);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m23);
if( (max1 < am) ) { max1 = am; }
double max2 = CGAL::abs(m01);
am = CGAL::abs(m02);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m11);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m12);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m21);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m22);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m23);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m33);
if( (max2 < am) ) { max2 = am; }
double max3 = CGAL::abs(m04);
am = CGAL::abs(m14);
if( (max3 < am) ) { max3 = am; }
am = CGAL::abs(m24);
if( (max3 < am) ) { max3 = am; }
am = CGAL::abs(m34);
if( (max3 < am) ) { max3 = am; }
double max4 = CGAL::abs(m11);
am = CGAL::abs(m12);
if( (max4 < am) ) { max4 = am; }
am = CGAL::abs(m21);
if( (max4 < am) ) { max4 = am; }
am = CGAL::abs(m22);
if( (max4 < am) ) { max4 = am; }
am = CGAL::abs(m31);
if( (max4 < am) ) { max4 = am; }
am = CGAL::abs(m32);
if( (max4 < am) ) { max4 = am; }
double lower_bound_1;
double upper_bound_1;
lower_bound_1 = max1;
upper_bound_1 = max1;
if( (max2 < lower_bound_1) )
{
lower_bound_1 = max2;
}
else
{
if( (max2 > upper_bound_1) )
{
upper_bound_1 = max2;
}
}
if( (max3 < lower_bound_1) )
{
lower_bound_1 = max3;
}
else
{
if( (max3 > upper_bound_1) )
{
upper_bound_1 = max3;
}
}
if( (max4 < lower_bound_1) )
{
lower_bound_1 = max4;
}
else
{
if( (max4 > upper_bound_1) )
{
upper_bound_1 = max4;
}
}
if( (lower_bound_1 < 2.89273249588395272840e-74) )
{
return Base::operator()(p, q, r, s, t);
}
else
{
if( (upper_bound_1 > 7.23700557733225900010e+75) )
{
return Base::operator()(p, q, r, s, t);
}
eps = (3.17768858673611327578e-14 * (((max4 * max2) * max1) * max3));
if( (det > eps) )
{
CGAL_assertion(should_be == POSITIVE);
return POSITIVE;
}
else
{
if( (det < -eps) )
{
CGAL_assertion(should_be == NEGATIVE);
return NEGATIVE;
}
else
{
return Base::operator()(p, q, r, s, t);
}
}
}
}
return Base::operator()(p, q, r, s, t);
}
};
} } } // namespace CGAL::internal::Static_filters_predicates
#endif // CGAL_INTERNAL_STATIC_FILTERS_ORIENTATION_4_H

View File

@ -0,0 +1,289 @@
// Copyright (c) 2025 GeometryFactory (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org)
//
// $URL$
// $Id$
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
//
//
// Author(s) : Andreas Fabri
#ifndef CGAL_INTERNAL_STATIC_FILTERS_ORIENTATION_5_H
#define CGAL_INTERNAL_STATIC_FILTERS_ORIENTATION_5_H
#include <CGAL/Profile_counter.h>
#include <CGAL/Filtered_kernel/internal/Static_filters/Static_filter_error.h>
#include <CGAL/determinant.h>
#include <cmath>
namespace CGAL { namespace internal { namespace Static_filters_predicates {
template < typename K_base >
class Orientation_5
: public K_base::Orientation_5
{
typedef typename K_base::Orientation Orientation;
typedef typename K_base::Point_5 Point_5;
typedef typename K_base::Orientation_5 Base;
public:
using Base::operator();
Orientation
operator()(const Point_5 &p, const Point_5 &q,
const Point_5 &r, const Point_5 &s,
const Point_5 &t, const Point_5 &u) const
{
CGAL_BRANCH_PROFILER_3("semi-static failures/attempts/calls to : Orientation_5", tmp);
double p0, p1, p2, p3, p4, q0, q1, q2, q3, q4, r0, r1, r2, r3, r4, s0, s1, s2, s3, s4, t0, t1, t2, t3, t4, u0, u1, u2, u3, u4;
if (fit_in_double(p.c0(), p0) && fit_in_double(p.c1(), p1) &&
fit_in_double(p.c2(), p2) && fit_in_double(p.c3(), p3) &&
fit_in_double(p.c4(), p4) &&
fit_in_double(q.c0(), q0) && fit_in_double(q.c1(), q1) &&
fit_in_double(q.c2(), q2) && fit_in_double(q.c3(), q3) &&
fit_in_double(q.c4(), q4) &&
fit_in_double(r.c0(), r0) && fit_in_double(r.c1(), r1) &&
fit_in_double(r.c2(), r2) && fit_in_double(r.c3(), r3) &&
fit_in_double(r.c4(), r4) &&
fit_in_double(s.c0(), s0) && fit_in_double(s.c1(), s1) &&
fit_in_double(s.c2(), s2) && fit_in_double(s.c3(), s3) &&
fit_in_double(s.c4(), s4) &&
fit_in_double(t.c0(), t0) && fit_in_double(t.c1(), t1) &&
fit_in_double(t.c2(), t2) && fit_in_double(t.c3(), t3) &&
fit_in_double(t.c4(), t4) &&
fit_in_double(u.c0(), u0) && fit_in_double(u.c1(), u1) &&
fit_in_double(u.c2(), u2) && fit_in_double(u.c3(), u3) &&
fit_in_double(u.c4(), u4))
{
CGAL_assertion_code(Orientation should_be = Base::operator()(p, q, r, s, t, u));
double m01;
m01 = (q0 - p0);
double m02;
m02 = (r0 - p0);
double m03;
m03 = (s0 - p0);
double m04;
m04 = (t0 - p0);
double m05;
m05 = (u0 - p0);
double m11;
m11 = (q1 - p1);
double m12;
m12 = (r1 - p1);
double m13;
m13 = (s1 - p1);
double m14;
m14 = (t1 - p1);
double m15;
m15 = (u1 - p1);
double m21;
m21 = (q2 - p2);
double m22;
m22 = (r2 - p2);
double m23;
m23 = (s2 - p2);
double m24;
m24 = (t2 - p2);
double m25;
m25 = (u2 - p2);
double m31;
m31 = (q3 - p3);
double m32;
m32 = (r3 - p3);
double m33;
m33 = (s3 - p3);
double m34;
m34 = (t3 - p3);
double m35;
m35 = (u3 - p3);
double m41;
m41 = (q4 - p4);
double m42;
m42 = (r4 - p4);
double m43;
m43 = (s4 - p4);
double m44;
m44 = (t4 - p4);
double m45;
m45 = (u4 - p4);
double det;
det = ::CGAL::determinant( m01, m02, m03, m04, m05, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25, m31, m32, m33, m34, m35, m41, m42, m43, m44, m45 );
double eps;
double max1 = CGAL::abs(m01);
double am = CGAL::abs(m02);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m03);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m11);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m12);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m13);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m21);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m22);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m23);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m33);
if( (max1 < am) ) { max1 = am; }
double max2 = CGAL::abs(m01);
am = CGAL::abs(m02);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m11);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m12);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m21);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m22);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m23);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m31);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m32);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m33);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m43);
if( (max2 < am) ) { max2 = am; }
double max3 = CGAL::abs(m04);
am = CGAL::abs(m14);
if( (max3 < am) ) { max3 = am; }
am = CGAL::abs(m24);
if( (max3 < am) ) { max3 = am; }
am = CGAL::abs(m34);
if( (max3 < am) ) { max3 = am; }
am = CGAL::abs(m44);
if( (max3 < am) ) { max3 = am; }
double max4 = CGAL::abs(m05);
am = CGAL::abs(m15);
if( (max4 < am) ) { max4 = am; }
am = CGAL::abs(m25);
if( (max4 < am) ) { max4 = am; }
am = CGAL::abs(m35);
if( (max4 < am) ) { max4 = am; }
am = CGAL::abs(m45);
if( (max4 < am) ) { max4 = am; }
double max5 = CGAL::abs(m11);
am = CGAL::abs(m12);
if( (max5 < am) ) { max5 = am; }
am = CGAL::abs(m21);
if( (max5 < am) ) { max5 = am; }
am = CGAL::abs(m22);
if( (max5 < am) ) { max5 = am; }
am = CGAL::abs(m31);
if( (max5 < am) ) { max5 = am; }
am = CGAL::abs(m32);
if( (max5 < am) ) { max5 = am; }
am = CGAL::abs(m41);
if( (max5 < am) ) { max5 = am; }
am = CGAL::abs(m42);
if( (max5 < am) ) { max5 = am; }
double lower_bound_1;
double upper_bound_1;
lower_bound_1 = max5;
upper_bound_1 = max5;
if( (max1 < lower_bound_1) )
{
lower_bound_1 = max1;
}
else
{
if( (max1 > upper_bound_1) )
{
upper_bound_1 = max1;
}
}
if( (max2 < lower_bound_1) )
{
lower_bound_1 = max2;
}
else
{
if( (max2 > upper_bound_1) )
{
upper_bound_1 = max2;
}
}
if( (max3 < lower_bound_1) )
{
lower_bound_1 = max3;
}
else
{
if( (max3 > upper_bound_1) )
{
upper_bound_1 = max3;
}
}
if( (max4 < lower_bound_1) )
{
lower_bound_1 = max4;
}
else
{
if( (max4 > upper_bound_1) )
{
upper_bound_1 = max4;
}
}
if( (lower_bound_1 < 9.99657131447050328602e-60) )
{
return Base::operator()(p, q, r, s, t, u);
}
else
{
if( (upper_bound_1 > 3.21387608851797912384e+60) )
{
return Base::operator()(p, q, r, s, t, u);
}
eps = (2.22889232457534740153e-13 * ((((max5 * max2) * max1) * max3) * max4));
if( (det > eps) )
{
CGAL_assertion(should_be == POSITIVE);
return POSITIVE;
}
else
{
if( (det < -eps) )
{
CGAL_assertion(should_be == NEGATIVE);
return NEGATIVE;
}
else
{
return Base::operator()(p, q, r, s, t, u);
}
}
}
}
return Base::operator()(p, q, r, s, t, u);
}
};
} } } // namespace CGAL::internal::Static_filters_predicates
#endif // CGAL_INTERNAL_STATIC_FILTERS_ORIENTATION_5_H

View File

@ -0,0 +1,358 @@
// Copyright (c) 2025 GeometryFactory (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org)
//
// $URL$
// $Id$
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
//
//
// Author(s) : Andreas Fabri
#ifndef CGAL_INTERNAL_STATIC_FILTERS_ORIENTATION_6_H
#define CGAL_INTERNAL_STATIC_FILTERS_ORIENTATION_6_H
#include <CGAL/Profile_counter.h>
#include <CGAL/Filtered_kernel/internal/Static_filters/Static_filter_error.h>
#include <CGAL/determinant.h>
#include <cmath>
namespace CGAL { namespace internal { namespace Static_filters_predicates {
template < typename K_base >
class Orientation_6
: public K_base::Orientation_6
{
typedef typename K_base::Orientation Orientation;
typedef typename K_base::Point_6 Point_6;
typedef typename K_base::Orientation_6 Base;
public:
using Base::operator();
Orientation
operator()(const Point_6 &p, const Point_6 &q,
const Point_6 &r, const Point_6 &s,
const Point_6 &t, const Point_6 &u, const Point_6 &v) const
{
CGAL_BRANCH_PROFILER_3("semi-static failures/attempts/calls to : Orientation_6", tmp);
double p0, p1, p2, p3, p4, p5, q0, q1, q2, q3, q4, q5, r0, r1, r2, r3, r4, r5, s0, s1, s2, s3, s4, s5, t0, t1, t2, t3, t4, t5, u0, u1, u2, u3, u4, u5, v0, v1, v2, v3, v4, v5;
if (fit_in_double(p.c0(), p0) && fit_in_double(p.c1(), p1) &&
fit_in_double(p.c2(), p2) && fit_in_double(p.c3(), p3) &&
fit_in_double(p.c4(), p4) && fit_in_double(p.c5(), p5) &&
fit_in_double(q.c0(), q0) && fit_in_double(q.c1(), q1) &&
fit_in_double(q.c2(), q2) && fit_in_double(q.c3(), q3) &&
fit_in_double(q.c4(), q4) && fit_in_double(q.c5(), q5) &&
fit_in_double(r.c0(), r0) && fit_in_double(r.c1(), r1) &&
fit_in_double(r.c2(), r2) && fit_in_double(r.c3(), r3) &&
fit_in_double(r.c4(), r4) && fit_in_double(r.c5(), r5) &&
fit_in_double(s.c0(), s0) && fit_in_double(s.c1(), s1) &&
fit_in_double(s.c2(), s2) && fit_in_double(s.c3(), s3) &&
fit_in_double(s.c4(), s4) && fit_in_double(s.c5(), s5) &&
fit_in_double(t.c0(), t0) && fit_in_double(t.c1(), t1) &&
fit_in_double(t.c2(), t2) && fit_in_double(t.c3(), t3) &&
fit_in_double(t.c4(), t4) && fit_in_double(t.c5(), t5) &&
fit_in_double(u.c0(), u0) && fit_in_double(u.c1(), u1) &&
fit_in_double(u.c2(), u2) && fit_in_double(u.c3(), u3) &&
fit_in_double(u.c4(), u4) && fit_in_double(u.c5(), u5) &&
fit_in_double(v.c0(), v0) && fit_in_double(v.c1(), v1) &&
fit_in_double(v.c2(), v2) && fit_in_double(v.c3(), v3) &&
fit_in_double(v.c4(), v4) && fit_in_double(v.c5(), v5))
{
CGAL_assertion_code(Orientation should_be = Base::operator()(p, q, r, s, t, u, v));
double m01;
m01 = (q0 - p0);
double m02;
m02 = (r0 - p0);
double m03;
m03 = (s0 - p0);
double m04;
m04 = (t0 - p0);
double m05;
m05 = (u0 - p0);
double m06;
m06 = (v0 - p0);
double m11;
m11 = (q1 - p1);
double m12;
m12 = (r1 - p1);
double m13;
m13 = (s1 - p1);
double m14;
m14 = (t1 - p1);
double m15;
m15 = (u1 - p1);
double m16;
m16 = (v1 - p1);
double m21;
m21 = (q2 - p2);
double m22;
m22 = (r2 - p2);
double m23;
m23 = (s2 - p2);
double m24;
m24 = (t2 - p2);
double m25;
m25 = (u2 - p2);
double m26;
m26 = (v2 - p2);
double m31;
m31 = (q3 - p3);
double m32;
m32 = (r3 - p3);
double m33;
m33 = (s3 - p3);
double m34;
m34 = (t3 - p3);
double m35;
m35 = (u3 - p3);
double m36;
m36 = (v3 - p3);
double m41;
m41 = (q4 - p4);
double m42;
m42 = (r4 - p4);
double m43;
m43 = (s4 - p4);
double m44;
m44 = (t4 - p4);
double m45;
m45 = (u4 - p4);
double m46;
m46 = (v4 - p4);
double m51;
m51 = (q5 - p5);
double m52;
m52 = (r5 - p5);
double m53;
m53 = (s5 - p5);
double m54;
m54 = (t5 - p5);
double m55;
m55 = (u5 - p5);
double m56;
m56 = (v5 - p5);
double det;
det = ::CGAL::determinant( m01, m02, m03, m04, m05, m06, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26, m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56 );
double eps;
double max1 = CGAL::abs(m01);
double am = CGAL::abs(m02);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m11);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m12);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m21);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m22);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m31);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m32);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m41);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m42);
if( (max1 < am) ) { max1 = am; }
double max2 = CGAL::abs(m03);
am = CGAL::abs(m11);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m12);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m13);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m21);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m22);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m23);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m31);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m32);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m33);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m41);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m42);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m43);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m51);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m52);
if( (max2 < am) ) { max2 = am; }
double max3 = CGAL::abs(m04);
am = CGAL::abs(m14);
if( (max3 < am) ) { max3 = am; }
am = CGAL::abs(m24);
if( (max3 < am) ) { max3 = am; }
am = CGAL::abs(m34);
if( (max3 < am) ) { max3 = am; }
am = CGAL::abs(m44);
if( (max3 < am) ) { max3 = am; }
am = CGAL::abs(m54);
if( (max3 < am) ) { max3 = am; }
double max4 = CGAL::abs(m05);
am = CGAL::abs(m15);
if( (max4 < am) ) { max4 = am; }
am = CGAL::abs(m25);
if( (max4 < am) ) { max3 = am; }
am = CGAL::abs(m35);
if( (max4 < am) ) { max4= am; }
am = CGAL::abs(m45);
if( (max4 < am) ) { max4 = am; }
am = CGAL::abs(m55);
if( (max4 < am) ) { max4 = am; }
double max5 = CGAL::abs(m06);
am = CGAL::abs(m16);
if( (max5 < am) ) { max5 = am; }
am = CGAL::abs(m26);
if( (max5 < am) ) { max5 = am; }
am = CGAL::abs(m36);
if( (max5 < am) ) { max5 = am; }
am = CGAL::abs(m46);
if( (max5 < am) ) { max5 = am; }
am = CGAL::abs(m56);
if( (max5 < am) ) { max5 = am; }
double max6 = CGAL::abs(m13);
am = CGAL::abs(m21);
if( (max6 < am) ) { max6 = am; }
am = CGAL::abs(m22);
if( (max6 < am) ) { max6 = am; }
am = CGAL::abs(m23);
if( (max6 < am) ) { max6 = am; }
am = CGAL::abs(m31);
if( (max6 < am) ) { max6 = am; }
am = CGAL::abs(m32);
if( (max6 < am) ) { max6 = am; }
am = CGAL::abs(m33);
if( (max6 < am) ) { max6 = am; }
am = CGAL::abs(m41);
if( (max6 < am) ) { max6 = am; }
am = CGAL::abs(m42);
if( (max6 < am) ) { max6 = am; }
am = CGAL::abs(m43);
if( (max6 < am) ) { max6 = am; }
am = CGAL::abs(m51);
if( (max6 < am) ) { max6 = am; }
am = CGAL::abs(m52);
if( (max6 < am) ) { max6 = am; }
am = CGAL::abs(m53);
am = CGAL::abs(m53);
if( (max6 < am) ) { max6 = am; }
double lower_bound_1;
double upper_bound_1;
lower_bound_1 = max6;
upper_bound_1 = max6;
if( (max5 < lower_bound_1) )
{
lower_bound_1 = max5;
}
else
{
if( (max5 > upper_bound_1) )
{
upper_bound_1 = max5;
}
}
if( (max1 < lower_bound_1) )
{
lower_bound_1 = max1;
}
else
{
if( (max1 > upper_bound_1) )
{
upper_bound_1 = max1;
}
}
if( (max2 < lower_bound_1) )
{
lower_bound_1 = max2;
}
else
{
if( (max2 > upper_bound_1) )
{
upper_bound_1 = max2;
}
}
if( (max3 < lower_bound_1) )
{
lower_bound_1 = max3;
}
else
{
if( (max3 > upper_bound_1) )
{
upper_bound_1 = max3;
}
}
if( (max4 < lower_bound_1) )
{
lower_bound_1 = max4;
}
else
{
if( (max4 > upper_bound_1) )
{
upper_bound_1 = max4;
}
}
if( (lower_bound_1 < 4.82472686053427214432e-50) )
{
return Base::operator()(p, q, r, s, t, u, v);
}
else
{
if( (upper_bound_1 > 1.87072209578355511223e+50) )
{
return Base::operator()(p, q, r, s, t, u, v);
}
eps = (1.76403842114300859158e-12 * (((((max1 * max2) * max6) * max3) * max4) * max5));
if( (det > eps) )
{
CGAL_assertion(should_be == POSITIVE);
return POSITIVE;
}
else
{
if( (det < -eps) )
{
CGAL_assertion(should_be == NEGATIVE);
return NEGATIVE;
}
}
}
}
return Base::operator()(p, q, r, s, t, u, v);
}
};
} } } // namespace CGAL::internal::Static_filters_predicates
#endif // CGAL_INTERNAL_STATIC_FILTERS_ORIENTATION_6_H

View File

@ -229,14 +229,14 @@ print_dag(const Return_base_tag&, std::ostream& os, int level)
struct Depth_base { struct Depth_base {
#ifdef CGAL_PROFILE #ifdef CGAL_PROFILE
int depth_; mutable int depth_;
Depth_base() Depth_base()
: depth_(0) : depth_(0)
{} {}
int depth() const { return depth_; } int depth() const { return depth_; }
void set_depth(int i) void set_depth(int i) const
{ {
depth_ = i; depth_ = i;
CGAL_HISTOGRAM_PROFILER(std::string("[Lazy_kernel DAG depths]"), i); CGAL_HISTOGRAM_PROFILER(std::string("[Lazy_kernel DAG depths]"), i);
@ -244,7 +244,7 @@ struct Depth_base {
} }
#else #else
int depth() const { return 0; } int depth() const { return 0; }
void set_depth(int) {} void set_depth(int) const {}
#endif #endif
}; };
@ -656,6 +656,7 @@ class Lazy_rep_n final :
auto* p = new typename Base::Indirect(ec()( CGAL::exact( std::get<I>(l) ) ... ) ); auto* p = new typename Base::Indirect(ec()( CGAL::exact( std::get<I>(l) ) ... ) );
this->set_at(p); this->set_at(p);
this->set_ptr(p); this->set_ptr(p);
this->set_depth(0);
if(!noprune || is_currently_single_threaded()) if(!noprune || is_currently_single_threaded())
lazy_reset_member(l); lazy_reset_member(l);
} }

View File

@ -1,8 +1,20 @@
# Release History # Release History
## [Release 6.2](https://github.com/CGAL/cgal/releases/tag/v6.2)
Release date: July 2026
### [Linear Cell Complex](https://doc.cgal.org/6.2/Manual/packages.html#PkgLinearCellComplex)
- **API Changes**: The following import functions have been deprecated and renamed for better naming clarity and consistency:
- `import_from_plane_graph()``read_plane_graph_in_lcc()`
- `import_from_polyhedron_3()``polyhedron_3_to_lcc()`
- `import_from_triangulation_3()``triangulation_3_to_lcc()`
- The old function names are still available but marked as deprecated for backward compatibility.
## [Release 6.1](https://github.com/CGAL/cgal/releases/tag/v6.1) ## [Release 6.1](https://github.com/CGAL/cgal/releases/tag/v6.1)
Release date: July 2025 Release date: Sept 2025
### General Changes ### General Changes

View File

@ -970,19 +970,6 @@ ${CGAL_3RD_PARTY_DEFINITIONS} ${CGAL_Qt6_3RD_PARTY_DEFINITIONS} \
${CGAL_DEFINITIONS}" -std=c++17) ${CGAL_DEFINITIONS}" -std=c++17)
message("COMPILATION OPTIONS ARE : ${compile_options}") message("COMPILATION OPTIONS ARE : ${compile_options}")
if(NOT RS_FOUND AND NOT RS3_FOUND)
set(compile_options
"${compile_options} \
-DCGAL_ALGEBRAIC_KERNEL_RS_GMPZ_D_1=1 \
-DCGAL_ALGEBRAIC_KERNEL_RS_GMPQ_D_1=1")
message(STATUS "Skip RS headers \"CGAL/Algebraic_kernel_rs_gmpq_d_1.h\" \
and \"CGAL/Algebraic_kernel_rs_gmpz_d_1.h\" because RS_FOUND is false.")
else()
set(compile_options
"${compile_options} \
-DCGAL_USE_MPFI=1 \
-DCGAL_USE_RS=1")
endif()
if(NOT OpenMesh_FOUND) if(NOT OpenMesh_FOUND)
set(compile_options set(compile_options
"${compile_options} \ "${compile_options} \
@ -1163,16 +1150,12 @@ LEDA_FOUND is false.")
CMD UNIX_COMMAND "${CMAKE_CXX_COMPILER} ${compile_options_str} CMD UNIX_COMMAND "${CMAKE_CXX_COMPILER} ${compile_options_str}
${include_options_str} -x c++ ${flag} -H \ ${include_options_str} -x c++ ${flag} -H \
${CMAKE_CURRENT_SOURCE_DIR}/../${package}/include/${header}" ${CMAKE_CURRENT_SOURCE_DIR}/../${package}/include/${header}"
# The header Algebraic_kernel_rs_gmpz_d_1.h is skipped on purpose: it
# depends on RS.
) )
# CMD2 is CMD without the -H option # CMD2 is CMD without the -H option
separate_arguments( separate_arguments(
CMD2 UNIX_COMMAND "${CMAKE_CXX_COMPILER} ${compile_options_str} CMD2 UNIX_COMMAND "${CMAKE_CXX_COMPILER} ${compile_options_str}
${include_options_str} -x c++ ${flag} \ ${include_options_str} -x c++ ${flag} \
${CMAKE_CURRENT_SOURCE_DIR}/../${package}/include/${header}" ${CMAKE_CURRENT_SOURCE_DIR}/../${package}/include/${header}"
# The header Algebraic_kernel_rs_gmpz_d_1.h is skipped on purpose: it
# depends on RS.
) )
set(chk_header_name set(chk_header_name
${CGAL_BINARY_DIR}/package_info/${package}/check_headers/check_${header2} ${CGAL_BINARY_DIR}/package_info/${package}/check_headers/check_${header2}

View File

@ -9,7 +9,7 @@ function(process_CGAL_subdirectory entry subdir type_name)
make_directory("${CMAKE_BINARY_DIR}/${subdir}/${ENTRY_DIR_NAME}") make_directory("${CMAKE_BINARY_DIR}/${subdir}/${ENTRY_DIR_NAME}")
endif() endif()
message("\n-- Configuring ${subdir} in ${subdir}/${ENTRY_DIR_NAME}") message("-- Configuring ${subdir} in ${subdir}/${ENTRY_DIR_NAME}")
set(source_dir "") set(source_dir "")
if(EXISTS ${entry}/CMakeLists.txt) if(EXISTS ${entry}/CMakeLists.txt)

View File

@ -1,7 +1,15 @@
cmake_minimum_required(VERSION 3.12...3.31) cmake_minimum_required(VERSION 3.12...3.31)
project(CGAL_Demos)
if(NOT CGAL_MODULES_DIR) file(GLOB pkgs RELATIVE ${CMAKE_SOURCE_DIR} "*")
find_package(CGAL REQUIRED) list(SORT pkgs)
endif()
include(${CGAL_MODULES_DIR}/CGALHelpers.cmake) message("== Generating build files for demos ==")
CGAL_handle_subdirectories(demo demos) foreach(pkg ${pkgs})
set(pkg_dir ${CMAKE_SOURCE_DIR}/${pkg})
if(IS_DIRECTORY "${pkg_dir}" AND EXISTS "${pkg_dir}/CMakeLists.txt")
message("\n-- Configuring ${pkg}")
add_subdirectory(${pkg_dir} "${CMAKE_BINARY_DIR}/${pkg}")
endif()
endforeach()
message("== Generating build files for done (DONE) ==")

View File

@ -1,6 +1,15 @@
cmake_minimum_required(VERSION 3.12...3.31) cmake_minimum_required(VERSION 3.12...3.31)
if(NOT CGAL_MODULES_DIR) project(CGAL_Examples)
find_package(CGAL REQUIRED)
endif() file(GLOB pkgs RELATIVE ${CMAKE_SOURCE_DIR} "*")
include(${CGAL_MODULES_DIR}/CGALHelpers.cmake) list(SORT pkgs)
CGAL_handle_subdirectories(examples examples)
message("== Generating build files for examples ==")
foreach(pkg ${pkgs})
set(pkg_dir ${CMAKE_SOURCE_DIR}/${pkg})
if(IS_DIRECTORY "${pkg_dir}" AND EXISTS "${pkg_dir}/CMakeLists.txt")
message("\n-- Configuring ${pkg}")
add_subdirectory(${pkg_dir} "${CMAKE_BINARY_DIR}/${pkg}")
endif()
endforeach()
message("== Generating build files for done (DONE) ==")

View File

@ -17,12 +17,12 @@
#define CGAL_VERSION_H #define CGAL_VERSION_H
#ifndef SWIG #ifndef SWIG
#define CGAL_VERSION 6.1-beta2 #define CGAL_VERSION 6.2-dev
#define CGAL_GIT_HASH abcdef #define CGAL_GIT_HASH abcdef
#endif #endif
#define CGAL_VERSION_NR 1060100920 #define CGAL_VERSION_NR 1060200900
#define CGAL_SVN_REVISION 99999 #define CGAL_SVN_REVISION 99999
#define CGAL_RELEASE_DATE 20250701 #define CGAL_RELEASE_DATE 20260401
#include <CGAL/version_macros.h> #include <CGAL/version_macros.h>

View File

@ -1,8 +1,8 @@
set(CGAL_MAJOR_VERSION 6) set(CGAL_MAJOR_VERSION 6)
set(CGAL_MINOR_VERSION 1) set(CGAL_MINOR_VERSION 2)
set(CGAL_BUGFIX_VERSION 0) set(CGAL_BUGFIX_VERSION 0)
include(${CMAKE_CURRENT_LIST_DIR}/CGALConfigBuildVersion.cmake) include(${CMAKE_CURRENT_LIST_DIR}/CGALConfigBuildVersion.cmake)
set(CGAL_VERSION_PUBLIC_RELEASE_VERSION "6.1-beta2") set(CGAL_VERSION_PUBLIC_RELEASE_VERSION "6.2-dev")
set(CGAL_VERSION_PUBLIC_RELEASE_NAME "CGAL-${CGAL_VERSION_PUBLIC_RELEASE_VERSION}") set(CGAL_VERSION_PUBLIC_RELEASE_NAME "CGAL-${CGAL_VERSION_PUBLIC_RELEASE_VERSION}")
if (CGAL_BUGFIX_VERSION AND CGAL_BUGFIX_VERSION GREATER 0) if (CGAL_BUGFIX_VERSION AND CGAL_BUGFIX_VERSION GREATER 0)

View File

@ -1,8 +1,15 @@
cmake_minimum_required(VERSION 3.12...3.31) cmake_minimum_required(VERSION 3.12...3.31)
project(CGAL_Tests)
file(GLOB pkgs RELATIVE ${CMAKE_SOURCE_DIR} "*")
list(SORT pkgs)
if(NOT CGAL_MODULES_DIR) message("== Generating build files for tests ==")
find_package(CGAL REQUIRED) foreach(pkg ${pkgs})
endif() set(pkg_dir ${CMAKE_SOURCE_DIR}/${pkg})
include(${CGAL_MODULES_DIR}/CGALHelpers.cmake) if(IS_DIRECTORY "${pkg_dir}" AND EXISTS "${pkg_dir}/CMakeLists.txt")
CGAL_handle_subdirectories(test tests) message("\n-- Configuring ${pkg}")
add_subdirectory(${pkg_dir} "${CMAKE_BINARY_DIR}/${pkg}")
endif()
endforeach()
message("== Generating build files for done (DONE) ==")

View File

@ -89,6 +89,44 @@ double operator[](int i)const;
Cartesian_const_iterator_d cartesian_begin()const; Cartesian_const_iterator_d cartesian_begin()const;
/*! returns an iterator pointing beyond the last %Cartesian coordinate. */ /*! returns an iterator pointing beyond the last %Cartesian coordinate. */
Cartesian_const_iterator_d cartesian_end()const; Cartesian_const_iterator_d cartesian_end()const;
/*! returns whether the points coincide. */
friend bool operator==(Point_d,Point_d);
/*! returns whether the points are distinct. */
friend bool operator!=(Point_d,Point_d);
};
/*!
represents a vector in the Euclidean space
\cgalModels{DefaultConstructible,Assignable}
*/
class Vector_d {
public:
/*! introduces a vector with coordinates (x0, x1, ...) where the number of
coordinates matches the dimension.
\pre `DimensionTag` is a fixed dimension, not `Dynamic_dimension_tag`. */
Vector_d(double x0, double x1, ...);
/*! introduces a vector with coordinate set `[first,end)`.
\pre If `DimensionTag` is a fixed dimension, it matches `distance(first,end)`.
\tparam ForwardIterator has its value type that is convertible to `double`.
*/
template<typename ForwardIterator>
Vector_d(ForwardIterator first, ForwardIterator end);
/*! returns the i-th coordinate of a vector.
\pre `i` is non-negative and less than the dimension. */
double operator[](int i)const;
/*! returns an iterator pointing to the zeroth %Cartesian coordinate. */
Cartesian_const_iterator_d cartesian_begin()const;
/*! returns an iterator pointing beyond the last %Cartesian coordinate. */
Cartesian_const_iterator_d cartesian_end()const;
/*! returns whether the vectors coincide. */
friend bool operator==(Vector_d,Vector_d);
/*! returns whether the vectors are distinct. */
friend bool operator!=(Vector_d,Vector_d);
}; };
/*! /*!

View File

@ -77,6 +77,48 @@ double operator[](int i)const;
Cartesian_const_iterator_d cartesian_begin()const; Cartesian_const_iterator_d cartesian_begin()const;
/*! returns an iterator pointing beyond the last Cartesian coordinate. */ /*! returns an iterator pointing beyond the last Cartesian coordinate. */
Cartesian_const_iterator_d cartesian_end()const; Cartesian_const_iterator_d cartesian_end()const;
/*! returns whether the points coincide. This may not be safe
if the points are the result of inexact constructions. */
friend bool operator==(Point_d,Point_d);
/*! returns whether the points are distinct. This may not be safe
if the points are the result of inexact constructions. */
friend bool operator!=(Point_d,Point_d);
};
/*!
represents a vector in the Euclidean space
\cgalModels{DefaultConstructible,Assignable}
*/
class Vector_d {
public:
/*! introduces a vector with coordinates (x0, x1, ...) where the number of
coordinates matches the dimension.
\pre `DimensionTag` is a fixed dimension, not `Dynamic_dimension_tag`. */
Vector_d(double x0, double x1, ...);
/*! introduces a vector with coordinate set `[first,end)`.
\pre If `DimensionTag` is a fixed dimension, it matches `distance(first,end)`.
\tparam InputIterator has its value type that is convertible to `double`.
*/
template<typename InputIterator>
Vector_d(InputIterator first, InputIterator end);
/*! returns the i-th coordinate of a vector.
\pre `i` is non-negative and less than the dimension. */
double operator[](int i)const;
/*! returns an iterator pointing to the zeroth Cartesian coordinate. */
Cartesian_const_iterator_d cartesian_begin()const;
/*! returns an iterator pointing beyond the last Cartesian coordinate. */
Cartesian_const_iterator_d cartesian_end()const;
/*! returns whether the vectors coincide. This may not be safe
if the vectors are the result of inexact constructions. */
friend bool operator==(Vector_d,Vector_d);
/*! returns whether the vectors are distinct. This may not be safe
if the vectors are the result of inexact constructions. */
friend bool operator!=(Vector_d,Vector_d);
}; };
/*! /*!

View File

@ -22,8 +22,8 @@
#include <CGAL/AABB_face_graph_triangle_primitive.h> #include <CGAL/AABB_face_graph_triangle_primitive.h>
#include <CGAL/AABB_halfedge_graph_segment_primitive.h> #include <CGAL/AABB_halfedge_graph_segment_primitive.h>
#include <CGAL/AABB_tree/internal/AABB_drawing_traits.h> #include <CGAL/AABB_tree/internal/AABB_drawing_traits.h>
//#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Simple_cartesian.h> #include <CGAL/Side_of_triangle_mesh.h>
#include <CGAL/bounding_box.h> #include <CGAL/bounding_box.h>
@ -60,7 +60,7 @@ typedef Edge_container Ec;
typedef Triangle_container Tc; typedef Triangle_container Tc;
typedef Viewer_interface Vi; typedef Viewer_interface Vi;
typedef CGAL::Simple_cartesian<double> Simple_kernel; typedef CGAL::Exact_predicates_inexact_constructions_kernel Simple_kernel;
typedef Simple_kernel::FT FT; typedef Simple_kernel::FT FT;
typedef Simple_kernel::Point_3 Point; typedef Simple_kernel::Point_3 Point;
typedef std::pair<Point,FT> Point_distance; typedef std::pair<Point,FT> Point_distance;
@ -81,24 +81,25 @@ Simple_kernel::Vector_3 random_vector()
return Simple_kernel::Vector_3(x,y,z); return Simple_kernel::Vector_3(x,y,z);
} }
template< typename Mesh>
struct PPMAP;
//functor for tbb parallelization //functor for tbb parallelization
template <typename SM_Tree> template <typename SM_Tree, bool is_signed>
class FillGridSize { class FillGridSize {
std::size_t grid_size; std::size_t grid_size;
Point_distance (&distance_function)[100][100]; Point_distance (&distance_function)[100][100];
FT diag; FT diag;
FT& max_distance_function; FT& max_distance_function;
std::vector<SM_Tree*>&sm_trees; std::vector<SM_Tree*>&sm_trees;
bool is_signed;
CGAL::qglviewer::ManipulatedFrame* frame; CGAL::qglviewer::ManipulatedFrame* frame;
public: public:
FillGridSize(std::size_t grid_size, FT diag, Point_distance (&distance_function)[100][100], FillGridSize(std::size_t grid_size, FT diag, Point_distance (&distance_function)[100][100],
FT& max_distance_function, std::vector<SM_Tree*>& sm_trees, FT& max_distance_function, std::vector<SM_Tree*>& sm_trees,
bool is_signed, CGAL::qglviewer::ManipulatedFrame* frame) CGAL::qglviewer::ManipulatedFrame* frame)
: grid_size(grid_size), distance_function (distance_function), diag(diag), : grid_size(grid_size), distance_function (distance_function), diag(diag),
max_distance_function(max_distance_function), max_distance_function(max_distance_function),
sm_trees(sm_trees), is_signed(is_signed), frame(frame) sm_trees(sm_trees), frame(frame)
{ {
} }
template<typename Range> template<typename Range>
@ -137,7 +138,7 @@ public:
max_distance_function = (std::max)(min, max_distance_function); max_distance_function = (std::max)(min, max_distance_function);
if(is_signed) if constexpr (is_signed)
{ {
if(!min_sm_tree) if(!min_sm_tree)
{ {
@ -145,17 +146,12 @@ public:
max_distance_function = DBL_MAX;//(std::max)(min, max_distance_function); max_distance_function = DBL_MAX;//(std::max)(min, max_distance_function);
continue; continue;
} }
typedef typename SM_Tree::size_type size_type; CGAL::Side_of_triangle_mesh<SMesh, Simple_kernel, PPMAP<SMesh>, SM_Tree> side_of(*min_sm_tree);
Simple_kernel::Vector_3 random_vec = random_vector();
const Simple_kernel::Point_3& p = distance_function[i][j].first; const Simple_kernel::Point_3& p = distance_function[i][j].first;
const FT unsigned_distance = distance_function[i][j].second; const FT unsigned_distance = distance_function[i][j].second;
// get sign through ray casting (random vector) FT sign ( side_of(p)==CGAL::ON_UNBOUNDED_SIDE ? 1 : -1);
Simple_kernel::Ray_3 ray(p, random_vec);
size_type nbi = min_sm_tree->number_of_intersected_primitives(ray);
FT sign ( (nbi&1) == 0 ? 1 : -1);
distance_function[i][j].second = sign * unsigned_distance; distance_function[i][j].second = sign * unsigned_distance;
} }
} }
@ -191,9 +187,7 @@ public:
GLubyte* getData(){return data; } GLubyte* getData(){return data; }
}; };
typedef CGAL::Simple_cartesian<double> Simple_kernel;
//typedef CGAL::Exact_predicates_inexact_constructions_kernel Simple_kernel;
template< typename Mesh> template< typename Mesh>
struct PPMAP struct PPMAP
{ {
@ -390,8 +384,8 @@ private:
mutable Simple_kernel::FT m_max_distance_function; mutable Simple_kernel::FT m_max_distance_function;
mutable std::vector<float> tex_map; mutable std::vector<float> tex_map;
mutable Cut_planes_types m_cut_plane; mutable Cut_planes_types m_cut_plane;
template <typename SM_Tree> template <bool is_signed = false, typename SM_Tree>
void compute_distance_function(QMap<QObject*, SM_Tree*> *sm_trees, bool is_signed = false)const void compute_distance_function(QMap<QObject*, SM_Tree*> *sm_trees)const
{ {
m_max_distance_function = FT(0); m_max_distance_function = FT(0);
@ -402,11 +396,11 @@ private:
if(!(is_signed && !CGAL::is_closed(*qobject_cast<Scene_surface_mesh_item*>(sm_trees->key(sm_tree))->polyhedron()))) if(!(is_signed && !CGAL::is_closed(*qobject_cast<Scene_surface_mesh_item*>(sm_trees->key(sm_tree))->polyhedron())))
closed_sm_trees.push_back(sm_tree); closed_sm_trees.push_back(sm_tree);
#ifndef CGAL_LINKED_WITH_TBB #ifndef CGAL_LINKED_WITH_TBB
FillGridSize<SM_Tree> f(m_grid_size, diag, m_distance_function, m_max_distance_function, closed_sm_trees, is_signed, frame); FillGridSize<SM_Tree, is_signed> f(m_grid_size, diag, m_distance_function, m_max_distance_function, closed_sm_trees, frame);
HackRange range(0, static_cast<std::size_t>(m_grid_size*m_grid_size)); HackRange range(0, static_cast<std::size_t>(m_grid_size*m_grid_size));
f(range); f(range);
#else #else
FillGridSize<SM_Tree> f(m_grid_size, diag, m_distance_function, m_max_distance_function, closed_sm_trees, is_signed, frame); FillGridSize<SM_Tree, is_signed> f(m_grid_size, diag, m_distance_function, m_max_distance_function, closed_sm_trees, frame);
tbb::parallel_for(tbb::blocked_range<size_t>(0, m_grid_size*m_grid_size), f); tbb::parallel_for(tbb::blocked_range<size_t>(0, m_grid_size*m_grid_size), f);
#endif #endif
} }
@ -459,7 +453,7 @@ private:
break; break;
case SIGNED_FACETS: case SIGNED_FACETS:
if (!facet_sm_trees || facet_sm_trees->empty() ) { return; } if (!facet_sm_trees || facet_sm_trees->empty() ) { return; }
compute_distance_function( facet_sm_trees, true); compute_distance_function<true>( facet_sm_trees);
break; break;
case UNSIGNED_EDGES: case UNSIGNED_EDGES:

View File

@ -35,6 +35,9 @@ target_link_libraries(off_to_nef_plugin PRIVATE scene_nef_polyhedron_item)
cgal_lab_plugin(polylines_io_plugin Polylines_io_plugin KEYWORDS Viewer Mesh_3) cgal_lab_plugin(polylines_io_plugin Polylines_io_plugin KEYWORDS Viewer Mesh_3)
target_link_libraries(polylines_io_plugin PRIVATE scene_polylines_item) target_link_libraries(polylines_io_plugin PRIVATE scene_polylines_item)
cgal_lab_plugin(spheres_io_plugin Spheres_io_plugin KEYWORDS Viewer Mesh_3)
target_link_libraries(spheres_io_plugin PRIVATE scene_basic_objects)
cgal_lab_plugin(wkt_plugin WKT_io_plugin KEYWORDS Viewer PointSetProcessing Mesh_3) cgal_lab_plugin(wkt_plugin WKT_io_plugin KEYWORDS Viewer PointSetProcessing Mesh_3)
target_link_libraries(wkt_plugin PRIVATE scene_polylines_item) target_link_libraries(wkt_plugin PRIVATE scene_polylines_item)

View File

@ -0,0 +1,162 @@
#include "Scene_spheres_item.h"
#include <QMainWindow>
#include <CGAL/Three/CGAL_Lab_io_plugin_interface.h>
#include <CGAL/Three/CGAL_Lab_plugin_interface.h>
#include <CGAL/Three/CGAL_Lab_plugin_helper.h>
#include <CGAL/Three/Three.h>
#include <fstream>
#include <QVariant>
#include <QMessageBox>
#include <QInputDialog>
using namespace CGAL::Three;
class CGAL_Lab_spheres_io_plugin :
public QObject,
public CGAL_Lab_io_plugin_interface,
public CGAL_Lab_plugin_helper
{
Q_OBJECT
Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface CGAL::Three::CGAL_Lab_io_plugin_interface)
Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0" FILE "spheres_io_plugin.json")
Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.IOPluginInterface/1.90")
public:
// To silent a warning -Woverloaded-virtual
// See https://stackoverflow.com/questions/9995421/gcc-woverloaded-virtual-warnings
using CGAL_Lab_io_plugin_interface::init;
//! Configures the widget
void init(QMainWindow* mainWindow,
CGAL::Three::Scene_interface* scene_interface,
Messages_interface*) override{
//get the references
this->scene = scene_interface;
this->mw = mainWindow;
}
QString name() const override{ return "spheres_io_plugin"; }
QString nameFilters() const override{ return "Spheres files (*.spheres.txt)"; }
bool canLoad(QFileInfo fileinfo) const override;
QList<Scene_item*> load(QFileInfo fileinfo, bool& ok, bool add_to_scene=true) override;
bool canSave(const CGAL::Three::Scene_item*) override;
bool save(QFileInfo fileinfo,QList<CGAL::Three::Scene_item*>&) override;
bool applicable(QAction* ) const override {
return false;
}
QList<QAction*> actions() const override{
return QList<QAction*>();
}
bool isDefaultLoader(const Scene_item* item) const override{
if(qobject_cast<const Scene_spheres_item*>(item))
return true;
return false;
}
};
bool CGAL_Lab_spheres_io_plugin::canLoad(QFileInfo fileinfo) const{
if(!fileinfo.suffix().contains("cgal"))
return true;
std::ifstream in(fileinfo.filePath().toUtf8());
if(!in) {
return false;
}
int first;
if(!(in >> first)
|| first <= 0)
return false;
return true;
}
QList<Scene_item*>
CGAL_Lab_spheres_io_plugin::
load(QFileInfo fileinfo, bool& ok, bool add_to_scene){
// Open file
std::ifstream ifs(fileinfo.filePath().toUtf8());
if(!ifs) {
std::cerr << "Error! Cannot open file " << (const char*)fileinfo.filePath().toUtf8() << std::endl;
ok = false;
return QList<Scene_item*>();
}
if(fileinfo.size() == 0)
{
CGAL::Three::Three::warning( tr("The file you are trying to load is empty."));
Scene_spheres_item* item = new Scene_spheres_item(nullptr, 0, false, false);
item->setName(fileinfo.completeBaseName());
ok = true;
if(add_to_scene)
CGAL::Three::Three::scene()->addItem(item);
return QList<Scene_item*>()<<item;
}
double x, y, z, r;
std::vector<std::array<double, 4> > spheres;
while (ifs >> x && ifs >> y && ifs >> z && ifs >> r)
spheres.push_back({x, y, z, r});
std::vector<QColor> colors;
if (true) {
colors.resize(spheres.size());
for (QColor &c : colors)
c = generate_random_color();
}
else {
colors.reserve(spheres.size());
compute_deterministic_color_map(QColor(180, 120, 130, 255), spheres.size(), std::back_inserter(colors));
}
Scene_spheres_item* item = new Scene_spheres_item(nullptr, spheres.size(), false, true);
item->setName(fileinfo.completeBaseName());
for (std::size_t i = 0;i<spheres.size();i++) {
const std::array<double, 4>& s = spheres[i];
item->add_sphere(CGAL::Epick::Sphere_3(CGAL::Epick::Point_3(s[0], s[1], s[2]), s[3] * s[3]), i, CGAL::IO::Color(colors[i].red(), colors[i].green(), colors[i].blue()));
}
std::cerr << "Number of spheres loaded: " << spheres.size() << std::endl;
item->invalidateOpenGLBuffers();
item->setRenderingMode(Gouraud);
CGAL::Three::Three::scene()->addItem(item);
item->computeElements();
return QList<Scene_item*>()<<item;
}
bool CGAL_Lab_spheres_io_plugin::canSave(const CGAL::Three::Scene_item* item)
{
return qobject_cast<const Scene_spheres_item*>(item) != 0;
}
bool CGAL_Lab_spheres_io_plugin::
save(QFileInfo fileinfo,QList<CGAL::Three::Scene_item*>& items)
{
Scene_item* item = items.front();
const Scene_spheres_item* sphere_item =
qobject_cast<const Scene_spheres_item*>(item);
if(!sphere_item)
return false;
std::ofstream out(fileinfo.filePath().toUtf8());
out.precision (std::numeric_limits<double>::digits10 + 2);
if(!out) {
std::cerr << "Error! Cannot open file " << (const char*)fileinfo.filePath().toUtf8() << std::endl;
return false;
}
return false;
}
#include "Spheres_io_plugin.moc"

View File

@ -47,7 +47,7 @@ public:
QString ext = fileinfo.suffix(); QString ext = fileinfo.suffix();
bool res = true; bool res = true;
if(ext == "off") if(ext == "off")
CGAL::import_from_polyhedron_3_flux < Scene_lcc_item::LCC > (lcc, ifs); CGAL::polyhedron_3_flux_to_lcc < Scene_lcc_item::LCC > (lcc, ifs);
else else
{ {
res = CGAL::load_combinatorial_map(ifs, lcc); res = CGAL::load_combinatorial_map(ifs, lcc);

View File

@ -2,7 +2,9 @@
#include<fstream> #include<fstream>
#include <CGAL/Three/Triangle_container.h> #include <CGAL/Three/Triangle_container.h>
#include <CGAL/Three/Edge_container.h> #include <CGAL/Three/Edge_container.h>
#include <CGAL/Three/Three.h>
#include <QApplication> #include <QApplication>
#include <QMenu>
using namespace CGAL::Three; using namespace CGAL::Three;
@ -43,9 +45,7 @@ struct Scene_spheres_item_priv
model_sphere_is_up = false; model_sphere_is_up = false;
} }
~Scene_spheres_item_priv() ~Scene_spheres_item_priv() {}
{
}
void pick(int &id)const; void pick(int &id)const;
@ -85,6 +85,15 @@ void Scene_spheres_item_priv::pick(int& id) const
id = -1; id = -1;
} }
if (id != -1 && spheres[id].size() == 1) {
const Sphere& sphere = spheres[id][0].first;
Three::information(QString("Selected sphere: center (%1, %2, %3) radius %4").
arg(sphere.center().x(), 0, 'g', 10).
arg(sphere.center().y(), 0, 'g', 10).
arg(sphere.center().z(), 0, 'g', 10).
arg(CGAL::approximate_sqrt(sphere.squared_radius()), 0, 'g', 10));
}
int offset = 0; int offset = 0;
float color[4]; float color[4];
for(std::size_t i=0; i<spheres.size(); ++i) for(std::size_t i=0; i<spheres.size(); ++i)
@ -112,8 +121,10 @@ void Scene_spheres_item_priv::pick(int& id) const
} }
} }
Scene_spheres_item::Scene_spheres_item(Scene_group_item* parent, std::size_t max_index, bool planed, bool pickable) Scene_spheres_item::Scene_spheres_item(Scene_group_item* parent, std::size_t max_index, bool planed, bool pickable) : Scene_group_item()
{ {
connected_alpha_slider = false;
rendering_mode = Gouraud;
setParent(parent); setParent(parent);
d = new Scene_spheres_item_priv(planed, max_index, this, pickable); d = new Scene_spheres_item_priv(planed, max_index, this, pickable);
if(pickable) if(pickable)
@ -173,6 +184,9 @@ void Scene_spheres_item_priv::initializeBuffers(CGAL::Three::Viewer_interface *v
void Scene_spheres_item::draw(Viewer_interface *viewer) const void Scene_spheres_item::draw(Viewer_interface *viewer) const
{ {
if (renderingMode() != Gouraud || !visible())
return;
if(!isInit(viewer)) if(!isInit(viewer))
initGL(viewer); initGL(viewer);
if ( getBuffersFilled() && if ( getBuffersFilled() &&
@ -201,6 +215,7 @@ void Scene_spheres_item::draw(Viewer_interface *viewer) const
} }
else else
{ {
getTriangleContainer(0)->setAlpha(alpha());
getTriangleContainer(0)->draw(viewer, false); getTriangleContainer(0)->draw(viewer, false);
} }
if(d->pickable && (d->spheres.size() > 1 && viewer->inDrawWithNames())) if(d->pickable && (d->spheres.size() > 1 && viewer->inDrawWithNames()))
@ -218,6 +233,9 @@ void Scene_spheres_item::draw(Viewer_interface *viewer) const
void Scene_spheres_item::drawEdges(Viewer_interface *viewer) const void Scene_spheres_item::drawEdges(Viewer_interface *viewer) const
{ {
if (renderingMode() != Wireframe || !visible())
return;
if(!isInit(viewer)) if(!isInit(viewer))
initGL(viewer); initGL(viewer);
if ( getBuffersFilled() && if ( getBuffersFilled() &&
@ -295,6 +313,18 @@ void Scene_spheres_item::invalidateOpenGLBuffers()
getTriangleContainer(1)->reset_vbos(COLORS); getTriangleContainer(1)->reset_vbos(COLORS);
} }
getEdgeContainer(0)->reset_vbos(NOT_INSTANCED); getEdgeContainer(0)->reset_vbos(NOT_INSTANCED);
compute_bbox();
}
QMenu* Scene_spheres_item::contextMenu() {
QMenu* menu = Scene_item_rendering_helper::contextMenu();
if (!connected_alpha_slider && alphaSlider() != nullptr) {
connect(alphaSlider(), &QSlider::valueChanged, [this]() {redraw(); });
connected_alpha_slider = true;
}
return menu;
} }
QString QString

View File

@ -2,6 +2,7 @@
#define SCENE_SPHERES_ITEM_H #define SCENE_SPHERES_ITEM_H
#include "Scene_basic_objects_config.h" #include "Scene_basic_objects_config.h"
#include "create_sphere.h" #include "create_sphere.h"
#include "Color_map.h"
#include <CGAL/Three/Scene_group_item.h> #include <CGAL/Three/Scene_group_item.h>
#include <CGAL/Three/Scene_item_rendering_helper.h> #include <CGAL/Three/Scene_item_rendering_helper.h>
@ -24,7 +25,7 @@ struct Scene_spheres_item_priv;
* have a Scene_spheres_item child). * have a Scene_spheres_item child).
*/ */
class SCENE_BASIC_OBJECTS_EXPORT Scene_spheres_item class SCENE_BASIC_OBJECTS_EXPORT Scene_spheres_item
: public CGAL::Three::Scene_item_rendering_helper : public CGAL::Three::Scene_group_item
{ {
Q_OBJECT Q_OBJECT
public: public:
@ -37,6 +38,7 @@ public:
~Scene_spheres_item(); ~Scene_spheres_item();
Bbox bbox() const override { return _bbox; }
bool isFinite() const override{ return true; } bool isFinite() const override{ return true; }
bool isEmpty() const override{ return false; } bool isEmpty() const override{ return false; }
Scene_item* clone() const override{return nullptr;} Scene_item* clone() const override{return nullptr;}
@ -57,10 +59,12 @@ public:
void setColor(QColor c) override; void setColor(QColor c) override;
bool save(const std::string &file_name) const; bool save(const std::string &file_name) const;
QMenu *contextMenu() override;
void initializeBuffers(Viewer_interface *) const override; void initializeBuffers(Viewer_interface *) const override;
void computeElements() const override; void computeElements() const override;
bool eventFilter(QObject *watched, QEvent *event)override; bool eventFilter(QObject *watched, QEvent *event)override;
Q_SIGNALS: Q_SIGNALS:
void on_color_changed(); void on_color_changed();
void picked(std::size_t id) const; void picked(std::size_t id) const;
@ -68,6 +72,7 @@ Q_SIGNALS:
protected: protected:
friend struct Scene_spheres_item_priv; friend struct Scene_spheres_item_priv;
Scene_spheres_item_priv* d; Scene_spheres_item_priv* d;
bool connected_alpha_slider;
}; };
#endif // SCENE_SPHERES_ITEM_H #endif // SCENE_SPHERES_ITEM_H

View File

@ -375,7 +375,7 @@ void MainWindow::load_off (const QString & fileName, bool clear)
std::ifstream ifs (qPrintable (fileName)); std::ifstream ifs (qPrintable (fileName));
CGAL::import_from_polyhedron_3_flux < LCC > (*scene.lcc, ifs); CGAL::polyhedron_3_flux_to_lcc < LCC > (*scene.lcc, ifs);
#ifdef CGAL_PROFILE_LCC_DEMO #ifdef CGAL_PROFILE_LCC_DEMO
timer.stop(); timer.stop();
@ -415,7 +415,7 @@ void MainWindow::load_3DTDS (const QString & fileName, bool clear)
T.insert (std::istream_iterator < Point_3 >(ifs), T.insert (std::istream_iterator < Point_3 >(ifs),
std::istream_iterator < Point_3 >() ); std::istream_iterator < Point_3 >() );
CGAL::import_from_triangulation_3 < LCC, Triangulation >(*scene.lcc, T); CGAL::triangulation_3_to_lcc < LCC, Triangulation >(*scene.lcc, T);
#ifdef CGAL_PROFILE_LCC_DEMO #ifdef CGAL_PROFILE_LCC_DEMO
timer.stop(); timer.stop();
@ -673,7 +673,7 @@ void MainWindow::on_actionCompute_Voronoi_3D_triggered ()
std::map<Triangulation::Cell_handle, std::map<Triangulation::Cell_handle,
LCC::Dart_descriptor > vol_to_dart; LCC::Dart_descriptor > vol_to_dart;
dh = CGAL::import_from_triangulation_3 < LCC, Triangulation > dh = CGAL::triangulation_3_to_lcc < LCC, Triangulation >
(delaunay_lcc, T, &vol_to_dart); (delaunay_lcc, T, &vol_to_dart);
Dart_descriptor ddh=delaunay_lcc.dual(*scene.lcc, dh); Dart_descriptor ddh=delaunay_lcc.dual(*scene.lcc, dh);

View File

@ -24,13 +24,20 @@ Here a small example:
<B>Middle</B>: the 2D linear cell complex reconstructed if combinatorial maps are the combinatorial data-structure. <B>Middle</B>: the 2D linear cell complex reconstructed if combinatorial maps are the combinatorial data-structure.
<B>Right</B>: the 2D linear cell complex reconstructed if generalized maps are the combinatorial data-structure. <B>Right</B>: the 2D linear cell complex reconstructed if generalized maps are the combinatorial data-structure.
\sa `CGAL::import_from_triangulation_3<LCC,Triangulation>` \sa `CGAL::triangulation_3_to_lcc<LCC,Triangulation>`
\sa `CGAL::import_from_polyhedron_3<LCC,Polyhedron>` \sa `CGAL::polyhedron_3_to_lcc<LCC,Polyhedron>`
*/ */
template<class LCC> template<class LCC>
typename LCC::Dart_descriptor import_from_plane_graph(LCC& lcc, typename LCC::Dart_descriptor read_plane_graph_in_lcc(LCC& lcc,
std::istream& ais); std::istream& ais);
/*!
\ingroup PkgLinearCellComplexConstructions
\deprecated Use `read_plane_graph_in_lcc()` instead.
*/
template<class LCC>
[[deprecated("Use read_plane_graph_in_lcc instead")]]
typename LCC::Dart_descriptor import_from_plane_graph(LCC& lcc, std::istream& ais);
} /* namespace CGAL */ } /* namespace CGAL */

View File

@ -5,10 +5,10 @@ namespace CGAL{
Imports `apoly` (a `Polyhedron_3`) into `lcc`, a model of the `LinearCellComplex` concept. Objects are added in `lcc`, existing darts are not modified. Returns a dart created during the import. Imports `apoly` (a `Polyhedron_3`) into `lcc`, a model of the `LinearCellComplex` concept. Objects are added in `lcc`, existing darts are not modified. Returns a dart created during the import.
\pre \link GenericMap::dimension `LCC::dimension`\endlink \f$ \geq\f$ 2 and \link LinearCellComplex::ambient_dimension `LCC::ambient_dimension`\endlink==3. \pre \link GenericMap::dimension `LCC::dimension`\endlink \f$ \geq\f$ 2 and \link LinearCellComplex::ambient_dimension `LCC::ambient_dimension`\endlink==3.
\sa `CGAL::import_from_plane_graph<LCC>` \sa `CGAL::read_plane_graph_in_lcc<LCC>`
\sa `CGAL::import_from_triangulation_3<LCC,Triangulation>` \sa `CGAL::triangulation_3_to_lcc<LCC,Triangulation>`
*/ */
template<class LCC,class Polyhedron> template<class LCC,class Polyhedron>
typename LCC::Dart_descriptor import_from_polyhedron_3(LCC& lcc, typename LCC::Dart_descriptor polyhedron_3_to_lcc(LCC& lcc,
const Polyhedron &apoly); const Polyhedron &apoly);
} }

View File

@ -3,13 +3,23 @@ namespace CGAL{
/*! /*!
\ingroup PkgLinearCellComplexConstructions \ingroup PkgLinearCellComplexConstructions
Imports `atr` (a `Triangulation_3`) into `lcc`, a model of the `LinearCellComplex` concept. Objects are added in `lcc`, existing darts are not modified. Returns a dart created during the import. Imports `atr` (a `Triangulation_3`) into `lcc`, a model of the `LinearCellComplex` concept.
\pre \link GenericMap::dimension `LCC::dimension`\endlink \f$ \geq\f$ 3 and \link LinearCellComplex::ambient_dimension `LCC::ambient_dimension`\endlink==3. Objects are added in `lcc`, existing darts are not modified. Returns a dart created during the import.
\pre \link GenericMap::dimension `LCC::dimension`\endlink \f$ \geq\f$ 3 and
\link LinearCellComplex::ambient_dimension `LCC::ambient_dimension`\endlink==3.
\sa `CGAL::import_from_plane_graph<LCC>` \sa `CGAL::read_plane_graph_in_lcc<LCC>`
\sa `CGAL::import_from_polyhedron_3<LCC,Polyhedron>` \sa `CGAL::polyhedron_3_to_lcc<LCC,Polyhedron>`
*/ */
template <class LCC,class Triangulation_> template <class LCC,class Triangulation_>
typename LCC::Dart_descriptor import_from_triangulation_3(LCC& lcc, typename LCC::Dart_descriptor triangulation_3_to_lcc(LCC& lcc, const Triangulation_&atr);
const Triangulation_&atr);
template <class LCC, class Triangulation_>
[[deprecated("Use triangulation_3_to_lcc instead")]]
typename LCC::Dart_descriptor import_from_triangulation_3(LCC& lcc, const Triangulation_& atr)
{
return triangulation_3_to_lcc(lcc, atr);
} }
}

View File

@ -64,8 +64,8 @@ which constructs a vector as the difference of points `p2-p1`, and
\link LinearCellComplexTraits::Vector ` Vector `\endlink `operator() (const CGAL::Origin&, const ` \link Point ` Point`\endlink`& p)` \link LinearCellComplexTraits::Vector ` Vector `\endlink `operator() (const CGAL::Origin&, const ` \link Point ` Point`\endlink`& p)`
which constructs a vector as the difference of point `p` and a point at the origin which constructs a vector as the difference of point `p` and a point at the origin
(used in \link CGAL::barycenter `barycenter`\endlink (used in \link CGAL::barycenter `barycenter`\endlink
and `CGAL::import_from_plane_graph`). and `CGAL::read_plane_graph_in_lcc`).*/
*/
typedef unspecified_type Construct_vector; typedef unspecified_type Construct_vector;
/*! /*!
@ -104,7 +104,7 @@ a model of \link Kernel::Direction_2 `Direction_2`\endlink.
typedef unspecified_type Direction_2; typedef unspecified_type Direction_2;
/*! /*!
a model of \link Kernel::ConstructDirection_2 `ConstructDirection_2`\endlink (used in `CGAL::import_from_plane_graph`). a model of \link Kernel::ConstructDirection_2 `ConstructDirection_2`\endlink (used in `CGAL::read_plane_graph_in_lcc`).
*/ */
typedef unspecified_type Construct_direction_2; typedef unspecified_type Construct_direction_2;

View File

@ -105,11 +105,12 @@ There are several member functions allowing to insert specific configurations of
There are two functions allowing to build a linear cell complex from two other \cgal data types: There are two functions allowing to build a linear cell complex from two other \cgal data types:
<UL> <UL>
<LI>\link ::import_from_triangulation_3 `import_from_triangulation_3(lcc,atr)`\endlink: adds in `lcc` all the tetrahedra present in `atr`, a \link CGAL::Triangulation_3 `Triangulation_3`\endlink;
<LI>\link ::import_from_polyhedron_3 `import_from_polyhedron_3(lcc,ap)`\endlink: adds in `lcc` all the cells present in `ap`, a `Polyhedron_3`. <LI>\link CGAL::triangulation_3_to_lcc `triangulation_3_to_lcc(lcc,atr)`\endlink: adds in `lcc` all the tetrahedra present in `atr`, a \link CGAL::Triangulation_3 `Triangulation_3`\endlink;
<LI>\link CGAL::polyhedron_3_to_lcc `polyhedron_3_to_lcc(lcc,ap)`\endlink: adds in `lcc` all the cells present in `ap`, a `Polyhedron_3`.
</UL> </UL>
Lastly, the function \link ::import_from_plane_graph `import_from_plane_graph(lcc,ais)`\endlink adds in `lcc` all the cells reconstructed from the planar graph read in `ais`, a `std::istream` (see the \link ::import_from_plane_graph `reference manual`\endlink for the file format). Lastly, the function \link CGAL::read_plane_graph_in_lcc `read_plane_graph_in_lcc(lcc,ais)`\endlink adds in `lcc` all the cells reconstructed from the planar graph read in `ais`, a `std::istream` (see the \link CGAL::read_plane_graph_in_lcc `reference manual`\endlink for the file format).
\subsection Linear_cell_complexModificationOperations Modification Operations \subsection Linear_cell_complexModificationOperations Modification Operations
\anchor ssecmodifop \anchor ssecmodifop

View File

@ -62,9 +62,9 @@
\cgalCRPSection{Global Functions} \cgalCRPSection{Global Functions}
\cgalCRPSubsection{Constructions for Linear Cell Complex} \cgalCRPSubsection{Constructions for Linear Cell Complex}
- `CGAL::import_from_plane_graph<LCC>` - `CGAL::read_plane_graph_in_lcc<LCC>` (formerly `import_from_plane_graph`)
- `CGAL::import_from_triangulation_3<LCC,Triangulation>` - `CGAL::triangulation_3_to_lcc<LCC,Triangulation>` (formerly `import_from_triangulation_3`)
- `CGAL::import_from_polyhedron_3<LCC,Polyhedron>` - `CGAL::polyhedron_3_to_lcc<LCC,Polyhedron>` (formerly `import_from_polyhedron_3`)
\cgalCRPSubsection{Operations for Linear Cell Complex} \cgalCRPSubsection{Operations for Linear Cell Complex}
- `CGAL::compute_normal_of_cell_0<LCC>` - `CGAL::compute_normal_of_cell_0<LCC>`

View File

@ -24,7 +24,7 @@ create_single_source_cgal_program(
"linear_cell_complex_3_with_colored_vertices.cpp") "linear_cell_complex_3_with_colored_vertices.cpp")
create_single_source_cgal_program("linear_cell_complex_3_with_mypoint.cpp") create_single_source_cgal_program("linear_cell_complex_3_with_mypoint.cpp")
create_single_source_cgal_program("linear_cell_complex_4.cpp") create_single_source_cgal_program("linear_cell_complex_4.cpp")
create_single_source_cgal_program("plane_graph_to_lcc_2.cpp") create_single_source_cgal_program("read_plane_graph_in_lcc_2.cpp")
create_single_source_cgal_program("voronoi_2.cpp") create_single_source_cgal_program("voronoi_2.cpp")
create_single_source_cgal_program("voronoi_3.cpp") create_single_source_cgal_program("voronoi_3.cpp")

View File

@ -8,7 +8,7 @@ Examples for Linear_cell_complex package:
Three "basic" examples, detailed in the user manual. Three "basic" examples, detailed in the user manual.
* plane_graph_to_lcc_2.cpp * read_plane_graph_in_lcc_2.cpp
Program allowing to transform a planar graph into a 2D linear cell complex. Program allowing to transform a planar graph into a 2D linear cell complex.

View File

@ -42,7 +42,7 @@ int main(int narg, char** argv)
std::ifstream is(filename.c_str()); std::ifstream is(filename.c_str());
std::cout<<"Import plane graph from "<<filename<<std::endl; std::cout<<"Import plane graph from "<<filename<<std::endl;
CGAL::import_from_plane_graph(lcc, is); CGAL::read_plane_graph_in_lcc(lcc, is);
// Display the lcc characteristics. // Display the lcc characteristics.
std::cout<<"LCC characteristics:"<<std::endl<<" "; std::cout<<"LCC characteristics:"<<std::endl<<" ";

View File

@ -134,7 +134,7 @@ int main(int narg, char** argv)
std::map<Triangulation::Cell_handle, std::map<Triangulation::Cell_handle,
LCC_3::Dart_descriptor > vol_to_dart; LCC_3::Dart_descriptor > vol_to_dart;
Dart_descriptor d=CGAL::import_from_triangulation_3<LCC_3, Triangulation> Dart_descriptor d=CGAL::triangulation_3_to_lcc<LCC_3, Triangulation>
(lcc, T, &vol_to_dart); (lcc, T, &vol_to_dart);
std::cout<<"Delaunay triangulation :"<<std::endl<<" "; std::cout<<"Delaunay triangulation :"<<std::endl<<" ";

View File

@ -23,6 +23,7 @@
#include <map> #include <map>
#include <vector> #include <vector>
#include <list> #include <list>
#include <CGAL/config.h>
namespace CGAL { namespace CGAL {
@ -36,7 +37,7 @@ namespace CGAL {
* Imports a plane-embedded graph from a list of points and edges represented as pairs of vertex indices * Imports a plane-embedded graph from a list of points and edges represented as pairs of vertex indices
*/ */
template< class LCC > template< class LCC >
typename LCC::Dart_descriptor import_from_plane_graph(LCC& alcc, typename LCC::Dart_descriptor read_plane_graph_in_lcc(LCC& alcc,
const std::vector<typename LCC::Point>& vertices, const std::vector<typename LCC::Point>& vertices,
const std::vector<size_t>& edge_indices) const std::vector<size_t>& edge_indices)
{ {
@ -130,6 +131,21 @@ namespace CGAL {
return first; return first;
} }
#ifndef CGAL_NO_DEPRECATED_CODE
/*!
\deprecated This function is deprecated since CGAL 6.2. Use `read_plane_graph_in_lcc()` instead.
*/
template< class LCC >
CGAL_DEPRECATED
typename LCC::Dart_descriptor
import_from_plane_graph(LCC& alcc,
const std::vector<typename LCC::Point>& vertices,
const std::vector<size_t>& edge_indices)
{
return read_plane_graph_in_lcc(alcc, vertices, edge_indices);
}
#endif
/** /**
* Imports a plane-embedded graph from a file into a LinearCellComplex. * Imports a plane-embedded graph from a file into a LinearCellComplex.
* *
@ -138,7 +154,7 @@ namespace CGAL {
* @return A dart created during the conversion. * @return A dart created during the conversion.
*/ */
template< class LCC > template< class LCC >
typename LCC::Dart_descriptor import_from_plane_graph(LCC& alcc, typename LCC::Dart_descriptor read_plane_graph_in_lcc(LCC& alcc,
std::istream& ais) std::istream& ais)
{ {
using FT = typename LCC::FT; using FT = typename LCC::FT;
@ -185,18 +201,44 @@ namespace CGAL {
edge_indices.push_back(v2); edge_indices.push_back(v2);
} }
return import_from_plane_graph(alcc, vertices, edge_indices); return read_plane_graph_in_lcc(alcc, vertices, edge_indices);
} }
#ifndef CGAL_NO_DEPRECATED_CODE
/*!
\deprecated This function is deprecated since CGAL 6.2. Use `read_plane_graph_in_lcc()` instead.
*/
template< class LCC >
CGAL_DEPRECATED
typename LCC::Dart_descriptor
import_from_plane_graph(LCC& alcc, std::istream& ais)
{
return read_plane_graph_in_lcc(alcc, ais);
}
#endif
template < class LCC > template < class LCC >
typename LCC::Dart_descriptor typename LCC::Dart_descriptor
import_from_plane_graph(LCC& alcc, const char* filename) read_plane_graph_in_lcc(LCC& alcc, const char* filename)
{ {
std::ifstream input(filename); std::ifstream input(filename);
if (!input.is_open()) return alcc.null_descriptor; if (!input.is_open()) return alcc.null_descriptor;
return import_from_plane_graph(alcc, input); return read_plane_graph_in_lcc(alcc, input);
} }
#ifndef CGAL_NO_DEPRECATED_CODE
/*!
\deprecated This function is deprecated since CGAL 6.2. Use `read_plane_graph_in_lcc()` instead.
*/
template< class LCC >
CGAL_DEPRECATED
typename LCC::Dart_descriptor
import_from_plane_graph(LCC& alcc, const char* filename)
{
return read_plane_graph_in_lcc(alcc, filename);
}
#endif
template < class LCC > template < class LCC >
bool load_off(LCC& alcc, std::istream& in) bool load_off(LCC& alcc, std::istream& in)
{ {

View File

@ -36,3 +36,13 @@ add_executable(Linear_cell_complex_copy_test_index Linear_cell_complex_copy_test
target_compile_definitions(Linear_cell_complex_copy_test_index PRIVATE USE_COMPACT_CONTAINER_WITH_INDEX) target_compile_definitions(Linear_cell_complex_copy_test_index PRIVATE USE_COMPACT_CONTAINER_WITH_INDEX)
target_link_libraries(Linear_cell_complex_copy_test_index PRIVATE CGAL CGAL::Data) target_link_libraries(Linear_cell_complex_copy_test_index PRIVATE CGAL CGAL::Data)
cgal_add_compilation_test(Linear_cell_complex_copy_test_index) cgal_add_compilation_test(Linear_cell_complex_copy_test_index)
# Alias tests (test old function names, with deprecated warnings disabled)
create_single_source_cgal_program(test_triangulation_alias.cpp ${hfiles})
target_compile_definitions(test_triangulation_alias PRIVATE CGAL_NO_DEPRECATION_WARNINGS)
create_single_source_cgal_program(test_polyhedron_3_alias.cpp ${hfiles})
target_compile_definitions(test_polyhedron_3_alias PRIVATE CGAL_NO_DEPRECATION_WARNINGS)
create_single_source_cgal_program(test_plane_graph_alias.cpp ${hfiles})
target_compile_definitions(test_plane_graph_alias PRIVATE CGAL_NO_DEPRECATION_WARNINGS)

View File

@ -382,7 +382,7 @@ bool test_LCC_2()
std::cout<<"Error: impossible to open 'data/graph.txt'"<<std::endl; std::cout<<"Error: impossible to open 'data/graph.txt'"<<std::endl;
return false; return false;
} }
CGAL::import_from_plane_graph<LCC>(lcc,in); CGAL::read_plane_graph_in_lcc<LCC>(lcc,in);
if ( !check_number_of_cells_2(lcc, 66, 166, 104, 2) ) if ( !check_number_of_cells_2(lcc, 66, 166, 104, 2) )
return false; return false;
lcc.clear(); lcc.clear();
@ -431,7 +431,7 @@ struct Test_change_orientation_LCC_2<LCC, CGAL::Combinatorial_map_tag>
std::cout<<"Error: impossible to open 'data/graph.txt'"<<std::endl; std::cout<<"Error: impossible to open 'data/graph.txt'"<<std::endl;
return false; return false;
} }
CGAL::import_from_plane_graph<LCC>(lcc,in); CGAL::read_plane_graph_in_lcc<LCC>(lcc,in);
trace_test_begin(); trace_test_begin();

View File

@ -997,7 +997,7 @@ bool test_LCC_3()
} }
in >> P; in >> P;
CGAL::import_from_polyhedron_3<LCC>(lcc,P); CGAL::polyhedron_3_to_lcc<LCC>(lcc,P);
if ( !check_number_of_cells_3(lcc, 1539, 4434, 2894, 2, 2) ) if ( !check_number_of_cells_3(lcc, 1539, 4434, 2894, 2, 2) )
return false; return false;
@ -1029,7 +1029,7 @@ bool test_LCC_3()
} }
T.insert ( std::istream_iterator < Point >(in), T.insert ( std::istream_iterator < Point >(in),
std::istream_iterator < Point >() ); std::istream_iterator < Point >() );
CGAL::import_from_triangulation_3<LCC>(lcc,T); CGAL::triangulation_3_to_lcc<LCC>(lcc,T);
if ( !lcc.is_valid() ) if ( !lcc.is_valid() )
return false; return false;

View File

@ -0,0 +1,35 @@
#include <CGAL/Installation/internal/disable_deprecation_warnings_and_errors.h>
#include <CGAL/Linear_cell_complex_for_combinatorial_map.h>
#include <CGAL/Linear_cell_complex_constructors.h>
#include <cassert>
#include <sstream>
#include <cstdlib>
typedef CGAL::Linear_cell_complex_for_combinatorial_map<2> LCC;
int main()
{
#ifndef CGAL_NO_DEPRECATED_CODE
LCC lcc1, lcc2;
// Planar graph with 3 vertices and 3 edges (triangle)
std::stringstream input;
input << "3 3\n0.0 0.0\n1.0 0.0\n0.0 1.0\n0 1\n1 2\n2 0\n";
// Test new function
auto d1 = CGAL::read_plane_graph_in_lcc(lcc1, input);
assert(d1 != LCC::null_descriptor);
// Rewind input stream for second test
input.clear();
input.seekg(0, std::ios::beg);
// Test deprecated function
auto d2 = CGAL::import_from_plane_graph(lcc2, input);
assert(d2 != LCC::null_descriptor);
#endif // CGAL_NO_DEPRECATED_CODE
return EXIT_SUCCESS;
}

View File

@ -0,0 +1,31 @@
#include <CGAL/Linear_cell_complex_for_combinatorial_map.h>
#include <CGAL/Installation/internal/disable_deprecation_warnings_and_errors.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/Polyhedron_3_to_lcc.h>
#include <sstream>
#include <cassert>
#include <cstdlib>
typedef CGAL::Linear_cell_complex_for_combinatorial_map<3> LCC;
typedef CGAL::Polyhedron_3<LCC::Traits> Polyhedron;
int main()
{
#ifndef CGAL_NO_DEPRECATED_CODE
std::stringstream ss("OFF\n0 0 0\n");
Polyhedron P;
ss >> P;
LCC lcc1, lcc2;
auto d1 = CGAL::polyhedron_3_to_lcc(lcc1, P);
assert(d1 == LCC::null_descriptor);
auto d2 = CGAL::import_from_polyhedron_3<LCC>(lcc2, P);
assert(d2 == LCC::null_descriptor);
#endif // CGAL_NO_DEPRECATED_CODE
return EXIT_SUCCESS;
}

View File

@ -0,0 +1,29 @@
#include <CGAL/Linear_cell_complex_for_combinatorial_map.h>
#include <CGAL/Installation/internal/disable_deprecation_warnings_and_errors.h>
#include <CGAL/Delaunay_triangulation_3.h>
#include <CGAL/Triangulation_3_to_lcc.h>
#include <cassert>
#include <cstdlib>
typedef CGAL::Linear_cell_complex_for_combinatorial_map<3> LCC_3;
typedef CGAL::Delaunay_triangulation_3<LCC_3::Traits> Triangulation;
int main()
{
#ifndef CGAL_NO_DEPRECATED_CODE
LCC_3 lcc1, lcc2;
Triangulation T;
assert(T.dimension() == -1);
auto d1 = CGAL::triangulation_3_to_lcc(lcc1, T);
assert(d1 == LCC_3::null_descriptor);
auto d2 = CGAL::import_from_triangulation_3(lcc2, T);
assert(d2 == LCC_3::null_descriptor);
#endif // CGAL_NO_DEPRECATED_CODE
return EXIT_SUCCESS;
}

View File

@ -6,5 +6,5 @@
release=${${PWD:t}/CGAL-/} release=${${PWD:t}/CGAL-/}
tag=v${release} tag=v${release}
gh release upload "$tag" *.(zip|xz|txt|exe) -R CGAL/cgal gh release upload --clobber "$tag" *.(zip|xz|txt|exe) -R CGAL/cgal
gh release upload "$tag" CGAL-${release}-win64-auxiliary-libraries-gmp-mpfr.zip'#GMP and MPFR libraries, for Windows 64bits' -R CGAL/cgal --clobber gh release upload --clobber "$tag" CGAL-${release}-win64-auxiliary-libraries-gmp-mpfr.zip'#GMP and MPFR libraries, for Windows 64bits' -R CGAL/cgal --clobber

View File

@ -12,5 +12,4 @@ Number_types
Profiling_tools Profiling_tools
STL_Extension STL_Extension
Stream_support Stream_support
TDS_2
Triangulation_2 Triangulation_2

View File

@ -18,6 +18,9 @@
#include <CGAL/Filtered_kernel/internal/Static_filters/Side_of_oriented_circle_2.h> #include <CGAL/Filtered_kernel/internal/Static_filters/Side_of_oriented_circle_2.h>
#include <CGAL/Filtered_kernel/internal/Static_filters/Orientation_3.h> #include <CGAL/Filtered_kernel/internal/Static_filters/Orientation_3.h>
#include <CGAL/Filtered_kernel/internal/Static_filters/Side_of_oriented_sphere_3.h> #include <CGAL/Filtered_kernel/internal/Static_filters/Side_of_oriented_sphere_3.h>
#include <CGAL/Filtered_kernel/internal/Static_filters/Orientation_4.h>
#include <CGAL/Filtered_kernel/internal/Static_filters/Orientation_5.h>
#include <CGAL/Filtered_kernel/internal/Static_filters/Orientation_6.h>
namespace CGAL { namespace CGAL {
namespace SFA { // static filter adapter namespace SFA { // static filter adapter
@ -151,6 +154,150 @@ template <class Base_,class R_> struct Side_of_oriented_sphere_3 : private Store
return typename internal::Static_filters_predicates::Side_of_oriented_sphere_3<Adapter>()(P(this->kernel(),c,A),P(this->kernel(),c,B),P(this->kernel(),c,C),P(this->kernel(),c,D),P(this->kernel(),c,E)); return typename internal::Static_filters_predicates::Side_of_oriented_sphere_3<Adapter>()(P(this->kernel(),c,A),P(this->kernel(),c,B),P(this->kernel(),c,C),P(this->kernel(),c,D),P(this->kernel(),c,E));
} }
}; };
template <class Base_,class R_> struct Adapter_4 {
typedef typename Get_type<R_, Orientation_tag>::type Orientation;
typedef typename Get_type<R_, Oriented_side_tag>::type Oriented_side;
typedef typename Get_type<R_, Point_tag>::type Point;
typedef typename Get_functor<R_, Compute_point_cartesian_coordinate_tag>::type CC;
typedef typename Get_functor<Base_, Orientation_of_points_tag>::type Orientation_base;
struct Point_4 {
R_ const&r; CC const&c; Point const& p;
Point_4(R_ const&r_, CC const&c_, Point const&p_):r(r_),c(c_),p(p_){}
decltype(auto) c0()const{return c(p,0);}
decltype(auto) c1()const{return c(p,1);}
decltype(auto) c2()const{return c(p,2);}
decltype(auto) c3()const{return c(p,3);}
};
struct Orientation_4 {
typedef typename Get_type<R_, Orientation_tag>::type result_type;
auto operator()(Point_4 const&A, Point_4 const&B, Point_4 const&C,
Point_4 const&D, Point_4 const&E)const{
Point const* t[6]={&A.p,&B.p,&C.p,&D.p,&E.p};
return Orientation_base(A.r)(make_transforming_iterator<Dereference_functor>(t+0),make_transforming_iterator<Dereference_functor>(t+5));
}
};
};
template <class Base_,class R_> struct Orientation_of_points_4 : private Store_kernel<R_> {
CGAL_FUNCTOR_INIT_STORE(Orientation_of_points_4)
typedef typename Get_type<R_, Point_tag>::type Point;
typedef typename Get_type<R_, Orientation_tag>::type result_type;
typedef typename Get_functor<R_, Compute_point_cartesian_coordinate_tag>::type CC;
typedef Adapter_4<Base_, R_> Adapter;
template<class Iter> result_type operator()(Iter f, Iter CGAL_assertion_code(e))const{
CC c(this->kernel());
Point const& A=*f;
Point const& B=*++f;
Point const& C=*++f;
Point const& D=*++f;
Point const& E=*++f;
CGAL_assertion(++f==e);
typedef typename Adapter::Point_4 P;
return typename internal::Static_filters_predicates::Orientation_4<Adapter>()(P(this->kernel(),c,A),P(this->kernel(),c,B),P(this->kernel(),c,C),
P(this->kernel(),c,D),P(this->kernel(),c,E));
}
};
template <class Base_,class R_> struct Adapter_5 {
typedef typename Get_type<R_, Orientation_tag>::type Orientation;
typedef typename Get_type<R_, Oriented_side_tag>::type Oriented_side;
typedef typename Get_type<R_, Point_tag>::type Point;
typedef typename Get_functor<R_, Compute_point_cartesian_coordinate_tag>::type CC;
typedef typename Get_functor<Base_, Orientation_of_points_tag>::type Orientation_base;
struct Point_5 {
R_ const&r; CC const&c; Point const& p;
Point_5(R_ const&r_, CC const&c_, Point const&p_):r(r_),c(c_),p(p_){}
decltype(auto) c0()const{return c(p,0);}
decltype(auto) c1()const{return c(p,1);}
decltype(auto) c2()const{return c(p,2);}
decltype(auto) c3()const{return c(p,3);}
decltype(auto) c4()const{return c(p,4);}
};
struct Orientation_5 {
typedef typename Get_type<R_, Orientation_tag>::type result_type;
auto operator()(Point_5 const&A, Point_5 const&B, Point_5 const&C,
Point_5 const&D, Point_5 const&E, Point_5 const&F)const{
Point const* t[6]={&A.p,&B.p,&C.p,&D.p,&E.p,&F.p};
return Orientation_base(A.r)(make_transforming_iterator<Dereference_functor>(t+0),make_transforming_iterator<Dereference_functor>(t+6));
}
};
};
template <class Base_,class R_> struct Orientation_of_points_5 : private Store_kernel<R_> {
CGAL_FUNCTOR_INIT_STORE(Orientation_of_points_5)
typedef typename Get_type<R_, Point_tag>::type Point;
typedef typename Get_type<R_, Orientation_tag>::type result_type;
typedef typename Get_functor<R_, Compute_point_cartesian_coordinate_tag>::type CC;
typedef Adapter_5<Base_, R_> Adapter;
template<class Iter> result_type operator()(Iter f, Iter CGAL_assertion_code(e))const{
CC c(this->kernel());
Point const& A=*f;
Point const& B=*++f;
Point const& C=*++f;
Point const& D=*++f;
Point const& E=*++f;
Point const& F=*++f;
CGAL_assertion(++f==e);
typedef typename Adapter::Point_5 P;
return typename internal::Static_filters_predicates::Orientation_5<Adapter>()(P(this->kernel(),c,A),P(this->kernel(),c,B),P(this->kernel(),c,C),
P(this->kernel(),c,D),P(this->kernel(),c,E),P(this->kernel(),c,F));
}
};
template <class Base_,class R_> struct Adapter_6 {
typedef typename Get_type<R_, Orientation_tag>::type Orientation;
typedef typename Get_type<R_, Oriented_side_tag>::type Oriented_side;
typedef typename Get_type<R_, Point_tag>::type Point;
typedef typename Get_functor<R_, Compute_point_cartesian_coordinate_tag>::type CC;
typedef typename Get_functor<Base_, Orientation_of_points_tag>::type Orientation_base;
struct Point_6 {
R_ const&r; CC const&c; Point const& p;
Point_6(R_ const&r_, CC const&c_, Point const&p_):r(r_),c(c_),p(p_){}
decltype(auto) c0()const{return c(p,0);}
decltype(auto) c1()const{return c(p,1);}
decltype(auto) c2()const{return c(p,2);}
decltype(auto) c3()const{return c(p,3);}
decltype(auto) c4()const{return c(p,4);}
decltype(auto) c5()const{return c(p,5);}
};
struct Orientation_6 {
typedef typename Get_type<R_, Orientation_tag>::type result_type;
auto operator()(Point_6 const&A, Point_6 const&B, Point_6 const&C,
Point_6 const&D, Point_6 const&E, Point_6 const&F, Point_6 const&G)const{
Point const* t[7]={&A.p,&B.p,&C.p,&D.p,&E.p,&F.p,&G.p};
return Orientation_base(A.r)(make_transforming_iterator<Dereference_functor>(t+0),make_transforming_iterator<Dereference_functor>(t+7));
}
};
};
template <class Base_,class R_> struct Orientation_of_points_6 : private Store_kernel<R_> {
CGAL_FUNCTOR_INIT_STORE(Orientation_of_points_6)
typedef typename Get_type<R_, Point_tag>::type Point;
typedef typename Get_type<R_, Orientation_tag>::type result_type;
typedef typename Get_functor<R_, Compute_point_cartesian_coordinate_tag>::type CC;
typedef Adapter_6<Base_, R_> Adapter;
template<class Iter> result_type operator()(Iter f, Iter CGAL_assertion_code(e))const{
CC c(this->kernel());
Point const& A=*f;
Point const& B=*++f;
Point const& C=*++f;
Point const& D=*++f;
Point const& E=*++f;
Point const& F=*++f;
Point const& G=*++f;
CGAL_assertion(++f==e);
typedef typename Adapter::Point_6 P;
return typename internal::Static_filters_predicates::Orientation_6<Adapter>()(P(this->kernel(),c,A),P(this->kernel(),c,B),P(this->kernel(),c,C),
P(this->kernel(),c,D),P(this->kernel(),c,E),P(this->kernel(),c,F),
P(this->kernel(),c,G));
}
};
} // namespace SFA } // namespace SFA
template <class Dim_ /* should be implicit */, class R_, class Derived_=Default> template <class Dim_ /* should be implicit */, class R_, class Derived_=Default>
@ -194,5 +341,44 @@ struct Cartesian_static_filters<Dimension_tag<3>, R_, Derived_> : public R_ {
typedef SFA::Side_of_oriented_sphere_3<R_,Derived> type; typedef SFA::Side_of_oriented_sphere_3<R_,Derived> type;
}; };
}; };
#ifndef CGAL_NO_STATIC_FILTER_456
template <class R_, class Derived_>
struct Cartesian_static_filters<Dimension_tag<4>, R_, Derived_> : public R_ {
constexpr Cartesian_static_filters(){}
constexpr Cartesian_static_filters(int d):R_(d){}
typedef Cartesian_static_filters<Dimension_tag<4>, R_, Derived_> Self;
typedef typename Default::Get<Derived_,Self>::type Derived;
template <class T, class=void> struct Functor : Inherit_functor<R_, T> {};
template <class D> struct Functor <Orientation_of_points_tag,D> {
typedef SFA::Orientation_of_points_4<R_,Derived> type;
};
};
template <class R_, class Derived_>
struct Cartesian_static_filters<Dimension_tag<5>, R_, Derived_> : public R_ {
constexpr Cartesian_static_filters(){}
constexpr Cartesian_static_filters(int d):R_(d){}
typedef Cartesian_static_filters<Dimension_tag<5>, R_, Derived_> Self;
typedef typename Default::Get<Derived_,Self>::type Derived;
template <class T, class=void> struct Functor : Inherit_functor<R_, T> {};
template <class D> struct Functor <Orientation_of_points_tag,D> {
typedef SFA::Orientation_of_points_5<R_,Derived> type;
};
};
template <class R_, class Derived_>
struct Cartesian_static_filters<Dimension_tag<6>, R_, Derived_> : public R_ {
constexpr Cartesian_static_filters(){}
constexpr Cartesian_static_filters(int d):R_(d){}
typedef Cartesian_static_filters<Dimension_tag<6>, R_, Derived_> Self;
typedef typename Default::Get<Derived_,Self>::type Derived;
template <class T, class=void> struct Functor : Inherit_functor<R_, T> {};
template <class D> struct Functor <Orientation_of_points_tag,D> {
typedef SFA::Orientation_of_points_6<R_,Derived> type;
};
};
#endif
} // namespace CGAL } // namespace CGAL
#endif #endif

View File

@ -137,6 +137,12 @@ public:
friend auto operator!=(Point_d const&p, Point_d const&q) { return !(p==q); } friend auto operator!=(Point_d const&p, Point_d const&q) { return !(p==q); }
// May be accidentally inherited from the base class otherwise
friend auto operator< (Point_d const&p, Point_d const&q) = delete;
friend auto operator> (Point_d const&p, Point_d const&q) = delete;
friend auto operator<=(Point_d const&p, Point_d const&q) = delete;
friend auto operator>=(Point_d const&p, Point_d const&q) = delete;
friend std::ostream& operator <<(std::ostream& os, const Point_d& p) friend std::ostream& operator <<(std::ostream& os, const Point_d& p)
{ {
auto b = p.cartesian_begin(); auto b = p.cartesian_begin();

View File

@ -130,6 +130,19 @@ public:
return SLBase()(rep()); return SLBase()(rep());
} }
friend auto operator==(Vector_d const&p, Vector_d const&q) {
typedef typename Get_functor<Kbase, Equal_vectors_tag>::type EPBase;
return EPBase()(p.rep(), q.rep());
}
friend auto operator!=(Vector_d const&p, Vector_d const&q) { return !(p==q); }
// May be accidentally inherited from the base class otherwise
friend auto operator< (Vector_d const&p, Vector_d const&q) = delete;
friend auto operator> (Vector_d const&p, Vector_d const&q) = delete;
friend auto operator<=(Vector_d const&p, Vector_d const&q) = delete;
friend auto operator>=(Vector_d const&p, Vector_d const&q) = delete;
friend std::ostream& operator <<(std::ostream& os, const Vector_d& v) friend std::ostream& operator <<(std::ostream& os, const Vector_d& v)
{ {
auto b = v.cartesian_begin(); auto b = v.cartesian_begin();

View File

@ -1279,6 +1279,36 @@ template<class R_> struct Equal_points : private Store_kernel<R_> {
CGAL_KD_DEFAULT_FUNCTOR(Equal_points_tag,(CartesianDKernelFunctors::Equal_points<K>),(),(Construct_ttag<Point_cartesian_const_iterator_tag>)); CGAL_KD_DEFAULT_FUNCTOR(Equal_points_tag,(CartesianDKernelFunctors::Equal_points<K>),(),(Construct_ttag<Point_cartesian_const_iterator_tag>));
namespace CartesianDKernelFunctors {
template<class R_> struct Equal_vectors : private Store_kernel<R_> {
CGAL_FUNCTOR_INIT_STORE(Equal_vectors)
typedef R_ R;
typedef typename Get_type<R, Bool_tag>::type result_type;
typedef typename Get_functor<R, Construct_ttag<Vector_cartesian_const_iterator_tag> >::type CI;
// TODO: This is_exact thing should be reengineered.
// the goal is to have a way to tell: don't filter this
typedef typename CGAL::Uses_no_arithmetic<CI> Uses_no_arithmetic;
template<class V,class W>
result_type operator()(V const&a, W const&b)const{
CI c(this->kernel());
auto a_begin=c(a,Begin_tag());
auto b_begin=c(b,Begin_tag());
auto a_end=c(a,End_tag());
result_type res = true;
// Is using CGAL::possibly for Uncertain really an optimization?
do res = res & (*a_begin++ == *b_begin++);
while(a_begin!=a_end && possibly(res));
return res;
}
};
}
CGAL_KD_DEFAULT_FUNCTOR(Equal_vectors_tag,(CartesianDKernelFunctors::Equal_vectors<K>),(),(Construct_ttag<Vector_cartesian_const_iterator_tag>));
namespace CartesianDKernelFunctors { namespace CartesianDKernelFunctors {
template<class R_> struct Oriented_side : private Store_kernel<R_> { template<class R_> struct Oriented_side : private Store_kernel<R_> {
CGAL_FUNCTOR_INIT_STORE(Oriented_side) CGAL_FUNCTOR_INIT_STORE(Oriented_side)

View File

@ -282,6 +282,7 @@ namespace CGAL {
CGAL_DECL_PREDICATE(Less_lexicographically); CGAL_DECL_PREDICATE(Less_lexicographically);
CGAL_DECL_PREDICATE(Less_or_equal_lexicographically); CGAL_DECL_PREDICATE(Less_or_equal_lexicographically);
CGAL_DECL_PREDICATE(Equal_points); CGAL_DECL_PREDICATE(Equal_points);
CGAL_DECL_PREDICATE(Equal_vectors);
CGAL_DECL_PREDICATE(Has_on_positive_side); CGAL_DECL_PREDICATE(Has_on_positive_side);
CGAL_DECL_PREDICATE_(Orientation); // duplicate with the type CGAL_DECL_PREDICATE_(Orientation); // duplicate with the type
CGAL_DECL_PREDICATE_(Oriented_side); // duplicate with the type CGAL_DECL_PREDICATE_(Oriented_side); // duplicate with the type

View File

@ -0,0 +1,254 @@
// Copyright (c) 2025
// INRIA Saclay-Ile de France (France)
//
// This file is part of CGAL (www.cgal.org)
//
// $URL$
// $Id$
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
//
// Author(s) : Andreas Fabri
// Files needed as input for the static filter generator
#if 0
double determinant(
double a00, double a01, double a02, double a03,
double a10, double a11, double a12, double a13,
double a20, double a21, double a22, double a23,
double a30, double a31, double a32, double a33)
{
double m01 = a10*a01 - a00*a11;
double m02 = a20*a01 - a00*a21;
double m03 = a30*a01 - a00*a31;
double m12 = a20*a11 - a10*a21;
double m13 = a30*a11 - a10*a31;
double m23 = a30*a21 - a20*a31;
double m012 = m12*a02 - m02*a12 + m01*a22;
double m013 = m13*a02 - m03*a12 + m01*a32;
double m023 = m23*a02 - m03*a22 + m02*a32;
double m123 = m23*a12 - m13*a22 + m12*a32;
double m0123 = m123*a03 - m023*a13 + m013*a23 - m012*a33;
return m0123;
}
int orientationC4(double p0, double p1, double p2, double p3,
double q0, double q1, double q2, double q3,
double r0, double r1, double r2, double r3,
double s0, double s1, double s2, double s3,
double t0, double t1, double t2, double t3)
group p0 q0 r0 t0 q0;
group p1 q1 r1 t1 q1;
group p2 q2 r2 t2 q2;
group p3 q3 r3 t3 q3;
{
double m01;
m01 = (q0 - p0);
double m02;
m02 = (r0 - p0);
double m03;
m03 = (s0 - p0);
double m04;
m04 = (t0 - p0);
double m11;
m11 = (q1 - p1);
double m12;
m12 = (r1 - p1);
double m13;
m13 = (s1 - p1);
double m14;
m14 = (t1 - p1);
double m21;
m21 = (q2 - p2);
double m22;
m22 = (r2 - p2);
double m23;
m23 = (s2 - p2);
double m24;
m24 = (t2 - p2);
double m31;
m31 = (q3 - p3);
double m32;
m32 = (r3 - p3);
double m33;
m33 = (s3 - p3);
double m34;
m34 = (t3 - p3);
double det = determinant(m01, m02, m03, m04,
m11, m12, m13, m14,
m21, m22, m23, m24,
m31, m32, m33, m34);
return sign(det);
}
//===========generated ==================
inline int orientationC4( double p0, double p1, double p2, double p3, double q0, double q1, double q2, double q3, double r0, double r1, double r2, double r3, double s0, double s1, double s2, double s3, double t0, double t1, double t2, double t3) {
double m01;
m01 = (q0 - p0);
double m02;
m02 = (r0 - p0);
double m03;
m03 = (s0 - p0);
double m04;
m04 = (t0 - p0);
double m11;
m11 = (q1 - p1);
double m12;
m12 = (r1 - p1);
double m13;
m13 = (s1 - p1);
double m14;
m14 = (t1 - p1);
double m21;
m21 = (q2 - p2);
double m22;
m22 = (r2 - p2);
double m23;
m23 = (s2 - p2);
double m24;
m24 = (t2 - p2);
double m31;
m31 = (q3 - p3);
double m32;
m32 = (r3 - p3);
double m33;
m33 = (s3 - p3);
double m34;
m34 = (t3 - p3);
double det;
det = determinant( m01, m02, m03, m04, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34 );
int int_tmp_result;
double eps;
double max1 = CGAL::abs(m01);
double am = CGAL::abs(m02);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m03);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m11);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m12);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m13);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m23);
if( (max1 < am) ) { max1 = am; }
double max2 = CGAL::abs(m01);
am = CGAL::abs(m02);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m11);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m12);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m21);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m22);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m23);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m33);
if( (max2 < am) ) { max2 = am; }
double max3 = CGAL::abs(m04);
am = CGAL::abs(m14);
if( (max3 < am) ) { max3 = am; }
am = CGAL::abs(m24);
if( (max3 < am) ) { max3 = am; }
am = CGAL::abs(m34);
if( (max3 < am) ) { max3 = am; }
double max4 = CGAL::abs(m11);
am = CGAL::abs(m12);
if( (max4 < am) ) { max4 = am; }
am = CGAL::abs(m21);
if( (max4 < am) ) { max4 = am; }
am = CGAL::abs(m22);
if( (max4 < am) ) { max4 = am; }
am = CGAL::abs(m31);
if( (max4 < am) ) { max4 = am; }
am = CGAL::abs(m32);
if( (max4 < am) ) { max4 = am; }
double lower_bound_1;
double upper_bound_1;
lower_bound_1 = max1;
upper_bound_1 = max1;
if( (max2 < lower_bound_1) )
{
lower_bound_1 = max2;
}
else
{
if( (max2 > upper_bound_1) )
{
upper_bound_1 = max2;
}
}
if( (max3 < lower_bound_1) )
{
lower_bound_1 = max3;
}
else
{
if( (max3 > upper_bound_1) )
{
upper_bound_1 = max3;
}
}
if( (max4 < lower_bound_1) )
{
lower_bound_1 = max4;
}
else
{
if( (max4 > upper_bound_1) )
{
upper_bound_1 = max4;
}
}
if( (lower_bound_1 < 2.89273249588395272840e-74) )
{
return FPG_UNCERTAIN_VALUE;
}
else
{
if( (upper_bound_1 > 7.23700557733225900010e+75) )
{
return FPG_UNCERTAIN_VALUE;
}
eps = (3.17768858673611327578e-14 * (((max4 * max2) * max1) * max3));
if( (det > eps) )
{
int_tmp_result = 1;
}
else
{
if( (det < -eps) )
{
int_tmp_result = -1;
}
else
{
return FPG_UNCERTAIN_VALUE;
}
}
}
return int_tmp_result;
}
#endif

View File

@ -0,0 +1,345 @@
// Copyright (c) 2025
// INRIA Saclay-Ile de France (France)
//
// This file is part of CGAL (www.cgal.org)
//
// $URL$
// $Id$
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
//
// Author(s) : Andreas Fabri
// Files needed as input for the static filter generator
#if 0
double
determinant(
double a00, double a01, double a02, double a03, double a04,
double a10, double a11, double a12, double a13, double a14,
double a20, double a21, double a22, double a23, double a24,
double a30, double a31, double a32, double a33, double a34,
double a40, double a41, double a42, double a43, double a44)
{
double m01 = a10*a01 - a00*a11;
double m02 = a20*a01 - a00*a21;
double m03 = a30*a01 - a00*a31;
double m04 = a40*a01 - a00*a41;
double m12 = a20*a11 - a10*a21;
double m13 = a30*a11 - a10*a31;
double m14 = a40*a11 - a10*a41;
double m23 = a30*a21 - a20*a31;
double m24 = a40*a21 - a20*a41;
double m34 = a40*a31 - a30*a41;
double m012 = m12*a02 - m02*a12 + m01*a22;
double m013 = m13*a02 - m03*a12 + m01*a32;
double m014 = m14*a02 - m04*a12 + m01*a42;
double m023 = m23*a02 - m03*a22 + m02*a32;
double m024 = m24*a02 - m04*a22 + m02*a42;
double m034 = m34*a02 - m04*a32 + m03*a42;
double m123 = m23*a12 - m13*a22 + m12*a32;
double m124 = m24*a12 - m14*a22 + m12*a42;
double m134 = m34*a12 - m14*a32 + m13*a42;
double m234 = m34*a22 - m24*a32 + m23*a42;
double m0123 = m123*a03 - m023*a13 + m013*a23 - m012*a33;
double m0124 = m124*a03 - m024*a13 + m014*a23 - m012*a43;
double m0134 = m134*a03 - m034*a13 + m014*a33 - m013*a43;
double m0234 = m234*a03 - m034*a23 + m024*a33 - m023*a43;
double m1234 = m234*a13 - m134*a23 + m124*a33 - m123*a43;
double m01234 = m1234*a04 - m0234*a14 + m0134*a24 - m0124*a34 + m0123*a44;
return m01234;
}
int orientationC5(double p0, double p1, double p2, double p3, double p4,
double q0, double q1, double q2, double q3, double q4,
double r0, double r1, double r2, double r3, double r4,
double s0, double s1, double s2, double s3, double s4,
double t0, double t1, double t2, double t3, double t4,
double u0, double u1, double u2, double u3, double u4)
group p0 q0 r0 t0 q0 u0;
group p1 q1 r1 t1 q1 u1;
group p2 q2 r2 t2 q2 u2;
group p3 q3 r3 t3 q3 u3;
group p4 q4 r4 t4 q4 u4;
{
double m01;
m01 = (q0 - p0);
double m02;
m02 = (r0 - p0);
double m03;
m03 = (s0 - p0);
double m04;
m04 = (t0 - p0);
double m05;
m05 = (u0 - p0);
double m11;
m11 = (q1 - p1);
double m12;
m12 = (r1 - p1);
double m13;
m13 = (s1 - p1);
double m14;
m14 = (t1 - p1);
double m15;
m15 = (u1 - p1);
double m21;
m21 = (q2 - p2);
double m22;
m22 = (r2 - p2);
double m23;
m23 = (s2 - p2);
double m24;
m24 = (t2 - p2);
double m25;
m25 = (u2 - p2);
double m31;
m31 = (q3 - p3);
double m32;
m32 = (r3 - p3);
double m33;
m33 = (s3 - p3);
double m34;
m34 = (t3 - p3);
double m35;
m35 = (u3 - p3);
double m41;
m41 = (q4 - p4);
double m42;
m42 = (r4 - p4);
double m43;
m43 = (s4 - p4);
double m44;
m44 = (t4 - p4);
double m45;
m45 = (u4 - p4);
double det = determinant(m01, m02, m03, m04, m05,
m11, m12, m13, m14, m15,
m21, m22, m23, m24, m25,
m31, m32, m33, m34, m35,
m41, m42, m43, m44, m45);
return sign(det);
}
//===========generated ==================
inline int orientationC5( double p0, double p1, double p2, double p3, double p4, double q0, double q1, double q2, double q3, double q4, double r0, double r1, double r2, double r3, double r4, double s0, double s1, double s2, double s3, double s4, double t0, double t1, double t2, double t3, double t4, double u0, double u1, double u2, double u3, double u4) {
double m01;
m01 = (q0 - p0);
double m02;
m02 = (r0 - p0);
double m03;
m03 = (s0 - p0);
double m04;
m04 = (t0 - p0);
double m05;
m05 = (u0 - p0);
double m11;
m11 = (q1 - p1);
double m12;
m12 = (r1 - p1);
double m13;
m13 = (s1 - p1);
double m14;
m14 = (t1 - p1);
double m15;
m15 = (u1 - p1);
double m21;
m21 = (q2 - p2);
double m22;
m22 = (r2 - p2);
double m23;
m23 = (s2 - p2);
double m24;
m24 = (t2 - p2);
double m25;
m25 = (u2 - p2);
double m31;
m31 = (q3 - p3);
double m32;
m32 = (r3 - p3);
double m33;
m33 = (s3 - p3);
double m34;
m34 = (t3 - p3);
double m35;
m35 = (u3 - p3);
double m41;
m41 = (q4 - p4);
double m42;
m42 = (r4 - p4);
double m43;
m43 = (s4 - p4);
double m44;
m44 = (t4 - p4);
double m45;
m45 = (u4 - p4);
double det;
det = determinant( m01, m02, m03, m04, m05, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25, m31, m32, m33, m34, m35, m41, m42, m43, m44, m45 );
int int_tmp_result;
double eps;
double max1 = CGAL::abs(m01);
double am = CGAL::abs(m02);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m03);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m11);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m12);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m13);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m21);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m22);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m23);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m33);
if( (max1 < am) ) { max1 = am; }
double max2 = CGAL::abs(m01);
am = CGAL::abs(m02);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m11);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m12);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m21);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m22);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m23);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m31);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m32);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m33);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m43);
if( (max2 < am) ) { max2 = am; }
double max3 = CGAL::abs(m04);
am = CGAL::abs(m14);
if( (max3 < am) ) { max3 = am; }
am = CGAL::abs(m24);
if( (max3 < am) ) { max3 = am; }
am = CGAL::abs(m34);
if( (max3 < am) ) { max3 = am; }
am = CGAL::abs(m44);
if( (max3 < am) ) { max3 = am; }
double max4 = CGAL::abs(m05);
am = CGAL::abs(m15);
if( (max4 < am) ) { max4 = am; }
am = CGAL::abs(m25);
if( (max4 < am) ) { max4 = am; }
am = CGAL::abs(m35);
if( (max4 < am) ) { max4 = am; }
am = CGAL::abs(m45);
if( (max4 < am) ) { max4 = am; }
double max5 = CGAL::abs(m11);
am = CGAL::abs(m12);
if( (max5 < am) ) { max5 = am; }
am = CGAL::abs(m21);
if( (max5 < am) ) { max5 = am; }
am = CGAL::abs(m22);
if( (max5 < am) ) { max5 = am; }
am = CGAL::abs(m31);
if( (max5 < am) ) { max5 = am; }
am = CGAL::abs(m32);
if( (max5 < am) ) { max5 = am; }
am = CGAL::abs(m41);
if( (max5 < am) ) { max5 = am; }
am = CGAL::abs(m42);
if( (max5 < am) ) { max5 = am; }
double lower_bound_1;
double upper_bound_1;
lower_bound_1 = max5;
upper_bound_1 = max5;
if( (max1 < lower_bound_1) )
{
lower_bound_1 = max1;
}
else
{
if( (max1 > upper_bound_1) )
{
upper_bound_1 = max1;
}
}
if( (max2 < lower_bound_1) )
{
lower_bound_1 = max2;
}
else
{
if( (max2 > upper_bound_1) )
{
upper_bound_1 = max2;
}
}
if( (max3 < lower_bound_1) )
{
lower_bound_1 = max3;
}
else
{
if( (max3 > upper_bound_1) )
{
upper_bound_1 = max3;
}
}
if( (max4 < lower_bound_1) )
{
lower_bound_1 = max4;
}
else
{
if( (max4 > upper_bound_1) )
{
upper_bound_1 = max4;
}
}
if( (lower_bound_1 < 9.99657131447050328602e-60) )
{
return FPG_UNCERTAIN_VALUE;
}
else
{
if( (upper_bound_1 > 3.21387608851797912384e+60) )
{
return FPG_UNCERTAIN_VALUE;
}
eps = (2.22889232457534740153e-13 * ((((max5 * max2) * max1) * max3) * max4));
if( (det > eps) )
{
int_tmp_result = 1;
}
else
{
if( (det < -eps) )
{
int_tmp_result = -1;
}
else
{
return FPG_UNCERTAIN_VALUE;
}
}
}
return int_tmp_result;
}
#endif

View File

@ -0,0 +1,477 @@
// Copyright (c) 2025
// INRIA Saclay-Ile de France (France)
//
// This file is part of CGAL (www.cgal.org)
//
// $URL$
// $Id$
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
//
// Author(s) : Andreas Fabri
// Files needed as input for the static filter generator
#if 0
double
determinant(
double a00, double a01, double a02, double a03, double a04, double a05,
double a10, double a11, double a12, double a13, double a14, double a15,
double a20, double a21, double a22, double a23, double a24, double a25,
double a30, double a31, double a32, double a33, double a34, double a35,
double a40, double a41, double a42, double a43, double a44, double a45,
double a50, double a51, double a52, double a53, double a54, double a55)
{
double m01 = a00*a11 - a10*a01;
double m02 = a00*a21 - a20*a01;
double m03 = a00*a31 - a30*a01;
double m04 = a00*a41 - a40*a01;
double m05 = a00*a51 - a50*a01;
double m12 = a10*a21 - a20*a11;
double m13 = a10*a31 - a30*a11;
double m14 = a10*a41 - a40*a11;
double m15 = a10*a51 - a50*a11;
double m23 = a20*a31 - a30*a21;
double m24 = a20*a41 - a40*a21;
double m25 = a20*a51 - a50*a21;
double m34 = a30*a41 - a40*a31;
double m35 = a30*a51 - a50*a31;
double m45 = a40*a51 - a50*a41;
double m012 = m01*a22 - m02*a12 + m12*a02;
double m013 = m01*a32 - m03*a12 + m13*a02;
double m014 = m01*a42 - m04*a12 + m14*a02;
double m015 = m01*a52 - m05*a12 + m15*a02;
double m023 = m02*a32 - m03*a22 + m23*a02;
double m024 = m02*a42 - m04*a22 + m24*a02;
double m025 = m02*a52 - m05*a22 + m25*a02;
double m034 = m03*a42 - m04*a32 + m34*a02;
double m035 = m03*a52 - m05*a32 + m35*a02;
double m045 = m04*a52 - m05*a42 + m45*a02;
double m123 = m12*a32 - m13*a22 + m23*a12;
double m124 = m12*a42 - m14*a22 + m24*a12;
double m125 = m12*a52 - m15*a22 + m25*a12;
double m134 = m13*a42 - m14*a32 + m34*a12;
double m135 = m13*a52 - m15*a32 + m35*a12;
double m145 = m14*a52 - m15*a42 + m45*a12;
double m234 = m23*a42 - m24*a32 + m34*a22;
double m235 = m23*a52 - m25*a32 + m35*a22;
double m245 = m24*a52 - m25*a42 + m45*a22;
double m345 = m34*a52 - m35*a42 + m45*a32;
double m0123 = m012*a33 - m013*a23 + m023*a13 - m123*a03;
double m0124 = m012*a43 - m014*a23 + m024*a13 - m124*a03;
double m0125 = m012*a53 - m015*a23 + m025*a13 - m125*a03;
double m0134 = m013*a43 - m014*a33 + m034*a13 - m134*a03;
double m0135 = m013*a53 - m015*a33 + m035*a13 - m135*a03;
double m0145 = m014*a53 - m015*a43 + m045*a13 - m145*a03;
double m0234 = m023*a43 - m024*a33 + m034*a23 - m234*a03;
double m0235 = m023*a53 - m025*a33 + m035*a23 - m235*a03;
double m0245 = m024*a53 - m025*a43 + m045*a23 - m245*a03;
double m0345 = m034*a53 - m035*a43 + m045*a33 - m345*a03;
double m1234 = m123*a43 - m124*a33 + m134*a23 - m234*a13;
double m1235 = m123*a53 - m125*a33 + m135*a23 - m235*a13;
double m1245 = m124*a53 - m125*a43 + m145*a23 - m245*a13;
double m1345 = m134*a53 - m135*a43 + m145*a33 - m345*a13;
double m2345 = m234*a53 - m235*a43 + m245*a33 - m345*a23;
double m01234 = m0123*a44 - m0124*a34 + m0134*a24 - m0234*a14 + m1234*a04;
double m01235 = m0123*a54 - m0125*a34 + m0135*a24 - m0235*a14 + m1235*a04;
double m01245 = m0124*a54 - m0125*a44 + m0145*a24 - m0245*a14 + m1245*a04;
double m01345 = m0134*a54 - m0135*a44 + m0145*a34 - m0345*a14 + m1345*a04;
double m02345 = m0234*a54 - m0235*a44 + m0245*a34 - m0345*a24 + m2345*a04;
double m12345 = m1234*a54 - m1235*a44 + m1245*a34 - m1345*a24 + m2345*a14;
double m012345 = m01234*a55 - m01235*a45 + m01245*a35 - m01345*a25
+ m02345*a15 - m12345*a05;
return m012345;
}
int orientationC6(double p0, double p1, double p2, double p3, double p4, double p5,
double q0, double q1, double q2, double q3, double q4, double q5,
double r0, double r1, double r2, double r3, double r4, double r5,
double s0, double s1, double s2, double s3, double s4, double s5,
double t0, double t1, double t2, double t3, double t4, double t5,
double u0, double u1, double u2, double u3, double u4, double u5,
double v0, double v1, double v2, double v3, double v4, double v5)
group p0 q0 r0 t0 q0 u0 v0;
group p1 q1 r1 t1 q1 u1 v1;
group p2 q2 r2 t2 q2 u2 v2;
group p3 q3 r3 t3 q3 u3 v3;
group p4 q4 r4 t4 q4 u4 v4;
group p5 q5 r5 t5 q5 u5 v5;
{
double m01;
m01 = (q0 - p0);
double m02;
m02 = (r0 - p0);
double m03;
m03 = (s0 - p0);
double m04;
m04 = (t0 - p0);
double m05;
m05 = (u0 - p0);
double m06;
m06 = (v0 - p0);
double m11;
m11 = (q1 - p1);
double m12;
m12 = (r1 - p1);
double m13;
m13 = (s1 - p1);
double m14;
m14 = (t1 - p1);
double m15;
m15 = (u1 - p1);
double m16;
m16 = (v1 - p1);
double m21;
m21 = (q2 - p2);
double m22;
m22 = (r2 - p2);
double m23;
m23 = (s2 - p2);
double m24;
m24 = (t2 - p2);
double m25;
m25 = (u2 - p2);
double m26;
m26 = (v2 - p2);
double m31;
m31 = (q3 - p3);
double m32;
m32 = (r3 - p3);
double m33;
m33 = (s3 - p3);
double m34;
m34 = (t3 - p3);
double m35;
m35 = (u3 - p3);
double m36;
m36 = (v3 - p3);
double m41;
m41 = (q4 - p4);
double m42;
m42 = (r4 - p4);
double m43;
m43 = (s4 - p4);
double m44;
m44 = (t4 - p4);
double m45;
m45 = (u4 - p4);
double m46;
m46 = (v4 - p4);
double m51;
m51 = (q5 - p5);
double m52;
m52 = (r5 - p5);
double m53;
m53 = (s5 - p5);
double m54;
m54 = (t5 - p5);
double m55;
m55 = (u5 - p5);
double m56;
m56 = (v5 - p5);
double det = determinant(m01, m02, m03, m04, m05, m06,
m11, m12, m13, m14, m15, m16,
m21, m22, m23, m24, m25, m26,
m31, m32, m33, m34, m35, m36,
m41, m42, m43, m44, m45, m46,
m51, m52, m53, m54, m55, m56);
return sign(det);
}
//===========generated ==================
inline int orientationC6( double p0, double p1, double p2, double p3, double p4, double p5, double q0, double q1, double q2, double q3, double q4, double q5, double r0, double r1, double r2, double r3, double r4, double r5, double s0, double s1, double s2, double s3, double s4, double s5, double t0, double t1, double t2, double t3, double t4, double t5, double u0, double u1, double u2, double u3, double u4, double u5, double v0, double v1, double v2, double v3, double v4, double v5) {
double m01;
m01 = (q0 - p0);
double m02;
m02 = (r0 - p0);
double m03;
m03 = (s0 - p0);
double m04;
m04 = (t0 - p0);
double m05;
m05 = (u0 - p0);
double m06;
m06 = (v0 - p0);
double m11;
m11 = (q1 - p1);
double m12;
m12 = (r1 - p1);
double m13;
m13 = (s1 - p1);
double m14;
m14 = (t1 - p1);
double m15;
m15 = (u1 - p1);
double m16;
m16 = (v1 - p1);
double m21;
m21 = (q2 - p2);
double m22;
m22 = (r2 - p2);
double m23;
m23 = (s2 - p2);
double m24;
m24 = (t2 - p2);
double m25;
m25 = (u2 - p2);
double m26;
m26 = (v2 - p2);
double m31;
m31 = (q3 - p3);
double m32;
m32 = (r3 - p3);
double m33;
m33 = (s3 - p3);
double m34;
m34 = (t3 - p3);
double m35;
m35 = (u3 - p3);
double m36;
m36 = (v3 - p3);
double m41;
m41 = (q4 - p4);
double m42;
m42 = (r4 - p4);
double m43;
m43 = (s4 - p4);
double m44;
m44 = (t4 - p4);
double m45;
m45 = (u4 - p4);
double m46;
m46 = (v4 - p4);
double m51;
m51 = (q5 - p5);
double m52;
m52 = (r5 - p5);
double m53;
m53 = (s5 - p5);
double m54;
m54 = (t5 - p5);
double m55;
m55 = (u5 - p5);
double m56;
m56 = (v5 - p5);
double det;
det = determinant( m01, m02, m03, m04, m05, m06, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26, m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56 );
int int_tmp_result;
double eps;
double max1 = CGAL::abs(m01);
double am = CGAL::abs(m02);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m11);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m12);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m21);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m22);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m31);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m32);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m41);
if( (max1 < am) ) { max1 = am; }
am = CGAL::abs(m42);
if( (max1 < am) ) { max1 = am; }
double max2 = CGAL::abs(m03);
am = CGAL::abs(m11);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m12);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m13);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m21);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m22);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m23);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m31);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m32);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m33);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m41);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m42);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m43);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m51);
if( (max2 < am) ) { max2 = am; }
am = CGAL::abs(m52);
if( (max2 < am) ) { max2 = am; }
double max3 = CGAL::abs(m04);
am = CGAL::abs(m14);
if( (max3 < am) ) { max3 = am; }
am = CGAL::abs(m24);
if( (max3 < am) ) { max3 = am; }
am = CGAL::abs(m34);
if( (max3 < am) ) { max3 = am; }
am = CGAL::abs(m44);
if( (max3 < am) ) { max3 = am; }
am = CGAL::abs(m54);
if( (max3 < am) ) { max3 = am; }
double max4 = CGAL::abs(m05);
am = CGAL::abs(m15);
if( (max4 < am) ) { max4 = am; }
am = CGAL::abs(m25);
if( (max4 < am) ) { max4 = am; }
am = CGAL::abs(m35);
if( (max4 < am) ) { max4 = am; }
am = CGAL::abs(m45);
if( (max4 < am) ) { max4 = am; }
am = CGAL::abs(m55);
if( (max4 < am) ) { max4 = am; }
double max5 = CGAL::abs(m06);
am = CGAL::abs(m16);
if( (max5 < am) ) { max5 = am; }
am = CGAL::abs(m26);
if( (max5 < am) ) { max5 = am; }
am = CGAL::abs(m36);
if( (max5 < am) ) { max5 = am; }
am = CGAL::abs(m46);
if( (max5 < am) ) { max5 = am; }
am = CGAL::abs(m56);
if( (max5 < am) ) { max5 = am; }
double max6 = CGAL::abs(m13);
am = CGAL::abs(m21);
if( (max6 < am) ) { max6 = am; }
am = CGAL::abs(m22);
if( (max6 < am) ) { max6 = am; }
am = CGAL::abs(m23);
if( (max6 < am) ) { max6 = am; }
am = CGAL::abs(m31);
if( (max6 < am) ) { max6 = am; }
am = CGAL::abs(m32);
if( (max6 < am) ) { max6 = am; }
am = CGAL::abs(m33);
if( (max6 < am) ) { max6 = am; }
am = CGAL::abs(m41);
if( (max6 < am) ) { max6 = am; }
am = CGAL::abs(m42);
if( (max6 < am) ) { max6 = am; }
am = CGAL::abs(m43);
if( (max6 < am) ) { max6 = am; }
am = CGAL::abs(m51);
if( (max6 < am) ) { max6 = am; }
am = CGAL::abs(m52);
if( (max6 < am) ) { max6 = am; }
am = CGAL::abs(m53);
if( (max6 < am) ) { max6 = am; }
double lower_bound_1;
double upper_bound_1;
lower_bound_1 = max6;
upper_bound_1 = max6;
if( (max5 < lower_bound_1) )
{
lower_bound_1 = max5;
}
else
{
if( (max5 > upper_bound_1) )
{
upper_bound_1 = max5;
}
}
if( (max1 < lower_bound_1) )
{
lower_bound_1 = max1;
}
else
{
if( (max1 > upper_bound_1) )
{
upper_bound_1 = max1;
}
}
if( (max2 < lower_bound_1) )
{
lower_bound_1 = max2;
}
else
{
if( (max2 > upper_bound_1) )
{
upper_bound_1 = max2;
}
}
if( (max3 < lower_bound_1) )
{
lower_bound_1 = max3;
}
else
{
if( (max3 > upper_bound_1) )
{
upper_bound_1 = max3;
}
}
if( (max4 < lower_bound_1) )
{
lower_bound_1 = max4;
}
else
{
if( (max4 > upper_bound_1) )
{
upper_bound_1 = max4;
}
}
if( (lower_bound_1 < 4.82472686053427214432e-50) )
{
return FPG_UNCERTAIN_VALUE;
}
else
{
if( (upper_bound_1 > 1.87072209578355511223e+50) )
{
return FPG_UNCERTAIN_VALUE;
}
eps = (1.76403842114300859158e-12 * (((((max1 * max2) * max6) * max3) * max4) * max5));
if( (det > eps) )
{
int_tmp_result = 1;
}
else
{
if( (det < -eps) )
{
int_tmp_result = -1;
}
else
{
return FPG_UNCERTAIN_VALUE;
}
}
}
return int_tmp_result;
}
#endif

View File

@ -277,6 +277,7 @@ void test2(){
P x4=cp(0,0); P x4=cp(0,0);
P x5=cp(0,-1); P x5=cp(0,-1);
P tab2[]={x1,x2,x3,x4}; P tab2[]={x1,x2,x3,x4};
assert(x1==x1 && x1!=x2);
assert(dp(x1,x2)[1]==2); assert(dp(x1,x2)[1]==2);
assert(po(tab2+0,tab2+3)==CGAL::COUNTERCLOCKWISE); assert(po(tab2+0,tab2+3)==CGAL::COUNTERCLOCKWISE);
assert(sos(tab2+0,tab2+3,x4)==CGAL::ON_POSITIVE_SIDE); assert(sos(tab2+0,tab2+3,x4)==CGAL::ON_POSITIVE_SIDE);
@ -285,6 +286,7 @@ void test2(){
assert(y1.squared_length()==2); assert(y1.squared_length()==2);
assert(sl(y1)==2); assert(sl(y1)==2);
V y2=cv(3,-3); V y2=cv(3,-3);
assert(y1==y1 && y1!=y2);
assert(spr(y1,y2)==6); assert(spr(y1,y2)==6);
assert(dv(y2,y1)[0]==2); assert(dv(y2,y1)[0]==2);
V tab3[]={y1,y2}; V tab3[]={y1,y2};

View File

@ -629,7 +629,9 @@ inline double IA_sqrt_toward_zero(double d) {
} //namespace CGAL } //namespace CGAL
#ifdef CGAL_HEADER_ONLY #ifdef CGAL_HEADER_ONLY
#ifndef CGAL_DISABLE_ROUNDING_MATH_CHECK
#include <CGAL/test_FPU_rounding_mode_impl.h> #include <CGAL/test_FPU_rounding_mode_impl.h>
#endif
#endif // CGAL_HEADER_ONLY #endif // CGAL_HEADER_ONLY
#endif // CGAL_FPU_H #endif // CGAL_FPU_H

View File

@ -51,11 +51,13 @@ get_static_check_fpu_rounding_mode_is_restored()
return check_fpu_rounding_mode_is_restored; return check_fpu_rounding_mode_is_restored;
} }
#ifndef CGAL_DISABLE_ROUNDING_MATH_CHECK
namespace { namespace {
CGAL_UNUSED const Check_FPU_rounding_mode_is_restored & CGAL_UNUSED const Check_FPU_rounding_mode_is_restored &
check_fpu_rounding_mode_is_restored check_fpu_rounding_mode_is_restored
= get_static_check_fpu_rounding_mode_is_restored(); = get_static_check_fpu_rounding_mode_is_restored();
} }
#endif
#else #else

View File

@ -1,3 +1,4 @@
#define CGAL_DISABLE_ROUNDING_MATH_CHECK 1
#include <iostream> #include <iostream>
#include <CGAL/config.h> #include <CGAL/config.h>
#include <CGAL/Interval_nt.h> #include <CGAL/Interval_nt.h>

View File

@ -1312,7 +1312,7 @@ OutputIterator
adjacent_vertices(Vertex_handle v, OutputIterator vertices) const; adjacent_vertices(Vertex_handle v, OutputIterator vertices) const;
/*! /*!
Returns the degree of a vertex, that is, the number of adjacent vertices. Returns the degree of `v`, that is, the number of adjacent vertices.
\pre `v` \f$ \neq\f$ `Vertex_handle()`, `t`.`is_vertex(v)`. \pre `v` \f$ \neq\f$ `Vertex_handle()`, `t`.`is_vertex(v)`.
*/ */
size_type degree(Vertex_handle v) const; size_type degree(Vertex_handle v) const;

View File

@ -547,91 +547,6 @@ bool read_LAS(const std::string& fname, OutputIterator output, const CGAL_NP_CLA
} // namespace IO } // namespace IO
#ifndef CGAL_NO_DEPRECATED_CODE
/// \cond SKIP_IN_MANUAL
using IO::make_las_point_reader;
namespace LAS_property = IO::LAS_property;
template <typename OutputIteratorValueType,
typename OutputIterator,
typename PointMap >
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::read_las_points(), please update your code")
bool read_las_points(std::istream& is, ///< input stream.
OutputIterator output, ///< output iterator over points.
PointMap point_map) ///< property map: value_type of OutputIterator -> Point_3.
{
return read_las_points<OutputIteratorValueType>(is, output, CGAL::parameters::point_map (point_map));
}
template <typename OutputIterator,
typename PointMap >
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::read_las_points(), please update your code")
bool read_las_points(std::istream& is, ///< input stream.
OutputIterator output, ///< output iterator over points.
PointMap point_map) ///< property map: value_type of OutputIterator -> Point_3.
{
return read_las_points<typename value_type_traits<OutputIterator>::type>(is, output,
CGAL::parameters::point_map(point_map));
}
/// \endcond
template <typename OutputIteratorValueType,
typename OutputIterator,
typename ... PropertyHandler>
CGAL_DEPRECATED bool read_las_points_with_properties(std::istream& is,
OutputIterator output,
PropertyHandler&& ... properties)
{
return IO::read_LAS_with_properties(is, output, std::forward<PropertyHandler>(properties)...);
}
/// \cond SKIP_IN_MANUAL
template <typename OutputIterator,
typename ... PropertyHandler>
CGAL_DEPRECATED bool read_las_points_with_properties(std::istream& is,
OutputIterator output,
PropertyHandler&& ... properties)
{
return IO::read_LAS_with_properties<typename value_type_traits<OutputIterator>::type>(is, output, std::forward<PropertyHandler>(properties)...);
}
/// \endcond
template <typename OutputIteratorValueType,
typename OutputIterator,
typename CGAL_NP_TEMPLATE_PARAMETERS>
CGAL_DEPRECATED bool read_las_points(std::istream& is,
OutputIterator output,
const CGAL_NP_CLASS& np = parameters::default_values())
{
using parameters::choose_parameter;
using parameters::get_parameter;
typename CGAL::GetPointMap<Point_set_processing_3::Fake_point_range<OutputIteratorValueType>, CGAL_NP_CLASS>::type point_map =
choose_parameter<typename CGAL::GetPointMap<Point_set_processing_3::Fake_point_range<OutputIteratorValueType>, CGAL_NP_CLASS>::type>(get_parameter(np, internal_np::point_map));
return IO::read_LAS(is, output, make_las_point_reader(point_map));
}
/// \cond SKIP_IN_MANUAL
// variant with default output iterator value type
template <typename OutputIterator, typename CGAL_NP_TEMPLATE_PARAMETERS>
CGAL_DEPRECATED bool read_las_points(std::istream& is, OutputIterator output, const CGAL_NP_CLASS& np = parameters::default_values())
{
return IO::read_LAS<typename value_type_traits<OutputIterator>::type>(is, output, np);
}
/// \endcond
#endif // CGAL_NO_DEPRECATED_CODE
} // namespace CGAL } // namespace CGAL
#endif // CGAL_POINT_SET_PROCESSING_READ_LAS_POINTS_H #endif // CGAL_POINT_SET_PROCESSING_READ_LAS_POINTS_H

View File

@ -271,174 +271,6 @@ bool read_OFF(const std::string& fname, OutputIterator output, const CGAL_NP_CLA
} // namespace IO } // namespace IO
#ifndef CGAL_NO_DEPRECATED_CODE
/// \cond SKIP_IN_MANUAL
template <typename OutputIteratorValueType,
typename OutputIterator,
typename PointPMap,
typename NormalPMap,
typename Kernel>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::read_off_points_and_normals(), please update your code")
bool read_off_points_and_normals(std::istream& is, ///< input stream.
OutputIterator output, ///< output iterator over points.
PointPMap point_map, ///< property map: value_type of OutputIterator -> Point_3.
NormalPMap normal_map, ///< property map: value_type of OutputIterator -> Vector_3.
const Kernel& /*kernel*/) ///< geometric traits.
{
return IO::read_OFF<OutputIteratorValueType>(is, output,
parameters::point_map(point_map)
.normal_map(normal_map)
.geom_traits(Kernel()));
}
template <typename OutputIterator,
typename PointPMap,
typename NormalPMap,
typename Kernel>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::read_off_points_and_normals(), please update your code")
bool read_off_points_and_normals(std::istream& is, ///< input stream.
OutputIterator output, ///< output iterator over points.
PointPMap point_map, ///< property map: value_type of OutputIterator -> Point_3.
NormalPMap normal_map, ///< property map: value_type of OutputIterator -> Vector_3.
const Kernel& kernel) ///< geometric traits.
{
return IO::read_OFF<typename value_type_traits<OutputIterator>::type>(is, output,
parameters::point_map(point_map)
.normal_map(normal_map)
.geom_traits(kernel));
}
template <typename OutputIteratorValueType,
typename OutputIterator,
typename PointPMap,
typename NormalPMap>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::read_off_points_and_normals(), please update your code")
bool read_off_points_and_normals(std::istream& is, ///< input stream.
OutputIterator output, ///< output iterator over points.
PointPMap point_map, ///< property map: value_type of OutputIterator -> Point_3.
NormalPMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{
return IO::read_OFF<OutputIteratorValueType>(is, output, parameters::point_map(point_map)
.normal_map(normal_map));
}
template <typename OutputIterator,
typename PointPMap,
typename NormalPMap>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::read_off_points_and_normals(), please update your code")
bool read_off_points_and_normals(std::istream& is, ///< input stream.
OutputIterator output, ///< output iterator over points.
PointPMap point_map, ///< property map: value_type of OutputIterator -> Point_3.
NormalPMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{
return IO::read_OFF<typename value_type_traits<OutputIterator>::type>(is, output,
parameters::point_map(point_map)
.normal_map(normal_map));
}
template <typename OutputIteratorValueType,
typename OutputIterator,
typename NormalPMap>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::read_off_points_and_normals(), please update your code")
bool read_off_points_and_normals(std::istream& is, ///< input stream.
OutputIterator output, ///< output iterator over points.
NormalPMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{
return IO::read_OFF<OutputIteratorValueType>(is, output, parameters::normal_map(normal_map));
}
template <typename OutputIterator,
typename NormalPMap>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::read_off_points_and_normals(), please update your code")
bool read_off_points_and_normals(std::istream& is, ///< input stream.
OutputIterator output, ///< output iterator over points.
NormalPMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{
return IO::read_OFF<typename value_type_traits<OutputIterator>::type>(is, output, parameters::normal_map(normal_map));
}
template <typename OutputIteratorValueType,
typename OutputIterator,
typename PointPMap,
typename Kernel
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::read_off_points(), please update your code")
bool read_off_points(std::istream& is, ///< input stream.
OutputIterator output, ///< output iterator over points.
PointPMap point_map, ///< property map: value_type of OutputIterator -> Point_3.
const Kernel& kernel) ///< geometric traits.
{
return read_off_points<OutputIteratorValueType>(is, output, parameters::point_map(point_map)
.geom_traits(kernel));
}
template <typename OutputIterator,
typename PointPMap,
typename Kernel>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::read_off_points(), please update your code")
bool read_off_points(std::istream& is, ///< input stream.
OutputIterator output, ///< output iterator over points.
PointPMap point_map, ///< property map: value_type of OutputIterator -> Point_3.
const Kernel& kernel) ///< geometric traits.
{
return read_off_points<typename value_type_traits<OutputIterator>::type>(is, output,
parameters::point_map(point_map)
.geom_traits (kernel));
}
template <typename OutputIteratorValueType,
typename OutputIterator,
typename PointPMap>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::read_off_points(), please update your code")
bool read_off_points(std::istream& is, ///< input stream.
OutputIterator output, ///< output iterator over points.
PointPMap point_map) ///< property map: value_type of OutputIterator -> Point_3.
{
return read_off_points<OutputIteratorValueType>(is, output, parameters::point_map (point_map));
}
template <typename OutputIterator, typename PointPMap>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::read_off_points(), please update your code")
bool read_off_points(std::istream& is, ///< input stream.
OutputIterator output, ///< output iterator over points.
PointPMap point_map) ///< property map: value_type of OutputIterator -> Point_3.
{
return read_off_points<typename value_type_traits<OutputIterator>::type>(is, output, parameters::point_map(point_map));
}
/// \endcond
template <typename OutputIteratorValueType,
typename OutputIterator,
typename CGAL_NP_TEMPLATE_PARAMETERS>
CGAL_DEPRECATED bool read_off_points(std::istream& is,
OutputIterator output,
const CGAL_NP_CLASS& np = parameters::default_values())
{
return IO::read_OFF(is, output, np);
}
/// \cond SKIP_IN_MANUAL
template <typename OutputIteratorValueType, typename OutputIterator>
CGAL_DEPRECATED bool read_off_points(std::istream& is, OutputIterator output)
{
return IO::read_OFF(is, output);
}
// variant with default output iterator value type
template <typename OutputIterator, typename CGAL_NP_TEMPLATE_PARAMETERS>
CGAL_DEPRECATED bool read_off_points(std::istream& is, OutputIterator output, const CGAL_NP_CLASS& np = parameters::default_values())
{
return IO::read_OFF(is, output, np);
}
/// \endcond
#endif //CGAL_NO_DEPRECATED_CODE
} // namespace CGAL } // namespace CGAL
#endif // CGAL_POINT_SET_PROCESSING_READ_OFF_POINTS_H #endif // CGAL_POINT_SET_PROCESSING_READ_OFF_POINTS_H

View File

@ -358,114 +358,6 @@ bool read_PLY(const std::string& fname, OutputIterator output, const CGAL_NP_CLA
} // namespace IO } // namespace IO
#ifndef CGAL_NO_DEPRECATED_CODE
/// \cond SKIP_IN_MANUAL
template <typename OutputIteratorValueType,
typename OutputIterator,
typename PointMap,
typename NormalMap>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::read_ply_points_and_normals(), please update your code")
bool read_ply_points_and_normals(std::istream& is, ///< input stream.
OutputIterator output, ///< output iterator over points.
PointMap point_map, ///< property map: value_type of OutputIterator -> Point_3.
NormalMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{
return IO::read_PLY<OutputIteratorValueType>(is, output, parameters::point_map(point_map)
.normal_map(normal_map));
}
template <typename OutputIterator,
typename PointMap,
typename NormalMap>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::read_ply_points_and_normals(), please update your code")
bool read_ply_points_and_normals(std::istream& is, ///< input stream.
OutputIterator output, ///< output iterator over points.
PointMap point_map, ///< property map: value_type of OutputIterator -> Point_3.
NormalMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{
return IO::read_PLY<typename value_type_traits<OutputIterator>::type>(is, output, parameters::point_map(point_map)
.normal_map(normal_map));
}
template <typename OutputIteratorValueType,
typename OutputIterator,
typename NormalMap>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::read_ply_points_and_normals(), please update your code")
bool read_ply_points_and_normals(std::istream& is, ///< input stream.
OutputIterator output, ///< output iterator over points.
NormalMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{
return IO::read_PLY<OutputIteratorValueType>(is, output, parameters::normal_map(normal_map));
}
template <typename OutputIterator, typename NormalMap>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::read_ply_points_and_normals(), please update your code")
bool read_ply_points_and_normals(std::istream& is, ///< input stream.
OutputIterator output, ///< output iterator over points.
NormalMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{
return IO::read_PLY<typename value_type_traits<OutputIterator>::type>(is, output, parameters::normal_map(normal_map));
}
template <typename OutputIteratorValueType,
typename OutputIterator,
typename PointMap>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::read_ply_points(), please update your code")
bool read_ply_points(std::istream& is, ///< input stream.
OutputIterator output, ///< output iterator over points.
PointMap point_map) ///< property map: value_type of OutputIterator -> Point_3.
{
return IO::read_PLY<OutputIteratorValueType>(is, output, parameters::point_map(point_map));
}
template <typename OutputIterator,
typename PointMap>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::read_ply_points(), please update your code")
bool read_ply_points(std::istream& is, ///< input stream.
OutputIterator output, ///< output iterator over points.
PointMap point_map) ///< property map: value_type of OutputIterator -> Point_3.
{
return IO::read_PLY<typename value_type_traits<OutputIterator>::type>(is, output, parameters::point_map(point_map));
}
/// \endcond
template <typename OutputIteratorValueType, typename OutputIterator, typename ... PropertyHandler>
CGAL_DEPRECATED bool read_ply_points_with_properties(std::istream& is, OutputIterator output, PropertyHandler&& ... properties)
{
return IO::read_PLY_with_properties(is, output, std::forward<PropertyHandler>(properties)...);
}
template <typename OutputIteratorValueType, typename OutputIterator, typename CGAL_NP_TEMPLATE_PARAMETERS>
CGAL_DEPRECATED bool read_ply_points(std::istream& is, OutputIterator output, const CGAL_NP_CLASS& np = parameters::default_values())
{
return IO::read_PLY(is, output, np);
}
/// \cond SKIP_IN_MANUAL
template <typename OutputIterator,
typename ... PropertyHandler>
CGAL_DEPRECATED bool read_ply_points_with_properties(std::istream& is, OutputIterator output, PropertyHandler&& ... properties)
{
return IO::read_PLY_with_properties<typename value_type_traits<OutputIterator>::type>(is, output, std::forward<PropertyHandler>(properties)...);
}
// variant with default output iterator value type
template <typename OutputIterator,
typename CGAL_NP_TEMPLATE_PARAMETERS>
CGAL_DEPRECATED bool read_ply_points(std::istream& is, OutputIterator output, const CGAL_NP_CLASS& np = parameters::default_values())
{
return IO::read_PLY<typename value_type_traits<OutputIterator>::type>(is, output, np);
}
/// \endcond
#endif // CGAL_NO_DEPRECATED_CODE
} // namespace CGAL } // namespace CGAL
#undef TRY_TO_GENERATE_POINT_PROPERTY #undef TRY_TO_GENERATE_POINT_PROPERTY

View File

@ -251,173 +251,6 @@ bool read_XYZ(const std::string& fname, OutputIterator output, const CGAL_NP_CLA
#ifndef CGAL_NO_DEPRECATED_CODE
/// \cond SKIP_IN_MANUAL
template <typename OutputIteratorValueType,
typename OutputIterator,
typename PointPMap,
typename NormalPMap,
typename Kernel>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::read_xyz_points_and_normals(), please update your code")
bool read_xyz_points_and_normals(std::istream& is, ///< input stream.
OutputIterator output, ///< output iterator over points.
PointPMap point_map, ///< property map: value_type of OutputIterator -> Point_3.
NormalPMap normal_map, ///< property map: value_type of OutputIterator -> Vector_3.
const Kernel& /*kernel*/) ///< geometric traits.
{
return IO::read_XYZ<OutputIteratorValueType>(is, output,
parameters::point_map(point_map)
.normal_map(normal_map)
.geom_traits(Kernel()));
}
template <typename OutputIterator,
typename PointPMap,
typename NormalPMap,
typename Kernel>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::read_xyz_points_and_normals(), please update your code")
bool read_xyz_points_and_normals(std::istream& is, ///< input stream.
OutputIterator output, ///< output iterator over points.
PointPMap point_map, ///< property map: value_type of OutputIterator -> Point_3.
NormalPMap normal_map, ///< property map: value_type of OutputIterator -> Vector_3.
const Kernel& kernel) ///< geometric traits.
{
return IO::read_XYZ<typename value_type_traits<OutputIterator>::type>(is, output,
parameters::point_map(point_map)
.normal_map(normal_map)
.geom_traits(kernel));
}
template <typename OutputIteratorValueType,
typename OutputIterator,
typename PointPMap,
typename NormalPMap>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::read_xyz_points_and_normals(), please update your code")
bool read_xyz_points_and_normals(std::istream& is, ///< input stream.
OutputIterator output, ///< output iterator over points.
PointPMap point_map, ///< property map: value_type of OutputIterator -> Point_3.
NormalPMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{
return IO::read_XYZ<OutputIteratorValueType>(is, output,
parameters::point_map(point_map)
.normal_map(normal_map));
}
template <typename OutputIterator,
typename PointPMap,
typename NormalPMap>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::read_xyz_points_and_normals(), please update your code")
bool read_xyz_points_and_normals(std::istream& is, ///< input stream.
OutputIterator output, ///< output iterator over points.
PointPMap point_map, ///< property map: value_type of OutputIterator -> Point_3.
NormalPMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{
return IO::read_XYZ<typename value_type_traits<OutputIterator>::type>(is, output,
parameters::point_map(point_map)
.normal_map(normal_map));
}
template <typename OutputIteratorValueType,
typename OutputIterator,
typename NormalPMap>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::read_xyz_points_and_normals(), please update your code")
bool read_xyz_points_and_normals(std::istream& is, ///< input stream.
OutputIterator output, ///< output iterator over points.
NormalPMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{
return IO::read_XYZ<OutputIteratorValueType>(is, output, parameters::normal_map(normal_map));
}
template <typename OutputIterator,
typename NormalPMap>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::read_xyz_points_and_normals(), please update your code")
bool read_xyz_points_and_normals(std::istream& is, ///< input stream.
OutputIterator output, ///< output iterator over points.
NormalPMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{
return IO::read_XYZ<typename value_type_traits<OutputIterator>::type>(is, output,
parameters::normal_map(normal_map));
}
template <typename OutputIteratorValueType,
typename OutputIterator,
typename PointPMap,
typename Kernel>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::read_xyz_points(), please update your code")
bool read_xyz_points(std::istream& is, ///< input stream.
OutputIterator output, ///< output iterator over points.
PointPMap point_map, ///< property map: value_type of OutputIterator -> Point_3.
const Kernel& kernel) ///< geometric traits.
{
return IO::read_XYZ<OutputIteratorValueType>(is, output,
parameters::point_map(point_map)
.geom_traits(kernel));
}
template <typename OutputIterator,
typename PointPMap,
typename Kernel>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::read_xyz_points(), please update your code")
bool read_xyz_points(std::istream& is, ///< input stream.
OutputIterator output, ///< output iterator over points.
PointPMap point_map, ///< property map: value_type of OutputIterator -> Point_3.
const Kernel& kernel) ///< geometric traits.
{
return IO::read_XYZ<typename value_type_traits<OutputIterator>::type>(is, output,
parameters::point_map(point_map)
.geom_traits(kernel));
}
template <typename OutputIteratorValueType,
typename OutputIterator,
typename PointPMap>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::read_xyz_points(), please update your code")
bool read_xyz_points(std::istream& is, ///< input stream.
OutputIterator output, ///< output iterator over points.
PointPMap point_map) ///< property map: value_type of OutputIterator -> Point_3.
{
return IO::read_XYZ<OutputIteratorValueType>(is, output, parameters::point_map(point_map));
}
template <typename OutputIterator,
typename PointPMap>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::read_xyz_points(), please update your code")
bool read_xyz_points(std::istream& is, ///< input stream.
OutputIterator output, ///< output iterator over points.
PointPMap point_map) ///< property map: value_type of OutputIterator -> Point_3.
{
return IO::read_XYZ<typename value_type_traits<OutputIterator>::type>(is, output,
parameters::point_map(point_map));
}
/// \endcond
template <typename OutputIteratorValueType,
typename OutputIterator,
typename CGAL_NP_TEMPLATE_PARAMETERS>
CGAL_DEPRECATED bool read_xyz_points(std::istream& is,
OutputIterator output,
const CGAL_NP_CLASS& np = parameters::default_values())
{
return IO::read_XYZ(is, output, np);
}
/// \cond SKIP_IN_MANUAL
template <typename OutputIterator,
typename CGAL_NP_TEMPLATE_PARAMETERS>
CGAL_DEPRECATED bool read_xyz_points(std::istream& is,
OutputIterator output,
const CGAL_NP_CLASS& np = parameters::default_values())
{
return IO::read_XYZ<typename value_type_traits<OutputIterator>::type>(is, output, np);
}
/// \endcond
#endif //CGAL_NO_DEPRECATED_CODE
} // namespace CGAL } // namespace CGAL
#endif // CGAL_POINT_SET_PROCESSING_READ_XYZ_POINTS_H #endif // CGAL_POINT_SET_PROCESSING_READ_XYZ_POINTS_H

View File

@ -379,59 +379,6 @@ bool write_LAS(const std::string& filename,
} // namespace IO } // namespace IO
#ifndef CGAL_NO_DEPRECATED_CODE
using IO::make_las_point_writer;
/// \cond SKIP_IN_MANUAL
template <typename ForwardIterator,
typename PointMap>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::write_las_points(), please update your code")
bool write_las_points(std::ostream& os, ///< output stream.
ForwardIterator first, ///< first input point.
ForwardIterator beyond, ///< past-the-end input point.
PointMap point_map) ///< property map: value_type of OutputIterator -> Point_3.
{
CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return IO::write_LAS(os, points, parameters::point_map(point_map));
}
template <typename ForwardIterator>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::write_las_points(), please update your code")
bool write_las_points(std::ostream& os, ///< output stream.
ForwardIterator first, ///< first input point.
ForwardIterator beyond) ///< past-the-end input point.
{
CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return IO::write_LAS(os, points);
}
/// \endcond
template <typename PointRange,
typename PointMap,
typename ... PropertyHandler>
CGAL_DEPRECATED bool write_las_points_with_properties(std::ostream& os,
const PointRange& points,
std::tuple<PointMap,
IO::LAS_property::X,
IO::LAS_property::Y,
IO::LAS_property::Z> point_property,
PropertyHandler&& ... properties)
{
return IO::write_LAS_with_properties(os, points, point_property, std::forward<PropertyHandler>(properties)...);
}
template <typename PointRange, typename CGAL_NP_TEMPLATE_PARAMETERS>
bool write_las_points(std::ostream& os, const PointRange& points, const CGAL_NP_CLASS& np = parameters::default_values())
{
return IO::write_LAS(os, points, np);
}
#endif //CGAL_NO_DEPRECATED_CODE
} // namespace CGAL } // namespace CGAL
#endif // CGAL_POINT_SET_PROCESSING_WRITE_LAS_POINTS_H #endif // CGAL_POINT_SET_PROCESSING_WRITE_LAS_POINTS_H

View File

@ -198,107 +198,6 @@ bool write_OFF(const std::string& filename,
} // IO namespace } // IO namespace
#ifndef CGAL_NO_DEPRECATED_CODE
/// \cond SKIP_IN_MANUAL
template <typename ForwardIterator,
typename PointMap,
typename NormalMap,
typename Kernel>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::write_off_points_and_normals(), please update your code")
bool write_off_points_and_normals(std::ostream& os, ///< output stream.
ForwardIterator first, ///< iterator over the first input point.
ForwardIterator beyond, ///< past-the-end iterator over the input points.
PointMap point_map, ///< property map: value_type of ForwardIterator -> Point_3.
NormalMap normal_map, ///< property map: value_type of ForwardIterator -> Vector_3.
const Kernel& /*kernel*/) ///< geometric traits.
{
CGAL::Iterator_range<ForwardIterator> points(first, beyond);
return write_off_points(os, points,
CGAL::parameters::point_map(point_map)
.normal_map(normal_map)
.geom_traits(Kernel()));
}
template <typename ForwardIterator,
typename PointMap,
typename NormalMap
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::write_off_points_and_normals(), please update your code")
bool write_off_points_and_normals(std::ostream& os, ///< output stream.
ForwardIterator first, ///< first input point.
ForwardIterator beyond, ///< past-the-end input point.
PointMap point_map, ///< property map: value_type of OutputIterator -> Point_3.
NormalMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{
CGAL::Iterator_range<ForwardIterator> points(first, beyond);
return write_off_points(os, points,
parameters::point_map(point_map)
.normal_map(normal_map));
}
template <typename ForwardIterator,
typename NormalMap>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::write_off_points_and_normals(), please update your code")
bool write_off_points_and_normals(std::ostream& os, ///< output stream.
ForwardIterator first, ///< first input point.
ForwardIterator beyond, ///< past-the-end input point.
NormalMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{
CGAL::Iterator_range<ForwardIterator> points(first, beyond);
return write_off_points(os, points, parameters::normal_map (normal_map));
}
template <typename ForwardIterator,
typename PointMap,
typename Kernel>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::write_off_points(), please update your code")
bool write_off_points(std::ostream& os, ///< output stream.
ForwardIterator first, ///< iterator over the first input point.
ForwardIterator beyond, ///< past-the-end iterator over the input points.
PointMap point_map, ///< property map: value_type of ForwardIterator -> Point_3.
const Kernel&) ///< geometric traits.
{
CGAL::Iterator_range<ForwardIterator> points(first, beyond);
return write_off_points(os, points,
parameters::point_map(point_map)
.geom_traits(Kernel()));
}
template <typename ForwardIterator,
typename PointMap>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::write_off_points(), please update your code")
bool write_off_points(std::ostream& os, ///< output stream.
ForwardIterator first, ///< first input point.
ForwardIterator beyond, ///< past-the-end input point.
PointMap point_map) ///< property map: value_type of OutputIterator -> Point_3.
{
CGAL::Iterator_range<ForwardIterator> points(first, beyond);
return write_off_points(os, points, parameters::point_map (point_map));
}
template <typename ForwardIterator
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::write_off_points(), please update your code")
bool write_off_points(std::ostream& os, ///< output stream.
ForwardIterator first, ///< first input point.
ForwardIterator beyond) ///< past-the-end input point.
{
CGAL::Iterator_range<ForwardIterator> points(first, beyond);
return write_off_points(os, points);
}
/// \endcond
template <typename PointRange, typename CGAL_NP_TEMPLATE_PARAMETERS>
CGAL_DEPRECATED bool write_off_points(std::ostream& os, const PointRange& points, const CGAL_NP_CLASS& np = parameters::default_values())
{
return IO::write_OFF(os, points, np);
}
#endif // CGAL_NO_DEPRECATED_CODE
} // namespace CGAL } // namespace CGAL
#endif // CGAL_POINT_SET_PROCESSING_WRITE_OFF_POINTS_H #endif // CGAL_POINT_SET_PROCESSING_WRITE_OFF_POINTS_H

View File

@ -298,80 +298,6 @@ bool write_PLY(const std::string& filename,
} // namespace IO } // namespace IO
#ifndef CGAL_NO_DEPRECATED_CODE
/// \cond SKIP_IN_MANUAL
template <typename ForwardIterator,
typename PointMap,
typename VectorMap>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::write_ply_points_and_normals(), please update your code")
bool write_ply_points_and_normals(std::ostream& os, ///< output stream.
ForwardIterator first, ///< first input point.
ForwardIterator beyond, ///< past-the-end input point.
PointMap point_map, ///< property map: value_type of OutputIterator -> Point_3.
VectorMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{
CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return IO::write_PLY(os, points, parameters::point_map(point_map)
.normal_map(normal_map));
}
template <typename ForwardIterator,
typename VectorMap>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::write_ply_points_and_normals(), please update your code")
bool write_ply_points_and_normals(std::ostream& os, ///< output stream.
ForwardIterator first, ///< first input point.
ForwardIterator beyond, ///< past-the-end input point.
VectorMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{
CGAL::Iterator_range<ForwardIterator> points(first, beyond);
return IO::write_PLY(os, points, parameters::normal_map (normal_map));
}
template <typename ForwardIterator,
typename PointMap >
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::write_ply_points(), please update your code")
bool write_ply_points(std::ostream& os, ///< output stream.
ForwardIterator first, ///< first input point.
ForwardIterator beyond, ///< past-the-end input point.
PointMap point_map) ///< property map: value_type of OutputIterator -> Point_3.
{
CGAL::Iterator_range<ForwardIterator> points(first, beyond);
return IO::write_PLY(os, points, parameters::point_map(point_map));
}
template <typename ForwardIterator >
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::write_ply_points(), please update your code")
bool write_ply_points(std::ostream& os, ///< output stream.
ForwardIterator first, ///< first input point.
ForwardIterator beyond) ///< past-the-end input point.
{
CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return IO::write_PLY(os, points);
}
/// \endcond
template <typename PointRange,
typename ... PropertyHandler>
CGAL_DEPRECATED bool write_ply_points_with_properties(std::ostream& os, ///< output stream.
const PointRange& points, ///< input point range.
PropertyHandler&& ... properties) ///< parameter pack of property handlers
{
return IO::write_PLY_with_properties(os, points, std::forward<PropertyHandler>(properties)...);
}
template <typename PointRange, typename CGAL_NP_TEMPLATE_PARAMETERS>
CGAL_DEPRECATED bool write_ply_points(std::ostream& os, const PointRange& points, const CGAL_NP_CLASS& np = parameters::default_values())
{
return IO::write_PLY(os, points, np);
}
#endif // CGAL_NO_DEPRECATED_CODE
} // namespace CGAL } // namespace CGAL
#endif // CGAL_POINT_SET_PROCESSING_WRITE_PLY_POINTS_H #endif // CGAL_POINT_SET_PROCESSING_WRITE_PLY_POINTS_H

View File

@ -189,106 +189,6 @@ bool write_XYZ(const std::string& filename,
} // namespace IO } // namespace IO
#ifndef CGAL_NO_DEPRECATED_CODE
/// \cond SKIP_IN_MANUAL
template <typename ForwardIterator,
typename PointMap,
typename NormalMap,
typename Kernel>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::write_xyz_points_and_normals(), please update your code")
bool write_xyz_points_and_normals(std::ostream& os, ///< output stream.
ForwardIterator first, ///< iterator over the first input point.
ForwardIterator beyond, ///< past-the-end iterator over the input points.
PointMap point_map, ///< property map: value_type of ForwardIterator -> Point_3.
NormalMap normal_map, ///< property map: value_type of ForwardIterator -> Vector_3.
const Kernel& /*kernel*/) ///< geometric traits.
{
CGAL::Iterator_range<ForwardIterator> points(first, beyond);
return IO::write_XYZ(os, points,
parameters::point_map(point_map)
.normal_map(normal_map)
.geom_traits(Kernel()));
}
template <typename ForwardIterator,
typename PointMap,
typename NormalMap>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::write_xyz_points_and_normals(), please update your code")
bool write_xyz_points_and_normals(std::ostream& os, ///< output stream.
ForwardIterator first, ///< first input point.
ForwardIterator beyond, ///< past-the-end input point.
PointMap point_map, ///< property map: value_type of OutputIterator -> Point_3.
NormalMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{
CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return IO::write_XYZ(os, points,
parameters::point_map(point_map)
.normal_map(normal_map));
}
template <typename ForwardIterator,
typename NormalMap
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::write_xyz_points_and_normals(), please update your code")
bool write_xyz_points_and_normals(std::ostream& os, ///< output stream.
ForwardIterator first, ///< first input point.
ForwardIterator beyond, ///< past-the-end input point.
NormalMap normal_map) ///< property map: value_type of ForwardIterator -> Vector_3.
{
CGAL::Iterator_range<ForwardIterator> points(first, beyond);
return IO::write_XYZ(os, points, parameters::normal_map(normal_map));
}
template <typename ForwardIterator,
typename PointMap,
typename Kernel>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::write_xyz_points(), please update your code")
bool write_xyz_points(std::ostream& os, ///< output stream.
ForwardIterator first, ///< first input point.
ForwardIterator beyond, ///< past-the-end input point.
PointMap point_map, ///< property map: value_type of OutputIterator -> Point_3.
const Kernel& kernel)
{
CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return IO::write_XYZ(os, points, parameters::point_map(point_map)
.geom_traits (kernel));
}
template <typename ForwardIterator,
typename PointMap>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::write_xyz_points(), please update your code")
bool write_xyz_points(std::ostream& os, ///< output stream.
ForwardIterator first, ///< first input point.
ForwardIterator beyond, ///< past-the-end input point.
PointMap point_map) ///< property map: value_type of OutputIterator -> Point_3.
{
CGAL::Iterator_range<ForwardIterator> points(first, beyond);
return IO::write_XYZ(os, points, parameters::point_map(point_map));
}
template <typename ForwardIterator>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::write_xyz_points(), please update your code")
bool write_xyz_points(std::ostream& os, ///< output stream.
ForwardIterator first, ///< first input point.
ForwardIterator beyond) ///< past-the-end input point.
{
CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return IO::write_XYZ(os, points);
}
/// \endcond
template <typename PointRange, typename CGAL_NP_TEMPLATE_PARAMETERS>
CGAL_DEPRECATED bool write_xyz_points(std::ostream& os, const PointRange& points, const CGAL_NP_CLASS& np = parameters::default_values())
{
return IO::write_XYZ(os, points, np);
}
#endif // CGAL_NO_DEPRECATED_CODE
} // namespace CGAL } // namespace CGAL
#endif // CGAL_POINT_SET_PROCESSING_WRITE_XYZ_POINTS_H #endif // CGAL_POINT_SET_PROCESSING_WRITE_XYZ_POINTS_H

View File

@ -22,7 +22,6 @@ endif()
# Executables that do *not* require Eigen # Executables that do *not* require Eigen
create_single_source_cgal_program( "read_test.cpp" ) create_single_source_cgal_program( "read_test.cpp" )
create_single_source_cgal_program( "test_read_write_point_set.cpp" ) create_single_source_cgal_program( "test_read_write_point_set.cpp" )
create_single_source_cgal_program( "test_deprecated_io_point_set.cpp" )
create_single_source_cgal_program( "test_poisson_eliminate.cpp" ) create_single_source_cgal_program( "test_poisson_eliminate.cpp" )
create_single_source_cgal_program( "read_test_with_different_pmaps.cpp" ) create_single_source_cgal_program( "read_test_with_different_pmaps.cpp" )
create_single_source_cgal_program( "analysis_test.cpp" ) create_single_source_cgal_program( "analysis_test.cpp" )
@ -39,7 +38,6 @@ if(NOT MSVC_VERSION OR MSVC_VERSION GREATER_EQUAL 1919 OR MSVC_VERSION LESS 1910
include(CGAL_LASLIB_support) include(CGAL_LASLIB_support)
if (TARGET CGAL::LASLIB_support) if (TARGET CGAL::LASLIB_support)
target_link_libraries(test_read_write_point_set PRIVATE ${CGAL_libs} CGAL::LASLIB_support) target_link_libraries(test_read_write_point_set PRIVATE ${CGAL_libs} CGAL::LASLIB_support)
target_link_libraries(test_deprecated_io_point_set PRIVATE ${CGAL_libs} CGAL::LASLIB_support)
else() else()
message(STATUS "NOTICE: the LAS reader test requires LASlib and will not be compiled.") message(STATUS "NOTICE: the LAS reader test requires LASlib and will not be compiled.")
endif() endif()

View File

@ -1,241 +0,0 @@
#include <CGAL/Installation/internal/disable_deprecation_warnings_and_errors.h>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Point_set_3.h>
#include <CGAL/IO/read_points.h>
#include <CGAL/IO/write_points.h>
// Just to try and create ambiguities
#include <CGAL/boost/graph/io.h>
#include <CGAL/IO/io.h>
#include <CGAL/property_map.h>
#include <vector>
#include <cassert>
#include <string>
#include <sstream>
typedef CGAL::Simple_cartesian<double> Kernel;
typedef Kernel::Point_3 Point_3;
typedef Kernel::Vector_3 Vector_3;
typedef std::array<unsigned short, 4> Color;
typedef std::pair<Point_3, Color> PointWithColor;
typedef CGAL::Nth_of_tuple_property_map<1, PointWithColor> Color_map;
struct GetRedMap
{
typedef PointWithColor key_type;
typedef unsigned short value_type;
typedef const value_type& reference;
typedef boost::lvalue_property_map_tag category;
};
unsigned short get(const GetRedMap&, const PointWithColor& p)
{
return p.second[0];
}
struct GetGreenMap
{
typedef PointWithColor key_type;
typedef unsigned short value_type;
typedef const value_type& reference;
typedef boost::lvalue_property_map_tag category;
};
unsigned short get(const GetGreenMap&, const PointWithColor& p)
{
return p.second[1];
}
struct GetBlueMap
{
typedef PointWithColor key_type;
typedef unsigned short value_type;
typedef const value_type& reference;
typedef boost::lvalue_property_map_tag category;
};
unsigned short get(const GetBlueMap&, const PointWithColor& p)
{
return p.second[2];
}
struct GetAlphaMap
{
typedef PointWithColor key_type;
typedef unsigned short value_type;
typedef const value_type& reference;
typedef boost::lvalue_property_map_tag category;
};
unsigned short get(const GetAlphaMap&, const PointWithColor& p)
{
return p.second[3];
}
int main()
{
std::vector<PointWithColor> points(3);
points[0] = std::make_pair(Point_3(1,0,0), Color{255,0,0,255});
points[1] = std::make_pair(Point_3(0,1,0), Color{0,255,0,255});
points[2] = std::make_pair(Point_3(0,0,1), Color{0,0,255,255});
bool ok;
std::vector<Point_3> ps;
ps.push_back(Point_3(1,0,0));
ps.push_back(Point_3(0,1,0));
ps.push_back(Point_3(0,0,1));
std::string input;
//LAS
#ifdef CGAL_LINKED_WITH_LASLIB
{
std::ostringstream os(std::ios::binary);
ok = CGAL::write_las_points_with_properties(os, points,
CGAL::make_las_point_writer(CGAL::First_of_pair_property_map<PointWithColor>()),
std::make_pair(GetRedMap(),CGAL::LAS_property::R()),
std::make_pair(GetGreenMap(), CGAL::LAS_property::G()),
std::make_pair(GetBlueMap(), CGAL::LAS_property::B()),
std::make_pair(GetAlphaMap(), CGAL::LAS_property::I())
);
assert(ok);
os.flush();
input = os.str();
}
{
points.clear();
std::istringstream is(input, std::ios::binary);
ok = CGAL::read_las_points_with_properties(is, std::back_inserter (points),
CGAL::make_las_point_reader(CGAL::First_of_pair_property_map<PointWithColor>()),
std::make_tuple(CGAL::Second_of_pair_property_map<PointWithColor>(),
CGAL::Construct_array(),
CGAL::LAS_property::R(),
CGAL::LAS_property::G(),
CGAL::LAS_property::B(),
CGAL::LAS_property::I()));
assert(ok);
assert(points.size() == 3);
assert(points[1].second[1] == 255);
}
{
std::ostringstream os(std::ios_base::binary);
CGAL::write_las_points(os, ps);
assert(ok);
os.flush();
input = os.str();
}
{
ps.clear();
std::istringstream is(input, std::ios::binary);
ok = CGAL::read_las_points(is, std::back_inserter (ps));
assert(ok);
assert(ps.size() == 3);
}
#endif
//PLY
{
std::ostringstream os;
assert(os.good());
ok = CGAL::write_ply_points_with_properties(os, points,
CGAL::make_ply_point_writer (CGAL::First_of_pair_property_map<PointWithColor>()),
std::make_pair(GetRedMap(),CGAL::PLY_property<unsigned short>("red")),
std::make_pair(GetGreenMap(), CGAL::PLY_property<unsigned short>("green")),
std::make_pair(GetBlueMap(), CGAL::PLY_property<unsigned short>("blue")),
std::make_pair(GetAlphaMap(), CGAL::PLY_property<unsigned short>("alpha"))
);
assert(! os.fail());
assert(ok);
os.flush();
input = os.str();
}
{
std::istringstream is(input);
assert(is.good());
points.clear();
ok = CGAL::read_ply_points_with_properties(is, std::back_inserter (points),
CGAL::make_ply_point_reader(CGAL::First_of_pair_property_map<PointWithColor>()),
std::make_tuple(CGAL::Second_of_pair_property_map<PointWithColor>(),
CGAL::Construct_array(),
CGAL::PLY_property<unsigned short>("red"),
CGAL::PLY_property<unsigned short>("green"),
CGAL::PLY_property<unsigned short>("blue"),
CGAL::PLY_property<unsigned short>("alpha")));
assert(! is.fail());
assert(ok);
assert(points.size() == 3);
assert(points[1].second[1] == 255);
}
{
std::ostringstream os;
assert(os.good());
ok = CGAL::write_ply_points(os, ps);
assert(! os.fail());
assert(ok);
os.flush();
input = os.str();
}
{
std::istringstream is(input);
assert(is.good());
ps.clear();
ok = CGAL::read_ply_points(is, std::back_inserter (ps));
assert(! is.fail());
assert(ok);
assert(ps.size() == 3);
}
//OFF
{
std::ostringstream os;
assert(os.good());
ok = CGAL::write_off_points(os, ps);
assert(! os.fail());
assert(ok);
os.flush();
input = os.str();
}
{
std::istringstream is(input);
assert(is.good());
ps.clear();
ok = CGAL::read_off_points(is, std::back_inserter (ps));
assert(! is.fail());
assert(ok);
assert(ps.size() == 3);
}
//XYZ
{
std::ostringstream os;
assert(os.good());
ok = CGAL::write_xyz_points(os, ps);
assert(! os.fail());
assert(ok);
os.flush();
input = os.str();
}
{
std::istringstream is(input);
assert(is.good());
ps.clear();
ok = CGAL::read_xyz_points(is, std::back_inserter (ps));
assert(! is.fail());
assert(ok);
assert(ps.size() == 3);
}
std::cout << "Done" << std::endl;
return EXIT_SUCCESS;
}

View File

@ -45,10 +45,227 @@
#include <CGAL/Polygon_mesh_processing/refine_with_plane.h> #include <CGAL/Polygon_mesh_processing/refine_with_plane.h>
#ifndef CGAL_PLANE_CLIP_DO_NOT_USE_TRIANGULATION
#include <CGAL/Triangulation_vertex_base_with_info_2.h>
#include <CGAL/Triangulation_face_base_with_info_2.h>
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
#include <CGAL/Projection_traits_3.h>
#include <CGAL/mark_domain_in_triangulation.h>
#include <CGAL/Delaunay_mesh_face_base_2.h>
#include <boost/iterator/transform_iterator.hpp>
#endif
namespace CGAL { namespace CGAL {
namespace Polygon_mesh_processing { namespace Polygon_mesh_processing {
namespace internal { namespace internal {
#ifndef CGAL_PLANE_CLIP_DO_NOT_USE_TRIANGULATION
template <class Traits,
class TriangleMesh,
class VertexPointMap,
class Visitor>
void close_and_triangulate(TriangleMesh& tm, VertexPointMap vpm, typename Traits::Vector_3 plane_normal, Visitor& visitor)
{
using vertex_descriptor = typename boost::graph_traits<TriangleMesh>::vertex_descriptor;
using halfedge_descriptor = typename boost::graph_traits<TriangleMesh>::halfedge_descriptor;
using face_descriptor = typename boost::graph_traits<TriangleMesh>::face_descriptor;
using P_traits = Projection_traits_3<Traits>;
using Vb = Triangulation_vertex_base_with_info_2<vertex_descriptor, P_traits>;
using Fb = CGAL::Delaunay_mesh_face_base_2<P_traits>;
using TDS = Triangulation_data_structure_2<Vb, Fb>;
using Itag = No_constraint_intersection_tag;
using CDT = Constrained_Delaunay_triangulation_2<P_traits, TDS, Itag>;
P_traits p_traits(plane_normal);
std::vector<std::pair<typename Traits::Point_3, vertex_descriptor>> points;
std::vector<std::pair<vertex_descriptor, vertex_descriptor>> csts;
halfedge_descriptor href = boost::graph_traits<TriangleMesh>::null_halfedge ();
bool first=true;
for (halfedge_descriptor h : halfedges(tm))
{
if (is_border(h, tm))
{
if (first)
{
href=h;
first=false;
}
vertex_descriptor src = source(h, tm), tgt = target(h, tm);
points.emplace_back(get(vpm, tgt), tgt);
csts.emplace_back(src, tgt);
}
}
if (points.empty()) return;
CDT cdt(p_traits);
cdt.insert(points.begin(), points.end());
// TODO: in case of degenerate edges, we don't triangulate but it's kind of an issue on our side
if (cdt.number_of_vertices()!=points.size()) return;
typedef CGAL::dynamic_vertex_property_t<typename CDT::Vertex_handle> V_tag;
typename boost::property_map<TriangleMesh, V_tag>::type v2v = get(V_tag(), tm);
for (auto vh : cdt.finite_vertex_handles())
put(v2v, vh->info(), vh);
for (auto vv : csts)
cdt.insert_constraint(get(v2v, vv.first), get(v2v, vv.second));
mark_domain_in_triangulation(cdt);
typename CDT::Edge edge_ref;
CGAL_assertion_code(bool OK =)
cdt.is_edge(get(v2v, csts[0].first), get(v2v, csts[0].second), edge_ref.first, edge_ref.second);
CGAL_assertion(OK);
if (!edge_ref.first->is_in_domain()) edge_ref = cdt.mirror_edge(edge_ref);
CGAL_assertion(edge_ref.first->is_in_domain());
bool flip_ori = ( edge_ref.first->vertex( (edge_ref.second+1)%3 )->info() != source(href, tm) );
CGAL_assertion(
( !flip_ori &&
edge_ref.first->vertex( (edge_ref.second+1)%3 )->info() == source(href, tm) &&
edge_ref.first->vertex( (edge_ref.second+2)%3 )->info() == target(href, tm) )
||
( flip_ori &&
edge_ref.first->vertex( (edge_ref.second+2)%3 )->info() == source(href, tm) &&
edge_ref.first->vertex( (edge_ref.second+1)%3 )->info() == target(href, tm) )
);
for (auto fh : cdt.finite_face_handles())
{
if (!fh->is_in_domain()) continue;
std::array<vertex_descriptor,3> vrts = make_array(fh->vertex(0)->info(),
fh->vertex(1)->info(),
fh->vertex(2)->info());
if (flip_ori) std::swap(vrts[0], vrts[1]);
CGAL_assertion(Euler::can_add_face(vrts, tm));
visitor.before_face_copy(boost::graph_traits<TriangleMesh>::null_face(), tm, tm);
face_descriptor f = Euler::add_face(vrts, tm);
visitor.after_face_copy(boost::graph_traits<TriangleMesh>::null_face(), tm, f, tm);
}
}
template <class Traits,
class PolygonMesh,
class VertexPointMap,
class Visitor>
bool close(PolygonMesh& pm, VertexPointMap vpm, typename Traits::Vector_3 plane_normal, Visitor& visitor)
{
//using vertex_descriptor = typename boost::graph_traits<PolygonMesh>::vertex_descriptor;
using halfedge_descriptor = typename boost::graph_traits<PolygonMesh>::halfedge_descriptor;
// using face_descriptor = typename boost::graph_traits<PolygonMesh>::face_descriptor;
using Point_3 = typename Traits::Point_3;
using P_traits = Projection_traits_3<Traits>;
std::vector< std::vector<Point_3> > polygons;
std::vector< halfedge_descriptor > border_cycles;
std::vector< Bbox_3 > bboxes;
typedef CGAL::dynamic_halfedge_property_t<bool> H_tag;
typename boost::property_map<PolygonMesh, H_tag>::type
is_hedge_selected = get(H_tag(), pm, false);
for (halfedge_descriptor h : halfedges(pm))
{
if (is_border(h, pm) && get(is_hedge_selected, h)==false)
{
border_cycles.push_back(h);
polygons.emplace_back();
bboxes.emplace_back();
for (halfedge_descriptor he : CGAL::halfedges_around_face(h, pm))
{
put(is_hedge_selected, he, true);
polygons.back().push_back(get(vpm, target(he, pm)));
bboxes.back()+=polygons.back().back().bbox();
}
}
}
if (bboxes.empty()) return true;
Bbox_3 gbox;
for (const Bbox_3& bb : bboxes)
gbox+=bb;
// arrange polygons
int axis = 0;
if ((gbox.ymax()-gbox.ymin()) > (gbox.xmax()-gbox.xmin())) axis=1;
if ((gbox.zmax()-gbox.zmin()) > ((gbox.max)(axis)-(gbox.min)(axis))) axis=2;
std::vector<std::size_t> poly_ids(polygons.size());
std::iota(poly_ids.begin(), poly_ids.end(), 0);
std::sort(poly_ids.begin(), poly_ids.end(),
[&bboxes, axis](std::size_t i, std::size_t j)
{
return (bboxes[i].min)(axis) < (bboxes[j].min)(axis);
});
std::vector<std::size_t> simply_connected_faces;
std::vector<bool> handled(poly_ids.size(), false);
P_traits ptraits(plane_normal);
for (std::size_t pid=0; pid<poly_ids.size()-1; ++pid)
{
std::size_t curr_poly_id = poly_ids[pid];
if (handled[curr_poly_id]) continue;
std::vector<std::size_t> nested;
for (std::size_t npid=pid+1; npid<poly_ids.size(); ++npid)
{
std::size_t next_poly_id = poly_ids[npid];
if (do_overlap(bboxes[curr_poly_id], bboxes[next_poly_id]))
{
//TODO: what about tanjencies?
//TODO: check orientation for predicate
if (bounded_side_2(polygons[curr_poly_id].begin(), polygons[curr_poly_id].end(),
polygons[next_poly_id].front(), ptraits) == ON_BOUNDED_SIDE)
{
nested.push_back(next_poly_id);
handled[next_poly_id]=true;
}
}
else
break; // no further overlaps
}
handled[curr_poly_id] = true;
if (nested.empty())
simply_connected_faces.push_back(curr_poly_id);
}
if (!handled[poly_ids.back()])
simply_connected_faces.push_back(poly_ids.back());
for (std::size_t id : simply_connected_faces)
{
halfedge_descriptor h = border_cycles[id];
visitor.before_face_copy(boost::graph_traits<PolygonMesh>::null_face(), pm, pm);
Euler::fill_hole(h, pm);
visitor.after_face_copy(boost::graph_traits<PolygonMesh>::null_face(), pm, face(h, pm), pm);
}
return simply_connected_faces.size()==poly_ids.size();
}
#endif
template <class Plane_3, template <class Plane_3,
class TriangleMesh, class TriangleMesh,
class NamedParameters> class NamedParameters>
@ -791,7 +1008,7 @@ bool clip(PolygonMesh& pm,
Default_visitor default_visitor; Default_visitor default_visitor;
using Visitor_ref = typename internal_np::Lookup_named_param_def<internal_np::visitor_t, NamedParameters, Default_visitor>::reference; using Visitor_ref = typename internal_np::Lookup_named_param_def<internal_np::visitor_t, NamedParameters, Default_visitor>::reference;
Visitor_ref visitor = choose_parameter(get_parameter_reference(np, internal_np::visitor), default_visitor); Visitor_ref visitor = choose_parameter(get_parameter_reference(np, internal_np::visitor), default_visitor);
constexpr bool has_visitor = !std::is_same_v<Default_visitor, std::remove_cv_t<std::remove_reference_t<Visitor_ref>>>; // constexpr bool has_visitor = !std::is_same_v<Default_visitor, std::remove_cv_t<std::remove_reference_t<Visitor_ref>>>;
typedef typename internal_np::Lookup_named_param_def < typedef typename internal_np::Lookup_named_param_def <
internal_np::concurrency_tag_t, internal_np::concurrency_tag_t,
@ -834,6 +1051,8 @@ bool clip(PolygonMesh& pm,
if (clip_volume && !is_closed(pm)) clip_volume=false; if (clip_volume && !is_closed(pm)) clip_volume=false;
if (clip_volume && !use_compact_clipper) use_compact_clipper=true; if (clip_volume && !use_compact_clipper) use_compact_clipper=true;
CGAL_precondition(!clip_volume || !triangulate || does_bound_a_volume(pm));
auto fcc = get(dynamic_face_property_t<std::size_t>(), pm); auto fcc = get(dynamic_face_property_t<std::size_t>(), pm);
std::size_t nbcc = connected_components(pm, fcc, CGAL::parameters::edge_is_constrained_map(ecm)); std::size_t nbcc = connected_components(pm, fcc, CGAL::parameters::edge_is_constrained_map(ecm));
@ -865,35 +1084,12 @@ bool clip(PolygonMesh& pm,
if (clip_volume) if (clip_volume)
{ {
std::vector<halfedge_descriptor> borders; //TODO: add in the traits construct_orthogonal_vector
extract_boundary_cycles(pm, std::back_inserter(borders)); if (triangulate)
internal::close_and_triangulate<GT>(pm, vpm, plane.orthogonal_vector(), visitor);
for (halfedge_descriptor h : borders) else
{ if (!internal::close<GT>(pm, vpm, plane.orthogonal_vector(), visitor))
#ifndef CGAL_PLANE_CLIP_DO_NOT_USE_TRIANGULATION internal::close_and_triangulate<GT>(pm, vpm, plane.orthogonal_vector(), visitor);
if (triangulate)
{
Euler::fill_hole(h, pm); // visitor call done in the triangulation visitor
if constexpr (!has_visitor)
{
triangulate_face(face(h,pm), pm, parameters::vertex_point_map(vpm).geom_traits(traits));
}
else
{
using Base_visitor = std::remove_cv_t<std::remove_reference_t<Visitor_ref>>;
internal::Visitor_wrapper_for_triangulate_face<PolygonMesh, Base_visitor> visitor_wrapper(pm, visitor);
triangulate_face(face(h,pm), pm, parameters::vertex_point_map(vpm).geom_traits(traits).visitor(visitor_wrapper));
}
}
else
#endif
{
visitor.before_face_copy(boost::graph_traits<PolygonMesh>::null_face(), pm, pm);
Euler::fill_hole(h, pm);
visitor.after_face_copy(boost::graph_traits<PolygonMesh>::null_face(), pm, face(h, pm), pm);
}
}
} }
return true; return true;

View File

@ -278,6 +278,7 @@ template <typename PolygonMesh, typename FaceNormalVector, typename K>
bool does_enclose_other_normals(const std::size_t i, const std::size_t j, const std::size_t k, bool does_enclose_other_normals(const std::size_t i, const std::size_t j, const std::size_t k,
const typename K::Vector_3& nb, const typename K::Vector_3& nb,
const typename K::FT sp_bi, const typename K::FT sp_bi,
typename boost::graph_traits<PolygonMesh>::face_descriptor &not_enclose_normal,
const std::vector<typename boost::graph_traits<PolygonMesh>::face_descriptor>& incident_faces, const std::vector<typename boost::graph_traits<PolygonMesh>::face_descriptor>& incident_faces,
const FaceNormalVector& face_normals, const FaceNormalVector& face_normals,
const K& traits) const K& traits)
@ -291,6 +292,7 @@ bool does_enclose_other_normals(const std::size_t i, const std::size_t j, const
// check that this min circle defined by the diameter contains the other points // check that this min circle defined by the diameter contains the other points
const std::size_t nif = incident_faces.size(); const std::size_t nif = incident_faces.size();
bool enclose_other_normals=true;
for(std::size_t l=0; l<nif; ++l) for(std::size_t l=0; l<nif; ++l)
{ {
if(l == i || l == j || l == k) if(l == i || l == j || l == k)
@ -311,11 +313,18 @@ bool does_enclose_other_normals(const std::size_t i, const std::size_t j, const
if(CGAL::abs(sp_bi - sp_bl) <= sp_diff_bound) if(CGAL::abs(sp_bi - sp_bl) <= sp_diff_bound)
continue; continue;
if(sp_bl < sp_bi) //Get the normal farthest from the center
return false; if(sp_bl < sp_bi){
if(enclose_other_normals){
enclose_other_normals=false;
not_enclose_normal=incident_faces[l];
} else if(sp_bl < sp(nb, get(face_normals, not_enclose_normal))){
not_enclose_normal=incident_faces[l];
}
}
} }
return true; return enclose_other_normals;
} }
template <typename GT> template <typename GT>
@ -385,156 +394,160 @@ typename GT::Vector_3 compute_normals_bisector(const typename GT::Vector_3& ni,
return nb; return nb;
} }
template <typename PolygonMesh, typename FaceNormalVector, typename GT>
typename GT::Vector_3
compute_most_visible_normal_2_points(std::vector<typename boost::graph_traits<PolygonMesh>::face_descriptor>& incident_faces,
const FaceNormalVector& face_normals,
const GT& traits)
{
typedef typename GT::FT FT;
typedef typename GT::Vector_3 Vector_3;
typedef typename boost::property_traits<FaceNormalVector>::reference Vector_ref;
typename GT::Compute_scalar_product_3 sp_3 = traits.compute_scalar_product_3_object();
typename GT::Construct_vector_3 cv_3 = traits.construct_vector_3_object();
#ifdef CGAL_PMP_COMPUTE_NORMAL_DEBUG_PP
std::cout << "Trying to find enclosing normal with 2 normals" << std::endl;
#endif
FT min_sp = -1;
Vector_3 n = cv_3(CGAL::NULL_VECTOR);
const std::size_t nif = incident_faces.size();
for(std::size_t i=0; i<nif; ++i)
{
for(std::size_t j=i+1; j<nif; ++j)
{
const Vector_ref ni = get(face_normals, incident_faces[i]);
const Vector_ref nj = get(face_normals, incident_faces[j]);
const Vector_3 nb = compute_normals_bisector(ni, nj, traits);
// Degeneracies like ni == -nj or a numerical error in the construction of 'nb' can happen.
if(traits.equal_3_object()(nb, CGAL::NULL_VECTOR))
return CGAL::NULL_VECTOR;
FT sp_bi = sp_3(nb, ni);
sp_bi = (std::max)(FT(0), sp_bi);
if(sp_bi <= min_sp)
continue;
if(!does_enclose_other_normals<PolygonMesh>(i, j, -1 /*NA*/, nb, sp_bi, incident_faces, face_normals, traits))
continue;
min_sp = sp_bi;
n = nb;
}
}
return n;
}
template <typename PolygonMesh, typename FaceNormalVector, typename GT>
typename GT::Vector_3
compute_most_visible_normal_3_points(const std::vector<typename boost::graph_traits<PolygonMesh>::face_descriptor>& incident_faces,
const FaceNormalVector& face_normals,
const GT& traits)
{
typedef typename GT::FT FT;
typedef typename GT::Vector_3 Vector_3;
typedef typename boost::property_traits<FaceNormalVector>::reference Vector_ref;
#ifdef CGAL_PMP_COMPUTE_NORMAL_DEBUG_PP
std::cout << "Trying to find enclosing normal with 3 normals" << std::endl;
#endif
FT min_sp = -1;
Vector_3 n = traits.construct_vector_3_object()(CGAL::NULL_VECTOR);
const std::size_t nif = incident_faces.size();
for(std::size_t i=0; i<nif; ++i)
{
for(std::size_t j=i+1; j<nif; ++j)
{
for(std::size_t k=j+1; k<nif; ++k)
{
const Vector_ref ni = get(face_normals, incident_faces[i]);
const Vector_ref nj = get(face_normals, incident_faces[j]);
const Vector_ref nk = get(face_normals, incident_faces[k]);
if(ni == CGAL::NULL_VECTOR || nj == CGAL::NULL_VECTOR || nk == CGAL::NULL_VECTOR)
continue;
Vector_3 nb = compute_normals_bisector(ni, nj, nk, traits);
if(traits.equal_3_object()(nb, CGAL::NULL_VECTOR))
return nb;
FT sp_bi = traits.compute_scalar_product_3_object()(nb, ni);
if(sp_bi < FT(0))
{
nb = traits.construct_opposite_vector_3_object()(nb);
sp_bi = - sp_bi;
}
if(sp_bi <= min_sp)
continue;
if(!does_enclose_other_normals<PolygonMesh>(i, j, k, nb, sp_bi, incident_faces, face_normals, traits))
continue;
min_sp = sp_bi;
n = nb;
}
}
}
#ifdef CGAL_PMP_COMPUTE_NORMAL_DEBUG_PP
std::cout << "Best normal from 3-normals-approach: " << n << std::endl;
#endif
return n;
}
// Inspired by Aubry et al. On the most 'normal' normal // Inspired by Aubry et al. On the most 'normal' normal
template <typename PolygonMesh, typename FaceNormalVector, typename GT> template <typename PolygonMesh, typename FaceNormalVector, typename GT>
typename GT::Vector_3 typename GT::Vector_3
compute_vertex_normal_most_visible_min_circle(typename boost::graph_traits<PolygonMesh>::vertex_descriptor v, compute_vertex_normal_most_visible_min_circle(typename boost::graph_traits<PolygonMesh>::vertex_descriptor v,
const FaceNormalVector& face_normals, const FaceNormalVector& face_normals,
const PolygonMesh& pmesh, const PolygonMesh& pmesh,
const GT& traits) const GT& traits){
{
typedef typename boost::graph_traits<PolygonMesh>::face_descriptor face_descriptor; typedef typename boost::graph_traits<PolygonMesh>::face_descriptor face_descriptor;
typedef typename GT::FT FT;
typedef typename GT::Vector_3 Vector_3; typedef typename GT::Vector_3 Vector_3;
typedef typename boost::property_traits<FaceNormalVector>::reference Vector_ref;
typename GT::Compute_scalar_product_3 sp_3 = traits.compute_scalar_product_3_object();
typename GT::Construct_cross_product_vector_3 cp_3 = traits.construct_cross_product_vector_3_object();
std::vector<face_descriptor> incident_faces; std::vector<face_descriptor> incident_faces;
incident_faces.reserve(8); incident_faces.reserve(8);
for(face_descriptor f : CGAL::faces_around_target(halfedge(v, pmesh), pmesh)) for(face_descriptor f : CGAL::faces_around_target(halfedge(v, pmesh), pmesh))
{ {
if(f == boost::graph_traits<PolygonMesh>::null_face()) // Remove degenerate and redundant faces
if((f == boost::graph_traits<PolygonMesh>::null_face()) || (get(face_normals, f)==NULL_VECTOR) )
continue; continue;
if(! incident_faces.empty()){
if(get(face_normals, incident_faces.back()) == get(face_normals, f) )
continue;
}
incident_faces.push_back(f); incident_faces.push_back(f);
} }
if(incident_faces.size() == 0)
return NULL_VECTOR;
if(incident_faces.size() == 1) if(incident_faces.size() == 1)
return get(face_normals, incident_faces.front()); return get(face_normals, incident_faces.front());
Vector_3 res = compute_most_visible_normal_2_points<PolygonMesh>(incident_faces, face_normals, traits); std::array<face_descriptor, 3> circum_points;
short int circum_points_size=2;
circum_points[0]=incident_faces[0];
circum_points[1]=incident_faces[1];
if(res != CGAL::NULL_VECTOR) // found a valid normal through 2 point min circle // Get the farthest point from circum_points[0]
return res; const Vector_ref n0 = get(face_normals, circum_points[0]);
const Vector_ref n1 = get(face_normals, circum_points[1]);
FT sp_min = sp_3(n0, n1);
for(size_t i=2; i<incident_faces.size(); ++i){
const Vector_ref ni = get(face_normals, incident_faces[i]);
FT sp = sp_3(n0, ni);
if(sp < sp_min){
sp_min=sp;
circum_points[1]=incident_faces[i];
}
}
// The vertex has only two incident faces with opposite normals (fold)... // At each step, we get a vertex outside of the current circumcircle to define a larger circumcircle
// @todo devise something based on the directions of the 2/3/4 incident edges? while(true)
if(incident_faces.size() == 2 && res == CGAL::NULL_VECTOR) {
return res; Vector_3 center;
FT radius; //Here, 'radius' refers to the negative scalar product between one circum_point and the center.
const Vector_ref ni = get(face_normals, circum_points[0]);
const Vector_ref nj = get(face_normals, circum_points[1]);
CGAL_assertion(incident_faces.size() >= 2); if(circum_points_size==2){
center = compute_normals_bisector(ni, nj, traits);
} else {
CGAL_assertion(circum_points_size==3);
const Vector_ref nk = get(face_normals, circum_points[2]);
center = compute_normals_bisector(ni, nj, nk, traits);
}
return compute_most_visible_normal_3_points<PolygonMesh>(incident_faces, face_normals, traits); if(center==NULL_VECTOR)
return NULL_VECTOR;
radius = -sp_3(ni, center);
if(is_positive(radius))
return NULL_VECTOR; // The circle is larger than a hemisphere, so no normal is visible to all
face_descriptor f_out;
if(does_enclose_other_normals<PolygonMesh>(-1,-2,-3, center, -radius, f_out, incident_faces, face_normals, traits))
return center;
const Vector_ref no = get(face_normals, f_out);
if(circum_points_size==2){
circum_points[2]=f_out;
circum_points_size=3;
} else {
if(is_negative(sp_3(center, no)))
return NULL_VECTOR; // The circle will become bigger than a hemisphere, no normal visible by all
const Vector_ref nk = get(face_normals, circum_points[2]);
// We need to remove one of the previous points
// We keep the farthest point from the new one
// Then we divide the sphere in two along the equator that passes through the first point and the center
// We remove the previous point that lies in the same hemisphere as the new one
// move the farthest point to f_out at the beginning of circum_points
FT sp_ni_no = sp_3(ni, no);
FT sp_nj_no = sp_3(nj, no);
FT sp_nk_no = sp_3(nk, no);
if(sp_nj_no < sp_nk_no){
if(sp_nj_no < sp_ni_no){
std::swap(circum_points[0], circum_points[1]);
}
} else {
if(sp_nk_no < sp_ni_no){
std::swap(circum_points[0], circum_points[2]);
}
}
// Get the new vectors
const Vector_ref n0 = get(face_normals, circum_points[0]);
const Vector_ref n1 = get(face_normals, circum_points[1]);
const Vector_ref n2 = get(face_normals, circum_points[2]);
// Search for the points that lie in the same hemisphere as f_out compared to ni
Vector_3 n_middle = cp_3(n0, center);
FT sp_no_nm = sp_3(no, n_middle);
FT sp_n1_nm = sp_3(n1, n_middle);
FT sp_n2_nm = sp_3(n2, n_middle);
//We use the same bound than above in does_enclose_other_normals
const FT nmn = CGAL::approximate_sqrt(traits.compute_squared_length_3_object()(n_middle));
const FT sp_diff_bound = nmn*0.00017453292431333;
CGAL_assertion((CGAL::sign(sp_n1_nm)!=CGAL::sign(sp_n2_nm)) || (abs(sp_n1_nm)<=sp_diff_bound) || (abs(sp_n2_nm)<=sp_diff_bound));
if((abs(sp_n1_nm)<=sp_diff_bound) || (abs(sp_n2_nm)<=sp_diff_bound))
return NULL_VECTOR; // The case is nearly degenerate and leads to geometric inconsistencies due to numerical errors
if( CGAL::sign(sp_no_nm) == CGAL::sign(sp_n1_nm)){
circum_points[1]=f_out;
} else {
circum_points[2]=f_out;
}
}
// Delete one vertex if it is included in the circumcircle of the other two
const Vector_ref ni2 = get(face_normals, circum_points[0]);
const Vector_ref nj2 = get(face_normals, circum_points[1]);
const Vector_ref nk2 = get(face_normals, circum_points[2]);
Vector_3 center_ni_nj = compute_normals_bisector(ni2, nj2, traits);
Vector_3 center_ni_nk = compute_normals_bisector(ni2, nk2, traits);
Vector_3 center_nj_nk = compute_normals_bisector(nj2, nk2, traits);
if(sp_3(center_ni_nj, nk2) > sp_3(center_ni_nj, ni2)){
circum_points_size=2;
} else if(sp_3(center_ni_nk, nj2) > sp_3(center_ni_nk, ni2)){
std::swap(circum_points[1],circum_points[2]);
circum_points_size=2;
} else if(sp_3(center_nj_nk, ni2) > sp_3(center_nj_nk, nj2)){
std::swap(circum_points[0],circum_points[2]);
circum_points_size=2;
}
}
} }
template <typename PolygonMesh, typename FaceNormalVector, typename VertexPointMap, typename GT> template <typename PolygonMesh, typename FaceNormalVector, typename VertexPointMap, typename GT>
@ -727,7 +740,6 @@ compute_vertex_normal(typename boost::graph_traits<PolygonMesh>::vertex_descript
std::cout << "get normal at f " << face(h, pmesh) << " : " << get(face_normals, face(h, pmesh)) << std::endl; std::cout << "get normal at f " << face(h, pmesh) << " : " << get(face_normals, face(h, pmesh)) << std::endl;
} }
#endif #endif
Vector_3 normal = internal::compute_vertex_normal_most_visible_min_circle(v, face_normals, pmesh, traits); Vector_3 normal = internal::compute_vertex_normal_most_visible_min_circle(v, face_normals, pmesh, traits);
if(traits.equal_3_object()(normal, CGAL::NULL_VECTOR)) // can't always find a most visible normal if(traits.equal_3_object()(normal, CGAL::NULL_VECTOR)) // can't always find a most visible normal
{ {

View File

@ -1689,8 +1689,9 @@ bounded_error_squared_Hausdorff_distance_impl(const TriangleMesh1& tm1,
// Thus, subdivision can only decrease the min, and the upper bound. // Thus, subdivision can only decrease the min, and the upper bound.
Local_bounds<Kernel, Face_handle_1, Face_handle_2> bounds(triangle_bounds.upper); Local_bounds<Kernel, Face_handle_1, Face_handle_2> bounds(triangle_bounds.upper);
// Ensure 'uface' is initialized in case the upper bound is not changed by the subdivision // Ensure 'lface' and 'uface' are initialized in case the bounds are not changed by the subdivision
bounds.tm2_uface = triangle_bounds.tm2_uface; bounds.tm2_uface = triangle_bounds.tm2_uface;
bounds.tm2_lface = triangle_bounds.tm2_lface;
TM2_hd_traits traversal_traits_tm2(sub_t1_bbox, tm2, vpm2, bounds, global_bounds, infinity_value); TM2_hd_traits traversal_traits_tm2(sub_t1_bbox, tm2, vpm2, bounds, global_bounds, infinity_value);
tm2_tree.traversal_with_priority(sub_triangles[i], traversal_traits_tm2); tm2_tree.traversal_with_priority(sub_triangles[i], traversal_traits_tm2);

View File

@ -7,6 +7,7 @@ project(Polygon_mesh_processing_Tests)
# CGAL and its components # CGAL and its components
find_package(CGAL REQUIRED COMPONENTS Core) find_package(CGAL REQUIRED COMPONENTS Core)
create_single_source_cgal_program("slow_compute_normal.cpp")
create_single_source_cgal_program("test_pmp_triangle.cpp") create_single_source_cgal_program("test_pmp_triangle.cpp")
create_single_source_cgal_program("test_hausdorff_bounded_error_distance.cpp") create_single_source_cgal_program("test_hausdorff_bounded_error_distance.cpp")
create_single_source_cgal_program("test_pmp_read_polygon_mesh.cpp") create_single_source_cgal_program("test_pmp_read_polygon_mesh.cpp")
@ -72,6 +73,7 @@ create_single_source_cgal_program("test_isolevel_refinement.cpp")
create_single_source_cgal_program("test_corefinement_nm_bo.cpp") create_single_source_cgal_program("test_corefinement_nm_bo.cpp")
create_single_source_cgal_program("test_corefinement_cavities.cpp") create_single_source_cgal_program("test_corefinement_cavities.cpp")
create_single_source_cgal_program("issue_8730.cpp") create_single_source_cgal_program("issue_8730.cpp")
create_single_source_cgal_program("issue_7164.cpp")
# create_single_source_cgal_program("test_pmp_repair_self_intersections.cpp") # create_single_source_cgal_program("test_pmp_repair_self_intersections.cpp")
find_package(Eigen3 3.2.0 QUIET) #(requires 3.2.0 or greater) find_package(Eigen3 3.2.0 QUIET) #(requires 3.2.0 or greater)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,61 @@
#include <CGAL/Surface_mesh.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h>
#include <CGAL/Polygon_mesh_processing/distance.h>
#include <CGAL/Random.h>
using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel;
using Point_3 = Kernel::Point_3;
using Mesh = CGAL::Surface_mesh<Point_3>;
namespace PMP = CGAL::Polygon_mesh_processing;
int main(/*int argc, char** argv*/)
{
// A simple triangle
std::vector<Point_3> pts_A;
std::vector<std::vector<size_t>> trs_A;
pts_A.emplace_back( 0.26641936088212415, 0.2664193608821242, 0.73358063911787585);
pts_A.emplace_back(-0.14011519816541251, 0.6017979969632727, 1.1810107045967466);
pts_A.emplace_back(-0.14011519816541279,-0.1810107045967464, 0.39820200303672726);
trs_A.emplace_back(std::vector<size_t>{0,1,2});
Mesh A;
PMP::polygon_soup_to_polygon_mesh(pts_A, trs_A, A);
// An open tetrahedron
std::vector<Point_3> pts_B;
std::vector<std::vector<size_t>> trs_B;
pts_B.emplace_back(0,0,0);
pts_B.emplace_back(1,1,0);
pts_B.emplace_back(1,0,1);
pts_B.emplace_back(0,1,1);
trs_B.emplace_back(std::vector<size_t>{0,1,2});
trs_B.emplace_back(std::vector<size_t>{3,1,0});
trs_B.emplace_back(std::vector<size_t>{3,2,1});
Mesh B;
PMP::polygon_soup_to_polygon_mesh(pts_B, trs_B, B);
double bound = 0.01 * 0.42149467833714593;
PMP::bounded_error_Hausdorff_distance<CGAL::Sequential_tag>(A, B, bound);
PMP::bounded_error_Hausdorff_distance<CGAL::Sequential_tag>(B, A, bound);
// The bug was possible with closed models
std::vector<Point_3> pts_C;
std::vector<std::vector<size_t>> trs_C;
pts_C.emplace_back(0,0,0);
pts_C.emplace_back(1,1,0);
pts_C.emplace_back(1,0,1);
pts_C.emplace_back(0,1,1);
pts_C.emplace_back(0.75,0.75,0);
trs_C.emplace_back(std::vector<size_t>{0,1,2});
trs_C.emplace_back(std::vector<size_t>{3,1,0});
trs_C.emplace_back(std::vector<size_t>{3,2,1});
trs_C.emplace_back(std::vector<size_t>{0,2,4});
trs_C.emplace_back(std::vector<size_t>{3,0,4});
trs_C.emplace_back(std::vector<size_t>{3,4,2});
Mesh C;
PMP::polygon_soup_to_polygon_mesh(pts_C, trs_C, C);
PMP::bounded_error_Hausdorff_distance<CGAL::Sequential_tag>(A, C, bound);
PMP::bounded_error_Hausdorff_distance<CGAL::Sequential_tag>(C, A, bound);
return EXIT_SUCCESS;
}

View File

@ -0,0 +1,39 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/Timer.h>
#include <CGAL/Polygon_mesh_processing/compute_normal.h>
#include <CGAL/Polygon_mesh_processing/IO/polygon_mesh_io.h>
#include <iostream>
#include <string>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef K::Point_3 Point;
typedef K::Vector_3 Vector;
typedef CGAL::Surface_mesh<Point> Mesh;
typedef boost::graph_traits<Mesh>::vertex_descriptor vertex_descriptor;
typedef boost::graph_traits<Mesh>::face_descriptor face_descriptor;
namespace PMP = CGAL::Polygon_mesh_processing;
int main()
{
const std::string filename = "./data/slow_compute_normal.off";
Mesh mesh;
if(!PMP::IO::read_polygon_mesh(filename, mesh))
{
std::cerr << "Invalid input." << std::endl;
return 1;
}
CGAL::Timer t;
t.start();
std::cout << "compute_vertex_normal" << std::endl;
PMP::compute_vertex_normal(vertex_descriptor(523), mesh);
std::cout << t.time() << " sec." << std::endl;
return 0;
}

View File

@ -555,6 +555,49 @@ void test()
PMP::clip(tm1, K::Plane_3(0,0,-1,1), CGAL::parameters::use_compact_clipper(true).allow_self_intersections(true)); PMP::clip(tm1, K::Plane_3(0,0,-1,1), CGAL::parameters::use_compact_clipper(true).allow_self_intersections(true));
assert(vertices(tm1).size()==176); assert(vertices(tm1).size()==176);
} }
// non-simply connected output faces
{
TriangleMesh tm1;
CGAL::make_hexahedron(CGAL::Bbox_3(-3.5,-0.5,-0.5, -2.5,0.5,0.5), tm1);
PMP::reverse_face_orientations(tm1);
CGAL::make_hexahedron(CGAL::Bbox_3(-4,-1,-1, -2,1,1), tm1);
CGAL::make_hexahedron(CGAL::Bbox_3(-1,-1,-1, 1,1,1), tm1);
CGAL::make_hexahedron(CGAL::Bbox_3(2,-1,-1, 4,1,1), tm1);
CGAL::make_hexahedron(CGAL::Bbox_3(5,-1,-1, 7,1,1), tm1);
CGAL::make_hexahedron(CGAL::Bbox_3(-1,2,-1, 1,4,1), tm1);
CGAL::make_hexahedron(CGAL::Bbox_3(2,2,-1, 4,4,1), tm1);
CGAL::make_hexahedron(CGAL::Bbox_3(5,2,-1, 7,4,1), tm1);
CGAL::make_hexahedron(CGAL::Bbox_3(-1,5,-1, 1,7,1), tm1);
CGAL::make_hexahedron(CGAL::Bbox_3(2,5,-1, 4,7,1), tm1);
CGAL::make_hexahedron(CGAL::Bbox_3(5,5,-1, 7,7,1), tm1);
PMP::clip(tm1, K::Plane_3(0,0,1,0), CGAL::parameters::do_not_triangulate_faces(true).clip_volume(true));
assert(vertices(tm1).size()==88);
assert(faces(tm1).size()==72);
}
{
TriangleMesh tm1;
CGAL::make_hexahedron(CGAL::Bbox_3(-1,-1,-1, 1,1,1), tm1);
CGAL::make_hexahedron(CGAL::Bbox_3(-3,-3,-3, 3,3,3), tm1);
CGAL::make_hexahedron(CGAL::Bbox_3(-5,-5,-5, 5,5,5), tm1);
CGAL::make_hexahedron(CGAL::Bbox_3(-7,-7,-7, 7,7,7), tm1);
PMP::reverse_face_orientations(tm1);
CGAL::make_hexahedron(CGAL::Bbox_3(-0.5,-0.5,-0.5, 0.5,0.5,0.5), tm1);
CGAL::make_hexahedron(CGAL::Bbox_3(-2,-2,-2, 2,2,2), tm1);
CGAL::make_hexahedron(CGAL::Bbox_3(-4,-4,-4, 4,4,4), tm1);
CGAL::make_hexahedron(CGAL::Bbox_3(-6,-6,-6, 6,6,6), tm1);
CGAL::make_hexahedron(CGAL::Bbox_3(-8,-8,-8, 8,8,8), tm1);
PMP::clip(tm1, K::Plane_3(0,0,1,0), CGAL::parameters::do_not_triangulate_faces(true).clip_volume(true));
assert(vertices(tm1).size()==72);
assert(faces(tm1).size()==79);
}
} }
template <class Mesh> template <class Mesh>

View File

@ -34,13 +34,6 @@ polyhedral surface.
template <class Traits> template <class Traits>
bool read_OFF( std::istream& in, CGAL::Polyhedron_3<Traits>& P); bool read_OFF( std::istream& in, CGAL::Polyhedron_3<Traits>& P);
/*!
\deprecated This function is deprecated since \cgal 5.3,
\ref read_OFF(std::istream&, Polyhedron_3<Traits>&) should be used instead.
*/
template <class Traits>
bool read_off( std::istream& in, CGAL::Polyhedron_3<Traits>& P);
} // namespace IO } // namespace IO
/*! /*!
@ -79,12 +72,6 @@ This function overloads the generic function \link PkgBGLIoFuncsOFF `write_OFF(s
template <class Traits> template <class Traits>
bool write_OFF( std::ostream& out, const CGAL::Polyhedron_3<Traits>& P); bool write_OFF( std::ostream& out, const CGAL::Polyhedron_3<Traits>& P);
/*!
\deprecated This function is deprecated since \cgal 5.3,
\ref CGAL::IO::write_OFF(std::ostream&, const Polyhedron_3<Traits>&) should be used instead.
*/
template <class Traits>
bool write_off( std::ostream& out, const CGAL::Polyhedron_3<Traits>& P);
} // namespace IO } // namespace IO

View File

@ -21,6 +21,7 @@
#include <iostream> #include <iostream>
#include <map> #include <map>
#include <CGAL/Polyhedron_3.h> #include <CGAL/Polyhedron_3.h>
#include <CGAL/config.h>
namespace CGAL { namespace CGAL {
@ -30,7 +31,7 @@ namespace CGAL {
* @return A dart created during the conversion. * @return A dart created during the conversion.
*/ */
template< class LCC, class Polyhedron > template< class LCC, class Polyhedron >
typename LCC::Dart_descriptor import_from_polyhedron_3(LCC& alcc, typename LCC::Dart_descriptor polyhedron_3_to_lcc(LCC& alcc,
const Polyhedron &apoly) const Polyhedron &apoly)
{ {
static_assert( LCC::dimension>=2 && LCC::ambient_dimension==3 ); static_assert( LCC::dimension>=2 && LCC::ambient_dimension==3 );
@ -94,6 +95,21 @@ namespace CGAL {
return firstAll; return firstAll;
} }
#ifndef CGAL_NO_DEPRECATED_CODE
/*!
\deprecated This function is deprecated since CGAL 6.2. Use `polyhedron_3_to_lcc()` instead.
*/
template< class LCC, class Polyhedron >
CGAL_DEPRECATED
typename LCC::Dart_descriptor
import_from_polyhedron_3(LCC& alcc, const Polyhedron &apoly)
{
return polyhedron_3_to_lcc<LCC, Polyhedron>(alcc, apoly);
}
#endif // CGAL_NO_DEPRECATED_CODE
/** Convert a Polyhedron_3 read into a flux into 3D linear cell complex. /** Convert a Polyhedron_3 read into a flux into 3D linear cell complex.
* @param alcc the linear cell complex where Polyhedron_3 will be converted. * @param alcc the linear cell complex where Polyhedron_3 will be converted.
* @param ais the istream where read the Polyhedron_3. * @param ais the istream where read the Polyhedron_3.
@ -101,7 +117,7 @@ namespace CGAL {
*/ */
template < class LCC > template < class LCC >
typename LCC::Dart_descriptor typename LCC::Dart_descriptor
import_from_polyhedron_3_flux(LCC& alcc, std::istream& ais) polyhedron_3_flux_to_lcc(LCC& alcc, std::istream& ais)
{ {
if (!ais.good()) if (!ais.good())
{ {
@ -110,7 +126,7 @@ namespace CGAL {
} }
CGAL::Polyhedron_3<typename LCC::Traits> P; CGAL::Polyhedron_3<typename LCC::Traits> P;
ais >> P; ais >> P;
return import_from_polyhedron_3<LCC, CGAL::Polyhedron_3 return polyhedron_3_to_lcc<LCC, CGAL::Polyhedron_3
<typename LCC::Traits> > (alcc, P); <typename LCC::Traits> > (alcc, P);
} }

View File

@ -22,34 +22,5 @@
#include <CGAL/boost/graph/io.h> #include <CGAL/boost/graph/io.h>
#include <string>
namespace CGAL {
#ifndef CGAL_NO_DEPRECATED_CODE
/*!
\ingroup PkgSurfaceMeshIOFuncDeprecated
\deprecated This function is deprecated since \cgal 5.3, `CGAL::IO::read_polygon_mesh()` should be used instead.
*/
template <typename K>
CGAL_DEPRECATED bool read_mesh(Surface_mesh<K>& sm, const std::string& filename)
{
return IO::read_polygon_mesh(filename, sm);
}
/*!
\ingroup PkgSurfaceMeshIOFuncDeprecated
\deprecated This function is deprecated since \cgal 5.3, `CGAL::IO::write_polygon_mesh()` should be used instead.
*/
template <typename K>
CGAL_DEPRECATED bool write_mesh(const Surface_mesh<K>& mesh, const std::string& filename)
{
return IO::write_polygon_mesh(filename, mesh);
}
#endif // CGAL_NO_DEPRECATED_CODE
} // namespace CGAL
#endif // CGAL_SURFACE_MESH_IO_H #endif // CGAL_SURFACE_MESH_IO_H

View File

@ -137,20 +137,6 @@ bool read_3MF(const std::string& filename,
} // namespace IO } // namespace IO
#ifndef CGAL_NO_DEPRECATED_CODE
/*!
\ingroup PkgSurfaceMeshIOFuncDeprecated
\deprecated This function is deprecated since \cgal 5.3, `CGAL::IO::read_3MF()` should be used instead.
*/
template<typename Point>
CGAL_DEPRECATED int read_3mf(const std::string& filename, std::vector<CGAL::Surface_mesh<Point> >& output)
{
return IO::read_3MF(filename, output);
}
#endif // CGAL_NO_DEPRECATED_CODE
} // namespace CGAL } // namespace CGAL
#endif // defined(CGAL_LINKED_WITH_3MF) || defined(DOXYGEN_RUNNING) #endif // defined(CGAL_LINKED_WITH_3MF) || defined(DOXYGEN_RUNNING)

View File

@ -347,30 +347,6 @@ bool read_OFF(const std::string& fname,
} // namespace IO } // namespace IO
#ifndef CGAL_NO_DEPRECATED_CODE
/*!
\ingroup PkgSurfaceMeshIOFuncDeprecated
\deprecated This function is deprecated since \cgal 5.3, `CGAL::IO::read_OFF(std::istream&, const Surface_mesh<Point>&)` should be used instead.
*/
template <typename Point, typename CGAL_NP_TEMPLATE_PARAMETERS>
CGAL_DEPRECATED bool read_off(std::istream& is, Surface_mesh<Point>& sm, const CGAL_NP_CLASS& np = parameters::default_values())
{
return IO::read_OFF(is, sm, np);
}
/*!
\ingroup PkgSurfaceMeshIOFuncDeprecated
\deprecated This function is deprecated since \cgal 5.3, `CGAL::IO::read_OFF(std::istream&, const Surface_mesh<Point>&)` should be used instead.
*/
template <typename Point>
CGAL_DEPRECATED bool read_off(Surface_mesh<Point>& sm, const std::string& filename)
{
return IO::read_OFF(filename, sm, parameters::default_values());
}
#endif // CGAL_NO_DEPRECATED_CODE
////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
// Write // Write
@ -549,30 +525,6 @@ bool write_OFF(std::ostream& os,
} // namespace IO } // namespace IO
#ifndef CGAL_NO_DEPRECATED_CODE
/*!
\ingroup PkgSurfaceMeshIOFuncDeprecated
\deprecated This function is deprecated since \cgal 5.3, `CGAL::IO::write_OFF(std::ostream&, const Surface_mesh<Point>&)` should be used instead.
*/
template <typename Point, typename CGAL_NP_TEMPLATE_PARAMETERS>
CGAL_DEPRECATED bool write_off(std::ostream& os, const Surface_mesh<Point>& sm, const CGAL_NP_CLASS& np = parameters::default_values())
{
return IO::write_OFF(os, sm, np);
}
/*!
\ingroup PkgSurfaceMeshIOFuncDeprecated
\deprecated This function is deprecated since \cgal 5.3, `CGAL::IO::write_OFF(std::ostream&, const Surface_mesh<Point>&)` should be used instead.
*/
template <typename Point>
CGAL_DEPRECATED bool write_off(const Surface_mesh<Point>& sm, const std::string& filename)
{
return IO::write_OFF(filename, sm, parameters::default_values());
}
#endif // CGAL_NO_DEPRECATED_CODE
} // namespace CGAL } // namespace CGAL
#endif // CGAL_SURFACE_MESH_IO_OFF_H #endif // CGAL_SURFACE_MESH_IO_OFF_H

View File

@ -169,10 +169,7 @@ public:
const std::string& name = property->name(); const std::string& name = property->name();
if(name == "vertex1" || name == "vertex2") if(name == "vertex1" || name == "vertex2")
return true; return true;
#ifndef CGAL_NO_DEPRECATED_CODE
if(name == "v0" || name == "v1")
return true;
#endif
return false; return false;
} }
@ -888,21 +885,7 @@ bool read_PLY(std::istream& is, Surface_mesh<P>& sm)
} // namespace IO } // namespace IO
#ifndef CGAL_NO_DEPRECATED_CODE
/*!
\ingroup PkgSurfaceMeshIOFuncDeprecated
\deprecated This function is deprecated since \cgal 5.3, `CGAL::IO::read_PLY(std::ostream&, const Surface_mesh<Point>&)` should be used instead.
*/
template <typename P>
CGAL_DEPRECATED bool read_ply(std::istream& is, Surface_mesh<P>& sm, std::string& comments)
{
return IO::read_PLY(is, sm, comments);
}
#endif // CGAL_NO_DEPRECATED_CODE
////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
// Write // Write
@ -1155,26 +1138,6 @@ bool write_PLY(std::ostream& os, const Surface_mesh<P>& sm, const CGAL_NP_CLASS&
} // namespace IO } // namespace IO
#ifndef CGAL_NO_DEPRECATED_CODE
/*!
\ingroup PkgSurfaceMeshIOFuncDeprecated
\deprecated This function is deprecated since \cgal 5.3, `CGAL::IO::write_PLY(std::ostream&, const Surface_mesh<Point>&)` should be used instead.
*/
template <typename P>
CGAL_DEPRECATED bool write_ply(std::ostream& os, const Surface_mesh<P>& sm, const std::string& comments)
{
return IO::write_PLY(os, sm, comments);
}
template <typename P>
CGAL_DEPRECATED bool write_ply(std::ostream& os, const Surface_mesh<P>& sm)
{
return write_PLY(os, sm, "");
}
#endif // CGAL_NO_DEPRECATED_CODE
} // namespace CGAL } // namespace CGAL
#endif // CGAL_SURFACE_MESH_IO_PLY_H #endif // CGAL_SURFACE_MESH_IO_PLY_H

View File

@ -15,15 +15,3 @@ foreach(cppfile ${cppfiles})
create_single_source_cgal_program("${cppfile}") create_single_source_cgal_program("${cppfile}")
endforeach() endforeach()
find_path(3MF_INCLUDE_DIR
NAMES Model/COM/NMR_DLLInterfaces.h
DOC "Path to lib3MF headers"
)
find_library(3MF_LIBRARIES NAMES 3MF DOC "Path to the lib3MF library")
if(3MF_LIBRARIES AND 3MF_INCLUDE_DIR AND EXISTS "${3MF_INCLUDE_DIR}/Model/COM/NMR_DLLInterfaces.h")
include_directories(${3MF_INCLUDE_DIR})
target_link_libraries(test_deprecated_io_sm PRIVATE ${3MF_LIBRARIES})
target_compile_definitions(test_deprecated_io_sm PRIVATE -DCGAL_LINKED_WITH_3MF)
else()
message(STATUS "NOTICE: read_3mf requires the lib3MF library, and will not be tested.")
endif()

View File

@ -1,70 +0,0 @@
#include <CGAL/Installation/internal/disable_deprecation_warnings_and_errors.h>
#include <fstream>
#include <iostream>
#include <CGAL/Surface_mesh.h>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/boost/graph/generators.h>
#include <CGAL/Surface_mesh/IO/3MF.h>
#include <CGAL/Surface_mesh/IO/OFF.h>
#include <CGAL/Surface_mesh/IO/PLY.h>
typedef CGAL::Simple_cartesian<double> Kernel;
typedef Kernel::Point_3 Point_3;
typedef CGAL::Surface_mesh<Point_3> SM;
int main()
{
// OFF
SM sm_in, sm_out;
Point_3 p0(0,0,0), p1(1,0,0), p2(0,1,0);
CGAL::make_triangle(p0, p1, p2, sm_out);
bool ok = CGAL::write_off(sm_out, "tmp.off");
assert(ok);
ok = CGAL::read_off(sm_in, "tmp.off");
assert(ok);
assert(num_vertices(sm_in) == 3 && num_faces(sm_in) == 1);
sm_in.clear();
std::ofstream os("tmp.off");
ok = CGAL::write_off(os, sm_out);
assert(ok);
os.close();
std::ifstream is("tmp.off");
ok = CGAL::read_off(is, sm_in);
assert(ok);
assert(num_vertices(sm_in) == 3 && num_faces(sm_in) == 1);
is.close();
sm_in.clear();
//PLY
os.open("tmp.ply");
std::string comments;
ok = CGAL::write_ply(os, sm_out, comments);
assert(ok);
os.close();
is.open("tmp.ply");
ok = CGAL::read_ply(is, sm_in, comments);
assert(ok);
assert(num_vertices(sm_in) == 3 && num_faces(sm_in) == 1);
is.close();
sm_in.clear();
#ifdef CGAL_LINKED_WITH_3MF
// 3mf
std::vector<SM> output_3mf;
ok = CGAL::read_3mf("test.3mf", output_3mf);
assert(ok);
assert(output_3mf.size() == 2);
sm_in.clear();
#endif
//others
ok = CGAL::write_mesh(sm_out, "tmp.off");
assert(ok);
ok = CGAL::read_mesh(sm_in, "tmp.ply");
assert(ok);
assert(num_vertices(sm_in) == 3 && num_faces(sm_in) == 1);
sm_in.clear();
return EXIT_SUCCESS;
}

View File

@ -102,7 +102,7 @@ int main()
} }
// create compact metric approximation algorithm instance // create compact metric approximation algorithm instance
std::cout << "create compact vas instance" << std::endl; std::cout << "create compact vsa instance" << std::endl;
Compact_metric_point_proxy error_metric(center_pmap, area_pmap); Compact_metric_point_proxy error_metric(center_pmap, area_pmap);
Compact_approx approx(mesh, vpmap, error_metric); Compact_approx approx(mesh, vpmap, error_metric);

View File

@ -1,5 +1,6 @@
#include <CGAL/Simple_cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/Surface_mesh.h> #include <CGAL/Surface_mesh.h>
#include <CGAL/IO/polygon_mesh_io.h>
#include <CGAL/Timer.h> #include <CGAL/Timer.h>
#include <CGAL/Surface_mesh_simplification/edge_collapse.h> #include <CGAL/Surface_mesh_simplification/edge_collapse.h>
@ -36,8 +37,8 @@ int main(int argc, char** argv)
{ {
Surface_mesh surface_mesh; Surface_mesh surface_mesh;
const std::string filename = (argc > 1) ? argv[1] : CGAL::data_file_path("meshes/fold.off"); const std::string filename = (argc > 1) ? argv[1] : CGAL::data_file_path("meshes/fold.off");
std::ifstream is(filename);
if(!is || !(is >> surface_mesh)) if(!CGAL::IO::read_polygon_mesh(filename, surface_mesh))
{ {
std::cerr << "Failed to read input mesh: " << filename << std::endl; std::cerr << "Failed to read input mesh: " << filename << std::endl;
return EXIT_FAILURE; return EXIT_FAILURE;

View File

@ -13,6 +13,8 @@
#include <CGAL/license/Surface_mesh_simplification.h> #include <CGAL/license/Surface_mesh_simplification.h>
#include <CGAL/internal/robust_cross_product.h>
#include <CGAL/determinant.h> #include <CGAL/determinant.h>
#include <CGAL/Null_matrix.h> #include <CGAL/Null_matrix.h>
#include <CGAL/number_utils.h> #include <CGAL/number_utils.h>
@ -183,17 +185,19 @@ MatrixC33<R> cofactors_matrix(const MatrixC33<R>& m)
{ {
typedef typename R::RT RT; typedef typename R::RT RT;
RT c00 = determinant(m.r1().y(),m.r1().z(),m.r2().y(),m.r2().z()); using ::CGAL::Surface_mesh_simplification::internal::diff_of_products;
RT c01 = -determinant(m.r1().x(),m.r1().z(),m.r2().x(),m.r2().z());
RT c02 = determinant(m.r1().x(),m.r1().y(),m.r2().x(),m.r2().y());
RT c10 = -determinant(m.r0().y(),m.r0().z(),m.r2().y(),m.r2().z()); RT c00 = diff_of_products(m.r1().y(), m.r2().z(), m.r2().y(), m.r1().z());
RT c11 = determinant(m.r0().x(),m.r0().z(),m.r2().x(),m.r2().z()); RT c01 = -diff_of_products(m.r1().x(), m.r2().z(), m.r2().x(), m.r1().z());
RT c12 = -determinant(m.r0().x(),m.r0().y(),m.r2().x(),m.r2().y()); RT c02 = diff_of_products(m.r1().x(), m.r2().y(), m.r2().x(), m.r1().y());
RT c20 = determinant(m.r0().y(),m.r0().z(),m.r1().y(),m.r1().z()); RT c10 = -diff_of_products(m.r0().y(), m.r2().z(), m.r2().y(), m.r0().z());
RT c21 = -determinant(m.r0().x(),m.r0().z(),m.r1().x(),m.r1().z()); RT c11 = diff_of_products(m.r0().x(), m.r2().z(), m.r2().x(), m.r0().z());
RT c22 = determinant(m.r0().x(),m.r0().y(),m.r1().x(),m.r1().y()); RT c12 = -diff_of_products(m.r0().x(), m.r2().y(), m.r2().x(), m.r0().y());
RT c20 = diff_of_products(m.r0().y(), m.r1().z(), m.r1().y(), m.r0().z());
RT c21 = -diff_of_products(m.r0().x(), m.r1().z(), m.r1().x(), m.r0().z());
RT c22 = diff_of_products(m.r0().x(), m.r1().y(), m.r1().x(), m.r0().y());
return MatrixC33<R>(c00,c01,c02, return MatrixC33<R>(c00,c01,c02,
c10,c11,c12, c10,c11,c12,
@ -211,7 +215,9 @@ std::optional< MatrixC33<R> > inverse_matrix(const MatrixC33<R>& m)
{ {
typedef typename R::RT RT; typedef typename R::RT RT;
typedef MatrixC33<R> Matrix; typedef MatrixC33<R> Matrix;
typedef std::optional<Matrix> result_type; typedef std::optional<Matrix> result_type;
using ::CGAL::Surface_mesh_simplification::internal::diff_of_products;
result_type rInverse; result_type rInverse;
@ -219,17 +225,17 @@ std::optional< MatrixC33<R> > inverse_matrix(const MatrixC33<R>& m)
if(! CGAL_NTS is_zero(det)) if(! CGAL_NTS is_zero(det))
{ {
RT c00 = (m.r1().y()*m.r2().z() - m.r1().z()*m.r2().y()) / det; RT c00 = diff_of_products(m.r1().y(),m.r2().z(),m.r2().y(),m.r1().z()) / det;
RT c01 = (m.r2().y()*m.r0().z() - m.r0().y()*m.r2().z()) / det; RT c01 = diff_of_products(m.r2().y(),m.r0().z(),m.r0().y(),m.r2().z()) / det;
RT c02 = (m.r0().y()*m.r1().z() - m.r1().y()*m.r0().z()) / det; RT c02 = diff_of_products(m.r0().y(),m.r1().z(),m.r1().y(),m.r0().z()) / det;
RT c10 = (m.r1().z()*m.r2().x() - m.r1().x()*m.r2().z()) / det; RT c10 = diff_of_products(m.r2().x(),m.r1().z(),m.r1().x(),m.r2().z()) / det;
RT c11 = (m.r0().x()*m.r2().z() - m.r2().x()*m.r0().z()) / det; RT c11 = diff_of_products(m.r0().x(),m.r2().z(),m.r2().x(),m.r0().z()) / det;
RT c12 = (m.r1().x()*m.r0().z() - m.r0().x()*m.r1().z()) / det; RT c12 = diff_of_products(m.r1().x(),m.r0().z(),m.r0().x(),m.r1().z()) / det;
RT c20 = (m.r1().x()*m.r2().y() - m.r2().x()*m.r1().y()) / det; RT c20 = diff_of_products(m.r1().x(),m.r2().y(),m.r2().x(),m.r1().y()) / det;
RT c21 = (m.r2().x()*m.r0().y() - m.r0().x()*m.r2().y()) / det; RT c21 = diff_of_products(m.r2().x(),m.r0().y(),m.r0().x(),m.r2().y()) / det;
RT c22 = (m.r0().x()*m.r1().y() - m.r0().y()*m.r1().x()) / det; RT c22 = diff_of_products(m.r0().x(),m.r1().y(),m.r1().x(),m.r0().y()) / det;
rInverse = result_type(Matrix(c00,c01,c02, rInverse = result_type(Matrix(c00,c01,c02,
c10,c11,c12, c10,c11,c12,

View File

@ -18,6 +18,7 @@
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_profile.h> #include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_profile.h>
#include <CGAL/Cartesian/MatrixC33.h> #include <CGAL/Cartesian/MatrixC33.h>
#include <CGAL/internal/robust_cross_product.h>
#include <limits> #include <limits>
#include <vector> #include <vector>
@ -101,6 +102,8 @@ private :
void extract_triangle_data(); void extract_triangle_data();
void extract_boundary_data(); void extract_boundary_data();
double maxBb;
void add_boundary_preservation_constraints(const Boundary_data_vector& aBdry); void add_boundary_preservation_constraints(const Boundary_data_vector& aBdry);
void add_volume_preservation_constraints(const Triangle_data_vector& triangles); void add_volume_preservation_constraints(const Triangle_data_vector& triangles);
void add_boundary_and_volume_optimization_constraints(const Boundary_data_vector& aBdry, void add_boundary_and_volume_optimization_constraints(const Boundary_data_vector& aBdry,
@ -119,42 +122,6 @@ private :
const Geom_traits& geom_traits() const { return mProfile.geom_traits(); } const Geom_traits& geom_traits() const { return mProfile.geom_traits(); }
const TM& surface() const { return mProfile.surface(); } const TM& surface() const { return mProfile.surface(); }
#if 0
// a*b - c*d
// The next two functions are from https://stackoverflow.com/questions/63665010/accurate-floating-point-computation-of-the-sum-and-difference-of-two-products
static double diff_of_products_kahan(const double a, const double b, const double c, const double d)
{
double w = d * c;
double e = std::fma(c, -d, w);
double f = std::fma(a, b, -w);
return f + e;
}
static double diff_of_products_cht(const double a, const double b, const double c, const double d)
{
double p1 = a * b;
double p2 = c * d;
double e1 = std::fma (a, b, -p1);
double e2 = std::fma (c, -d, p2);
double r = p1 - p2;
double e = e1 + e2;
return r + e;
}
static double diff_of_products(const double a, const double b, const double c, const double d)
{
// the next two are equivalent in results and speed
return diff_of_products_kahan(a, b, c, d);
// return diff_of_products_cht(a, b, c, d);
}
template <typename OFT>
static OFT diff_of_products(const OFT& a, const OFT& b, const OFT& c, const OFT& d)
{
return a*b - c*d;
}
#endif
#ifdef __AVX__ #ifdef __AVX__
static Vector SL_cross_product_avx(const Vector& A, const Vector& B) static Vector SL_cross_product_avx(const Vector& A, const Vector& B)
{ {
@ -185,67 +152,10 @@ private :
} }
#endif #endif
static Vector SL_cross_product(const Vector& a, const Vector& b)
{
const FT ax=a.x(), ay=a.y(), az=a.z();
const FT bx=b.x(), by=b.y(), bz=b.z();
auto compute_minor = [](double ai, double bi, double aj, double bj)
{
// The main idea is that we expect ai and bi (and aj and bj) to have roughly the same magnitude
// since this function is used to compute the cross product of two vectors that are defined
// as (ORIGIN, pa) and (ORIGIN, pb) and pa and pb are part of the same triangle.
//
// We can abuse this fact to trade 2 extra subtractions to lower the error.
return ai * (bj - aj) + aj * (ai - bi);
};
// ay*
FT x = compute_minor(ay, by, az, bz);
FT y = compute_minor(az, bz, ax, bx);
FT z = compute_minor(ax, bx, ay, by);
return Vector(x, y, z);
}
#if 0
static Vector exact_cross_product(const Vector& a, const Vector& b)
{
CGAL::Cartesian_converter<Geom_traits, CGAL::Exact_predicates_exact_constructions_kernel> to_exact;
CGAL::Cartesian_converter<CGAL::Exact_predicates_exact_constructions_kernel, Geom_traits> to_approx;
auto exv = cross_product(to_exact(a), to_exact(b));
exv.exact();
return to_approx(exv);
}
#endif
static Vector X_product(const Vector& u, const Vector& v)
{
#if 0
// this can create large errors and spiky meshes for kernels with inexact constructions
return CGAL::cross_product(u,v);
#elif 0
// improves the problem mentioned above a bit, but not enough
return { std::fma(u.y(), v.z(), -u.z()*v.y()),
std::fma(u.z(), v.x(), -u.x()*v.z()),
std::fma(u.x(), v.y(), -u.y()*v.x()) };
#elif 0
// this is the best without resorting to exact, but it inflicts a 20% slowdown
return { diff_of_products(u.y(), v.z(), u.z(), v.y()),
diff_of_products(u.z(), v.x(), u.x(), v.z()),
diff_of_products(u.x(), v.y(), u.y(), v.x()) };
#elif 1
// balanced solution based on abusing the fact that here we expect u and v to have similar coordinates
return SL_cross_product(u, v);
#elif 0
// obviously too slow
return exact_cross_product(u, v);
#endif
}
static Vector point_cross_product(const Point& a, const Point& b) static Vector point_cross_product(const Point& a, const Point& b)
{ {
return X_product(a-ORIGIN, b-ORIGIN); return robust_cross_product<Geom_traits>(a-ORIGIN, b-ORIGIN);
} }
// This is the (uX)(Xu) product described in the Lindstrom-Turk paper // This is the (uX)(Xu) product described in the Lindstrom-Turk paper
@ -352,17 +262,21 @@ LindstromTurkCore<TM,K>::
extract_triangle_data() extract_triangle_data()
{ {
mTriangle_data.reserve(mProfile.triangles().size()); mTriangle_data.reserve(mProfile.triangles().size());
maxBb = 0.0;
for(const Triangle& tri : mProfile.triangles()) for(const Triangle& tri : mProfile.triangles())
{ {
const Point_reference p0 = get_point(tri.v0); const Point_reference p0 = get_point(tri.v0);
const Point_reference p1 = get_point(tri.v1); const Point_reference p1 = get_point(tri.v1);
const Point_reference p2 = get_point(tri.v2); const Point_reference p2 = get_point(tri.v2);
maxBb=(std::max)({maxBb,CGAL::abs(p0.x()),CGAL::abs(p0.y()),CGAL::abs(p0.z()),
CGAL::abs(p1.x()),CGAL::abs(p1.y()),CGAL::abs(p1.z()),
CGAL::abs(p2.x()),CGAL::abs(p2.y()),CGAL::abs(p2.z())});
Vector v01 = p1 - p0; Vector v01 = p1 - p0;
Vector v02 = p2 - p0; Vector v02 = p2 - p0;
Vector lNormalV = cross_product(v01,v02); Vector lNormalV = robust_cross_product<Geom_traits>(v01,v02);
FT lNormalL = point_cross_product(p0,p1) * (p2 - ORIGIN); FT lNormalL = point_cross_product(p0,p1) * (p2 - ORIGIN);
CGAL_SMS_LT_TRACE(1, " Extracting triangle v" << tri.v0 << "->v" << tri.v1 << "->v" << tri.v2 CGAL_SMS_LT_TRACE(1, " Extracting triangle v" << tri.v0 << "->v" << tri.v1 << "->v" << tri.v2
@ -370,6 +284,7 @@ extract_triangle_data()
mTriangle_data.push_back(Triangle_data(lNormalV,lNormalL)); mTriangle_data.push_back(Triangle_data(lNormalV,lNormalL));
} }
maxBb *= 2.0; // to avoid numerical problems
} }
template<class TM, class K> template<class TM, class K>
@ -394,11 +309,12 @@ compute_placement()
// A1 * v = b1 // A1 * v = b1
// A2 * v = b2 // A2 * v = b2
// //
// Which in matrix form is : A * v = b // Which in matrix form is: A * v = b
// //
// (with 'A' a 3x3 matrix and 'b' a vector) // (with 'A' a 3x3 matrix and 'b' a vector)
// //
// The member variable mConstrinas contains A and b. Indidivual constraints (Ai,bi) can be added to it. // The member variables mConstraints_A and mConstraints_b contain A and b.
// Indidivual constraints (Ai,bi) can be added to it.
// Once 3 such constraints have been added 'v' is directly solved a: // Once 3 such constraints have been added 'v' is directly solved a:
// //
// v = b*inverse(A) // v = b*inverse(A)
@ -421,7 +337,7 @@ compute_placement()
// In that case there is simply no good vertex placement // In that case there is simply no good vertex placement
if(mConstraints_n == 3) if(mConstraints_n == 3)
{ {
// If the matrix is singular it's inverse cannot be computed so an 'absent' value is returned. // If the matrix is singular its inverse cannot be computed so an 'absent' value is returned.
std::optional<Matrix> lOptional_Ai = inverse_matrix(mConstraints_A); std::optional<Matrix> lOptional_Ai = inverse_matrix(mConstraints_A);
if(lOptional_Ai) if(lOptional_Ai)
{ {
@ -686,7 +602,10 @@ add_constraint_if_alpha_compatible(const Vector& Ai,
FT l = CGAL_NTS sqrt(slai); FT l = CGAL_NTS sqrt(slai);
CGAL_SMS_LT_TRACE(3, " l: " << n_to_string(l)); CGAL_SMS_LT_TRACE(3, " l: " << n_to_string(l));
if(!CGAL_NTS is_zero(l)) // Due to double number type, l may have a small value instead of zero (example sum of the face normals of a tetrahedron for volume constraint)
// if bi is greater than maxBb, we consider that l is zero
CGAL_SMS_LT_TRACE(3, " error consider: " << (CGAL::abs(bi) / maxBb));
if(l > (CGAL::abs(bi) / maxBb))
{ {
Vector Ain = Ai / l; Vector Ain = Ai / l;
FT bin = bi / l; FT bin = bi / l;
@ -861,6 +780,7 @@ add_constraint_from_gradient(const Matrix& H,
} }
break; break;
} }
} }
} // namespace internal } // namespace internal

View File

@ -114,8 +114,9 @@ inline std::string optional_to_string(const std::optional<T>& o) {
namespace internal { namespace { bool cgal_enable_sms_trace = true; } } namespace internal { namespace { bool cgal_enable_sms_trace = true; } }
#define CGAL_SMS_TRACE_IMPL(m) \ #define CGAL_SMS_TRACE_IMPL(m) \
if(::internal::cgal_enable_sms_trace) { \ if(::internal::cgal_enable_sms_trace) { \
std::ostringstream ss; ss << m; std::string s = ss.str(); \ std::ostringstream ss; ss << m; \
/*Surface_simplification_external_trace(s)*/ std::cerr << s << std::endl; \ std::string s = ss.str(); \
Surface_simplification_external_trace(s); \
} }
#define CGAL_SMS_DEBUG_CODE(code) code #define CGAL_SMS_DEBUG_CODE(code) code

View File

@ -296,6 +296,8 @@ private:
void insert_in_PQ(const halfedge_descriptor h, Edge_data& data) void insert_in_PQ(const halfedge_descriptor h, Edge_data& data)
{ {
CGAL_SMS_TRACE(5, "Insert " << edge_to_string(h) << " in PQ");
CGAL_assertion(is_primary_edge(h)); CGAL_assertion(is_primary_edge(h));
CGAL_expensive_assertion(!data.is_in_PQ()); CGAL_expensive_assertion(!data.is_in_PQ());
CGAL_expensive_assertion(!mPQ->contains(h)); CGAL_expensive_assertion(!mPQ->contains(h));
@ -594,12 +596,33 @@ loop()
std::optional<halfedge_descriptor> opt_h; std::optional<halfedge_descriptor> opt_h;
// #define CGAL_SURF_SIMPL_INTERMEDIATE_STEPS_PRINTING
#ifdef CGAL_SURF_SIMPL_INTERMEDIATE_STEPS_PRINTING #ifdef CGAL_SURF_SIMPL_INTERMEDIATE_STEPS_PRINTING
int i_rm = 0; int i_rm = 0;
#endif #endif
while((opt_h = pop_from_PQ())) for(;;)
{ {
#ifdef CGAL_SURFACE_SIMPLIFICATION_ENABLE_TRACE
if(5 <= CGAL_SURFACE_SIMPLIFICATION_ENABLE_TRACE)
{
CGAL_SMS_TRACE_IMPL("== Current queue ==");
auto mPQ_clone = *mPQ;
std::optional<halfedge_descriptor> opt_th;
while((opt_th = mPQ_clone.extract_top()))
{
CGAL_SMS_TRACE_IMPL("\t" + edge_to_string(*opt_th));
Cost_type tcost = get_data(*opt_th).cost();
if(tcost)
CGAL_SMS_TRACE_IMPL("\t" + std::to_string(CGAL::to_double(*tcost)));
}
}
#endif
if(!(opt_h = pop_from_PQ()))
break;
CGAL_SMS_TRACE(1, "Popped " << edge_to_string(*opt_h)); CGAL_SMS_TRACE(1, "Popped " << edge_to_string(*opt_h));
CGAL_assertion(!is_constrained(*opt_h)); CGAL_assertion(!is_constrained(*opt_h));
@ -639,7 +662,7 @@ loop()
m_visitor.OnNonCollapsable(profile); m_visitor.OnNonCollapsable(profile);
CGAL_SMS_TRACE(1, edge_to_string(*opt_h) << " NOT Collapsible" ); CGAL_SMS_TRACE(1, edge_to_string(*opt_h) << " NOT Collapsible (filter)" );
} }
#ifdef CGAL_SURF_SIMPL_INTERMEDIATE_STEPS_PRINTING #ifdef CGAL_SURF_SIMPL_INTERMEDIATE_STEPS_PRINTING
@ -660,7 +683,7 @@ loop()
m_visitor.OnNonCollapsable(profile); m_visitor.OnNonCollapsable(profile);
CGAL_SMS_TRACE(1, edge_to_string(*opt_h) << " NOT Collapsible" ); CGAL_SMS_TRACE(1, edge_to_string(*opt_h) << " NOT Collapsible (topology)" );
} }
} }
else else
@ -823,7 +846,10 @@ is_collapse_topologically_valid(const Profile& profile)
{ {
/// ensure two constrained edges cannot get merged /// ensure two constrained edges cannot get merged
if(is_edge_adjacent_to_a_constrained_edge(profile, m_ecm)) if(is_edge_adjacent_to_a_constrained_edge(profile, m_ecm))
{
CGAL_SMS_TRACE(3," edge to collapse is adjacent to a constrained edge.");
return false; return false;
}
if(profile.is_v0_v1_a_border()) if(profile.is_v0_v1_a_border())
{ {

View File

@ -0,0 +1,143 @@
// Copyright (c) 2025 GeometryFactory (France). All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
//
// $URL$
// $Id$
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
//
// Author(s) : Mael Rouxel-Labbé
//
#ifndef CGAL_SMS_INTERNAL_ROBUST_CROSS_PRODUCT_H
#define CGAL_SMS_INTERNAL_ROBUST_CROSS_PRODUCT_H
#include <CGAL/license/Surface_mesh_simplification.h>
#include <CGAL/Surface_mesh_simplification/internal/Common.h>
#include <optional>
namespace CGAL {
namespace Surface_mesh_simplification {
namespace internal {
// a*b - c*d
// The next two functions are from https://stackoverflow.com/questions/63665010/accurate-floating-point-computation-of-the-sum-and-difference-of-two-products
inline double diff_of_products_kahan(const double a, const double b, const double c, const double d)
{
double w = d * c;
double e = std::fma(c, -d, w);
double f = std::fma(a, b, -w);
return f + e;
}
inline double diff_of_products_cht(const double a, const double b, const double c, const double d)
{
double p1 = a * b;
double p2 = c * d;
double e1 = std::fma (a, b, -p1);
double e2 = std::fma (c, -d, p2);
double r = p1 - p2;
double e = e1 + e2;
return r + e;
}
inline double diff_of_products(const double a, const double b, const double c, const double d)
{
#if 0
// this can create large errors with inexact constructions
return a*b - c*d;
// the next two are equivalent in results and speed
#elif 1
return diff_of_products_kahan(a, b, c, d);
#elif 0
return diff_of_products_cht(a, b, c, d);
#endif
}
template <typename OFT>
inline OFT diff_of_products(const OFT& a, const OFT& b, const OFT& c, const OFT& d)
{
return a*b - c*d;
}
// balanced solution based on abusing the fact that here we expect u and v to have similar coordinates
template<class GeomTraits>
typename GeomTraits::Vector_3 similar_coordinates_cross_product(const typename GeomTraits::Vector_3& u,
const typename GeomTraits::Vector_3& v)
{
using FT = typename GeomTraits::FT;
using Vector = typename GeomTraits::Vector_3;
const FT& ux = u.x();
const FT& uy = u.y();
const FT& uz = u.z();
const FT& vx = v.x();
const FT& vy = v.y();
const FT& vz = v.z();
auto minor = [](const FT& ui, const FT& vi, const FT& uj, const FT& vj)
{
// The main idea is that we expect ai and bi (and aj and bj) to have roughly the same magnitude
// since this function is used to compute the cross product of two vectors that are defined
// as (ORIGIN, pa) and (ORIGIN, pb) and pa and pb are part of the same triangle.
//
// We can abuse this fact to trade 2 extra subtractions to lower the error.
return ui * (vj - uj) + uj * (ui - vi);
};
// ay*
FT x = minor(uy, vy, uz, vz);
FT y = minor(uz, vz, ux, vx);
FT z = minor(ux, vx, uy, vy);
return Vector(x, y, z);
}
#if 0
template<class GeomTraits>
typename GeomTraits::Vector_3 exact_cross_product(const typename GeomTraits::Vector_3& a,
const typename GeomTraits::Vector_3& b)
{
CGAL::Cartesian_converter<GeomTraits, CGAL::Exact_predicates_exact_constructions_kernel> to_exact;
CGAL::Cartesian_converter<CGAL::Exact_predicates_exact_constructions_kernel, GeomTraits> to_approx;
auto exv = cross_product(to_exact(a), to_exact(b));
exv.exact();
return to_approx(exv);
}
#endif
template<class GeomTraits>
typename GeomTraits::Vector_3 robust_cross_product(const typename GeomTraits::Vector_3& u,
const typename GeomTraits::Vector_3& v)
{
#if 0
// this can create large errors and spiky meshes for kernels with inexact constructions
return CGAL::cross_product(u,v);
#elif 0
// improves the problem mentioned above a bit, but not enough
return { std::fma(u.y(), v.z(), -u.z()*v.y()),
std::fma(u.z(), v.x(), -u.x()*v.z()),
std::fma(u.x(), v.y(), -u.y()*v.x()) };
#elif 0
// this is the best without resorting to exact, but it inflicts a 20% slowdown
return { diff_of_products(u.y(), v.z(), u.z(), v.y()),
diff_of_products(u.z(), v.x(), u.x(), v.z()),
diff_of_products(u.x(), v.y(), u.y(), v.x()) };
#elif 0
// obviously too slow
return exact_cross_product(u, v);
#elif 1
// balanced solution based on abusing the fact that in this package, we usually have that
// u and v to have similar coordinates
return similar_coordinates_cross_product<GeomTraits>(u, v);
#endif
}
} // namespace CGAL
} // namespace Surface_mesh_simplification
} // namespace internal
#endif // CGAL_SMS_INTERNAL_ROBUST_CROSS_PRODUCT_H

View File

@ -6,6 +6,7 @@ project(Surface_mesh_simplification_Tests)
find_package(CGAL REQUIRED) find_package(CGAL REQUIRED)
create_single_source_cgal_program("issue_8213.cpp")
create_single_source_cgal_program("edge_collapse_topology.cpp") create_single_source_cgal_program("edge_collapse_topology.cpp")
create_single_source_cgal_program("test_edge_collapse_bounded_distance.cpp") create_single_source_cgal_program("test_edge_collapse_bounded_distance.cpp")
create_single_source_cgal_program("test_edge_collapse_Envelope.cpp") create_single_source_cgal_program("test_edge_collapse_Envelope.cpp")

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