Blender V4.3
flip_avoiding_line_search.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2016 Michael Rabinovich
2 * 2023 Blender Authors
3 *
4 * SPDX-License-Identifier: MPL-2.0 */
5
10#pragma once
11
12#include <Eigen/Dense>
13
14namespace slim {
15
16/* A bisection line search for a mesh based energy that avoids triangle flips as suggested in
17 * "Bijective Parameterization with Free Boundaries" (Smith J. and Schaefer S., 2015).
18 *
19 * The user specifies an initial vertices position (that has no flips) and target one (that my have
20 * flipped triangles). This method first computes the largest step in direction of the destination
21 * vertices that does not incur flips, and then minimizes a given energy using this maximal step
22 * and a bisection linesearch (see igl::line_search).
23 *
24 * Supports triangle meshes.
25 *
26 * Inputs:
27 * F #F by 3 list of mesh faces
28 * cur_v #V by dim list of variables
29 * dst_v #V by dim list of target vertices. This mesh may have flipped triangles
30 * energy A function to compute the mesh-based energy (return an energy that is
31 * bigger than 0) cur_energy(OPTIONAL) The energy at the given point. Helps save
32 * redundant computations.
33 * This is optional. If not specified, the function will compute it.
34 * Outputs:
35 * cur_v #V by dim list of variables at the new location
36 * Returns the energy at the new point.
37 */
38inline double flip_avoiding_line_search(const Eigen::MatrixXi F,
39 Eigen::MatrixXd &cur_v,
40 Eigen::MatrixXd &dst_v,
41 std::function<double(Eigen::MatrixXd &)> energy,
42 double cur_energy = -1);
43
44} // namespace slim
45
double flip_avoiding_line_search(const Eigen::MatrixXi F, Eigen::MatrixXd &cur_v, Eigen::MatrixXd &dst_v, std::function< double(Eigen::MatrixXd &)> energy, double cur_energy)