Blender V2.61 - r43446
Classes | Defines | Typedefs | Functions | Variables

meshlaplacian.c File Reference

#include <math.h>
#include <string.h>
#include "MEM_guardedalloc.h"
#include "DNA_object_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_scene_types.h"
#include "BLI_math.h"
#include "BLI_edgehash.h"
#include "BLI_memarena.h"
#include "BLI_utildefines.h"
#include "BLI_string.h"
#include "BKE_DerivedMesh.h"
#include "BKE_modifier.h"
#include "ONL_opennl.h"
#include "BLO_sys_types.h"
#include "ED_mesh.h"
#include "ED_armature.h"
#include "meshlaplacian.h"

Go to the source code of this file.

Classes

struct  LaplacianSystem
struct  LaplacianSystem::HeatWeighting
struct  BVHCallbackUserData
struct  MDefBoundIsect
struct  MDefBindInfluence
struct  MeshDeformBind
struct  MeshDeformIsect

Defines

#define C_WEIGHT   1.0f
#define WEIGHT_LIMIT_START   0.05f
#define WEIGHT_LIMIT_END   0.025f
#define DISTANCE_EPSILON   1e-4f
#define EPSILON   0.0001f
#define MESHDEFORM_TAG_UNTYPED   0
#define MESHDEFORM_TAG_BOUNDARY   1
#define MESHDEFORM_TAG_INTERIOR   2
#define MESHDEFORM_TAG_EXTERIOR   3
#define MESHDEFORM_LEN_THRESHOLD   1e-6f
#define MESHDEFORM_MIN_INFLUENCE   0.0005f

Typedefs

typedef struct BVHCallbackUserData BVHCallbackUserData
typedef struct MDefBoundIsect MDefBoundIsect
typedef struct MDefBindInfluence MDefBindInfluence
typedef struct MeshDeformBind MeshDeformBind
typedef struct MeshDeformIsect MeshDeformIsect

Functions

static void waitcursor (int UNUSED(val))
static void progress_bar (int UNUSED(dummy_val), const char *UNUSED(dummy))
static void start_progress_bar (void)
static void end_progress_bar (void)
static void error (const char *str)
static void laplacian_increase_edge_count (EdgeHash *edgehash, int v1, int v2)
static int laplacian_edge_count (EdgeHash *edgehash, int v1, int v2)
static float cotan_weight (float *v1, float *v2, float *v3)
static void laplacian_triangle_area (LaplacianSystem *sys, int i1, int i2, int i3)
static void laplacian_triangle_weights (LaplacianSystem *sys, int f, int i1, int i2, int i3)
static LaplacianSystemlaplacian_system_construct_begin (int totvert, int totface, int lsq)
void laplacian_add_vertex (LaplacianSystem *sys, float *co, int pinned)
void laplacian_add_triangle (LaplacianSystem *sys, int v1, int v2, int v3)
static void laplacian_system_construct_end (LaplacianSystem *sys)
static void laplacian_system_delete (LaplacianSystem *sys)
void laplacian_begin_solve (LaplacianSystem *sys, int index)
void laplacian_add_right_hand_side (LaplacianSystem *UNUSED(sys), int v, float value)
int laplacian_system_solve (LaplacianSystem *sys)
float laplacian_system_get_solution (int v)
static void bvh_callback (void *userdata, int index, const BVHTreeRay *UNUSED(ray), BVHTreeRayHit *hit)
static void heat_ray_tree_create (LaplacianSystem *sys)
static int heat_ray_source_visible (LaplacianSystem *sys, int vertex, int source)
static float heat_source_distance (LaplacianSystem *sys, int vertex, int source)
static int heat_source_closest (LaplacianSystem *sys, int vertex, int source)
static void heat_set_H (LaplacianSystem *sys, int vertex)
static void heat_calc_vnormals (LaplacianSystem *sys)
static void heat_laplacian_create (LaplacianSystem *sys)
static void heat_system_free (LaplacianSystem *sys)
static float heat_limit_weight (float weight)
void heat_bone_weighting (Object *ob, Mesh *me, float(*verts)[3], int numsource, bDeformGroup **dgrouplist, bDeformGroup **dgroupflip, float(*root)[3], float(*tip)[3], int *selected, const char **err_str)
static int meshdeform_tri_intersect (float orig[3], float end[3], float vert0[3], float vert1[3], float vert2[3], float *isectco, float *uvw)
static int meshdeform_intersect (MeshDeformBind *mdb, MeshDeformIsect *isec)
static MDefBoundIsectmeshdeform_ray_tree_intersect (MeshDeformBind *mdb, float *co1, float *co2)
static int meshdeform_inside_cage (MeshDeformBind *mdb, float *co)
static int meshdeform_index (MeshDeformBind *mdb, int x, int y, int z, int n)
static void meshdeform_cell_center (MeshDeformBind *mdb, int x, int y, int z, int n, float *center)
static void meshdeform_add_intersections (MeshDeformBind *mdb, int x, int y, int z)
static void meshdeform_bind_floodfill (MeshDeformBind *mdb)
static float meshdeform_boundary_phi (MeshDeformBind *UNUSED(mdb), MDefBoundIsect *isect, int cagevert)
static float meshdeform_interp_w (MeshDeformBind *mdb, float *gridvec, float *UNUSED(vec), int UNUSED(cagevert))
static void meshdeform_check_semibound (MeshDeformBind *mdb, int x, int y, int z)
static float meshdeform_boundary_total_weight (MeshDeformBind *mdb, int x, int y, int z)
static void meshdeform_matrix_add_cell (MeshDeformBind *mdb, int x, int y, int z)
static void meshdeform_matrix_add_rhs (MeshDeformBind *mdb, int x, int y, int z, int cagevert)
static void meshdeform_matrix_add_semibound_phi (MeshDeformBind *mdb, int x, int y, int z, int cagevert)
static void meshdeform_matrix_add_exterior_phi (MeshDeformBind *mdb, int x, int y, int z, int UNUSED(cagevert))
static void meshdeform_matrix_solve (MeshDeformModifierData *mmd, MeshDeformBind *mdb)
static void harmonic_coordinates_bind (Scene *UNUSED(scene), MeshDeformModifierData *mmd, MeshDeformBind *mdb)
void mesh_deform_bind (Scene *scene, MeshDeformModifierData *mmd, float *vertexcos, int totvert, float cagemat[][4])

Variables

static int MESHDEFORM_OFFSET [7][3]

Detailed Description

Definition in file meshlaplacian.c.


Define Documentation

#define C_WEIGHT   1.0f

Definition at line 396 of file meshlaplacian.c.

Referenced by heat_set_H().

#define DISTANCE_EPSILON   1e-4f

Definition at line 399 of file meshlaplacian.c.

Referenced by heat_source_closest().

#define EPSILON   0.0001f

Definition at line 1055 of file meshlaplacian.c.

Referenced by meshdeform_tri_intersect().

#define MESHDEFORM_LEN_THRESHOLD   1e-6f

Definition at line 1062 of file meshlaplacian.c.

Referenced by meshdeform_ray_tree_intersect().

#define MESHDEFORM_MIN_INFLUENCE   0.0005f

Definition at line 1064 of file meshlaplacian.c.

Referenced by meshdeform_matrix_solve().

#define MESHDEFORM_TAG_BOUNDARY   1

Definition at line 1058 of file meshlaplacian.c.

Referenced by meshdeform_add_intersections(), and meshdeform_bind_floodfill().

#define MESHDEFORM_TAG_EXTERIOR   3
#define MESHDEFORM_TAG_INTERIOR   2

Definition at line 1059 of file meshlaplacian.c.

Referenced by meshdeform_bind_floodfill(), and meshdeform_matrix_solve().

#define MESHDEFORM_TAG_UNTYPED   0

Definition at line 1057 of file meshlaplacian.c.

Referenced by harmonic_coordinates_bind(), and meshdeform_bind_floodfill().

#define WEIGHT_LIMIT_END   0.025f

Definition at line 398 of file meshlaplacian.c.

Referenced by heat_limit_weight().

#define WEIGHT_LIMIT_START   0.05f

Definition at line 397 of file meshlaplacian.c.

Referenced by heat_limit_weight().


Typedef Documentation


Function Documentation

static void bvh_callback ( void *  userdata,
int  index,
const BVHTreeRay UNUSEDray,
BVHTreeRayHit hit 
) [static]
static float cotan_weight ( float *  v1,
float *  v2,
float *  v3 
) [static]
static void end_progress_bar ( void  ) [static]

Definition at line 73 of file meshlaplacian.c.

Referenced by mesh_deform_bind().

static void error ( const char *  str) [static]

Definition at line 74 of file meshlaplacian.c.

Referenced by meshdeform_matrix_solve().

static void harmonic_coordinates_bind ( Scene UNUSEDscene,
MeshDeformModifierData mmd,
MeshDeformBind mdb 
) [static]
void heat_bone_weighting ( Object ob,
Mesh me,
float(*)  verts[3],
int  numsource,
bDeformGroup **  dgrouplist,
bDeformGroup **  dgroupflip,
float(*)  root[3],
float(*)  tip[3],
int *  selected,
const char **  err_str 
)
static void heat_calc_vnormals ( LaplacianSystem sys) [static]
static void heat_laplacian_create ( LaplacianSystem sys) [static]
static float heat_limit_weight ( float  weight) [static]

Definition at line 636 of file meshlaplacian.c.

References WEIGHT_LIMIT_END, and WEIGHT_LIMIT_START.

Referenced by heat_bone_weighting().

static int heat_ray_source_visible ( LaplacianSystem sys,
int  vertex,
int  source 
) [static]
static void heat_ray_tree_create ( LaplacianSystem sys) [static]
static void heat_set_H ( LaplacianSystem sys,
int  vertex 
) [static]
static int heat_source_closest ( LaplacianSystem sys,
int  vertex,
int  source 
) [static]
static float heat_source_distance ( LaplacianSystem sys,
int  vertex,
int  source 
) [static]
static void heat_system_free ( LaplacianSystem sys) [static]
void laplacian_add_right_hand_side ( LaplacianSystem UNUSEDsys,
int  v,
float  value 
)

Definition at line 371 of file meshlaplacian.c.

References nlRightHandSideAdd().

Referenced by heat_bone_weighting().

void laplacian_add_triangle ( LaplacianSystem sys,
int  v1,
int  v2,
int  v3 
)

Definition at line 279 of file meshlaplacian.c.

References LaplacianSystem::faces, and LaplacianSystem::totface.

Referenced by heat_laplacian_create().

void laplacian_add_vertex ( LaplacianSystem sys,
float *  co,
int  pinned 
)
void laplacian_begin_solve ( LaplacianSystem sys,
int  index 
)
static int laplacian_edge_count ( EdgeHash edgehash,
int  v1,
int  v2 
) [static]

Definition at line 149 of file meshlaplacian.c.

References BLI_edgehash_lookup().

Referenced by laplacian_triangle_weights().

static void laplacian_increase_edge_count ( EdgeHash edgehash,
int  v1,
int  v2 
) [static]

Definition at line 139 of file meshlaplacian.c.

References BLI_edgehash_insert(), BLI_edgehash_lookup_p(), and p.

Referenced by laplacian_system_construct_end().

static LaplacianSystem* laplacian_system_construct_begin ( int  totvert,
int  totface,
int  lsq 
) [static]
static void laplacian_system_construct_end ( LaplacianSystem sys) [static]
static void laplacian_system_delete ( LaplacianSystem sys) [static]
float laplacian_system_get_solution ( int  v)

Definition at line 387 of file meshlaplacian.c.

References nlGetVariable().

Referenced by heat_bone_weighting().

int laplacian_system_solve ( LaplacianSystem sys)
static void laplacian_triangle_area ( LaplacianSystem sys,
int  i1,
int  i2,
int  i3 
) [static]
static void laplacian_triangle_weights ( LaplacianSystem sys,
int  f,
int  i1,
int  i2,
int  i3 
) [static]
void mesh_deform_bind ( Scene scene,
MeshDeformModifierData mmd,
float *  vertexcos,
int  totvert,
float  cagemat[][4] 
)
static void meshdeform_add_intersections ( MeshDeformBind mdb,
int  x,
int  y,
int  z 
) [static]
static void meshdeform_bind_floodfill ( MeshDeformBind mdb) [static]
static float meshdeform_boundary_phi ( MeshDeformBind UNUSEDmdb,
MDefBoundIsect isect,
int  cagevert 
) [static]
static float meshdeform_boundary_total_weight ( MeshDeformBind mdb,
int  x,
int  y,
int  z 
) [static]
static void meshdeform_cell_center ( MeshDeformBind mdb,
int  x,
int  y,
int  z,
int  n,
float *  center 
) [static]
static void meshdeform_check_semibound ( MeshDeformBind mdb,
int  x,
int  y,
int  z 
) [static]
static int meshdeform_index ( MeshDeformBind mdb,
int  x,
int  y,
int  z,
int  n 
) [static]
static int meshdeform_inside_cage ( MeshDeformBind mdb,
float *  co 
) [static]
static float meshdeform_interp_w ( MeshDeformBind mdb,
float *  gridvec,
float *  UNUSEDvec,
int   UNUSEDcagevert 
) [static]
static int meshdeform_intersect ( MeshDeformBind mdb,
MeshDeformIsect isec 
) [static]
static void meshdeform_matrix_add_cell ( MeshDeformBind mdb,
int  x,
int  y,
int  z 
) [static]
static void meshdeform_matrix_add_exterior_phi ( MeshDeformBind mdb,
int  x,
int  y,
int  z,
int   UNUSEDcagevert 
) [static]
static void meshdeform_matrix_add_rhs ( MeshDeformBind mdb,
int  x,
int  y,
int  z,
int  cagevert 
) [static]
static void meshdeform_matrix_add_semibound_phi ( MeshDeformBind mdb,
int  x,
int  y,
int  z,
int  cagevert 
) [static]
static void meshdeform_matrix_solve ( MeshDeformModifierData mmd,
MeshDeformBind mdb 
) [static]
static MDefBoundIsect* meshdeform_ray_tree_intersect ( MeshDeformBind mdb,
float *  co1,
float *  co2 
) [static]
static int meshdeform_tri_intersect ( float  orig[3],
float  end[3],
float  vert0[3],
float  vert1[3],
float  vert2[3],
float *  isectco,
float *  uvw 
) [static]

Definition at line 1125 of file meshlaplacian.c.

References cross_v3_v3v3(), dot_v3v3(), EPSILON, and sub_v3_v3v3().

Referenced by meshdeform_intersect().

static void progress_bar ( int   UNUSEDdummy_val,
const char *  UNUSEDdummy 
) [static]

Definition at line 71 of file meshlaplacian.c.

Referenced by harmonic_coordinates_bind(), and meshdeform_matrix_solve().

static void start_progress_bar ( void  ) [static]

Definition at line 72 of file meshlaplacian.c.

Referenced by mesh_deform_bind().

static void waitcursor ( int   UNUSEDval) [static]

Definition at line 70 of file meshlaplacian.c.

Referenced by mesh_deform_bind().


Variable Documentation

int MESHDEFORM_OFFSET[7][3] [static]
Initial value:
        {{0,0,0}, {1,0,0}, {-1,0,0}, {0,1,0}, {0,-1,0}, {0,0,1}, {0,0,-1}}

Definition at line 1066 of file meshlaplacian.c.