Skip to content

Commit

Permalink
making it easy to switch between both arap terms
Browse files Browse the repository at this point in the history
  • Loading branch information
soesau committed Oct 9, 2024
1 parent f9ea5fb commit 5e48786
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <CGAL/Point_set_3.h>

#include <CGAL/Timer.h>
#include <sstream>

using K = CGAL::Exact_predicates_inexact_constructions_kernel;
using Mesh = CGAL::Surface_mesh<K::Point_3>;
Expand Down Expand Up @@ -41,7 +42,6 @@ int main(int, char**) {
if (corr.is_open()) {
std::size_t v0, v1;
while (corr >> v0 >> v1) {
std::cout << v0 << " " << v1 << std::endl;
correspondences_mesh.push_back(std::make_pair(*(source.vertices_begin() + v0), *(target.vertices_begin() + v1)));
}
}
Expand All @@ -53,13 +53,23 @@ int main(int, char**) {
Mesh::Property_map<Mesh::Vertex_index, CGAL::Aff_transformation_3<K>> vrm = source.add_property_map<Mesh::Vertex_index, CGAL::Aff_transformation_3<K>>("v:rotation").first;
Mesh::Property_map<Mesh::Vertex_index, K::Vector_3> vtm = source.add_property_map<Mesh::Vertex_index, K::Vector_3>("v:translation").first;

FT w1 = 2.0;
FT w2 = 2.0;
FT w3 = 50;
FT w1 = 0.2;
FT w2 = 0.2;
FT w3 = 5000;
new_arap = true;

std::ostringstream out;
out.precision(2);
if (new_arap)
out << "bear_" << std::fixed << w1 << "_" << w2 << "_" << w3 << "_new.off";
else
out << "bear_" << std::fixed << w1 << "_" << w2 << "_" << w3 << "_old.off";

std::cout << std::endl << out.str() << std::endl;

PMP::non_rigid_mesh_to_mesh_registration(source, target, vtm, vrm, CGAL::parameters::point_to_point_energy(w1).point_to_plane_energy(w2).as_rigid_as_possible_energy(w3).correspondences(std::cref(correspondences_mesh)));
PMP::apply_non_rigid_transformation(source, vtm);
CGAL::IO::write_polygon_mesh("bear_" + std::to_string(w1) + "_" + std::to_string(w2) + "_" + std::to_string(w3) + ".off", source);
CGAL::IO::write_polygon_mesh(out.str(), source);

return EXIT_SUCCESS;
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@

#include <CGAL/Aff_transformation_3.h>

bool new_arap = true;

namespace CGAL {
namespace Polygon_mesh_processing {
namespace internal {
Expand Down Expand Up @@ -619,7 +621,6 @@ void non_rigid_mesh_to_points_registration(TriangleMesh& source,
#endif

// Update edge neighborhoods by new local rotation
bool new_arap = true;
if (it == (iter - 1)) {
if (new_arap) {
for (Index i = 0; i < Z.rows(); ++i)
Expand Down

0 comments on commit 5e48786

Please sign in to comment.