Merge remote-tracking branch 'cgal/master' into CGAL-Prepare_CHANGES.md_5.6-GF

This commit is contained in:
Mael Rouxel-Labbé 2023-06-05 15:56:16 +02:00
commit 916f3fec5d
32 changed files with 362 additions and 246 deletions

View File

@ -25,8 +25,6 @@ using Mesh = CGAL::Surface_mesh<Point_3>;
int main(int argc, char** argv)
{
std::cout.precision(17);
// Read the inputs
const std::string ts_filename = (argc > 1) ? argv[1] : CGAL::data_file_path("meshes/armadillo.off"); // triangle soup
const std::string ss_filename = (argc > 2) ? argv[2] : CGAL::data_file_path("images/420.polylines.txt"); // segment soup

View File

@ -8,8 +8,6 @@
#include <iostream>
#include <string>
namespace AW3 = CGAL::Alpha_wraps_3;
using K = CGAL::Exact_predicates_inexact_constructions_kernel;
using Point_3 = K::Point_3;
@ -18,8 +16,6 @@ using Mesh = CGAL::Surface_mesh<Point_3>;
int main(int argc, char** argv)
{
std::cout.precision(17);
// Read the input
const std::string filename = (argc > 1) ? argv[1] : CGAL::data_file_path("points_3/oni.pwn");
std::cout << "Reading " << filename << "..." << std::endl;

View File

@ -9,7 +9,6 @@
#include <iostream>
#include <string>
namespace AW3 = CGAL::Alpha_wraps_3;
namespace PMP = CGAL::Polygon_mesh_processing;
using K = CGAL::Exact_predicates_inexact_constructions_kernel;
@ -19,8 +18,6 @@ using Mesh = CGAL::Surface_mesh<Point_3>;
int main(int argc, char** argv)
{
std::cout.precision(17);
// Read the input
const std::string filename = (argc > 1) ? argv[1] : CGAL::data_file_path("meshes/armadillo.off");
std::cout << "Reading " << filename << "..." << std::endl;

View File

@ -8,7 +8,6 @@
#include <iostream>
#include <string>
namespace AW3 = CGAL::Alpha_wraps_3;
namespace PMP = CGAL::Polygon_mesh_processing;
using K = CGAL::Exact_predicates_inexact_constructions_kernel;
@ -18,8 +17,6 @@ using Mesh = CGAL::Surface_mesh<Point_3>;
int main(int argc, char** argv)
{
std::cout.precision(17);
// Read the input
const std::string filename = (argc > 1) ? argv[1] : CGAL::data_file_path("meshes/armadillo.off");
std::cout << "Reading " << filename << "..." << std::endl;

View File

@ -290,7 +290,7 @@ by the user at runtime with the second argument.
\section TutorialsReconstruction_pipeline Full Pipeline Images
The following figure an example of a full reconstruction pipeline
The following figures show a full reconstruction pipeline
applied to a bear statue (courtesy _EPFL Computer Graphics and
Geometry Laboratory_ \cgalCite{cgal:e-esmr}). Two mesh processing
algorithms (hole filling and isotropic remeshing) are also applied

View File

@ -1,3 +1,5 @@
# Copy of https://github.com/NVIDIA/thrust/blob/9f1cddc62b1bebbaeb8d07d4476c285be5aa0adc/thrust/cmake/FindTBB.cmake
#
# - Find ThreadingBuildingBlocks include dirs and libraries
# Use this module by invoking find_package with the form:
# find_package(TBB
@ -11,6 +13,7 @@
# malloc proxy
# TBB::tbb - imported target for the TBB library
#
# TBB_VERSION - Product Version Number ("MAJOR.MINOR")
# TBB_VERSION_MAJOR - Major Product Version Number
# TBB_VERSION_MINOR - Minor Product Version Number
# TBB_INTERFACE_VERSION - Engineering Focused Version Number
@ -107,16 +110,17 @@ endfunction()
# Do the final processing for the package find.
#===============================================
macro(findpkg_finish PREFIX TARGET_NAME)
# skip if already processed during this run
if (NOT ${PREFIX}_FOUND)
if (${PREFIX}_INCLUDE_DIR AND ${PREFIX}_LIBRARY)
set(${PREFIX}_FOUND TRUE)
set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIR})
set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARY})
else ()
if (${PREFIX}_FIND_REQUIRED AND NOT ${PREFIX}_FIND_QUIETLY)
if (${PREFIX}_FIND_REQUIRED)
message(FATAL_ERROR "Required library ${PREFIX} not found.")
elseif (NOT ${PREFIX}_FIND_QUIETLY)
message("Library ${PREFIX} not found.")
endif()
return()
endif ()
if (NOT TARGET "TBB::${TARGET_NAME}")
@ -148,7 +152,6 @@ macro(findpkg_finish PREFIX TARGET_NAME)
${PREFIX}_LIBRARY
${PREFIX}_LIBRARY_DEBUG
${PREFIX}_LIBRARY_RELEASE)
endif ()
endmacro()
#===============================================
@ -188,6 +191,10 @@ endmacro()
#=============================================================================
# Now to actually find TBB
#
# Get path, convert backslashes as ${ENV_${var}}
getenv_path(TBB_ROOT)
#start with looking for TBB_DIR and TBB_ROOT
if((TBB_ROOT OR "$ENV{TBB_ROOT}" OR "$ENV{TBB_DIR}" ) AND NOT TBB_FOUND)
find_package(TBB QUIET NO_MODULE NO_CMAKE_SYSTEM_PATH NO_SYSTEM_ENVIRONMENT_PATH)
@ -202,9 +209,6 @@ if(TBB_FOUND)
return()
endif()#TBB_FOUND
# Get path, convert backslashes as ${ENV_${var}}
getenv_path(TBB_ROOT)
if(NOT ENV_TBB_ROOT)
getenv_path(TBBROOT)
set(ENV_TBB_ROOT ${ENV_TBBROOT})
@ -253,8 +257,26 @@ if (WIN32 AND MSVC)
set(COMPILER_PREFIX "vc11")
elseif(MSVC_VERSION EQUAL 1800)
set(COMPILER_PREFIX "vc12")
elseif(MSVC_VERSION EQUAL 1900)
elseif(MSVC_VERSION GREATER_EQUAL 1900 AND MSVC_VERSION LESS_EQUAL 1939)
# 1900-1925 actually spans three Visual Studio versions:
# 1900 = VS 14.0 (v140 toolset) a.k.a. MSVC 2015
# 1910-1919 = VS 15.0 (v141 toolset) a.k.a. MSVC 2017
# 1920-1929 = VS 16.0 (v142 toolset) a.k.a. MSVC 2019
# 1930-1939 = VS 17.0 (v143 toolset) a.k.a. MSVC 2022
#
# But these are binary compatible and TBB's open source distribution only
# ships a single vs14 lib (as of 2020.0)
set(COMPILER_PREFIX "vc14")
else()
# The next poor soul who finds themselves having to decode visual studio
# version conventions may find these helpful:
# - https://cmake.org/cmake/help/latest/variable/MSVC_VERSION.html
# - https://en.wikipedia.org/wiki/Microsoft_Visual_C%2B%2B#Internal_version_numbering
message(AUTHOR_WARNING
"Unrecognized MSVC version (${MSVC_VERSION}). "
"Please update FindTBB.cmake. "
"Some TBB_* CMake variables may need to be set manually."
)
endif ()
# for each prefix path, add ia32/64\${COMPILER_PREFIX}\lib to the lib search path
@ -351,7 +373,6 @@ endforeach ()
set(TBB_LIBRARY_NAMES tbb)
get_debug_names(TBB_LIBRARY_NAMES)
find_path(TBB_INCLUDE_DIR
NAMES tbb/tbb.h
PATHS ${TBB_INC_SEARCH_PATH})
@ -411,12 +432,18 @@ findpkg_finish(TBB_MALLOC_PROXY tbbmalloc_proxy)
#=============================================================================
#parse all the version numbers from tbb
# Parse all the version numbers from tbb.
if(NOT TBB_VERSION)
if(EXISTS "${TBB_INCLUDE_DIR}/tbb/version.h")
# The newer oneTBB provides tbb/version.h but no tbb/tbb_stddef.h.
set(version_file "${TBB_INCLUDE_DIR}/tbb/version.h")
else()
# Older TBB provides tbb/tbb_stddef.h but no tbb/version.h.
set(version_file "${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h")
endif()
#only read the start of the file
file(STRINGS
"${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h"
"${version_file}"
TBB_VERSION_CONTENTS
REGEX "VERSION")
@ -436,4 +463,5 @@ if(NOT TBB_VERSION)
".*#define TBB_COMPATIBLE_INTERFACE_VERSION ([0-9]+).*" "\\1"
TBB_COMPATIBLE_INTERFACE_VERSION "${TBB_VERSION_CONTENTS}")
set(TBB_VERSION "${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR}")
endif()

View File

@ -210,7 +210,7 @@ int main(int argc, char*argv[])
for (Point_set::Index idx : points)
f << points.point (idx) << std::endl;
for (const auto& facet : CGAL::make_range (reconstruct.facets_begin(), reconstruct.facets_end()))
f << "3 "<< facet << std::endl;
f << "3 "<< facet[0] << " " << facet[1] << " " << facet[2] << std::endl;
f.close ();
//! [Output scale space]

View File

@ -31,9 +31,9 @@ namespace Polygon_mesh_processing {
/*!
* \ingroup PMP_meshing_grp
*
* \short smooths a triangulated region of a polygon mesh.
* \brief smooths a triangulated region of a polygon mesh.
*
* This function attempts to make the triangle angle and area distributions as uniform as possible
* This function aims to make the triangle angle and area distributions as uniform as possible
* by moving (non-constrained) vertices.
*
* Angle-based smoothing does not change the combinatorial information of the mesh. Area-based smoothing
@ -329,13 +329,33 @@ void angle_and_area_smoothing(const FaceRange& faces,
}
}
///\cond SKIP_IN_MANUAL
/*!
* \ingroup PMP_meshing_grp
*
* \brief smooths a polygon mesh.
*
* This function aims to make the triangle angle and area distributions as uniform as possible
* by moving (non-constrained) vertices.
*
* Angle-based smoothing does not change the combinatorial information of the mesh. Area-based smoothing
* might change the combinatorial information, unless specified otherwise. It is also possible
* to make the smoothing algorithm "safer" by rejecting moves that, when applied, would worsen the
* quality of the mesh, e.g. that would decrease the value of the smallest angle around a vertex or
* create self-intersections.
*
* Optionally, the points are reprojected after each iteration.
*
* See the overload which takes a face range as additonal parameter for a comprehensive description
* of the parameters.
*/
template <typename TriangleMesh, typename CGAL_NP_TEMPLATE_PARAMETERS>
void angle_and_area_smoothing(TriangleMesh& tmesh, const CGAL_NP_CLASS& np = parameters::default_values())
{
angle_and_area_smoothing(faces(tmesh), tmesh, np);
}
///\cond SKIP_IN_MANUAL
template<typename TriangleMesh, typename GeomTraits, typename Stream>
void angles_evaluation(TriangleMesh& tmesh, GeomTraits traits, Stream& output)
{

View File

@ -1051,7 +1051,9 @@ public:
previous_bitvalue[2] = is_patch_inside_tm1.test(patch_id_q1);
previous_bitvalue[3] = is_patch_inside_tm1.test(patch_id_q2);
#ifndef CGAL_NDEBUG
/*
// Note that this code is commented as impossible_operation flag could be set thanks to
// another polyline and such a `continue` would make us miss it.
if (is_tm1_closed && is_tm2_closed)
{
if (!patch_status_was_not_already_set[0] &&
@ -1060,7 +1062,7 @@ public:
!patch_status_was_not_already_set[3])
continue; // all patches were already classified, no need to redo it
}
#endif
*/
// check incompatibility of patch classifications
auto inconsistent_classification = [&]()
@ -1084,6 +1086,25 @@ public:
}
return false;
};
#ifndef CGAL_NDEBUG
auto debug_check_consistency = [&]()
{
if (!used_to_clip_a_surface && !used_to_classify_patches)
{
CGAL_assertion( patch_status_was_not_already_set[0] || (previous_bitvalue[0]==is_patch_inside_tm2[patch_id_p1]) );
CGAL_assertion( patch_status_was_not_already_set[1] || (previous_bitvalue[1]==is_patch_inside_tm2[patch_id_p2]) );
CGAL_assertion( patch_status_was_not_already_set[2] || (previous_bitvalue[2]==is_patch_inside_tm1[patch_id_q1]) );
CGAL_assertion( patch_status_was_not_already_set[3] || (previous_bitvalue[3]==is_patch_inside_tm1[patch_id_q2]) );
}
};
is_patch_inside_tm2.reset(patch_id_p1);
is_patch_inside_tm2.reset(patch_id_p2);
is_patch_inside_tm1.reset(patch_id_q1);
is_patch_inside_tm1.reset(patch_id_q2);
#else
auto debug_check_consistency = [&](){};
#endif
//indicates that patch status will be updated
patch_status_not_set_tm1.reset(patch_id_p1);
@ -1140,6 +1161,7 @@ public:
if ( q2_is_between_p1p2 ) is_patch_inside_tm1.set(patch_id_q2); //case 1
else is_patch_inside_tm2.set(patch_id_p2); //case 2
if (inconsistent_classification()) return;
debug_check_consistency();
continue;
}
else{
@ -1171,6 +1193,7 @@ public:
is_patch_inside_tm2.set(patch_id_p2);
} //else case 4
if (inconsistent_classification()) return;
debug_check_consistency();
continue;
}
else
@ -1202,6 +1225,7 @@ public:
is_patch_inside_tm2.set(patch_id_p1);
} // else case 6
if (inconsistent_classification()) return;
debug_check_consistency();
continue;
}
else{
@ -1231,6 +1255,7 @@ public:
if ( q1_is_between_p1p2 ) is_patch_inside_tm1.set(patch_id_q1); //case 7
else is_patch_inside_tm2.set(patch_id_p1); //case 8
if (inconsistent_classification()) return;
debug_check_consistency();
continue;
}
}
@ -1393,13 +1418,7 @@ public:
}
}
if (inconsistent_classification()) return;
if (!used_to_clip_a_surface && !used_to_classify_patches)
{
CGAL_assertion( patch_status_was_not_already_set[0] || previous_bitvalue[0]==is_patch_inside_tm2[patch_id_p1] );
CGAL_assertion( patch_status_was_not_already_set[1] || previous_bitvalue[1]==is_patch_inside_tm2[patch_id_p2] );
CGAL_assertion( patch_status_was_not_already_set[2] || previous_bitvalue[2]==is_patch_inside_tm1[patch_id_q1] );
CGAL_assertion( patch_status_was_not_already_set[3] || previous_bitvalue[3]==is_patch_inside_tm1[patch_id_q2] );
}
debug_check_consistency();
}
}

View File

@ -42,6 +42,8 @@ template<class PolygonMesh, class VertexPointMap>
class Refine_Polyhedron_3 {
//// typedefs
typedef typename boost::property_traits<VertexPointMap>::value_type Point_3;
typedef typename boost::property_traits<VertexPointMap>::reference Point_3_ref;
typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor halfedge_descriptor;
typedef typename boost::graph_traits<PolygonMesh>::face_descriptor face_descriptor;
@ -88,7 +90,6 @@ private:
bool relax(halfedge_descriptor h)
{
#ifdef CGAL_PMP_REFINE_DEBUG_PP
typedef typename boost::property_traits<VertexPointMap>::reference Point_3_ref;
Point_3_ref p = get(vpmap, source(h,pmesh));
Point_3_ref q = get(vpmap, target(h,pmesh));
Point_3_ref r = get(vpmap, target(next(h,pmesh),pmesh));
@ -227,7 +228,7 @@ private:
const std::set<face_descriptor>& interior_map,
bool accept_internal_facets)
{
const Point_3& vp = get(vpmap, vh);
const Point_3_ref vp = get(vpmap, vh);
Halfedge_around_target_circulator<PolygonMesh> circ(halfedge(vh,pmesh),pmesh), done(circ);
int deg = 0;
double sum = 0;
@ -239,7 +240,7 @@ private:
{ continue; } // which means current edge is an interior edge and should not be included in scale attribute calculation
}
const Point_3& vq = get(vpmap, target(opposite(*circ,pmesh),pmesh));
const Point_3_ref vq = get(vpmap, target(opposite(*circ,pmesh),pmesh));
sum += to_double(CGAL::approximate_sqrt(CGAL::squared_distance(vp, vq)));
++deg;
} while(++circ != done);

View File

@ -1666,7 +1666,7 @@ locate_with_AABB_tree(const typename internal::Location_traits<TriangleMesh, Nam
typedef typename GetVertexPointMap<TriangleMesh, NamedParameters>::const_type VertexPointMap;
typedef internal::Point_to_Point_3_VPM<TriangleMesh, VertexPointMap> WrappedVPM;
const Point_3& p3 = P_to_P3()(p);
const Point_3 p3 = P_to_P3()(p);
typename AABB_tree<AABB_traits>::Point_and_primitive_id result = tree.closest_point_and_primitive(p3);
typedef typename GetGeomTraits<TriangleMesh, NamedParameters>::type Geom_traits;
@ -1763,7 +1763,7 @@ locate(const typename internal::Location_traits<TriangleMesh, NamedParameters>::
AABB_tree<AABB_face_graph_traits> tree;
build_AABB_tree(tm, tree, parameters::vertex_point_map(wrapped_vpm));
const Point_3& p3 = P_to_P3()(p);
const Point_3 p3 = P_to_P3()(p);
return locate_with_AABB_tree(p3, tree, tm, parameters::vertex_point_map(wrapped_vpm));
}

View File

@ -858,33 +858,37 @@ centroid(const TriangleMesh& tmesh,
get_const_property_map(CGAL::vertex_point, tmesh));
typedef typename GetGeomTraits<TriangleMesh, CGAL_NP_CLASS>::type Kernel;
typedef typename Kernel::Point_3 Point_3;
Kernel k = choose_parameter<Kernel>(get_parameter(np, internal_np::geom_traits));
typedef typename Kernel::FT FT;
typedef typename boost::property_traits<Vpm>::reference Point_3_ref;
typedef typename Kernel::Vector_3 Vector_3;
typedef typename Kernel::Construct_translated_point_3 Construct_translated_point_3;
typedef typename Kernel::Construct_vector_3 Construct_vector_3;
typedef typename Kernel::Construct_normal_3 Construct_normal_3;
typedef typename Kernel::Compute_scalar_product_3 Scalar_product;
typedef typename Kernel::Construct_scaled_vector_3 Scale;
typedef typename Kernel::Construct_sum_of_vectors_3 Sum;
typedef typename boost::graph_traits<TriangleMesh>::face_descriptor face_descriptor;
typedef typename Kernel::FT FT;
FT volume = 0;
Vector_3 centroid(NULL_VECTOR);
Construct_translated_point_3 point;
Construct_vector_3 vector;
Construct_normal_3 normal;
Scalar_product scalar_product;
Scale scale;
Sum sum;
Construct_translated_point_3 point = k.construct_translated_point_3_object();
Construct_vector_3 vector = k.construct_vector_3_object();
Construct_normal_3 normal = k.construct_normal_3_object();
Scalar_product scalar_product = k.compute_scalar_product_3_object();
Scale scale = k.construct_scaled_vector_3_object();
Sum sum = k.construct_sum_of_vectors_3_object();
for(face_descriptor fd : faces(tmesh))
{
const Point_3& p = get(vpm, target(halfedge(fd, tmesh), tmesh));
const Point_3& q = get(vpm, target(next(halfedge(fd, tmesh), tmesh), tmesh));
const Point_3& r = get(vpm, target(prev(halfedge(fd, tmesh), tmesh), tmesh));
const Point_3_ref p = get(vpm, target(halfedge(fd, tmesh), tmesh));
const Point_3_ref q = get(vpm, target(next(halfedge(fd, tmesh), tmesh), tmesh));
const Point_3_ref r = get(vpm, target(prev(halfedge(fd, tmesh), tmesh), tmesh));
Vector_3 vp = vector(ORIGIN, p),
vq = vector(ORIGIN, q),
vr = vector(ORIGIN, r);

View File

@ -483,7 +483,7 @@ struct Filter_wrapper_for_cap_needle_removal<TriangleMesh, VPM, Traits, std::fun
{
std::vector<face_descriptor> link_faces;
collect_link_faces(e, link_faces);
Functor f = std::move(m_make_envelope(link_faces));
Functor f = m_make_envelope(link_faces);
Base base(m_tm, m_vpm, f);
return base.collapse(e);
}

View File

@ -14,6 +14,8 @@ for i in `seq 1 $k`; do
ri=`echo $files | awk '{print $5}'`
rm=`echo $files | awk '{print $6}'`
rmr=`echo $files | awk '{print $7}'`
f1=`eval echo $f1`
f2=`eval echo $f2`
echo -n "==== " $f1 $f2 " "
if (./test_corefinement_bool_op $f1 $f2 ALL $ru $ri $rm $rmr|| false ) > /dev/null 2>&1; then

View File

@ -1,3 +1,21 @@
${CGAL_DATA_DIR}/meshes/elephant.off ${CGAL_DATA_DIR}/meshes/sphere.off ALL 1 1 1 1
${CGAL_DATA_DIR}/meshes/open_cube.off data-coref/incompatible_with_open_cube.off ALL 0 0 0 0
data-coref/floating_squares.off data-coref/hexa.off ALL 1 1 1 1
data-coref/star_tgt1-0.off data-coref/star_tgt2-0.off ALL 1 1 1 0
data-coref/star_tgt1-0.off data-coref/star_tgt2-1.off ALL 1 1 1 0
data-coref/star_tgt1-0.off data-coref/star_tgt2-2.off ALL 0 1 1 1
data-coref/star_tgt1-0.off data-coref/star_tgt2-3.off ALL 1 1 1 0
data-coref/star_tgt1-0.off data-coref/star_tgt2-4.off ALL 0 1 1 1
data-coref/star_tgt1-0.off data-coref/star_tgt2-5.off ALL 1 1 1 0
data-coref/star_tgt1-1.off data-coref/star_tgt2-0.off ALL 1 1 1 0
data-coref/star_tgt1-1.off data-coref/star_tgt2-1.off ALL 1 1 1 0
data-coref/star_tgt1-1.off data-coref/star_tgt2-2.off ALL 0 1 1 1
data-coref/star_tgt1-1.off data-coref/star_tgt2-3.off ALL 1 1 1 0
data-coref/star_tgt1-1.off data-coref/star_tgt2-4.off ALL 0 1 1 1
data-coref/star_tgt1-1.off data-coref/star_tgt2-5.off ALL 1 1 1 0
data-coref/star_tgt1-2.off data-coref/star_tgt2-0.off ALL 1 1 1 0
data-coref/star_tgt1-2.off data-coref/star_tgt2-1.off ALL 1 1 1 0
data-coref/star_tgt1-2.off data-coref/star_tgt2-2.off ALL 0 1 1 1
data-coref/star_tgt1-2.off data-coref/star_tgt2-3.off ALL 1 1 1 1
data-coref/star_tgt1-2.off data-coref/star_tgt2-4.off ALL 0 1 1 1
data-coref/star_tgt1-2.off data-coref/star_tgt2-5.off ALL 1 1 1 1

View File

@ -29,21 +29,3 @@ data-coref/cube_meshed.off data-coref/cube.off ALL 1 1 1 1
data-coref/cube.off data-coref/cube_interior_tgt.off ALL 1 1 1 1
data-coref/cube.off data-coref/edge_tangent_to_cube.off ALL 1 1 0 1
data-coref/cube_dig.off data-coref/wedge.off ALL 1 1 1 1
data-coref/star_tgt1-0.off data-coref/star_tgt2-0.off ALL 1 1 1 0
data-coref/star_tgt1-0.off data-coref/star_tgt2-1.off ALL 1 1 1 0
data-coref/star_tgt1-0.off data-coref/star_tgt2-2.off ALL 0 1 1 1
data-coref/star_tgt1-0.off data-coref/star_tgt2-3.off ALL 1 1 1 0
data-coref/star_tgt1-0.off data-coref/star_tgt2-4.off ALL 0 1 1 1
data-coref/star_tgt1-0.off data-coref/star_tgt2-5.off ALL 1 1 1 0
data-coref/star_tgt1-1.off data-coref/star_tgt2-0.off ALL 1 1 1 0
data-coref/star_tgt1-1.off data-coref/star_tgt2-1.off ALL 1 1 1 0
data-coref/star_tgt1-1.off data-coref/star_tgt2-2.off ALL 0 1 1 1
data-coref/star_tgt1-1.off data-coref/star_tgt2-3.off ALL 1 1 1 0
data-coref/star_tgt1-1.off data-coref/star_tgt2-4.off ALL 0 1 1 1
data-coref/star_tgt1-1.off data-coref/star_tgt2-5.off ALL 1 1 1 0
data-coref/star_tgt1-2.off data-coref/star_tgt2-0.off ALL 1 1 1 0
data-coref/star_tgt1-2.off data-coref/star_tgt2-1.off ALL 1 1 1 0
data-coref/star_tgt1-2.off data-coref/star_tgt2-2.off ALL 0 1 1 1
data-coref/star_tgt1-2.off data-coref/star_tgt2-3.off ALL 1 1 1 1
data-coref/star_tgt1-2.off data-coref/star_tgt2-4.off ALL 0 1 1 1
data-coref/star_tgt1-2.off data-coref/star_tgt2-5.off ALL 1 1 1 1

View File

@ -3191,8 +3191,8 @@ void MainWindow::on_actionSa_ve_Scene_as_Script_triggered()
tr("Enter the name of your scene file."));
if(path.isEmpty())
return;
if(!path.contains("Polyhedron_demo_"))
path.prepend("Polyhedron_demo_");
if(!path.contains("/tmp/Polyhedron_demo_"))
path.prepend("/tmp/Polyhedron_demo_");
try{
ssh_session session = nullptr;
bool res = establish_ssh_session_from_agent(session,

View File

@ -26,6 +26,10 @@
#include <QMessageBox>
#include <QStringList>
#include <libssh/sftp.h>
#include <fcntl.h>
bool test_result(int res)
{
switch(res){
@ -240,21 +244,22 @@ bool push_file(ssh_session &session,
const char* dest_path,
const char* filepath)
{
std::size_t processed = 0;
sftp_file sftpfile;
//copy a file
ssh_scp scp = ssh_scp_new(
session, SSH_SCP_WRITE | SSH_SCP_RECURSIVE, "/tmp");
if (scp == nullptr)
sftp_session sftp = sftp_new(session);
if (sftp == nullptr)
{
std::cerr<<"Error allocating scp session: %s\n"
std::cerr<<"Error allocating sftp session:\n"
<< ssh_get_error(session)<<std::endl;
return false;
}
int res = ssh_scp_init(scp);
if(res != SSH_OK)
int res = sftp_init(sftp);
if(res < 0)
{
std::cerr<< "Error initializing scp session: %s\n"
std::cerr<< "Error initializing sftp session:\n"
<< ssh_get_error(session)<<std::endl;
ssh_scp_free(scp);
sftp_free(sftp);
ssh_disconnect(session);
return false;
}
@ -263,7 +268,7 @@ bool push_file(ssh_session &session,
if(!file)
{
std::cerr<<"File not found."<<std::endl;
ssh_scp_free(scp);
sftp_free(sftp);
ssh_disconnect(session);
return false;
}
@ -274,44 +279,39 @@ bool push_file(ssh_session &session,
if (!file.read(buffer.data(), size))
{
std::cerr<<"error while reading file."<<std::endl;
ssh_scp_free(scp);
sftp_free(sftp);
ssh_disconnect(session);
return false;
}
//push a file to /tmp
res = ssh_scp_push_directory(scp, ".", 0755);
if (res != SSH_OK)
sftpfile = sftp_open(sftp, dest_path, O_WRONLY | O_CREAT, 0644);
if (sftpfile == NULL)
{
std::cerr<<"Can't create remote directory: %s\n"
std::cerr<< "Can't open remote file:\n"
<< ssh_get_error(session)<<std::endl;
ssh_scp_free(scp);
sftp_free(sftp);
ssh_disconnect(session);
return false;
}
res = ssh_scp_push_file
(scp, dest_path, size, 0644);
if (res != SSH_OK)
while ( size > 0 )
{
std::cerr<< "Can't open remote file: %s\n"
int s = size;
if (s > 16384)
s = 16384;
res = sftp_write(sftpfile, buffer.data() + processed, s);
if ( res < 0)
{
std::cerr<< "Can't write data to file:\n"
<< ssh_get_error(session)<<std::endl;
ssh_scp_free(scp);
sftp_free(sftp);
ssh_disconnect(session);
return false;
}
res = ssh_scp_write(scp, buffer.data(), size);
//some versions of libssh don't copy everything without this.
//This is the case for the official version on Ubuntu 18.04
std::chrono::duration<int, std::micro> timespan(size);
std::this_thread::sleep_for(timespan);
if (res != SSH_OK)
{
std::cerr<< "Can't write to remote file: %s\n"
<< ssh_get_error(session)<<std::endl;
ssh_scp_free(scp);
ssh_disconnect(session);
return false;
size -= res;
processed += res;
}
ssh_scp_free(scp);
sftp_close(sftpfile);
sftp_free(sftp);
return true;
}
@ -319,67 +319,65 @@ bool pull_file(ssh_session &session,
const char* from_path,
const char* to_path)
{
int rc;
std::size_t size;
std::size_t processed = 0;
std::vector<char> buffer;
ssh_scp scp = ssh_scp_new(
session, SSH_SCP_READ | SSH_SCP_RECURSIVE, from_path);
if (scp == nullptr)
sftp_file sftpfile;
sftp_session sftp = sftp_new(session);
if (sftp == nullptr)
{
std::cerr<<"Error allocating scp session: %s\n"
std::cerr<<"Error allocating sftp session:\n"
<< ssh_get_error(session)<<std::endl;
return false;
}
int res = ssh_scp_init(scp);
if(res != SSH_OK)
int res = sftp_init(sftp);
if(res < 0)
{
std::cerr<< "Error initializing scp session: %s\n"
std::cerr<< "Error initializing sftp session:\n"
<< ssh_get_error(session)<<std::endl;
ssh_scp_free(scp);
sftp_free(sftp);
ssh_disconnect(session);
return false;
}
rc = ssh_scp_pull_request(scp);
if (rc != SSH_SCP_REQUEST_NEWFILE)
sftpfile = sftp_open(sftp, from_path, O_RDONLY, 0);
if (sftpfile == NULL)
{
std::cerr<< "Error receiving information about file: %s\n"
std::cerr<< "Can't open remote file:\n"
<< ssh_get_error(session)<<std::endl;
ssh_scp_free(scp);
sftp_free(sftp);
ssh_disconnect(session);
return false;
}
size = ssh_scp_request_get_size64(scp);
sftp_attributes sftpattr;
sftpattr = sftp_stat(sftp,from_path);
size=sftpattr->size;
buffer.resize(size);
if(ssh_scp_accept_request(scp) != SSH_OK)
while ( size > 0 )
{
std::cerr<< "Could not accept request."<<std::endl;
ssh_scp_free(scp);
int s = size;
if (s > 16384)
s = 16384;
res = sftp_read(sftpfile, buffer.data() + processed, s);
if ( res < 0)
{
std::cerr<< "Can't read data to file:\n"
<< ssh_get_error(session)<<std::endl;
sftp_free(sftp);
ssh_disconnect(session);
return false;
}
do{
rc = ssh_scp_read(scp, buffer.data() + processed, size-processed);
if (rc == SSH_ERROR)
{
std::cerr<< "Error receiving file data: %s\n"<< ssh_get_error(session)<<std::endl;
//free(buffer);
ssh_scp_free(scp);
ssh_disconnect(session);
return false;
size -= res;
processed += res;
}
else
processed += rc;
}while(processed != size);
size=sftpattr->size;
std::ofstream file(to_path, std::ios::binary |std::ios::trunc);
if(!file.write(buffer.data(), size))
{
std::cerr<<"Error while writing file."<<std::endl;
}
file.close();
ssh_scp_free(scp);
sftp_close(sftpfile);
sftp_free(sftp);
return true;
}
@ -387,10 +385,9 @@ bool explore_the_galaxy(ssh_session &session,
QStringList& files)
{
ssh_channel channel;
int rc;
channel = ssh_channel_new(session);
if (channel == nullptr) return false;
rc = ssh_channel_open_session(channel);
int rc = ssh_channel_open_session(channel);
if (rc != SSH_OK)
{
ssh_channel_free(channel);

View File

@ -333,7 +333,7 @@ void output_to_vtu_with_attributes(std::ostream& os,
os << "<AppendedData encoding=\"raw\">\n_";
write_c3t3_points(os,tr,V); // fills V if the mode is BINARY
write_cells(os,c3t3,V);
for(std::size_t i = 0; i< attributes.size(); ++i)
for(std::size_t i = 0; i< attributes.size(); ++i) {
switch(attributes[i].second.which()){
case 0:
write_attributes(os, *boost::get<const std::vector<double>* >(attributes[i].second));
@ -346,6 +346,8 @@ void output_to_vtu_with_attributes(std::ostream& os,
break;
}
}
os << "\n</AppendedData>\n";
}
os << "</VTKFile>\n";
}

View File

@ -1,5 +1,6 @@
/*!
\example Scale_space_reconstruction_3/scale_space.cpp
\example Scale_space_reconstruction_3/scale_space_sm.cpp
\example Scale_space_reconstruction_3/scale_space_incremental.cpp
\example Scale_space_reconstruction_3/scale_space_manifold.cpp
\example Scale_space_reconstruction_3/scale_space_advancing_front.cpp

View File

@ -19,6 +19,8 @@ include(CGAL_Eigen3_support)
if(TARGET CGAL::Eigen3_support)
create_single_source_cgal_program("scale_space.cpp")
target_link_libraries(scale_space PUBLIC CGAL::Eigen3_support)
create_single_source_cgal_program("scale_space_sm.cpp")
target_link_libraries(scale_space_sm PUBLIC CGAL::Eigen3_support)
create_single_source_cgal_program("scale_space_incremental.cpp")
target_link_libraries(scale_space_incremental PUBLIC CGAL::Eigen3_support)
create_single_source_cgal_program("scale_space_manifold.cpp")

View File

@ -1,6 +1,7 @@
#include <CGAL/Scale_space_surface_reconstruction_3.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/IO/read_points.h>
#include <CGAL/IO/OFF.h>
#include <algorithm>
#include <fstream>
@ -16,19 +17,6 @@ typedef Reconstruction::Point Point;
typedef Reconstruction::Facet_const_iterator Facet_iterator;
// function for writing the reconstruction output in the off format
void dump_reconstruction(const Reconstruction& reconstruct, std::string name)
{
std::ofstream output(name.c_str());
output << "OFF " << reconstruct.number_of_points() << " "
<< reconstruct.number_of_facets() << " 0\n";
std::copy(reconstruct.points_begin(),
reconstruct.points_end(),
std::ostream_iterator<Point>(output,"\n"));
for( Facet_iterator it = reconstruct.facets_begin(); it != reconstruct.facets_end(); ++it )
output << "3 " << *it << std::endl;
}
int main(int argc, char* argv[])
{
@ -70,14 +58,18 @@ int main(int argc, char* argv[])
if (i == 0)
{
std::cout << "First reconstruction done." << std::endl;
// Write the reconstruction.
dump_reconstruction(reconstruct, "reconstruction1.off");
CGAL::IO::write_OFF("reconstruction1.off",
reconstruct.points(),
reconstruct.facets(),
CGAL::parameters::stream_precision(17));
}
else
{
std::cout << "Second reconstruction done." << std::endl;
// Write the reconstruction.
dump_reconstruction(reconstruct, "reconstruction2.off");
CGAL::IO::write_OFF("reconstruction2.off",
reconstruct.points(),
reconstruct.facets(),
CGAL::parameters::stream_precision(17));
}
}

View File

@ -21,7 +21,7 @@ typedef Mesher::Facet_const_iterator Mesher_iterator;
typedef CGAL::Timer Timer;
int main(int argc, char* argv[]) {
// Read the dat
// Read the data
std::string fname = argc==1?CGAL::data_file_path("points_3/kitten.off"):argv[1];
std::cerr << "Reading " << std::flush;
@ -49,22 +49,18 @@ int main(int argc, char* argv[]) {
reconstruct.reconstruct_surface(mesher);
std::cerr << "Reconstruction done in " << t.time() << " sec." << std::endl;
t.reset();
std::ofstream out("out.off");
// Write the reconstruction.
for(Facet_iterator it = reconstruct.facets_begin(); it != reconstruct.facets_end(); ++it )
out << "3 "<< *it << '\n'; // We write a '3' in front so that it can be assembled into an OFF file
std::cerr << "Writing result in " << t.time() << " sec." << std::endl;
// We write a '3' in front so that it can be assembled into an OFF file
out << "3 " << (*it)[0] << " " << (*it)[1] << " " << (*it)[2] << '\n';
out.close();
t.reset();
std::ofstream garbage("garbage.off");
// Write facets that were removed to force manifold output
for(Mesher_iterator it = mesher.garbage_begin(); it != mesher.garbage_end(); ++it )
garbage << "3 "<< *it << '\n'; // We write a '3' in front so that it can be assembled into an OFF file
std::cerr << "Writing garbage facets in " << t.time() << " sec." << std::endl;
garbage << "3 " << (*it)[0] << " " << (*it)[1] << " " << (*it)[2] << '\n';
std::cerr << "Done." << std::endl;

View File

@ -0,0 +1,73 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Scale_space_surface_reconstruction_3.h>
#include <CGAL/IO/read_points.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/Polygon_mesh_processing/orient_polygon_soup.h>
#include <CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h>
#include <fstream>
#include <iostream>
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef CGAL::Scale_space_surface_reconstruction_3< Kernel > Reconstruction;
typedef CGAL::Scale_space_reconstruction_3::Weighted_PCA_smoother< Kernel > Smoother;
typedef CGAL::Scale_space_reconstruction_3::Alpha_shape_mesher< Kernel > Mesher;
typedef Reconstruction::Point Point;
typedef Reconstruction::Facet_const_iterator Facet_iterator;
typedef CGAL::Surface_mesh<Point> Surface_mesh;
typedef boost::graph_traits<Surface_mesh>::vertex_descriptor vertex_descriptor;
int main(int argc, char* argv[]) {
// Read the data
std::string fname = argc==1?CGAL::data_file_path("points_3/kitten.off"):argv[1];
std::cerr << "Reading " << std::flush;
std::vector<Point> points;
if(!CGAL::IO::read_points(fname, std::back_inserter(points)))
{
std::cerr << "Error: cannot read file" << std::endl;
return EXIT_FAILURE;
}
std::cerr << "done: " << points.size() << " points." << std::endl;
// Construct the mesh in a scale space.
Reconstruction reconstruct(points.begin(), points.end() );
Smoother smoother(10, 200 );
reconstruct.increase_scale(4, smoother);
Mesher mesher(smoother.squared_radius(),
false, // Do not separate shells
true // Force manifold output
);
reconstruct.reconstruct_surface(mesher);
Reconstruction::Point_range smoothed(reconstruct.points());
Reconstruction::Facet_range polygons(reconstruct.facets());
CGAL::Polygon_mesh_processing::orient_polygon_soup(smoothed, polygons);
Surface_mesh mesh;
CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh(smoothed, polygons, mesh);
// Also store the input points as vertex property
Surface_mesh::Property_map<vertex_descriptor, Point> original;
bool created;
boost::tie(original, created) = mesh.add_property_map<vertex_descriptor,Point>("v:original");
assert(created);
int i = 0;
for(auto v : vertices(mesh)){
put(original, v, points[i++]);
}
std::cerr << "Done." << std::endl;
return EXIT_SUCCESS;
}

View File

@ -53,21 +53,23 @@ public:
typedef std::array<std::size_t, 3> Facet; ///< defines a facet of the surface (triple of point indices).
#ifdef DOXYGEN_RUNNING
typedef unspecified_type Point_range; ///< defines a range points.
typedef unspecified_type Point_iterator; ///< defines an iterator over the points.
typedef const unspecified_type Point_const_iterator; ///< defines a constant iterator over the points.
#else
typedef typename std::vector<Point> Point_vector;
typedef typename Point_vector::iterator Point_iterator;
typedef typename Point_vector::const_iterator Point_const_iterator;
typedef typename std::vector<Point> Point_range;
typedef typename Point_range::iterator Point_iterator;
typedef typename Point_range::const_iterator Point_const_iterator;
#endif
#ifdef DOXYGEN_RUNNING
typedef unspecified_type Facet_range; ///< defines a range of facets
typedef unspecified_type Facet_iterator; ///< defines an iterator over the facets.
typedef const unspecified_type Facet_const_iterator; ///< defines a constant iterator over the facets.
#else
typedef typename std::vector<Facet> Facet_vector;
typedef typename Facet_vector::iterator Facet_iterator;
typedef typename Facet_vector::const_iterator Facet_const_iterator;
typedef typename std::vector<Facet> Facet_range;
typedef typename Facet_range::iterator Facet_iterator;
typedef typename Facet_range::const_iterator Facet_const_iterator;
#endif
// Default algorithms used (same as in old API)
@ -76,8 +78,8 @@ public:
private:
Point_vector m_points;
Facet_vector m_facets;
Point_range m_points;
Facet_range m_facets;
FT m_internal_squared_radius; // For backward compatibility
@ -233,6 +235,9 @@ public:
/// gives the number of points of the surface.
std::size_t number_of_points() const { return m_points.size(); }
/// gives the range of points
const Point_range& points() const { return m_points; }
/// gives an iterator to the first point at the current scale.
/** \warning Changes to the scale-space do not cause an automatic update to
* the surface.
@ -254,6 +259,9 @@ public:
/// gives the number of facets of the surface.
std::size_t number_of_facets() const { return m_facets.size(); }
/// gives the range of facets
const Facet_range& facets() const { return m_facets; }
/// gives an iterator to the first triple in the surface.
/** \warning Changes to the surface may change its topology.
*/
@ -292,16 +300,4 @@ std::ostream& operator<< (std::ostream& os, const CGAL::Scale_space_surface_reco
} // namespace CGAL
template< typename T >
std::ostream&
operator<<( std::ostream& os, const std::array< T, 3 >& t ) {
return os << t[0] << " " << t[1] << " " << t[2];
}
template< typename T >
std::istream&
operator>>( std::istream& is, std::array< T, 3 >& t ) {
return is >> get<0>(t) >> get<1>(t) >> get<2>(t);
}
#endif // CGAL_SCALE_SPACE_SURFACE_RECONSTRUCTION_3_H

View File

@ -306,7 +306,7 @@ int r = edge_collapse(surface_mesh, stop_predicate,
.edge_is_border_map(ebmap)
.get_cost(cf)
.get_placement(pf)
.filter(filter
.filter(filter)
.visitor(vis));
\endcode

View File

@ -13,8 +13,6 @@
#include <QInputDialog>
#include <CGAL/Three/Three.h>
#include <boost/iterator/transform_iterator.hpp>
#include <list>
#include <fstream>

View File

@ -36,7 +36,7 @@ int main(int, char**)
std::cout << "It has:\n";
std::cout << dtos.number_of_vertices() << " vertices\n";
std::cout << dtos.number_of_edges() << " edges\n";
std::cout << dtos.number_of_faces() << " solid faces\n";
std::cout << dtos.number_of_solid_faces() << " solid faces\n";
std::cout << dtos.number_of_ghost_faces() << " ghost faces\n" << std::endl;
}

View File

@ -54,7 +54,7 @@ int main(int argc, char** argv)
DToS2 dtos(points.begin(), points.end(), traits);
std::cout << dtos.number_of_vertices() << " vertices" << std::endl;
std::cout << dtos.number_of_faces() << " solid faces" << std::endl;
std::cout << dtos.number_of_solid_faces() << " solid faces" << std::endl;
std::cout << dtos.number_of_ghost_faces() << " ghost faces" << std::endl;
CGAL::IO::write_OFF("result.off", dtos, CGAL::parameters::stream_precision(17));

View File

@ -3,8 +3,6 @@
#include <CGAL/Delaunay_triangulation_on_sphere_2.h>
#include <CGAL/Projection_on_sphere_traits_3.h>
#include <boost/iterator/transform_iterator.hpp>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Projection_on_sphere_traits_3<K> Traits;
@ -36,7 +34,7 @@ int main(int, char**)
std::cout << "The triangulation now has dimension: " << dtos.dimension() << " and\n";
std::cout << dtos.number_of_vertices() << " vertices" << std::endl;
std::cout << dtos.number_of_edges() << " edges" << std::endl;
std::cout << dtos.number_of_faces() << " solid faces" << std::endl;
std::cout << dtos.number_of_solid_faces() << " solid faces" << std::endl;
std::cout << dtos.number_of_ghost_faces() << " ghost faces" << std::endl;
}

View File

@ -38,7 +38,7 @@ int main(int argc, char** argv)
DToS2 dtos(points.begin(), points.end(), traits);
std::cout << dtos.number_of_vertices() << " vertices" << std::endl;
std::cout << dtos.number_of_faces() << " solid faces" << std::endl;
std::cout << dtos.number_of_solid_faces() << " solid faces" << std::endl;
CGAL::IO::write_OFF("result.off", dtos, CGAL::parameters::stream_precision(17));

View File

@ -27,7 +27,6 @@
#include <CGAL/spatial_sort_on_sphere.h>
#include <CGAL/Spatial_sort_traits_adapter_3.h>
#include <boost/iterator/transform_iterator.hpp>
#include <boost/property_map/function_property_map.hpp>
#include <algorithm>