mirror of https://github.com/CGAL/cgal
clean up
This commit is contained in:
parent
ee034985c3
commit
3e34b08746
|
|
@ -39,17 +39,15 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
|
||||
///// Uniform Isotropic ACVD
|
||||
#if 0
|
||||
std::cout << "Uniform Isotropic ACVD ...." << std::endl;
|
||||
Mesh acvd_mesh = smesh;
|
||||
PMP::approximated_centroidal_Voronoi_diagram_remeshing(acvd_mesh, nb_clusters);
|
||||
CGAL::IO::write_polygon_mesh(stem+"_acvd_"+nbc+extension, acvd_mesh);
|
||||
|
||||
std::cout << "Completed" << std::endl;
|
||||
#endif
|
||||
|
||||
|
||||
//// With Post-Processing QEM Optimization
|
||||
#if 0
|
||||
std::cout << "Uniform Isotropic ACVD with QEM optimization ...." << std::endl;
|
||||
|
||||
Mesh acvd_mesh_qem_pp = smesh;
|
||||
|
|
@ -57,25 +55,20 @@ int main(int argc, char* argv[])
|
|||
CGAL::IO::write_polygon_mesh( stem +"_acvd_qem-pp_"+nbc+extension, acvd_mesh_qem_pp);
|
||||
|
||||
std::cout << "Completed" << std::endl;
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
// With QEM Energy Minimization
|
||||
std::cout << "Uniform QEM ACVD ...." << std::endl;
|
||||
auto acvd_mesh_qem = smesh;
|
||||
PMP::approximated_centroidal_Voronoi_diagram_remeshing(acvd_mesh_qem, nb_clusters, params::use_qem_based_energy(true));
|
||||
CGAL::IO::write_polygon_mesh(stem +"_acvd_qem_"+ std::to_string(nb_clusters) + extension, acvd_mesh_qem);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/// Adaptive Isotropic ACVD
|
||||
std::cout << "Adaptive Isotropic ACVD ...." << std::endl;
|
||||
const double gradation_factor = 2;
|
||||
Mesh adaptive_acvd_mesh = smesh;
|
||||
PMP::approximated_centroidal_Voronoi_diagram_remeshing(adaptive_acvd_mesh, nb_clusters, params::gradation_factor(gradation_factor));
|
||||
|
||||
CGAL::IO::write_OFF(stem +"_acvd_adaptative_"+ std::to_string(nb_clusters) + extension, acvd_mesh_qem, adaptive_acvd_mesh);
|
||||
#endif
|
||||
CGAL::IO::write_polygon_mesh(stem +"_acvd_adaptative_"+ std::to_string(nb_clusters) + extension, adaptive_acvd_mesh);
|
||||
|
||||
std::cout << "Completed" << std::endl;
|
||||
|
||||
|
|
|
|||
|
|
@ -990,42 +990,33 @@ acvd_impl(TriangleMesh& tmesh,
|
|||
for (int i = 0; i < nb_clusters; ++i)
|
||||
cluster_quadrics[i].setZero();
|
||||
|
||||
// for storing the vertex_descriptor of each face
|
||||
std::vector<vertex_descriptor> face_vertices;
|
||||
|
||||
for (face_descriptor fd : faces(tmesh))
|
||||
{
|
||||
std::array<typename GT::Vector_3,3> vecs;
|
||||
std::array<int,3> cids;
|
||||
int i=0;
|
||||
// get Vs for fd
|
||||
// compute qem from Vs->"vector_3"s
|
||||
// add to the 3 indices of the cluster
|
||||
halfedge_descriptor hd = halfedge(fd, tmesh);
|
||||
do {
|
||||
vertex_descriptor vd = target(hd, tmesh);
|
||||
face_vertices.push_back(vd);
|
||||
cids[i]=get(vertex_cluster_pmap, vd);
|
||||
if (cids[i]==-1)
|
||||
break;
|
||||
const typename GT::Point_3& p_i=get(vpm, vd);
|
||||
vecs[i++]=p_i - ORIGIN;
|
||||
hd = next(hd, tmesh);
|
||||
} while (hd != halfedge(fd, tmesh));
|
||||
|
||||
auto p_i = get(vpm, face_vertices[0]);
|
||||
typename GT::Vector_3 vec_1 = typename GT::Vector_3(p_i.x(), p_i.y(), p_i.z());
|
||||
p_i = get(vpm, face_vertices[1]);
|
||||
typename GT::Vector_3 vec_2 = typename GT::Vector_3(p_i.x(), p_i.y(), p_i.z());
|
||||
p_i = get(vpm, face_vertices[2]);
|
||||
typename GT::Vector_3 vec_3 = typename GT::Vector_3(p_i.x(), p_i.y(), p_i.z());
|
||||
if (i!=3)
|
||||
continue;
|
||||
|
||||
int c_1 = get(vertex_cluster_pmap, face_vertices[0]);
|
||||
int c_2 = get(vertex_cluster_pmap, face_vertices[1]);
|
||||
int c_3 = get(vertex_cluster_pmap, face_vertices[2]);
|
||||
|
||||
if (c_1 != -1 && c_2 != -1 && c_3 != -1)
|
||||
{
|
||||
Eigen::Matrix<typename GT::FT, 4, 4> q;
|
||||
compute_qem_face<GT>(vec_1, vec_2, vec_3, q);
|
||||
cluster_quadrics[c_1] += q;
|
||||
cluster_quadrics[c_2] += q;
|
||||
cluster_quadrics[c_3] += q;
|
||||
}
|
||||
|
||||
face_vertices.clear();
|
||||
Eigen::Matrix<typename GT::FT, 4, 4> q;
|
||||
compute_qem_face<GT>(vecs[0], vecs[1], vecs[2], q);
|
||||
cluster_quadrics[cids[0]] += q;
|
||||
cluster_quadrics[cids[1]] += q;
|
||||
cluster_quadrics[cids[2]] += q;
|
||||
}
|
||||
|
||||
int valid_index = 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue