mirror of https://github.com/CGAL/cgal
Merge remote-tracking branch 'cgal/6.0.x-branch' into 'cgal/6.1.x-branch'
This commit is contained in:
commit
b2ba32307c
|
|
@ -15,8 +15,6 @@ find_package(Eigen3 3.1.0)
|
|||
include(CGAL_Eigen3_support)
|
||||
|
||||
create_single_source_cgal_program("draw_lcc.cpp")
|
||||
create_single_source_cgal_program("draw_mesh_and_points.cpp")
|
||||
create_single_source_cgal_program("draw_several_windows.cpp")
|
||||
create_single_source_cgal_program("draw_surface_mesh_height.cpp")
|
||||
create_single_source_cgal_program("draw_surface_mesh_small_faces.cpp")
|
||||
create_single_source_cgal_program("draw_surface_mesh_vcolor.cpp")
|
||||
|
|
@ -24,18 +22,19 @@ create_single_source_cgal_program("draw_surface_mesh_vcolor.cpp")
|
|||
if(CGAL_Qt6_FOUND)
|
||||
#link it with the required CGAL libraries
|
||||
target_link_libraries(draw_lcc PRIVATE CGAL::CGAL_Basic_viewer)
|
||||
target_link_libraries(draw_mesh_and_points PRIVATE CGAL::CGAL_Basic_viewer)
|
||||
target_link_libraries(draw_several_windows PRIVATE CGAL::CGAL_Basic_viewer)
|
||||
target_link_libraries(draw_surface_mesh_height PRIVATE CGAL::CGAL_Basic_viewer)
|
||||
target_link_libraries(draw_surface_mesh_small_faces PRIVATE CGAL::CGAL_Basic_viewer)
|
||||
target_link_libraries(draw_surface_mesh_vcolor PRIVATE CGAL::CGAL_Basic_viewer)
|
||||
if(TARGET CGAL::Eigen3_support)
|
||||
create_single_source_cgal_program("draw_mesh_and_points.cpp")
|
||||
create_single_source_cgal_program("draw_several_windows.cpp")
|
||||
target_link_libraries(draw_mesh_and_points PRIVATE CGAL::Eigen3_support CGAL::CGAL_Basic_viewer)
|
||||
target_link_libraries(draw_several_windows PRIVATE CGAL::Eigen3_support CGAL::CGAL_Basic_viewer)
|
||||
else()
|
||||
message("Eigen3 is not found, examples that require Eigen3 will not be compiled.")
|
||||
endif()
|
||||
else()
|
||||
message("CGAL_Qt6 not configured: examples that require Qt will not be compiled.")
|
||||
endif()
|
||||
|
||||
if(TARGET CGAL::Eigen3_support)
|
||||
target_link_libraries(draw_mesh_and_points PRIVATE CGAL::Eigen3_support)
|
||||
target_link_libraries(draw_several_windows PRIVATE CGAL::Eigen3_support)
|
||||
endif()
|
||||
|
||||
#end of the file
|
||||
|
|
|
|||
|
|
@ -1092,7 +1092,7 @@ void convex_hull_3(InputIterator first, InputIterator beyond,
|
|||
std::enable_if_t<boost::has_range_iterator<TriangleRange>::value>* = 0)
|
||||
{
|
||||
typedef typename std::iterator_traits<InputIterator>::value_type Point_3;
|
||||
typedef typename Kernel_traits<Point_3>::type Traits;
|
||||
typedef typename Convex_hull_3::internal::Default_traits_for_Chull_3<Point_3>::type Traits;
|
||||
|
||||
Convex_hull_3::internal::Indexed_triangle_set<PointRange, TriangleRange> its(vertices,faces);
|
||||
convex_hull_3(first, beyond, its, Traits());
|
||||
|
|
|
|||
|
|
@ -0,0 +1,41 @@
|
|||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/convex_hull_3.h>
|
||||
|
||||
#include <vector>
|
||||
#include <array>
|
||||
#include <fstream>
|
||||
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
|
||||
typedef K::Point_3 Point_3;
|
||||
|
||||
|
||||
int main() {
|
||||
std::vector<Point_3> points = {
|
||||
{-7.71169150943396353 ,-19.809308490566039, 10.0950745283018861},
|
||||
{-7.90879905660377602, -19.809308490566039, 9.8979669811320754},
|
||||
{-7.71169150943396353, -19.6122009433962283, 9.8979669811320754},
|
||||
{-7.90879905660377602, -19.6122009433962283, 9.8979669811320754},
|
||||
{-7.71169150943396353, -19.4150933962264141, 10.0950745283018861},
|
||||
{-7.90879905660377602, -19.809308490566039, 10.0950745283018861},
|
||||
{-7.71169150943396353, -19.6122009433962283, 10.2921820754716968},
|
||||
{-7.90879905660377602, -19.6122009433962283, 10.0950745283018861},
|
||||
{-7.71169150943396353, -19.6122009433962283, 10.0950745283018861},
|
||||
{-7.71169150943396353, -19.809308490566039, 9.8979669811320754},
|
||||
{-7.90879905660377602, -19.4150933962264141, 9.8979669811320754},
|
||||
{-7.90879905660377602, -19.4150933962264141, 10.0950745283018861},
|
||||
{-7.71169150943396353, -19.4150933962264141, 9.8979669811320754},
|
||||
{-7.90879905660377602, -19.6122009433962283, 10.2921820754716968},
|
||||
{-7.90879905660377602, -19.4150933962264141, 10.2921820754716968},
|
||||
{-7.71169150943396353, -19.4150933962264141, 10.2921820754716968} };
|
||||
|
||||
std::vector<Point_3> vertices;
|
||||
std::vector<std::array<int, 3> > faces;
|
||||
|
||||
CGAL::convex_hull_3(points.begin(), points.end(), vertices, faces);
|
||||
|
||||
assert(vertices.size() == 10);
|
||||
assert(faces.size() == 16);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -119,18 +119,14 @@ template<class T>inline std::enable_if_t<std::is_empty<T>::value, int> depth(T){
|
|||
|
||||
namespace internal{
|
||||
|
||||
template <typename AT, typename ET, typename E2A>
|
||||
struct Evaluate<Lazy<AT, ET, E2A>>
|
||||
{
|
||||
void operator()(const Lazy<AT, ET, E2A>& l)
|
||||
{
|
||||
exact(l);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename ET>
|
||||
struct Evaluate<Lazy_exact_nt<ET>>
|
||||
{
|
||||
template <typename AT, typename ET2, typename E2A>
|
||||
void operator()(const Lazy<AT, ET2, E2A>& l)
|
||||
{
|
||||
exact(l);
|
||||
}
|
||||
void operator()(const Lazy_exact_nt<ET>& l)
|
||||
{
|
||||
exact(l);
|
||||
|
|
|
|||
|
|
@ -272,7 +272,8 @@ namespace internal
|
|||
template <class NT>
|
||||
struct Evaluate
|
||||
{
|
||||
void operator()(const NT&)
|
||||
template <class T>
|
||||
void operator()(const T&)
|
||||
{}
|
||||
};
|
||||
} // internal namespace
|
||||
|
|
|
|||
|
|
@ -912,6 +912,8 @@ centroid(const TriangleMesh& tmesh,
|
|||
Scale scale = k.construct_scaled_vector_3_object();
|
||||
Sum sum = k.construct_sum_of_vectors_3_object();
|
||||
|
||||
::CGAL::internal::Evaluate<FT> evaluate;
|
||||
|
||||
for(face_descriptor fd : faces(tmesh))
|
||||
{
|
||||
const Point_3_ref p = get(vpm, target(halfedge(fd, tmesh), tmesh));
|
||||
|
|
@ -922,6 +924,7 @@ centroid(const TriangleMesh& tmesh,
|
|||
vr = vector(ORIGIN, r);
|
||||
Vector_3 n = normal(p, q, r);
|
||||
volume += (scalar_product(n,vp))/FT(6);
|
||||
evaluate(volume);
|
||||
n = scale(n, FT(1)/FT(24));
|
||||
|
||||
Vector_3 v2 = sum(vp, vq);
|
||||
|
|
@ -932,6 +935,7 @@ centroid(const TriangleMesh& tmesh,
|
|||
v3 = sum(v3, Vector_3(square(v2.x()), square(v2.y()), square(v2.z())));
|
||||
|
||||
centroid = sum(centroid, Vector_3(n.x() * v3.x(), n.y() * v3.y(), n.z() * v3.z()));
|
||||
evaluate(centroid);
|
||||
}
|
||||
|
||||
centroid = scale(centroid, FT(1)/(FT(2)*volume));
|
||||
|
|
|
|||
Loading…
Reference in New Issue