Blender V5.3
bmesh_decimate_collapse.cc File Reference
#include <cstddef>
#include "MEM_guardedalloc.h"
#include "BLI_array.hh"
#include "BLI_enum_flags.hh"
#include "BLI_heap.hh"
#include "BLI_linklist.hh"
#include "BLI_math_geom_c.hh"
#include "BLI_math_vector_c.hh"
#include "BLI_memarena.hh"
#include "BLI_polyfill_2d.hh"
#include "BLI_polyfill_2d_beautify.hh"
#include "BLI_quadric.hh"
#include "BLI_utildefines_stack.hh"
#include "BKE_customdata.hh"
#include "bmesh.hh"
#include "bmesh_decimate.hh"
#include "../intern/bmesh_structure.hh"
#include "BLI_kdtree.hh"

Go to the source code of this file.

Classes

struct  blender::KD_Symmetry_Data

Namespaces

namespace  blender
 BMesh Iterators.

Macros

#define USE_SYMMETRY
#define USE_CUSTOMDATA
#define USE_TRIANGULATE
#define USE_VERT_NORMAL_INTERP
#define USE_TOPOLOGY_FALLBACK
#define TOPOLOGY_FALLBACK_EPS   1e-12f
#define BOUNDARY_PRESERVE_WEIGHT   100.0f
#define OPTIMIZE_EPS   1e-8
#define COST_INVALID   FLT_MAX
#define CAN_LOOP_MERGE(l)

Enumerations

enum  blender::CD_UseFlag { blender::CD_DO_VERT = (1 << 0) , blender::CD_DO_EDGE = (1 << 1) , blender::CD_DO_LOOP = (1 << 2) }

Functions

static void blender::bm_decim_build_quadrics (BMesh *bm, Quadric *vquadrics)
static void blender::bm_decim_calc_target_co_db (BMEdge *e, double optimize_co[3], const Quadric *vquadrics)
static void blender::bm_decim_calc_target_co_fl (BMEdge *e, float optimize_co[3], const Quadric *vquadrics)
static bool blender::bm_edge_collapse_is_degenerate_flip (BMEdge *e, const float optimize_co[3])
static float blender::bm_decim_build_edge_cost_single_squared__topology (BMEdge *e)
static float blender::bm_decim_build_edge_cost_single__topology (BMEdge *e)
static void blender::bm_decim_build_edge_cost_single (BMEdge *e, const Quadric *vquadrics, const float *vweights, const float vweight_factor, Heap *eheap, HeapNode **eheap_table)
static void blender::bm_decim_invalid_edge_cost_single (BMEdge *e, Heap *eheap, HeapNode **eheap_table)
static void blender::bm_decim_build_edge_cost (BMesh *bm, const Quadric *vquadrics, const float *vweights, const float vweight_factor, Heap *eheap, HeapNode **eheap_table)
static bool blender::bm_edge_symmetry_check_cb (void *user_data, int index, const float3 &, float)
static int * blender::bm_edge_symmetry_map (BMesh *bm, uint symmetry_axis, float limit)
static bool blender::bm_face_triangulate (BMesh *bm, BMFace *f_base, LinkNode **r_faces_double, int *r_edges_tri_tot, MemArena *pf_arena, Heap *pf_heap)
static bool blender::bm_decim_triangulate_begin (BMesh *bm, int *r_edges_tri_tot)
static void blender::bm_decim_triangulate_end (BMesh *bm, const int edges_tri_tot)
static void blender::bm_edge_collapse_loop_customdata (BMesh *bm, BMLoop *l, BMVert *v_clear, BMVert *v_other, const float customdata_fac)
static void blender::bm_edge_tag_enable (BMEdge *e)
static void blender::bm_edge_tag_disable (BMEdge *e)
static bool blender::bm_edge_tag_test (BMEdge *e)
BLI_INLINE int blender::bm_edge_is_manifold_or_boundary (BMLoop *l)
static bool blender::bm_edge_collapse_is_degenerate_topology (BMEdge *e_first)
static bool blender::bm_edge_collapse (BMesh *bm, BMEdge *e_clear, BMVert *v_clear, int r_e_clear_other[2], int *edge_symmetry_map, const CD_UseFlag customdata_flag, const float customdata_fac)
static bool blender::bm_decim_edge_collapse (BMesh *bm, BMEdge *e, Quadric *vquadrics, float *vweights, const float vweight_factor, Heap *eheap, HeapNode **eheap_table, int *edge_symmetry_map, const CD_UseFlag customdata_flag, float optimize_co[3], bool optimize_co_calc)
void blender::BM_mesh_decimate_collapse (BMesh *bm, float factor, float *vweights, float vweight_factor, bool do_triangulate, int symmetry_axis, float symmetry_eps)
 BM_mesh_decimate.

Detailed Description

BMesh decimator that uses an edge collapse method.

Definition in file bmesh_decimate_collapse.cc.

Macro Definition Documentation

◆ BOUNDARY_PRESERVE_WEIGHT

#define BOUNDARY_PRESERVE_WEIGHT   100.0f

Definition at line 54 of file bmesh_decimate_collapse.cc.

Referenced by blender::bm_decim_build_quadrics().

◆ CAN_LOOP_MERGE

#define CAN_LOOP_MERGE ( l)
Value:
(BM_loop_is_manifold(l) && ((l)->v != (l)->radial_next->v) && \
(l_a_index == BM_elem_index_get(l)) && (l_a_index == BM_elem_index_get((l)->radial_next)))
#define BM_elem_index_get(ele)

Referenced by blender::bm_decim_triangulate_end().

◆ COST_INVALID

◆ OPTIMIZE_EPS

#define OPTIMIZE_EPS   1e-8

Uses double precision, impacts behavior on near-flat surfaces, cane give issues with very small faces. 1e-2 is too big, see: #48154.

Definition at line 59 of file bmesh_decimate_collapse.cc.

Referenced by blender::bm_decim_calc_target_co_db().

◆ TOPOLOGY_FALLBACK_EPS

#define TOPOLOGY_FALLBACK_EPS   1e-12f

cost is calculated with double precision, it's ok to use a very small epsilon, see #48154.

Definition at line 51 of file bmesh_decimate_collapse.cc.

Referenced by blender::bm_decim_build_edge_cost_single().

◆ USE_CUSTOMDATA

#define USE_CUSTOMDATA

Definition at line 42 of file bmesh_decimate_collapse.cc.

Referenced by blender::bm_edge_collapse().

◆ USE_SYMMETRY

◆ USE_TOPOLOGY_FALLBACK

#define USE_TOPOLOGY_FALLBACK

if the cost from #BLI_quadric_evaluate is 'noise', fallback to topology

Definition at line 48 of file bmesh_decimate_collapse.cc.

◆ USE_TRIANGULATE

#define USE_TRIANGULATE

Definition at line 43 of file bmesh_decimate_collapse.cc.

◆ USE_VERT_NORMAL_INTERP

#define USE_VERT_NORMAL_INTERP

Has the advantage that flipped faces don't mess up vertex normals.

Definition at line 45 of file bmesh_decimate_collapse.cc.