#include <poisson_solver.h>
Public Member Functions | |
void | FixDefaultVertices () |
void | Init (bool _use_direction_field=false, bool _correct_fixed=true, ScalarType _fieldScale=1.0) |
intialize parameters and setup fixed vertices vector | |
bool | IsFeaseable () |
return true if is possible to | |
PoissonSolver (MeshType &_mesh) | |
void | SetBorderAsFixed () |
set the border as fixed | |
void | SetSelectedAsFixed () |
set selected vertices as fixed | |
bool | SolvePoisson (bool _write_messages=false, ScalarType fieldScale=1.0, bool solve_global_fold=true) |
solve the system, it return false if the matrix is singular | |
Private Types | |
typedef MeshType::CoordType | CoordType |
typedef MeshType::FaceType | FaceType |
typedef MeshType::template PerFaceAttributeHandle < CoordType > | PerFaceCoordHandle |
typedef MeshType::ScalarType | ScalarType |
typedef MeshType::VertexType | VertexType |
Private Member Functions | |
void | Add33Block (ScalarType val[3][3], int index[3][3][2]) |
void | Add44Block (ScalarType val[4][4], int index[4][4][2]) |
void | AddAreaTerm (int index[3][3][2], ScalarType ScaleFactor) |
void | AddRHS (ScalarType b[6], int index[3]) |
add this values to the right hand side | |
void | AddVertexIndex (VertexType *v, int index) |
void | AllocateSystem () |
void | BuildLaplacianMatrix (double vfscale=1) |
void | FindFarthestVert (VertexType *&v0, VertexType *&v1) |
void | FindSizes () |
void | FixPointLSquares () |
VertexType * | IndexVertex (int index) |
void | InitIndex () |
void | InitMatrix () |
intitialize the whole matrix | |
void | MapCoords (bool normalize=true, ScalarType=1.0) |
void | perElementLHS (FaceType *f, ScalarType val[3][3], int index[3][3][2]) |
return the LHS for a given face | |
void | perElementRHS (FaceType *f, ScalarType b[6], ScalarType vector_field_scale=1) |
return the RHS for a given face | |
void | PerElementSystemReal (FaceType *f, ScalarType val[3][3], int index[3][3][2], ScalarType b[6], ScalarType vector_field_scale=1.0) |
return the LHS and RHS for a given face | |
void | SetDiagonal (ScalarType val[3][3]) |
void | SetValA (int Xindex, int Yindex, ScalarType val) |
set the value of A of the system Ax=b | |
void | SetValB (int Xindex, ScalarType val) |
set the value of b of the system Ax=b | |
bool | Solve () |
int | VertexIndex (VertexType *v) |
Private Attributes | |
Eigen::SparseMatrix< double > | A |
unknown vector | |
Eigen::VectorXd | b |
bool | correct_fixed |
ScalarType | fieldScale |
size of the scalar field | |
bool | fix_selected |
std::map< int, VertexType * > | IndToVertex |
MeshType & | mesh |
the mesh itself | |
unsigned int | n_fixed_vars |
number of fixed variables | |
unsigned int | n_vert_vars |
std::vector< VertexType * > | to_fix |
vertices to fix | |
unsigned int | total_size |
total system size | |
bool | use_direction_field |
if you intend to follow the cross field | |
std::map< VertexType *, int > | VertexToInd |
solver data | |
Eigen::VectorXd | x |
Definition at line 37 of file poisson_solver.h.
typedef MeshType::CoordType vcg::tri::PoissonSolver< MeshType >::CoordType [private] |
Definition at line 43 of file poisson_solver.h.
typedef MeshType::FaceType vcg::tri::PoissonSolver< MeshType >::FaceType [private] |
Definition at line 41 of file poisson_solver.h.
typedef MeshType:: template PerFaceAttributeHandle<CoordType> vcg::tri::PoissonSolver< MeshType >::PerFaceCoordHandle [private] |
Definition at line 44 of file poisson_solver.h.
typedef MeshType::ScalarType vcg::tri::PoissonSolver< MeshType >::ScalarType [private] |
Definition at line 40 of file poisson_solver.h.
typedef MeshType::VertexType vcg::tri::PoissonSolver< MeshType >::VertexType [private] |
Definition at line 42 of file poisson_solver.h.
vcg::tri::PoissonSolver< MeshType >::PoissonSolver | ( | MeshType & | _mesh | ) | [inline] |
Definition at line 746 of file poisson_solver.h.
void vcg::tri::PoissonSolver< MeshType >::Add33Block | ( | ScalarType | val[3][3], |
int | index[3][3][2] | ||
) | [inline, private] |
add a 3x3 block matrix to the system matrix... indexes are specified in the 3x3 matrix of x,y pairs indexes must be multiplied by 2 cause u and v
add for both u and v
Definition at line 205 of file poisson_solver.h.
void vcg::tri::PoissonSolver< MeshType >::Add44Block | ( | ScalarType | val[4][4], |
int | index[4][4][2] | ||
) | [inline, private] |
add a 3x3 block matrix to the system matrix... indexes are specified in the 3x3 matrix of x,y pairs indexes must be multiplied by 2 cause u and v
add for both u and v
Definition at line 224 of file poisson_solver.h.
void vcg::tri::PoissonSolver< MeshType >::AddAreaTerm | ( | int | index[3][3][2], |
ScalarType | ScaleFactor | ||
) | [inline, private] |
add the area term, scalefactor is used to sum up and normalize on the overlap zones
add for both u and v
Definition at line 156 of file poisson_solver.h.
void vcg::tri::PoissonSolver< MeshType >::AddRHS | ( | ScalarType | b[6], |
int | index[3] | ||
) | [inline, private] |
add this values to the right hand side
Definition at line 190 of file poisson_solver.h.
void vcg::tri::PoissonSolver< MeshType >::AddVertexIndex | ( | VertexType * | v, |
int | index | ||
) | [inline, private] |
Definition at line 90 of file poisson_solver.h.
void vcg::tri::PoissonSolver< MeshType >::AllocateSystem | ( | ) | [inline, private] |
Definition at line 446 of file poisson_solver.h.
void vcg::tri::PoissonSolver< MeshType >::BuildLaplacianMatrix | ( | double | vfscale = 1 | ) | [inline, private] |
void vcg::tri::PoissonSolver< MeshType >::FindFarthestVert | ( | VertexType *& | v0, |
VertexType *& | v1 | ||
) | [inline, private] |
Definition at line 108 of file poisson_solver.h.
void vcg::tri::PoissonSolver< MeshType >::FindSizes | ( | ) | [inline, private] |
initialize matrix size
must be multiplied by 2 becasue of u and v
Definition at line 435 of file poisson_solver.h.
void vcg::tri::PoissonSolver< MeshType >::FixDefaultVertices | ( | ) | [inline] |
fix default vertices no need if already border on other vertices are fixed you need at least 2 fixed for solving without field , while only 1 if you conforms to a given cross field
in this case there are already vertices fixed, so no need to fix by default
then fix only one vertex
then fix 2 vertices
Definition at line 606 of file poisson_solver.h.
void vcg::tri::PoissonSolver< MeshType >::FixPointLSquares | ( | ) | [inline, private] |
VertexType* vcg::tri::PoissonSolver< MeshType >::IndexVertex | ( | int | index | ) | [inline, private] |
Definition at line 83 of file poisson_solver.h.
void vcg::tri::PoissonSolver< MeshType >::Init | ( | bool | _use_direction_field = false , |
bool | _correct_fixed = true , |
||
ScalarType | _fieldScale = 1.0 |
||
) | [inline] |
intialize parameters and setup fixed vertices vector
Definition at line 640 of file poisson_solver.h.
void vcg::tri::PoissonSolver< MeshType >::InitIndex | ( | ) | [inline, private] |
Definition at line 475 of file poisson_solver.h.
void vcg::tri::PoissonSolver< MeshType >::InitMatrix | ( | ) | [inline, private] |
intitialize the whole matrix
Definition at line 456 of file poisson_solver.h.
bool vcg::tri::PoissonSolver< MeshType >::IsFeaseable | ( | ) | [inline] |
return true if is possible to
Definition at line 544 of file poisson_solver.h.
void vcg::tri::PoissonSolver< MeshType >::MapCoords | ( | bool | normalize = true , |
ScalarType | = 1.0 |
||
) | [inline, private] |
map back values to vertex if normalize==true then set the coordinates between 0 and 1
clear Visited Flag
then copy to faces
Definition at line 485 of file poisson_solver.h.
void vcg::tri::PoissonSolver< MeshType >::perElementLHS | ( | FaceType * | f, |
ScalarType | val[3][3], | ||
int | index[3][3][2] | ||
) | [inline, private] |
return the LHS for a given face
initialize to zero
get the vertices
get the indexes of vertex instance (to consider cuts) for the current face
initialize the indexes for the block
initialize edges
then consider area but also considering scale factor dur to overlaps
set the matrix as diagonal
Definition at line 241 of file poisson_solver.h.
void vcg::tri::PoissonSolver< MeshType >::perElementRHS | ( | FaceType * | f, |
ScalarType | b[6], | ||
ScalarType | vector_field_scale = 1 |
||
) | [inline, private] |
return the RHS for a given face
then set the rhs
2);
2);
Definition at line 291 of file poisson_solver.h.
void vcg::tri::PoissonSolver< MeshType >::PerElementSystemReal | ( | FaceType * | f, |
ScalarType | val[3][3], | ||
int | index[3][3][2], | ||
ScalarType | b[6], | ||
ScalarType | vector_field_scale = 1.0 |
||
) | [inline, private] |
return the LHS and RHS for a given face
Definition at line 338 of file poisson_solver.h.
void vcg::tri::PoissonSolver< MeshType >::SetBorderAsFixed | ( | ) | [inline] |
set the border as fixed
Definition at line 573 of file poisson_solver.h.
void vcg::tri::PoissonSolver< MeshType >::SetDiagonal | ( | ScalarType | val[3][3] | ) | [inline, private] |
set the diagonal of the matrix (which is zero at the beginning) as the sum of the other element inverted by sign
Definition at line 178 of file poisson_solver.h.
void vcg::tri::PoissonSolver< MeshType >::SetSelectedAsFixed | ( | ) | [inline] |
set selected vertices as fixed
Definition at line 588 of file poisson_solver.h.
void vcg::tri::PoissonSolver< MeshType >::SetValA | ( | int | Xindex, |
int | Yindex, | ||
ScalarType | val | ||
) | [inline, private] |
set the value of A of the system Ax=b
Definition at line 96 of file poisson_solver.h.
void vcg::tri::PoissonSolver< MeshType >::SetValB | ( | int | Xindex, |
ScalarType | val | ||
) | [inline, private] |
set the value of b of the system Ax=b
Definition at line 147 of file poisson_solver.h.
bool vcg::tri::PoissonSolver< MeshType >::Solve | ( | ) | [inline, private] |
Definition at line 462 of file poisson_solver.h.
bool vcg::tri::PoissonSolver< MeshType >::SolvePoisson | ( | bool | _write_messages = false , |
ScalarType | fieldScale = 1.0 , |
||
bool | solve_global_fold = true |
||
) | [inline] |
solve the system, it return false if the matrix is singular
Initializing Matrix
set vertex indexes
initialize the matrix ALLOCATING SPACE
build the laplacian system
then check if majority of faces are folded
Definition at line 661 of file poisson_solver.h.
int vcg::tri::PoissonSolver< MeshType >::VertexIndex | ( | VertexType * | v | ) | [inline, private] |
Definition at line 76 of file poisson_solver.h.
Eigen::SparseMatrix<double> vcg::tri::PoissonSolver< MeshType >::A [private] |
unknown vector
Definition at line 59 of file poisson_solver.h.
Eigen::VectorXd vcg::tri::PoissonSolver< MeshType >::b [private] |
Definition at line 60 of file poisson_solver.h.
bool vcg::tri::PoissonSolver< MeshType >::correct_fixed [private] |
Definition at line 70 of file poisson_solver.h.
ScalarType vcg::tri::PoissonSolver< MeshType >::fieldScale [private] |
size of the scalar field
Definition at line 72 of file poisson_solver.h.
bool vcg::tri::PoissonSolver< MeshType >::fix_selected [private] |
Definition at line 70 of file poisson_solver.h.
std::map<int, VertexType*> vcg::tri::PoissonSolver< MeshType >::IndToVertex [private] |
Definition at line 52 of file poisson_solver.h.
MeshType& vcg::tri::PoissonSolver< MeshType >::mesh [private] |
the mesh itself
Definition at line 47 of file poisson_solver.h.
unsigned int vcg::tri::PoissonSolver< MeshType >::n_fixed_vars [private] |
number of fixed variables
Definition at line 67 of file poisson_solver.h.
unsigned int vcg::tri::PoissonSolver< MeshType >::n_vert_vars [private] |
Definition at line 63 of file poisson_solver.h.
std::vector<VertexType *> vcg::tri::PoissonSolver< MeshType >::to_fix [private] |
vertices to fix
Definition at line 55 of file poisson_solver.h.
unsigned int vcg::tri::PoissonSolver< MeshType >::total_size [private] |
total system size
Definition at line 65 of file poisson_solver.h.
bool vcg::tri::PoissonSolver< MeshType >::use_direction_field [private] |
if you intend to follow the cross field
Definition at line 70 of file poisson_solver.h.
std::map<VertexType*,int> vcg::tri::PoissonSolver< MeshType >::VertexToInd [private] |
solver data
Definition at line 51 of file poisson_solver.h.
Eigen::VectorXd vcg::tri::PoissonSolver< MeshType >::x [private] |
Definition at line 60 of file poisson_solver.h.