|
Blender
V2.93
|
#include "BLI_utildefines.h"#include "BLI_math.h"#include "BLI_string.h"#include "BLI_utildefines_stack.h"#include "MEM_guardedalloc.h"#include "BLT_translation.h"#include "DNA_defaults.h"#include "DNA_mesh_types.h"#include "DNA_meshdata_types.h"#include "DNA_screen_types.h"#include "BKE_context.h"#include "BKE_deform.h"#include "BKE_editmesh.h"#include "BKE_lib_id.h"#include "BKE_mesh.h"#include "BKE_mesh_mapping.h"#include "BKE_mesh_runtime.h"#include "BKE_mesh_wrapper.h"#include "BKE_particle.h"#include "BKE_screen.h"#include "UI_interface.h"#include "UI_resources.h"#include "BLO_read_write.h"#include "RNA_access.h"#include "MOD_ui_common.h"#include "MOD_util.h"#include "eigen_capi.h"Go to the source code of this file.
Classes | |
| struct | LaplacianSystem |
Typedefs | |
| typedef struct LaplacianSystem | LaplacianSystem |
Functions | |
| static LaplacianSystem * | newLaplacianSystem (void) |
| static LaplacianSystem * | initLaplacianSystem (int totalVerts, int totalEdges, int totalTris, int totalAnchors, const char defgrpName[64], int iterations) |
| static void | deleteLaplacianSystem (LaplacianSystem *sys) |
| static void | createFaceRingMap (const int mvert_tot, const MLoopTri *mlooptri, const int mtri_tot, const MLoop *mloop, MeshElemMap **r_map, int **r_indices) |
| static void | createVertRingMap (const int mvert_tot, const MEdge *medge, const int medge_tot, MeshElemMap **r_map, int **r_indices) |
| static void | initLaplacianMatrix (LaplacianSystem *sys) |
| static void | computeImplictRotations (LaplacianSystem *sys) |
| static void | rotateDifferentialCoordinates (LaplacianSystem *sys) |
| static void | laplacianDeformPreview (LaplacianSystem *sys, float(*vertexCos)[3]) |
| static bool | isValidVertexGroup (LaplacianDeformModifierData *lmd, Object *ob, Mesh *mesh) |
| static void | initSystem (LaplacianDeformModifierData *lmd, Object *ob, Mesh *mesh, float(*vertexCos)[3], int numVerts) |
| static int | isSystemDifferent (LaplacianDeformModifierData *lmd, Object *ob, Mesh *mesh, int numVerts) |
| static void | LaplacianDeformModifier_do (LaplacianDeformModifierData *lmd, Object *ob, Mesh *mesh, float(*vertexCos)[3], int numVerts) |
| static void | initData (ModifierData *md) |
| static void | copyData (const ModifierData *md, ModifierData *target, const int flag) |
| static bool | isDisabled (const struct Scene *UNUSED(scene), ModifierData *md, bool UNUSED(useRenderParams)) |
| static void | requiredDataMask (Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks) |
| static void | deformVerts (ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh, float(*vertexCos)[3], int numVerts) |
| static void | deformVertsEM (ModifierData *md, const ModifierEvalContext *ctx, struct BMEditMesh *editData, Mesh *mesh, float(*vertexCos)[3], int numVerts) |
| static void | freeData (ModifierData *md) |
| static void | panel_draw (const bContext *UNUSED(C), Panel *panel) |
| static void | panelRegister (ARegionType *region_type) |
| static void | blendWrite (BlendWriter *writer, const ModifierData *md) |
| static void | blendRead (BlendDataReader *reader, ModifierData *md) |
Variables | |
| ModifierTypeInfo | modifierType_LaplacianDeform |
| typedef struct LaplacianSystem LaplacianSystem |
| anonymous enum |
Definition at line 62 of file MOD_laplaciandeform.c.
|
static |
Definition at line 867 of file MOD_laplaciandeform.c.
References BLO_read_float3_array(), LaplacianDeformModifierData::cache_system, NULL, LaplacianDeformModifierData::total_verts, and LaplacianDeformModifierData::vertexco.
|
static |
Definition at line 860 of file MOD_laplaciandeform.c.
References BLO_write_float3_array(), LaplacianDeformModifierData::total_verts, and LaplacianDeformModifierData::vertexco.
|
static |
Definition at line 317 of file MOD_laplaciandeform.c.
References LaplacianSystem::co, copy_v3_v3(), MeshElemMap::count, dot_v3v3(), fabsf, MeshElemMap::indices, LaplacianSystem::no, normalize_v3(), NULL, LaplacianSystem::ringv_map, sub_v3_v3v3(), LaplacianSystem::total_verts, and LaplacianSystem::unit_verts.
Referenced by laplacianDeformPreview().
|
static |
Definition at line 743 of file MOD_laplaciandeform.c.
References BKE_modifier_copydata_generic(), LaplacianDeformModifierData::cache_system, MEM_dupallocN, NULL, and LaplacianDeformModifierData::vertexco.
|
static |
Definition at line 157 of file MOD_laplaciandeform.c.
References MeshElemMap::count, MeshElemMap::indices, indices, MEM_calloc_arrayN, MLoopTri::tri, and MLoop::v.
Referenced by initSystem().
|
static |
Definition at line 195 of file MOD_laplaciandeform.c.
References MeshElemMap::count, MeshElemMap::indices, indices, MEM_calloc_arrayN, MEdge::v1, and MEdge::v2.
Referenced by initSystem().
|
static |
Definition at line 776 of file MOD_laplaciandeform.c.
References BKE_id_free(), ELEM, LaplacianDeformModifier_do(), mesh, MOD_deform_mesh_eval_get(), NULL, and ModifierEvalContext::object.
|
static |
Definition at line 792 of file MOD_laplaciandeform.c.
References BKE_id_free(), BKE_mesh_wrapper_ensure_mdata(), ELEM, LaplacianDeformModifier_do(), mesh, MOD_deform_mesh_eval_get(), NULL, and ModifierEvalContext::object.
|
static |
Definition at line 138 of file MOD_laplaciandeform.c.
References LaplacianSystem::co, LaplacianSystem::context, LaplacianSystem::delta, EIG_linear_solver_delete(), LaplacianSystem::index_anchors, MEM_SAFE_FREE, LaplacianSystem::no, LaplacianSystem::ringf_indices, LaplacianSystem::ringf_map, LaplacianSystem::ringv_indices, LaplacianSystem::ringv_map, LaplacianSystem::tris, and LaplacianSystem::unit_verts.
Referenced by freeData(), and LaplacianDeformModifier_do().
|
static |
Definition at line 815 of file MOD_laplaciandeform.c.
References LaplacianDeformModifierData::cache_system, deleteLaplacianSystem(), if(), MEM_SAFE_FREE, LaplacianDeformModifierData::total_verts, and LaplacianDeformModifierData::vertexco.
|
static |
Definition at line 734 of file MOD_laplaciandeform.c.
References BLI_assert, DNA_struct_default_get, MEMCMP_STRUCT_AFTER_IS_ZERO, and MEMCPY_STRUCT_AFTER.
|
static |
This method computes the Laplacian Matrix and Differential Coordinates for all vertex in the mesh.. The Linear system is LV = d Where L is Laplacian Matrix, V as the vertices in Mesh, d is the differential coordinates The Laplacian Matrix is computes as a Lij = sum(Wij) (if i == j) Lij = Wij (if i != j) Wij is weight between vertex Vi and vertex Vj, we use cotangent weight
The Differential Coordinate is computes as a di = Vi * sum(Wij) - sum(Wij * Vj) Where : di is the Differential Coordinate i sum (Wij) is the sum of all weights between vertex Vi and its vertices neighbors (Vj) sum (Wij * Vj) is the sum of the product between vertex neighbor Vj and weight Wij for all neighborhood.
This Laplacian Matrix is described in the paper: Desbrun M. et.al, Implicit fairing of irregular meshes using diffusion and curvature flow, SIGGRAPH '99, page 317-324, New York, USA
The computation of Laplace Beltrami operator on Hybrid Triangle/Quad Meshes is described in the paper: Pinzon A., Romero E., Shape Inflation With an Adapted Laplacian Operator For Hybrid Quad/Triangle Meshes, Conference on Graphics Patterns and Images, SIBGRAPI, 2013
The computation of Differential Coordinates is described in the paper: Sorkine, O. Laplacian Surface Editing. Proceedings of the EUROGRAPHICS/ACM SIGGRAPH Symposium on Geometry Processing,
Definition at line 264 of file MOD_laplaciandeform.c.
References add_v3_v3(), LaplacianSystem::co, LaplacianSystem::context, cotangent_tri_weight_v3(), LaplacianSystem::delta, EIG_linear_solver_matrix_add(), LaplacianSystem::no, normal_tri_v3(), LaplacianSystem::total_tris, LaplacianSystem::tris, UNPACK3, v1, and v2.
Referenced by laplacianDeformPreview().
|
static |
Definition at line 112 of file MOD_laplaciandeform.c.
References LaplacianSystem::anchor_grp_name, BLI_strncpy(), LaplacianSystem::co, LaplacianSystem::delta, LaplacianSystem::has_solution, LaplacianSystem::index_anchors, LaplacianSystem::is_matrix_computed, MEM_calloc_arrayN, MEM_malloc_arrayN, newLaplacianSystem(), LaplacianSystem::no, LaplacianSystem::repeat, LaplacianSystem::total_anchors, LaplacianSystem::total_edges, LaplacianSystem::total_tris, LaplacianSystem::total_verts, LaplacianSystem::tris, and LaplacianSystem::unit_verts.
Referenced by initSystem().
|
static |
Definition at line 537 of file MOD_laplaciandeform.c.
References LaplacianDeformModifierData::anchor_grp_name, BKE_defvert_find_weight(), BKE_mesh_runtime_looptri_ensure(), BKE_mesh_runtime_looptri_len(), BLI_assert, LaplacianDeformModifierData::cache_system, LaplacianSystem::co, createFaceRingMap(), createVertRingMap(), LaplacianDeformModifierData::flag, LaplacianSystem::index_anchors, initLaplacianSystem(), isValidVertexGroup(), Mesh::medge, MEM_freeN, MEM_malloc_arrayN, mesh, Mesh::mloop, MOD_get_vgroup(), MOD_LAPLACIANDEFORM_INVERT_VGROUP, NULL, LaplacianDeformModifierData::repeat, LaplacianSystem::ringf_indices, LaplacianSystem::ringf_map, LaplacianSystem::ringv_indices, LaplacianSystem::ringv_map, STACK_DECLARE, STACK_INIT, STACK_PUSH, STACK_SIZE, LaplacianSystem::total_tris, LaplacianDeformModifierData::total_verts, Mesh::totedge, Mesh::totvert, MLoopTri::tri, LaplacianSystem::tris, MLoop::v, and LaplacianDeformModifierData::vertexco.
Referenced by LaplacianDeformModifier_do().
|
static |
Definition at line 754 of file MOD_laplaciandeform.c.
References LaplacianDeformModifierData::anchor_grp_name.
|
static |
Definition at line 605 of file MOD_laplaciandeform.c.
References LaplacianDeformModifierData::anchor_grp_name, LaplacianSystem::anchor_grp_name, BKE_defvert_find_weight(), LaplacianDeformModifierData::cache_system, LaplacianDeformModifierData::flag, LAPDEFORM_SYSTEM_CHANGE_EDGES, LAPDEFORM_SYSTEM_CHANGE_NOT_VALID_GROUP, LAPDEFORM_SYSTEM_CHANGE_VERTEXES, LAPDEFORM_SYSTEM_NOT_CHANGE, LAPDEFORM_SYSTEM_ONLY_CHANGE_ANCHORS, LAPDEFORM_SYSTEM_ONLY_CHANGE_GROUP, mesh, MOD_get_vgroup(), MOD_LAPLACIANDEFORM_INVERT_VGROUP, NULL, STREQ, LaplacianSystem::total_anchors, LaplacianSystem::total_edges, LaplacianSystem::total_verts, and Mesh::totedge.
Referenced by LaplacianDeformModifier_do().
|
static |
Definition at line 527 of file MOD_laplaciandeform.c.
References LaplacianDeformModifierData::anchor_grp_name, mesh, MOD_get_vgroup(), and NULL.
Referenced by initSystem(), and LaplacianDeformModifier_do().
|
static |
Definition at line 648 of file MOD_laplaciandeform.c.
References LaplacianDeformModifierData::anchor_grp_name, LaplacianSystem::anchor_grp_name, BKE_modifier_set_error(), LaplacianDeformModifierData::cache_system, deleteLaplacianSystem(), ELEM, LaplacianDeformModifierData::flag, float(), LaplacianSystem::has_solution, initSystem(), LaplacianSystem::is_matrix_computed, isSystemDifferent(), isValidVertexGroup(), LAPDEFORM_SYSTEM_CHANGE_EDGES, LAPDEFORM_SYSTEM_CHANGE_NOT_VALID_GROUP, LAPDEFORM_SYSTEM_CHANGE_VERTEXES, LAPDEFORM_SYSTEM_ONLY_CHANGE_ANCHORS, LAPDEFORM_SYSTEM_ONLY_CHANGE_GROUP, laplacianDeformPreview(), MEM_malloc_arrayN, MEM_SAFE_FREE, mesh, MOD_LAPLACIANDEFORM_BIND, LaplacianDeformModifierData::modifier, NULL, LaplacianDeformModifierData::repeat, LaplacianSystem::repeat, LaplacianSystem::total_edges, LaplacianDeformModifierData::total_verts, Mesh::totedge, and LaplacianDeformModifierData::vertexco.
Referenced by deformVerts(), and deformVertsEM().
|
static |
Definition at line 410 of file MOD_laplaciandeform.c.
References LaplacianSystem::co, computeImplictRotations(), LaplacianSystem::context, LaplacianSystem::delta, EIG_linear_least_squares_solver_new(), EIG_linear_solver_matrix_add(), EIG_linear_solver_right_hand_side_add(), EIG_linear_solver_solve(), EIG_linear_solver_variable_get(), EIG_linear_solver_variable_set(), LaplacianSystem::has_solution, LaplacianSystem::index_anchors, initLaplacianMatrix(), LaplacianSystem::is_matrix_computed, LaplacianSystem::repeat, rotateDifferentialCoordinates(), LaplacianSystem::total_anchors, and LaplacianSystem::total_verts.
Referenced by LaplacianDeformModifier_do().
|
static |
Definition at line 95 of file MOD_laplaciandeform.c.
References LaplacianSystem::anchor_grp_name, LaplacianSystem::has_solution, LaplacianSystem::is_matrix_computed, MEM_callocN, LaplacianSystem::repeat, LaplacianSystem::total_anchors, LaplacianSystem::total_edges, LaplacianSystem::total_tris, and LaplacianSystem::total_verts.
Referenced by initLaplacianSystem().
Definition at line 826 of file MOD_laplaciandeform.c.
References IFACE_, Panel::layout, modifier_panel_end(), modifier_panel_get_property_pointers(), modifier_vgroup_ui(), NULL, ptr, RNA_boolean_get(), RNA_string_length(), uiItemO(), uiItemR(), uiItemS(), uiLayoutRow(), uiLayoutSetEnabled(), and uiLayoutSetPropSep().
Referenced by panelRegister().
|
static |
Definition at line 855 of file MOD_laplaciandeform.c.
References eModifierType_LaplacianDeform, modifier_panel_register(), and panel_draw().
|
static |
Definition at line 765 of file MOD_laplaciandeform.c.
References LaplacianDeformModifierData::anchor_grp_name, CD_MASK_MDEFORMVERT, and CustomData_MeshMasks::vmask.
|
static |
Definition at line 342 of file MOD_laplaciandeform.c.
References add_v3_v3(), alpha, beta(), LaplacianSystem::co, LaplacianSystem::context, copy_v3_v3(), MeshElemMap::count, cross_v3_v3v3(), LaplacianSystem::delta, dot_v3v3(), EIG_linear_solver_right_hand_side_add(), EIG_linear_solver_variable_get(), MeshElemMap::indices, len_squared_v3(), mul_v3_v3fl(), LaplacianSystem::no, normal_tri_v3(), normalize_v3(), LaplacianSystem::ringf_map, sub_v3_v3(), sub_v3_v3v3(), LaplacianSystem::total_verts, LaplacianSystem::tris, LaplacianSystem::unit_verts, UNPACK3, vn, and zero_v3().
Referenced by laplacianDeformPreview().
| ModifierTypeInfo modifierType_LaplacianDeform |
Definition at line 875 of file MOD_laplaciandeform.c.