Merge branch '5.3.x-branch' into 5.4.x-branch

This commit is contained in:
Laurent Rineau 2022-02-18 15:23:34 +01:00
commit fb764adef8
3 changed files with 43 additions and 42 deletions

View File

@ -26,9 +26,10 @@ int main()
// ---------------------------------------------- //
// two faces incident to the edge to be collapsed //
// ---------------------------------------------- //
Point_3 p1(0,0,0), p2(1,0,0), p3(0,1,0);
{
Mesh m;
Mesh::Halfedge_index h = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m);
Mesh::Halfedge_index h = CGAL::make_triangle(p1,p2,p3,m);
Mesh::Halfedge_index h2c = CGAL::Euler::add_center_vertex(h, m);
/* ECM ecm = */m.add_property_map<Mesh::Edge_index, bool>("ecm", false);
bool res = test(h2c, m);
@ -36,7 +37,7 @@ int main()
}
{
Mesh m;
Mesh::Halfedge_index h = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m);
Mesh::Halfedge_index h = CGAL::make_triangle(p1,p2,p3,m);
Mesh::Halfedge_index h2c = CGAL::Euler::add_center_vertex(h, m);
ECM ecm = m.add_property_map<Mesh::Edge_index, bool>("ecm", false).first;
put(ecm, edge(prev(h2c,m), m), true);
@ -46,7 +47,7 @@ int main()
}
{
Mesh m;
Mesh::Halfedge_index h = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m);
Mesh::Halfedge_index h = CGAL::make_triangle(p1,p2,p3,m);
Mesh::Halfedge_index h2c = CGAL::Euler::add_center_vertex(h, m);
ECM ecm = m.add_property_map<Mesh::Edge_index, bool>("ecm", false).first;
put(ecm, edge(next(h2c,m), m), true);
@ -56,7 +57,7 @@ int main()
}
{
Mesh m;
Mesh::Halfedge_index h = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m);
Mesh::Halfedge_index h = CGAL::make_triangle(p1,p2,p3,m);
Mesh::Halfedge_index h2c = CGAL::Euler::add_center_vertex(h, m);
ECM ecm = m.add_property_map<Mesh::Edge_index, bool>("ecm", false).first;
put(ecm, edge(prev(h2c,m), m), true);
@ -67,7 +68,7 @@ int main()
// duplicate block + add one border (1)
{
Mesh m;
Mesh::Halfedge_index h = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m);
Mesh::Halfedge_index h = CGAL::make_triangle(p1,p2,p3,m);
Mesh::Halfedge_index h2c = CGAL::Euler::add_center_vertex(h, m);
Mesh::Halfedge_index hb1 = opposite(prev(h2c, m), m);
assert(is_border(hb1, m));
@ -78,7 +79,7 @@ int main()
}
{
Mesh m;
Mesh::Halfedge_index h = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m);
Mesh::Halfedge_index h = CGAL::make_triangle(p1,p2,p3,m);
Mesh::Halfedge_index h2c = CGAL::Euler::add_center_vertex(h, m);
Mesh::Halfedge_index hb1 = opposite(prev(h2c, m), m);
assert(is_border(hb1, m));
@ -91,7 +92,7 @@ int main()
}
{
Mesh m;
Mesh::Halfedge_index h = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m);
Mesh::Halfedge_index h = CGAL::make_triangle(p1,p2,p3,m);
Mesh::Halfedge_index h2c = CGAL::Euler::add_center_vertex(h, m);
Mesh::Halfedge_index hb1 = opposite(prev(h2c, m), m);
assert(is_border(hb1, m));
@ -104,7 +105,7 @@ int main()
}
{
Mesh m;
Mesh::Halfedge_index h = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m);
Mesh::Halfedge_index h = CGAL::make_triangle(p1,p2,p3,m);
Mesh::Halfedge_index h2c = CGAL::Euler::add_center_vertex(h, m);
Mesh::Halfedge_index hb1 = opposite(prev(h2c, m), m);
assert(is_border(hb1, m));
@ -118,7 +119,7 @@ int main()
// duplicate block + add one border (2)
{
Mesh m;
Mesh::Halfedge_index h = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m);
Mesh::Halfedge_index h = CGAL::make_triangle(p1,p2,p3,m);
Mesh::Halfedge_index h2c = CGAL::Euler::add_center_vertex(h, m);
Mesh::Halfedge_index hb2 = opposite(next(opposite(h2c,m), m), m);
assert(is_border(hb2, m));
@ -129,7 +130,7 @@ int main()
}
{
Mesh m;
Mesh::Halfedge_index h = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m);
Mesh::Halfedge_index h = CGAL::make_triangle(p1,p2,p3,m);
Mesh::Halfedge_index h2c = CGAL::Euler::add_center_vertex(h, m);
Mesh::Halfedge_index hb2 = opposite(next(opposite(h2c,m), m), m);
assert(is_border(hb2, m));
@ -142,7 +143,7 @@ int main()
}
{
Mesh m;
Mesh::Halfedge_index h = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m);
Mesh::Halfedge_index h = CGAL::make_triangle(p1,p2,p3,m);
Mesh::Halfedge_index h2c = CGAL::Euler::add_center_vertex(h, m);
Mesh::Halfedge_index hb2 = opposite(next(opposite(h2c,m), m), m);
assert(is_border(hb2, m));
@ -155,7 +156,7 @@ int main()
}
{
Mesh m;
Mesh::Halfedge_index h = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m);
Mesh::Halfedge_index h = CGAL::make_triangle(p1,p2,p3,m);
Mesh::Halfedge_index h2c = CGAL::Euler::add_center_vertex(h, m);
Mesh::Halfedge_index hb2 = opposite(next(opposite(h2c,m), m), m);
assert(is_border(hb2, m));
@ -169,7 +170,7 @@ int main()
// duplicate block + add one border (1)
{
Mesh m;
Mesh::Halfedge_index h = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m);
Mesh::Halfedge_index h = CGAL::make_triangle(p1,p2,p3,m);
Mesh::Halfedge_index h2c = CGAL::Euler::add_center_vertex(h, m);
Mesh::Halfedge_index hb1 = opposite(prev(h2c, m), m);
assert(is_border(hb1, m));
@ -183,7 +184,7 @@ int main()
}
{
Mesh m;
Mesh::Halfedge_index h = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m);
Mesh::Halfedge_index h = CGAL::make_triangle(p1,p2,p3,m);
Mesh::Halfedge_index h2c = CGAL::Euler::add_center_vertex(h, m);
Mesh::Halfedge_index hb1 = opposite(prev(h2c, m), m);
assert(is_border(hb1, m));
@ -199,7 +200,7 @@ int main()
}
{
Mesh m;
Mesh::Halfedge_index h = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m);
Mesh::Halfedge_index h = CGAL::make_triangle(p1,p2,p3,m);
Mesh::Halfedge_index h2c = CGAL::Euler::add_center_vertex(h, m);
Mesh::Halfedge_index hb1 = opposite(prev(h2c, m), m);
assert(is_border(hb1, m));
@ -215,7 +216,7 @@ int main()
}
{
Mesh m;
Mesh::Halfedge_index h = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m);
Mesh::Halfedge_index h = CGAL::make_triangle(p1,p2,p3,m);
Mesh::Halfedge_index h2c = CGAL::Euler::add_center_vertex(h, m);
Mesh::Halfedge_index hb1 = opposite(prev(h2c, m), m);
assert(is_border(hb1, m));
@ -235,7 +236,7 @@ int main()
// center triangle with 2 border edges (1)
{
Mesh m;
Mesh::Halfedge_index h2c = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m);
Mesh::Halfedge_index h2c = CGAL::make_triangle(p1,p2,p3,m);
Mesh::Halfedge_index hb1=opposite(next(h2c,m),m);
CGAL::Euler::add_vertex_and_face_to_border(prev(hb1, m), hb1, m);
/* ECM ecm = */m.add_property_map<Mesh::Edge_index, bool>("ecm", false);
@ -244,7 +245,7 @@ int main()
}
{
Mesh m;
Mesh::Halfedge_index h2c = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m);
Mesh::Halfedge_index h2c = CGAL::make_triangle(p1,p2,p3,m);
Mesh::Halfedge_index hb1=opposite(next(h2c,m),m);
CGAL::Euler::add_vertex_and_face_to_border(prev(hb1, m), hb1, m);
ECM ecm = m.add_property_map<Mesh::Edge_index, bool>("ecm", false).first;
@ -254,7 +255,7 @@ int main()
}
{
Mesh m;
Mesh::Halfedge_index h2c = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m);
Mesh::Halfedge_index h2c = CGAL::make_triangle(p1,p2,p3,m);
Mesh::Halfedge_index hb1=opposite(next(h2c,m),m);
CGAL::Euler::add_vertex_and_face_to_border(prev(hb1, m), hb1, m);
ECM ecm = m.add_property_map<Mesh::Edge_index, bool>("ecm", false).first;
@ -265,7 +266,7 @@ int main()
// center triangle with 2 border edges (2)
{
Mesh m;
Mesh::Halfedge_index h2c = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m);
Mesh::Halfedge_index h2c = CGAL::make_triangle(p1,p2,p3,m);
Mesh::Halfedge_index hb2=opposite(prev(h2c,m),m);
CGAL::Euler::add_vertex_and_face_to_border(prev(hb2, m), hb2, m);
/* ECM ecm = */m.add_property_map<Mesh::Edge_index, bool>("ecm", false);
@ -274,7 +275,7 @@ int main()
}
{
Mesh m;
Mesh::Halfedge_index h2c = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m);
Mesh::Halfedge_index h2c = CGAL::make_triangle(p1,p2,p3,m);
Mesh::Halfedge_index hb2=opposite(prev(h2c,m),m);
CGAL::Euler::add_vertex_and_face_to_border(prev(hb2, m), hb2, m);
ECM ecm = m.add_property_map<Mesh::Edge_index, bool>("ecm", false).first;
@ -284,7 +285,7 @@ int main()
}
{
Mesh m;
Mesh::Halfedge_index h2c = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m);
Mesh::Halfedge_index h2c = CGAL::make_triangle(p1,p2,p3,m);
Mesh::Halfedge_index hb2=opposite(prev(h2c,m),m);
CGAL::Euler::add_vertex_and_face_to_border(prev(hb2, m), hb2, m);
ECM ecm = m.add_property_map<Mesh::Edge_index, bool>("ecm", false).first;
@ -295,7 +296,7 @@ int main()
// center triangle with 1 border edges
{
Mesh m;
Mesh::Halfedge_index h2c = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m);
Mesh::Halfedge_index h2c = CGAL::make_triangle(p1,p2,p3,m);
Mesh::Halfedge_index hb1=opposite(next(h2c,m),m);
CGAL::Euler::add_vertex_and_face_to_border(prev(hb1, m), hb1, m);
Mesh::Halfedge_index hb2=opposite(prev(h2c,m),m);
@ -306,7 +307,7 @@ int main()
}
{
Mesh m;
Mesh::Halfedge_index h2c = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m);
Mesh::Halfedge_index h2c = CGAL::make_triangle(p1,p2,p3,m);
Mesh::Halfedge_index hb1=opposite(next(h2c,m),m);
CGAL::Euler::add_vertex_and_face_to_border(prev(hb1, m), hb1, m);
Mesh::Halfedge_index hb2=opposite(prev(h2c,m),m);
@ -318,7 +319,7 @@ int main()
}
{
Mesh m;
Mesh::Halfedge_index h2c = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m);
Mesh::Halfedge_index h2c = CGAL::make_triangle(p1,p2,p3,m);
Mesh::Halfedge_index hb1=opposite(next(h2c,m),m);
CGAL::Euler::add_vertex_and_face_to_border(prev(hb1, m), hb1, m);
Mesh::Halfedge_index hb2=opposite(prev(h2c,m),m);

View File

@ -14,7 +14,7 @@ test_copy_face_graph_nm_umbrella()
CGAL_GRAPH_TRAITS_MEMBERS(T);
T g;
Kernel::Point_3 p;
Kernel::Point_3 p(0,0,0);
CGAL::make_tetrahedron(p, p, p, p, g);
CGAL::make_tetrahedron(p, p, p, p, g);
@ -39,8 +39,7 @@ template <typename T>
void
test_copy_face_graph_isolated_vertices()
{
typedef Kernel::Point_3 Point_3;
Kernel::Point_3 p(0,0,0);
{
T s, t;
add_vertex(s);
@ -55,7 +54,7 @@ test_copy_face_graph_isolated_vertices()
{
T s, t;
CGAL::make_triangle(Point_3(), Point_3(), Point_3(), s);
CGAL::make_triangle(p, p, p, s);
add_vertex(s);
t=s;
CGAL::copy_face_graph(s, t);
@ -63,7 +62,7 @@ test_copy_face_graph_isolated_vertices()
{
T s, t;
CGAL::make_triangle(Point_3(), Point_3(), Point_3(), s);
CGAL::make_triangle(p, p, p, s);
add_vertex(s);
add_vertex(t);
CGAL::copy_face_graph(s, t);
@ -71,7 +70,7 @@ test_copy_face_graph_isolated_vertices()
{
T s, t;
CGAL::make_tetrahedron(Point_3(), Point_3(), Point_3(), Point_3(), s);
CGAL::make_tetrahedron(p, p, p, p, s);
add_vertex(s);
t=s;
CGAL::copy_face_graph(s, t);
@ -79,7 +78,7 @@ test_copy_face_graph_isolated_vertices()
{
T s, t;
CGAL::make_tetrahedron(Point_3(), Point_3(), Point_3(), Point_3(), s);
CGAL::make_tetrahedron(p, p, p, p, s);
add_vertex(s);
add_vertex(t);
CGAL::copy_face_graph(s, t);

View File

@ -1244,7 +1244,7 @@ bool is_planar_2(
const Squared_distance_3 squared_distance_3 =
traits.compute_squared_distance_3_object();
const std::size_t n = points.size() - 1; // the first equals to the last
const double n = static_cast<double>(points.size() - 1); // the first equals to the last
if (n < 3) {
return false; // cant be a plane!
}
@ -1256,8 +1256,8 @@ bool is_planar_2(
// Compute covariance matrix.
FT xx = FT(0), yy = FT(0), zz = FT(0);
FT xy = FT(0), xz = FT(0), yz = FT(0);
for (std::size_t i = 0; i < n; ++i) {
const Point_3& p = points[i];
for (const Point_3& p : points)
{
const FT dx = p.x() - centroid.x();
const FT dy = p.y() - centroid.y();
const FT dz = p.z() - centroid.z();
@ -1281,12 +1281,12 @@ bool is_planar_2(
CGAL_assertion(avg_normal != typename Traits::Vector_3());
const Plane_3 plane = Plane_3(centroid, avg_normal);
FT avg_squared_distance = FT(0);
for (std::size_t i = 0; i < n; ++i) {
const Point_3& p = points[i];
for (const Point_3& p : points)
{
const Point_3 q = projection_3(plane, p);
avg_squared_distance += CGAL::abs(squared_distance_3(p, q));
}
avg_squared_distance /= static_cast<FT>(n);
avg_squared_distance /= FT(n);
// std::cout << "avg squared distance: " << avg_squared_distance << std::endl;
CGAL_assertion(max_squared_distance >= FT(0));
@ -1327,7 +1327,7 @@ triangulate_hole_polyline_with_cdt(const PointRange& points,
}
FT x = FT(0), y = FT(0), z = FT(0);
std::size_t num_normals = 0;
int num_normals = 0;
const Point_3& ref_point = P[0];
const std::size_t size = P.size() - 1;
for (std::size_t i = 1; i < size - 1; ++i) {
@ -1362,9 +1362,10 @@ triangulate_hole_polyline_with_cdt(const PointRange& points,
}
// Setting the final normal.
x /= static_cast<FT>(num_normals);
y /= static_cast<FT>(num_normals);
z /= static_cast<FT>(num_normals);
FT ft_nn(num_normals);
x /= ft_nn;
y /= ft_nn;
z /= ft_nn;
const Vector_3 avg_normal = Vector_3(x, y, z);
// std::cout << "avg normal: " << avg_normal << std::endl;