mirror of https://github.com/CGAL/cgal
Merge remote-tracking branch 'cgal/5.2.x-branch'
This commit is contained in:
commit
39367c2313
|
|
@ -73,7 +73,7 @@ jobs:
|
|||
wget --no-verbose cgal.github.io -O tmp.html
|
||||
if ! egrep -q "\/$PR_NUMBER\/$ROUND" tmp.html; then
|
||||
#list impacted packages
|
||||
LIST_OF_PKGS=$(git diff --name-only HEAD^1 HEAD |cut -s -d/ -f1 |sort -u | xargs -I {} ls -d {}/package_info 2>/dev/null |cut -d/ -f1 |egrep -v Installation||true)
|
||||
LIST_OF_PKGS=$(git diff --name-only HEAD^1 HEAD |cut -s -d/ -f1 |sort -u | xargs -I {} echo {} && ls -d {}/package_info 2>/dev/null |cut -d/ -f1 |egrep -v Installation||true)
|
||||
if [ "$LIST_OF_PKGS" = "" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1680,7 +1680,7 @@ bool IO_base_test<Base_geom_traits>::read_xcurve(InputStream_& is,
|
|||
read_point(is, p2);
|
||||
assert(p1 != p2);
|
||||
|
||||
unsigned int flag;
|
||||
unsigned int flag = static_cast<unsigned int>(-1);
|
||||
is >> flag;
|
||||
if (flag == 1) {
|
||||
X_monotone_curve_2::Direction_3 normal;
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 8.9 KiB |
|
|
@ -92,6 +92,11 @@ When you hit the *Configure* button, you must:
|
|||
<li>select *Specify toolchain file for cross compilation* (the file `vcpkg.cmake` within the directory
|
||||
where you have installed `vcpkg`, e.g. `C:/dev/vcpkg/scripts/buildsystems/vcpkg.cmake`).</li>
|
||||
</ul>
|
||||
|
||||
\cgalFigureBegin{toolchain,toolchain.png}
|
||||
The box to check to get to the toolchain option
|
||||
\cgalFigureEnd
|
||||
|
||||
Once the configuration process is done, tick *Advanced* and *Grouped* in `cmake-gui`.
|
||||
You will see entries for where header files and libraries are taken from.
|
||||
|
||||
|
|
|
|||
|
|
@ -21,13 +21,17 @@ generated polygons is not known since it depends on the generated points.
|
|||
- `PointGenerator::value_type` is equivalent to
|
||||
`Traits::Point_2` and `OutputIterator::value_type`.
|
||||
|
||||
|
||||
The default traits class `Default_traits` is the kernel in which
|
||||
`Traits::Point_2` is defined.
|
||||
|
||||
\sa `CGAL::Random_points_in_disc_2<Point_2, Creator>`
|
||||
\sa `CGAL::Random_points_in_square_2<Point_2, Creator>`
|
||||
|
||||
\cgalHeading{Preconditions}
|
||||
|
||||
- The number of unique points in the first \f$ n\f$ points generated by `pg` is at least `3`.
|
||||
- The unique points in the first \f$ n\f$ points generated by `pg` do not all lie on the same line.
|
||||
|
||||
\cgalHeading{Implementation}
|
||||
|
||||
The implementation is based on the method of eliminating self-intersections in
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ bool Less_segments<ForwardIterator, PolygonTraits>::
|
|||
less_than_in_tree(Vertex_index new_edge, Vertex_index tree_edge) const
|
||||
{
|
||||
#if defined(CGAL_POLY_GENERATOR_DEBUG)
|
||||
std::cout << "less_than_in_tree" << std::endl;
|
||||
std::cout << "less_than_in_tree; new: " << new_edge.as_int() << " tree edge: " << tree_edge.as_int() << std::endl;
|
||||
#endif
|
||||
CGAL_polygon_precondition(
|
||||
m_vertex_data->edges[tree_edge.as_int()].is_in_tree);
|
||||
|
|
@ -179,6 +179,52 @@ less_than_in_tree(Vertex_index new_edge, Vertex_index tree_edge) const
|
|||
m_vertex_data->point(mid),
|
||||
m_vertex_data->point(right)));
|
||||
m_vertex_data->is_simple_result = false;
|
||||
|
||||
// need to handle the specific combinations:
|
||||
// as the standard x;x+k swap (see below) will not work
|
||||
if (m_vertex_data->edges[tree_edge.as_int()].is_left_to_right)
|
||||
{
|
||||
// x+1 x x+2
|
||||
// This is actually already handled in the insertion event, when the orientation returns "COPLANAR"
|
||||
// but leaving the code below for completion.
|
||||
if (m_vertex_data->next(mid) == left || m_vertex_data->next(mid) == right)
|
||||
{
|
||||
// swap mid & left
|
||||
m_vertex_data->conflict1 = m_vertex_data->prev(mid);
|
||||
m_vertex_data->conflict2 = left;
|
||||
return true;
|
||||
}
|
||||
// x-2 x x-1
|
||||
else if (m_vertex_data->prev(mid) == left || m_vertex_data->prev(mid) == right)
|
||||
{
|
||||
// swap mid & right
|
||||
m_vertex_data->conflict1 = left;
|
||||
m_vertex_data->conflict2 = mid;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else // right to left
|
||||
{
|
||||
// x+2 x x+1
|
||||
if (m_vertex_data->next(mid) == left || m_vertex_data->next(mid) == right)
|
||||
{
|
||||
// swap mid & right
|
||||
m_vertex_data->conflict1 = m_vertex_data->prev(mid);
|
||||
m_vertex_data->conflict2 = right;
|
||||
return true;
|
||||
}
|
||||
// x-1 x x-2
|
||||
// This is actually already handled in the insertion event, when the orientation returns "COPLANAR"
|
||||
// but leaving the code below for completion.
|
||||
else if (m_vertex_data->prev(mid) == left || m_vertex_data->prev(mid) == right)
|
||||
{
|
||||
// swap mid & left
|
||||
m_vertex_data->conflict1 = right;
|
||||
m_vertex_data->conflict2 = mid;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Vertex_index mid_succ = m_vertex_data->next(mid);
|
||||
if (mid_succ.as_int() <= (std::min)(left.as_int(), right.as_int()))
|
||||
{
|
||||
|
|
@ -515,6 +561,15 @@ check_simple_polygon(Iterator points_begin, Iterator points_end,
|
|||
typedef Iterator ForwardIterator;
|
||||
typedef std::set<i_generator_polygon::Vertex_index,
|
||||
i_generator_polygon::Less_segments<ForwardIterator,PolygonTraits> > Tree;
|
||||
|
||||
#if defined(CGAL_POLY_GENERATOR_DEBUG)
|
||||
Iterator it;
|
||||
std::cout << "In check_simple_polygon the points are: " << std::endl;
|
||||
for(it = points_begin; it != points_end; it++)
|
||||
std::cout << *it << " ";
|
||||
std::cout << std::endl;
|
||||
#endif
|
||||
|
||||
i_generator_polygon::Vertex_data<ForwardIterator, PolygonTraits>
|
||||
vertex_data(points_begin, points_end, polygon_traits);
|
||||
Tree tree(&vertex_data);
|
||||
|
|
@ -556,8 +611,8 @@ void make_simple_polygon(Iterator points_begin, Iterator points_end,
|
|||
swap_interval = check_simple_polygon(points_begin,
|
||||
points_end, polygon_traits);
|
||||
#if defined(CGAL_POLY_GENERATOR_DEBUG)
|
||||
std::cout << swap_interval.first << " "
|
||||
<< swap_interval.second << std::endl;
|
||||
std::cout << "To swap: " << swap_interval.first << " "
|
||||
<< swap_interval.second << std::endl;
|
||||
CGAL_polygon_assertion(swap_interval.first >= -1 &&
|
||||
swap_interval.second >= -1 &&
|
||||
swap_interval.first < size &&
|
||||
|
|
|
|||
|
|
@ -46,6 +46,21 @@ OutputIterator random_polygon_2(std::size_t n, OutputIterator result,
|
|||
copy_n_unique(pg, n, std::back_inserter(vertices), traits);
|
||||
CGAL_assertion(!duplicate_points(vertices.begin(), vertices.end(), traits));
|
||||
|
||||
CGAL_precondition_code(auto d = std::distance(vertices.begin(), vertices.end());)
|
||||
CGAL_precondition(d > 2);
|
||||
|
||||
CGAL_precondition_code(const Point_2& p = *(vertices.begin());)
|
||||
CGAL_precondition_code(const Point_2& q = *(std::next(vertices.begin()));)
|
||||
CGAL_precondition_code(auto third_it = std::next(vertices.begin(), 2);)
|
||||
CGAL_precondition_code(bool all_collinear = true;)
|
||||
CGAL_precondition_code(do {)
|
||||
CGAL_precondition_code( if(traits.orientation_2_object()(p, q, *third_it) != CGAL::COLLINEAR) {)
|
||||
CGAL_precondition_code( all_collinear = false;)
|
||||
CGAL_precondition_code( break;)
|
||||
CGAL_precondition_code( })
|
||||
CGAL_precondition_code(} while(++third_it != vertices.end());)
|
||||
CGAL_precondition(!all_collinear);
|
||||
|
||||
#ifndef CGAL_DONT_SHUFFLE_IN_RANDOM_POLYGON_2
|
||||
CGAL::cpp98::random_shuffle(vertices.begin(), vertices.end());
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -22,56 +22,82 @@
|
|||
// Random Simple Polygons: Test Program
|
||||
// ============================================================================
|
||||
|
||||
#define CGAL_DONT_SHUFFLE_IN_RANDOM_POLYGON_2
|
||||
|
||||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/Homogeneous.h>
|
||||
|
||||
#include <CGAL/point_generators_2.h>
|
||||
#include <CGAL/random_polygon_2.h>
|
||||
#include <CGAL/Polygon_2.h>
|
||||
|
||||
#include <array>
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <list>
|
||||
|
||||
typedef CGAL::Simple_cartesian< double > CR;
|
||||
typedef CGAL::Point_2< CR > CPoint_2;
|
||||
typedef std::list<CPoint_2> CContainer;
|
||||
typedef CGAL::Polygon_2<CR, CContainer> CPolygon_2;
|
||||
typedef CGAL::Creator_uniform_2<double, CPoint_2> CCreator;
|
||||
typedef CGAL::Random_points_in_square_2<CPoint_2, CCreator> CPoint_generator;
|
||||
template <typename K>
|
||||
void test_fold()
|
||||
{
|
||||
// (-5, -7) is on [(-9, 5); (-2, -16)]
|
||||
std::array<typename K::Point_2, 4> input {typename K::Point_2{-5,-7},{7,-85},{-9,5},{-2,-16}};
|
||||
|
||||
typedef CGAL::Homogeneous< double > HR;
|
||||
typedef CGAL::Point_2< HR > HPoint_2;
|
||||
typedef std::list<HPoint_2> HContainer;
|
||||
typedef CGAL::Polygon_2<HR, HContainer> HPolygon_2;
|
||||
typedef CGAL::Creator_uniform_2<double, HPoint_2> HCreator;
|
||||
typedef CGAL::Random_points_in_square_2<HPoint_2, HCreator> HPoint_generator;
|
||||
int i = 0;
|
||||
do
|
||||
{
|
||||
std::cout << "permutation #" << i++ << std::endl;
|
||||
for(const auto& pt : input)
|
||||
std::cout << " (" << pt << ")";
|
||||
std::cout << std::endl;
|
||||
|
||||
int main() {
|
||||
CGAL::Polygon_2<K> polygon;
|
||||
CGAL::random_polygon_2(input.size(), std::back_inserter(polygon), input.begin());
|
||||
|
||||
CPolygon_2 polygon1;
|
||||
if (! polygon.is_simple())
|
||||
{
|
||||
std::cerr << "ERROR: polygon is not simple." << std::endl;
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
while(std::next_permutation(input.begin(), input.end()));
|
||||
}
|
||||
|
||||
template <typename K>
|
||||
void test_random()
|
||||
{
|
||||
typedef CGAL::Point_2< K > Point_2;
|
||||
typedef std::list<Point_2> Container;
|
||||
typedef CGAL::Polygon_2<K, Container> Polygon_2;
|
||||
typedef CGAL::Creator_uniform_2<double, Point_2> Creator;
|
||||
typedef CGAL::Random_points_in_square_2<Point_2, Creator> Point_generator;
|
||||
|
||||
Polygon_2 polygon;
|
||||
int n = 50;
|
||||
|
||||
// create a polygon
|
||||
CGAL::random_polygon_2(n, std::back_inserter(polygon1),
|
||||
CPoint_generator(0.5));
|
||||
CGAL::random_polygon_2(n, std::back_inserter(polygon), Point_generator(0.5));
|
||||
|
||||
// make sure it is simple
|
||||
if (! polygon1.is_simple())
|
||||
if (! polygon.is_simple())
|
||||
{
|
||||
std::cerr << "ERROR: polygon is not simple." << std::endl;
|
||||
return 1;
|
||||
assert(false);
|
||||
}
|
||||
|
||||
HPolygon_2 polygon2;
|
||||
|
||||
// create a polygon
|
||||
CGAL::random_polygon_2(n, std::back_inserter(polygon2),
|
||||
HPoint_generator(0.5));
|
||||
|
||||
// make sure it is simple
|
||||
if (! polygon1.is_simple())
|
||||
{
|
||||
std::cerr << "ERROR: polygon is not simple." << std::endl;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EOF
|
||||
int main()
|
||||
{
|
||||
typedef CGAL::Simple_cartesian<double> CK;
|
||||
typedef CGAL::Homogeneous<double> HK;
|
||||
|
||||
test_random<CK>();
|
||||
test_random<HK>();
|
||||
|
||||
test_fold<CK>();
|
||||
test_fold<HK>();
|
||||
|
||||
std::cout << "Done!" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,20 +31,35 @@ if( NOT GMP_in_cache )
|
|||
DOC "The directory containing the GMP header files"
|
||||
)
|
||||
|
||||
find_library(GMP_LIBRARIES NAMES gmp libgmp-10 mpir
|
||||
find_library(GMP_LIBRARY_RELEASE NAMES gmp libgmp-10 mpir
|
||||
HINTS ENV GMP_LIB_DIR
|
||||
ENV GMP_DIR
|
||||
${CGAL_INSTALLATION_PACKAGE_DIR}/auxiliary/gmp/lib
|
||||
PATH_SUFFIXES lib
|
||||
DOC "Path to the GMP library"
|
||||
DOC "Path to the Release GMP library"
|
||||
)
|
||||
|
||||
if ( GMP_LIBRARIES )
|
||||
get_filename_component(GMP_LIBRARIES_DIR ${GMP_LIBRARIES} PATH CACHE )
|
||||
find_library(GMP_LIBRARY_DEBUG NAMES gmpd gmp libgmp-10 mpir
|
||||
HINTS ENV GMP_LIB_DIR
|
||||
ENV GMP_DIR
|
||||
${CGAL_INSTALLATION_PACKAGE_DIR}/auxiliary/gmp/lib
|
||||
PATH_SUFFIXES lib
|
||||
DOC "Path to the Debug GMP library"
|
||||
)
|
||||
|
||||
get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||
if(IS_MULTI_CONFIG)
|
||||
set(GMP_LIBRARIES debug ${GMP_LIBRARY_DEBUG} optimized ${GMP_LIBRARY_RELEASE})
|
||||
else()
|
||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
||||
set(GMP_LIBRARIES ${GMP_LIBRARY_DEBUG})
|
||||
else()
|
||||
set(GMP_LIBRARIES ${GMP_LIBRARY_RELEASE})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Attempt to load a user-defined configuration for GMP if couldn't be found
|
||||
if ( NOT GMP_INCLUDE_DIR OR NOT GMP_LIBRARIES_DIR )
|
||||
if ( NOT GMP_INCLUDE_DIR OR NOT GMP_LIBRARIES)
|
||||
include( GMPConfig OPTIONAL )
|
||||
endif()
|
||||
|
||||
|
|
|
|||
|
|
@ -38,38 +38,6 @@ typedef CGAL::Interpolation_traits_2<K> Traits;
|
|||
|
||||
typedef std::vector<std::pair<Vertex_handle, Coord_type> > Coordinate_vector;
|
||||
|
||||
template <typename V, typename T>
|
||||
struct Value_function
|
||||
{
|
||||
typedef V argument_type;
|
||||
typedef std::pair<T, bool> result_type;
|
||||
|
||||
result_type operator()(const argument_type& a) const {
|
||||
return result_type(a->info().value, true);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename V, typename G>
|
||||
struct Gradient_function
|
||||
: public std::iterator<std::output_iterator_tag, void, void, void, void>
|
||||
{
|
||||
|
||||
typedef V argument_type;
|
||||
typedef std::pair<G, bool> result_type;
|
||||
|
||||
result_type operator()(const argument_type& a) const {
|
||||
return std::make_pair(a->info().gradient, a->info().gradient != CGAL::NULL_VECTOR);
|
||||
}
|
||||
|
||||
const Gradient_function& operator=(const std::pair<V, G>& p) const {
|
||||
p.first->info().gradient = p.second;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const Gradient_function& operator++(int) const { return *this; }
|
||||
const Gradient_function& operator*() const { return *this; }
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
//number of sample points:
|
||||
|
|
@ -94,9 +62,15 @@ int main()
|
|||
|
||||
Delaunay_triangulation T;
|
||||
|
||||
// Note that a supported alternative to creating the functors below is to use lambdas
|
||||
Value_function<Vertex_handle, Coord_type> value_function;
|
||||
Gradient_function<Vertex_handle, Vector> gradient_function;
|
||||
auto value_function = [](const Vertex_handle& a) -> std::pair<Coord_type, bool>
|
||||
{
|
||||
return std::make_pair(a->info().value, true);
|
||||
};
|
||||
|
||||
auto gradient_function = [](const Vertex_handle& a) -> std::pair<Vector, bool>
|
||||
{
|
||||
return std::make_pair(a->info().gradient, a->info().gradient != CGAL::NULL_VECTOR);
|
||||
};
|
||||
|
||||
//parameters for quadratic function:
|
||||
Coord_type alpha = Coord_type(1.0),
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@
|
|||
#include <CGAL/Triangulation_vertex_base_with_info_2.h>
|
||||
#include <CGAL/Regular_triangulation_2.h>
|
||||
|
||||
#include <boost/iterator/function_output_iterator.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <utility>
|
||||
|
|
@ -38,44 +40,26 @@ typedef CGAL::Triangulation_data_structure_2<Vb, Fb> Tds;
|
|||
typedef CGAL::Regular_triangulation_2<K, Tds> Regular_triangulation;
|
||||
typedef Regular_triangulation::Vertex_handle Vertex_handle;
|
||||
|
||||
template <typename V, typename T>
|
||||
struct Value_function
|
||||
{
|
||||
typedef V argument_type;
|
||||
typedef std::pair<T, bool> result_type;
|
||||
|
||||
result_type operator()(const argument_type& a) const {
|
||||
return result_type(a->info().value, true);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename V, typename G>
|
||||
struct Gradient_function
|
||||
: public std::iterator<std::output_iterator_tag, void, void, void, void>
|
||||
{
|
||||
typedef V argument_type;
|
||||
typedef std::pair<G, bool> result_type;
|
||||
|
||||
result_type operator()(const argument_type& a) const {
|
||||
return std::make_pair(a->info().gradient, a->info().gradient != CGAL::NULL_VECTOR);
|
||||
}
|
||||
|
||||
const Gradient_function& operator=(const std::pair<V, G>& p) const {
|
||||
p.first->info().gradient = p.second;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const Gradient_function& operator++(int) const { return *this; }
|
||||
const Gradient_function& operator*() const { return *this; }
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
Regular_triangulation rt;
|
||||
|
||||
// Note that a supported alternative to creating the functors below is to use lambdas
|
||||
Value_function<Vertex_handle, Coord_type> value_function;
|
||||
Gradient_function<Vertex_handle, Vector> gradient_function;
|
||||
auto value_function = [](const Vertex_handle& a) -> std::pair<Coord_type, bool>
|
||||
{
|
||||
return std::make_pair(a->info().value, true);
|
||||
};
|
||||
|
||||
auto gradient_function = [](const Vertex_handle& a) -> std::pair<Vector, bool>
|
||||
{
|
||||
return std::make_pair(a->info().gradient, a->info().gradient != CGAL::NULL_VECTOR);
|
||||
};
|
||||
|
||||
auto gradient_output_iterator
|
||||
= boost::make_function_output_iterator
|
||||
([](const std::pair<Vertex_handle, Vector>& p)
|
||||
{
|
||||
p.first->info().gradient = p.second;
|
||||
});
|
||||
|
||||
// parameters for spherical function:
|
||||
Coord_type a(0.25), bx(1.3), by(-0.7), c(0.2);
|
||||
|
|
@ -89,7 +73,7 @@ int main()
|
|||
}
|
||||
|
||||
CGAL::sibson_gradient_fitting_rn_2(rt,
|
||||
gradient_function,
|
||||
gradient_output_iterator,
|
||||
CGAL::Identity<std::pair<Vertex_handle, Vector> >(),
|
||||
value_function,
|
||||
Traits());
|
||||
|
|
|
|||
|
|
@ -286,8 +286,8 @@ struct Sizing_field_with_aabb_tree
|
|||
else { // dim == 1
|
||||
const typename MeshDomain::Curve_index& curve_id =
|
||||
domain.curve_index(id);
|
||||
const Patches_ids& ids = curves_incident_patches[curve_id];
|
||||
if(!aabb_tree.empty()) {
|
||||
const Patches_ids& ids = curves_incident_patches[curve_id];
|
||||
CGAL_assertion(! ids.empty());
|
||||
|
||||
//Compute distance to surface patches
|
||||
|
|
|
|||
|
|
@ -249,6 +249,7 @@ struct Enriched_pixel {
|
|||
Domain_type domain;
|
||||
Image_word_type word;
|
||||
bool on_edge_of_the_cube;
|
||||
bool on_corner_of_the_cube;
|
||||
}; // end struct template Enriched_pixel<Pix,P,D,C>
|
||||
|
||||
} // end namespace internal
|
||||
|
|
@ -536,17 +537,21 @@ polylines_to_protect
|
|||
double x = pixel[0] * vx + tx;
|
||||
double y = pixel[1] * vy + ty;
|
||||
double z = pixel[2] * vz + tz;
|
||||
square[ii][jj].on_edge_of_the_cube =
|
||||
( ( ( 0 == pixel[0] || (xdim - 1) == pixel[0] ) ? 1 : 0 )
|
||||
+
|
||||
( ( 0 == pixel[1] || (ydim - 1) == pixel[1] ) ? 1 : 0 )
|
||||
+
|
||||
( ( 0 == pixel[2] || (zdim - 1) == pixel[2] ) ? 1 : 0 ) > 1 );
|
||||
short sum_faces = ((0 == pixel[0] || (xdim - 1) == pixel[0]) ? 1 : 0)
|
||||
+ ((0 == pixel[1] || (ydim - 1) == pixel[1]) ? 1 : 0)
|
||||
+ ((0 == pixel[2] || (zdim - 1) == pixel[2]) ? 1 : 0);
|
||||
square[ii][jj].on_edge_of_the_cube = (sum_faces > 1);
|
||||
square[ii][jj].on_corner_of_the_cube = (sum_faces > 2);
|
||||
|
||||
#ifdef CGAL_MESH_3_DEBUG_POLYLINES_TO_PROTECT
|
||||
if(square[ii][jj].on_edge_of_the_cube) {
|
||||
std::cerr << " Pixel(" << pixel[0] << ", " << pixel[1] << ", "
|
||||
<< pixel[2] << ") is on edge\n";
|
||||
}
|
||||
if (square[ii][jj].on_corner_of_the_cube) {
|
||||
std::cerr << " Pixel(" << pixel[0] << ", " << pixel[1] << ", "
|
||||
<< pixel[2] << ") is on corner\n";
|
||||
}
|
||||
#endif // CGAL_MESH_3_DEBUG_POLYLINES_TO_PROTECT
|
||||
|
||||
square[ii][jj].point = Point_3(x, y, z);
|
||||
|
|
@ -582,10 +587,10 @@ polylines_to_protect
|
|||
bool out01 = null(square[0][1].domain);
|
||||
bool out11 = null(square[1][1].domain);
|
||||
|
||||
bool on_edge00 = square[0][0].on_edge_of_the_cube;
|
||||
bool on_edge10 = square[1][0].on_edge_of_the_cube;
|
||||
bool on_edge01 = square[0][1].on_edge_of_the_cube;
|
||||
bool on_edge11 = square[1][1].on_edge_of_the_cube;
|
||||
bool is_corner00 = square[0][0].on_corner_of_the_cube;
|
||||
bool is_corner10 = square[1][0].on_corner_of_the_cube;
|
||||
bool is_corner01 = square[0][1].on_corner_of_the_cube;
|
||||
bool is_corner11 = square[1][1].on_corner_of_the_cube;
|
||||
|
||||
//
|
||||
// Protect the edges of the cube
|
||||
|
|
@ -593,26 +598,26 @@ polylines_to_protect
|
|||
if(pix00[axis_xx] == 0 &&
|
||||
! ( out00 && out01 ) )
|
||||
{
|
||||
g_manip.try_add_edge(g_manip.get_vertex(p00, on_edge00),
|
||||
g_manip.get_vertex(p01, on_edge01));
|
||||
g_manip.try_add_edge(g_manip.get_vertex(p00, is_corner00),
|
||||
g_manip.get_vertex(p01, is_corner01));
|
||||
}
|
||||
if(pix11[axis_xx] == image_dims[axis_xx]-1 &&
|
||||
! ( out10 && out11 ) )
|
||||
{
|
||||
g_manip.try_add_edge(g_manip.get_vertex(p10, on_edge10),
|
||||
g_manip.get_vertex(p11, on_edge11));
|
||||
g_manip.try_add_edge(g_manip.get_vertex(p10, is_corner10),
|
||||
g_manip.get_vertex(p11, is_corner11));
|
||||
}
|
||||
if(pix00[axis_yy] == 0 &&
|
||||
! ( out00 && out10 ) )
|
||||
{
|
||||
g_manip.try_add_edge(g_manip.get_vertex(p00, on_edge00),
|
||||
g_manip.get_vertex(p10, on_edge10));
|
||||
g_manip.try_add_edge(g_manip.get_vertex(p00, is_corner00),
|
||||
g_manip.get_vertex(p10, is_corner10));
|
||||
}
|
||||
if(pix11[axis_yy] == image_dims[axis_yy]-1 &&
|
||||
! ( out01 && out11 ) )
|
||||
{
|
||||
g_manip.try_add_edge(g_manip.get_vertex(p01, on_edge01),
|
||||
g_manip.get_vertex(p11, on_edge11));
|
||||
g_manip.try_add_edge(g_manip.get_vertex(p01, is_corner01),
|
||||
g_manip.get_vertex(p11, is_corner11));
|
||||
}
|
||||
} // end of scope for outIJ and on_edgeIJ
|
||||
|
||||
|
|
|
|||
|
|
@ -109,34 +109,35 @@ int main(int argc, const char** argv)
|
|||
* */
|
||||
);
|
||||
|
||||
// OR call the ICP registration method from pointmatcher and apply the transformation to pwn2
|
||||
bool converged =
|
||||
CGAL::pointmatcher::register_point_sets
|
||||
bool converged = false;
|
||||
do
|
||||
{
|
||||
// OR call the ICP registration method from pointmatcher and apply the transformation to pwn2
|
||||
converged =
|
||||
CGAL::pointmatcher::register_point_sets
|
||||
(pwns1, pwns2,
|
||||
params::point_map(Point_map()).normal_map(Normal_map())
|
||||
.point_set_filters(point_set_1_filters)
|
||||
.matcher(matcher)
|
||||
.outlier_filters(outlier_filters)
|
||||
.error_minimizer(error_minimizer)
|
||||
.transformation_checkers(transformation_checkers)
|
||||
.inspector(inspector)
|
||||
.logger(logger),
|
||||
.point_set_filters(point_set_1_filters)
|
||||
.matcher(matcher)
|
||||
.outlier_filters(outlier_filters)
|
||||
.error_minimizer(error_minimizer)
|
||||
.transformation_checkers(transformation_checkers)
|
||||
.inspector(inspector)
|
||||
.logger(logger),
|
||||
params::point_map(Point_map()).normal_map(Normal_map())
|
||||
.point_set_filters(point_set_2_filters)
|
||||
.transformation(res.first) /* pass the above computed transformation as initial transformation.
|
||||
* as a result, the registration will require less iterations to converge.
|
||||
* */
|
||||
);
|
||||
.point_set_filters(point_set_2_filters)
|
||||
.transformation(res.first) /* pass the above computed transformation as initial transformation.
|
||||
* as a result, the registration will require less iterations to converge.
|
||||
* */
|
||||
);
|
||||
|
||||
if(converged)
|
||||
{
|
||||
std::cerr << "Success" << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "Failure" << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
// Algorithm may randomly not converge, repeat until it does
|
||||
if (converged)
|
||||
std::cerr << "Success" << std::endl;
|
||||
else
|
||||
std::cerr << "Did not converge, try again" << std::endl;
|
||||
}
|
||||
while (!converged);
|
||||
|
||||
if(!CGAL::write_points("pwns2_aligned.ply", pwns2,
|
||||
CGAL::parameters::point_map(Point_map()).normal_map(Normal_map())))
|
||||
|
|
|
|||
|
|
@ -74,6 +74,8 @@ struct Vertex_index {
|
|||
explicit Vertex_index(Index_t i): m_i(i) {}
|
||||
Index_t as_int() const {return m_i;}
|
||||
Vertex_index operator++() {++m_i; return *this; }
|
||||
bool operator==(const Vertex_index& other) const { return (m_i == other.m_i); }
|
||||
|
||||
private:
|
||||
Index_t m_i;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -324,23 +324,41 @@ class Callback_with_self_intersection_report
|
|||
: public Base
|
||||
{
|
||||
typedef typename Base::face_descriptor face_descriptor;
|
||||
typedef typename Base::halfedge_descriptor halfedge_descriptor;
|
||||
typedef typename Base::Box Box;
|
||||
boost::shared_ptr< std::set<face_descriptor> > faces_with_bbox_involved_in_intersections;
|
||||
std::set<face_descriptor>* tmf_collected_faces_ptr;
|
||||
std::set<face_descriptor>* tme_collected_faces_ptr;
|
||||
public:
|
||||
Callback_with_self_intersection_report(const Base& base)
|
||||
: Base(base), faces_with_bbox_involved_in_intersections(new std::set<face_descriptor>())
|
||||
Callback_with_self_intersection_report(const Base& base,
|
||||
std::set<face_descriptor>& tmf_collected_faces,
|
||||
std::set<face_descriptor>& tme_collected_faces)
|
||||
: Base(base),
|
||||
tmf_collected_faces_ptr(&tmf_collected_faces),
|
||||
tme_collected_faces_ptr(&tme_collected_faces)
|
||||
{}
|
||||
|
||||
void operator()( const Box* fb, const Box* eb) {
|
||||
faces_with_bbox_involved_in_intersections->insert( face(fb->info(), this->tm_faces) );
|
||||
halfedge_descriptor h = eb->info();
|
||||
if (!is_border(h, this->tm_edges))
|
||||
tme_collected_faces_ptr->insert( face(h, this->tm_edges) );
|
||||
h = opposite(h, this->tm_edges);
|
||||
if (!is_border(h, this->tm_edges))
|
||||
tme_collected_faces_ptr->insert( face(h, this->tm_edges) );
|
||||
tmf_collected_faces_ptr->insert( face(fb->info(), this->tm_faces) );
|
||||
Base::operator()(fb, eb);
|
||||
}
|
||||
bool self_intersections_found()
|
||||
{
|
||||
return Polygon_mesh_processing::does_self_intersect(
|
||||
*faces_with_bbox_involved_in_intersections,
|
||||
this->tm_faces,
|
||||
Polygon_mesh_processing::parameters::vertex_point_map(this->vpmap_tmf));
|
||||
return
|
||||
Polygon_mesh_processing::does_self_intersect(
|
||||
*tmf_collected_faces_ptr,
|
||||
this->tm_faces,
|
||||
Polygon_mesh_processing::parameters::vertex_point_map(this->vpmap_tmf))
|
||||
||
|
||||
Polygon_mesh_processing::does_self_intersect(
|
||||
*tme_collected_faces_ptr,
|
||||
this->tm_edges,
|
||||
Polygon_mesh_processing::parameters::vertex_point_map(this->vpmap_tme));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -218,7 +218,10 @@ class Intersection_of_triangle_meshes
|
|||
const VPMF& vpm_f,
|
||||
const VPME& vpm_e,
|
||||
const Non_manifold_feature_map<TriangleMesh>& non_manifold_feature_map,
|
||||
bool throw_on_self_intersection)
|
||||
bool throw_on_self_intersection,
|
||||
std::set<face_descriptor>& tm_f_faces,
|
||||
std::set<face_descriptor>& tm_e_faces,
|
||||
bool run_check)
|
||||
{
|
||||
std::vector<Box> face_boxes, edge_boxes;
|
||||
std::vector<Box*> face_boxes_ptr, edge_boxes_ptr;
|
||||
|
|
@ -291,11 +294,11 @@ class Intersection_of_triangle_meshes
|
|||
#endif
|
||||
//using pointers in box_intersection_d is about 10% faster
|
||||
if (throw_on_self_intersection){
|
||||
Callback_with_self_intersection_report<TriangleMesh, Callback> callback_si(callback);
|
||||
Callback_with_self_intersection_report<TriangleMesh, Callback> callback_si(callback, tm_f_faces, tm_e_faces);
|
||||
CGAL::box_intersection_d( face_boxes_ptr.begin(), face_boxes_ptr.end(),
|
||||
edge_boxes_ptr.begin(), edge_boxes_ptr.end(),
|
||||
callback_si, cutoff );
|
||||
if (callback_si.self_intersections_found())
|
||||
if (run_check && callback_si.self_intersections_found())
|
||||
throw Self_intersection_exception();
|
||||
}
|
||||
else {
|
||||
|
|
@ -1581,9 +1584,12 @@ public:
|
|||
const TriangleMesh& tm2=nodes.tm2;
|
||||
const VertexPointMap1& vpm1=nodes.vpm1;
|
||||
const VertexPointMap2& vpm2=nodes.vpm2;
|
||||
|
||||
filter_intersections(tm1, tm2, vpm1, vpm2, non_manifold_feature_map_2, throw_on_self_intersection);
|
||||
filter_intersections(tm2, tm1, vpm2, vpm1, non_manifold_feature_map_1, throw_on_self_intersection);
|
||||
|
||||
// used only if throw_on_self_intersection == true
|
||||
std::set<face_descriptor> tm1_faces;
|
||||
std::set<face_descriptor> tm2_faces;
|
||||
filter_intersections(tm1, tm2, vpm1, vpm2, non_manifold_feature_map_2, throw_on_self_intersection, tm1_faces, tm2_faces, false);
|
||||
filter_intersections(tm2, tm1, vpm2, vpm1, non_manifold_feature_map_1, throw_on_self_intersection, tm2_faces, tm1_faces, true);
|
||||
|
||||
Node_id current_node((std::numeric_limits<Node_id>::max)());
|
||||
CGAL_assertion(current_node+1==0);
|
||||
|
|
|
|||
|
|
@ -772,6 +772,7 @@ bool Scene_edit_box_item::eventFilter(QObject *obj, QEvent *event)
|
|||
int type, picked;
|
||||
d->picked_pixel = e->pos();
|
||||
d->picking(type, picked, viewer);
|
||||
viewer->makeCurrent();
|
||||
if(type !=-1)
|
||||
{
|
||||
bool found = false;
|
||||
|
|
|
|||
|
|
@ -264,7 +264,7 @@ Scene_polylines_item_private::computeSpheres()
|
|||
"<li>red: four incident polylines</li>"
|
||||
"<li>fuchsia: five or more incident polylines</li>"
|
||||
"</ul></p>"
|
||||
"<p>Tip: To erase this item, set its radius to 0 or less, or select it in the itme list and press the Delete key. </p>")
|
||||
"<p>Tip: To remove this item, set the corner radius of its corresponding polyline to 0, or simply delete it. </p>")
|
||||
);
|
||||
spheres->computeElements();
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ const int indices_table[4][3] = { { 3, 1, 2 },
|
|||
{ 3, 0, 1 },
|
||||
{ 2, 1, 0 } };
|
||||
|
||||
int indices(const int& i, const int& j)
|
||||
inline int indices(const int& i, const int& j)
|
||||
{
|
||||
CGAL_assertion(i < 4 && j < 3);
|
||||
if(i < 4 && j < 3)
|
||||
|
|
|
|||
Loading…
Reference in New Issue