Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Peiqi Wang HW4 #33

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
807 changes: 807 additions & 0 deletions README.html

Large diffs are not rendered by default.

680 changes: 641 additions & 39 deletions README.md

Large diffs are not rendered by default.

Binary file added images/bump-k-harmonic.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/bunny-biharmonic.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/bunny-harmonic.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/knight-arap-high-vs-low-resolution.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/knight-arap-large-rotation.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/knight-biharmonic-large-rotation.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/knight-deformation.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions include/arap_precompute.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#ifndef ARAP_PRECOMPUTE_H
#define ARAP_PRECOMPUTE_H
#include <Eigen/Core>
#include <Eigen/Sparse>

namespace igl
{
template <typename T> struct min_quad_with_fixed_data;
}

// Precompute data needed to efficiently conduct local-global iterations for an
// arap deformation. This includes the `data` struct employed by
// `igl::min_quad_with_fixed` to solve the global step" and constructing the
// bi-linear form `K` that mixes rotation degrees of freedom with unknown
// positions for preparing the covariance matrices of the local step and the
// linear term of the global step.
//
// Inputs:
// V #V by dim vertex positions
// F #F by simplex-size list of element indices
// b #b indices into V of handle vertices
// Outputs:
// data pre-factorized system matrix etc. (see `igl::min_quad_with_fixed`)
// K #R*dim by #V
void arap_precompute(
const Eigen::MatrixXd & V,
const Eigen::MatrixXi & F,
const Eigen::VectorXi & b,
igl::min_quad_with_fixed_data<double> & data,
Eigen::SparseMatrix<double> & K);

#endif

29 changes: 29 additions & 0 deletions include/arap_single_iteration.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#ifndef ARAP_SINGLE_ITERATION_H
#define ARAP_SINGLE_ITERATION_H
#include <Eigen/Core>
#include <Eigen/Sparse>

namespace igl
{
template <typename T> struct min_quad_with_fixed_data;
}

// Given precomputed data (`data` and `K`), handle _positions_ `bc` and current
// positions of all vertices `U`, conduct a _single_ iteration of the
// local-global solver for minimizing the as-rigid-as-possible energy. Output
// the _positions_ of all vertices of the mesh (by overwriting `U`).
//
// Inputs:
// data pre-factorized system matrix etc. (see `arap_precompute`
// K pre-constructed bi-linear term of energy combining rotations and
// positions
// U #V by dim list of current positions (see output)
// Outputs:
// U #V by dim list of new positions (see input)
void arap_single_iteration(
const igl::min_quad_with_fixed_data<double> & data,
const Eigen::SparseMatrix<double> & K,
const Eigen::MatrixXd & bc,
Eigen::MatrixXd & U);

#endif
27 changes: 27 additions & 0 deletions include/biharmonic_precompute.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#ifndef BIHARMONIC_PRECOMPUTE_H
#define BIHARMONIC_PRECOMPUTE_H
#include <Eigen/Core>

namespace igl
{
template <typename T> struct min_quad_with_fixed_data;
}

// Precompute data needed to efficiently solve for a biharmonic deformation
// given a mesh with vertices `V` and faces `F` and a list of selected vertices
// as indices `b` into `V`. The output should be a prefacorized system using
// the `data` struct employed by `igl::min_quad_with_fixed`.
//
// Inputs:
// V #V by dim vertex positions
// F #F by simplex-size list of element indices
// b #b indices into V of handle vertices
// Outputs:
// data pre-factorized system matrix etc. (see `igl::min_quad_with_fixed`)
void biharmonic_precompute(
const Eigen::MatrixXd & V,
const Eigen::MatrixXi & F,
const Eigen::VectorXi & b,
igl::min_quad_with_fixed_data<double> & data);

#endif
25 changes: 25 additions & 0 deletions include/biharmonic_solve.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#ifndef BIHARMONIC_SOLVE_H
#define BIHARMONIC_SOLVE_H
#include <Eigen/Core>

namespace igl
{
template <typename T> struct min_quad_with_fixed_data;
}

// Given precomputation data and a list of handle _displacements_ determine
// _displacements_ for all vertices in the mesh.
//
// Inputs:
// data pre-factorized system matrix etc. (see `biharmonic_precompute`
// bc #b by 3 list of displacements for each handle vertex
// Outputs:
// D #V by 3 list of displacements
void biharmonic_solve(
const igl::min_quad_with_fixed_data<double> & data,
const Eigen::MatrixXd & bc,
Eigen::MatrixXd & D);


#endif

Loading