Blender V4.3
bmo_fill_grid.cc File Reference
#include "MEM_guardedalloc.h"
#include "BLI_listbase.h"
#include "BLI_math_geom.h"
#include "BLI_math_vector.h"
#include "BKE_customdata.hh"
#include "bmesh.hh"
#include "intern/bmesh_operators_private.hh"
#include "BLI_strict_flags.h"

Go to the source code of this file.

Macros

#define EDGE_MARK   4
 
#define FACE_OUT   16
 
#define BARYCENTRIC_INTERP
 
#define XY(_x, _y)   ((_x) + ((_y) * (xtot)))
 
#define USE_FLIP_DETECT
 

Functions

static void quad_edges_to_normal (float no[3], const float co_a1[3], const float co_a2[3], const float co_b1[3], const float co_b2[3])
 
static void quad_verts_to_barycentric_tri (float tri[3][3], const float co_a[3], const float co_b[3], const float co_a_next[3], const float co_b_next[3], const float co_a_prev[3], const float co_b_prev[3], const bool is_flip)
 
static void barycentric_weights_v2_grid_cache (const uint xtot, const uint ytot, float(*weight_table)[4])
 
static void bm_grid_fill_array (BMesh *bm, BMVert **v_grid, const uint xtot, const uint ytot, const short mat_nr, const bool use_smooth, const bool use_flip, const bool use_interp_simple)
 
static void bm_grid_fill (BMesh *bm, BMEdgeLoopStore *estore_a, BMEdgeLoopStore *estore_b, BMEdgeLoopStore *estore_rail_a, BMEdgeLoopStore *estore_rail_b, const short mat_nr, const bool use_smooth, const bool use_interp_simple)
 
static void bm_edgeloop_flag_set (BMEdgeLoopStore *estore, char hflag, bool set)
 
static bool bm_edge_test_cb (BMEdge *e, void *bm_v)
 
static bool bm_edge_test_rail_cb (BMEdge *e, void *)
 
void bmo_grid_fill_exec (BMesh *bm, BMOperator *op)
 
Handle Loop Pairs
static void bm_loop_pair_from_verts (BMVert *v_a, BMVert *v_b, BMLoop *l_pair[2])
 
static void bm_loop_pair_test_copy (BMLoop *l_pair_a[2], BMLoop *l_pair_b[2])
 
static void bm_loop_interp_from_grid_boundary_4 (BMesh *bm, BMLoop *l, BMLoop *l_bound[4], const float w[4])
 
static void bm_loop_interp_from_grid_boundary_2 (BMesh *bm, BMLoop *l, BMLoop *l_bound[2], const float t)
 

Detailed Description

Fill 2 isolated, open edge loops with a grid of quads.

Definition in file bmo_fill_grid.cc.

Macro Definition Documentation

◆ BARYCENTRIC_INTERP

#define BARYCENTRIC_INTERP

Definition at line 28 of file bmo_fill_grid.cc.

◆ EDGE_MARK

#define EDGE_MARK   4

Definition at line 25 of file bmo_fill_grid.cc.

Referenced by bm_edge_test_cb(), and bmo_grid_fill_exec().

◆ FACE_OUT

#define FACE_OUT   16

Definition at line 26 of file bmo_fill_grid.cc.

Referenced by bm_grid_fill_array(), and bmo_grid_fill_exec().

◆ USE_FLIP_DETECT

#define USE_FLIP_DETECT

◆ XY

#define XY ( _x,
_y )   ((_x) + ((_y) * (xtot)))

Function Documentation

◆ barycentric_weights_v2_grid_cache()

static void barycentric_weights_v2_grid_cache ( const uint xtot,
const uint ytot,
float(*) weight_table[4] )
static

Avoids calling barycentric_weights_v2_quad often by caching weights into an array.

Definition at line 164 of file bmo_fill_grid.cc.

References barycentric_weights_v2_quad(), cos(), float, UNPACK4, x, and y.

Referenced by bm_grid_fill_array().

◆ bm_edge_test_cb()

static bool bm_edge_test_cb ( BMEdge * e,
void * bm_v )
static

Definition at line 577 of file bmo_fill_grid.cc.

References BMO_edge_flag_test_bool, e, and EDGE_MARK.

Referenced by bmo_grid_fill_exec().

◆ bm_edge_test_rail_cb()

static bool bm_edge_test_rail_cb ( BMEdge * e,
void *  )
static

◆ bm_edgeloop_flag_set()

static void bm_edgeloop_flag_set ( BMEdgeLoopStore * estore,
char hflag,
bool set )
static

◆ bm_grid_fill()

static void bm_grid_fill ( BMesh * bm,
BMEdgeLoopStore * estore_a,
BMEdgeLoopStore * estore_b,
BMEdgeLoopStore * estore_rail_a,
BMEdgeLoopStore * estore_rail_b,
const short mat_nr,
const bool use_smooth,
const bool use_interp_simple )
static
          estore_b
         +------------------+
      ^  |                  |
  end |  |                  |
      |  |                  |
      |  |estore_rail_a     |estore_rail_b
      |  |                  |
start |  |                  |
         |estore_a          |
         +------------------+
               --->
            start -> end

Definition at line 463 of file bmo_fill_grid.cc.

References BLI_assert, bm, BM_edge_exists(), BM_edge_is_boundary(), BM_edgeloop_length_get(), BM_edgeloop_verts_get(), bm_grid_fill_array(), LinkData::data, e, ListBase::first, ListBase::last, MEM_callocN, MEM_freeN(), LinkData::next, x, and y.

Referenced by bmo_grid_fill_exec().

◆ bm_grid_fill_array()

static void bm_grid_fill_array ( BMesh * bm,
BMVert ** v_grid,
const uint xtot,
const uint ytot,
const short mat_nr,
const bool use_smooth,
const bool use_flip,
const bool use_interp_simple )
static

◆ bm_loop_interp_from_grid_boundary_2()

static void bm_loop_interp_from_grid_boundary_2 ( BMesh * bm,
BMLoop * l,
BMLoop * l_bound[2],
const float t )
static

Definition at line 147 of file bmo_fill_grid.cc.

References bm, CustomData_bmesh_interp(), BMHeader::data, BMLoop::head, l, BMesh::ldata, and w().

Referenced by bm_grid_fill_array().

◆ bm_loop_interp_from_grid_boundary_4()

static void bm_loop_interp_from_grid_boundary_4 ( BMesh * bm,
BMLoop * l,
BMLoop * l_bound[4],
const float w[4] )
static

Interpolate from boundary loops.

Note
These weights will be calculated multiple times per vertex.

Definition at line 136 of file bmo_fill_grid.cc.

References bm, CustomData_bmesh_interp(), BMHeader::data, BMLoop::head, l, BMesh::ldata, and w().

Referenced by bm_grid_fill_array().

◆ bm_loop_pair_from_verts()

static void bm_loop_pair_from_verts ( BMVert * v_a,
BMVert * v_b,
BMLoop * l_pair[2] )
static

Assign a loop pair from 2 verts (which must share an edge)

Definition at line 94 of file bmo_fill_grid.cc.

References BM_edge_exists(), and e.

Referenced by bm_grid_fill_array().

◆ bm_loop_pair_test_copy()

static void bm_loop_pair_test_copy ( BMLoop * l_pair_a[2],
BMLoop * l_pair_b[2] )
static

Copy loop pair from one side to the other if either is missing, this simplifies interpolation code so we only need to check if x/y are missing, rather than checking each loop.

Definition at line 118 of file bmo_fill_grid.cc.

Referenced by bm_grid_fill_array().

◆ bmo_grid_fill_exec()

◆ quad_edges_to_normal()

static void quad_edges_to_normal ( float no[3],
const float co_a1[3],
const float co_a2[3],
const float co_b1[3],
const float co_b2[3] )
static

2 edge vectors to normal.

Definition at line 34 of file bmo_fill_grid.cc.

References add_v3_v3v3(), normalize_v3(), and sub_v3_v3v3().

Referenced by quad_verts_to_barycentric_tri().

◆ quad_verts_to_barycentric_tri()

static void quad_verts_to_barycentric_tri ( float tri[3][3],
const float co_a[3],
const float co_b[3],
const float co_a_next[3],
const float co_b_next[3],
const float co_a_prev[3],
const float co_b_prev[3],
const bool is_flip )
static