Blender  V3.3
Macros | Functions
bmo_fill_grid.c File Reference
#include "MEM_guardedalloc.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BKE_customdata.h"
#include "bmesh.h"
#include "intern/bmesh_operators_private.h"
#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, struct BMEdgeLoopStore *estore_a, struct BMEdgeLoopStore *estore_b, struct BMEdgeLoopStore *estore_rail_a, struct BMEdgeLoopStore *estore_rail_b, const short mat_nr, const bool use_smooth, const bool use_interp_simple)
 
static void bm_edgeloop_flag_set (struct 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 *UNUSED(bm_v))
 
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.c.

Macro Definition Documentation

◆ BARYCENTRIC_INTERP

#define BARYCENTRIC_INTERP

Definition at line 25 of file bmo_fill_grid.c.

◆ EDGE_MARK

#define EDGE_MARK   4

Definition at line 22 of file bmo_fill_grid.c.

◆ FACE_OUT

#define FACE_OUT   16

Definition at line 23 of file bmo_fill_grid.c.

◆ 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 161 of file bmo_fill_grid.c.

References barycentric_weights_v2_quad(), KDL::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 568 of file bmo_fill_grid.c.

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 UNUSEDbm_v 
)
static

Definition at line 573 of file bmo_fill_grid.c.

References BM_edge_is_boundary(), BM_edge_is_wire(), BM_elem_flag_test, BM_ELEM_HIDDEN, and e.

Referenced by bmo_grid_fill_exec().

◆ bm_edgeloop_flag_set()

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

◆ bm_grid_fill()

static void bm_grid_fill ( BMesh bm,
struct BMEdgeLoopStore estore_a,
struct BMEdgeLoopStore estore_b,
struct BMEdgeLoopStore estore_rail_a,
struct 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 459 of file bmo_fill_grid.c.

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, NULL, 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 144 of file bmo_fill_grid.c.

References bm, CustomData_bmesh_interp(), BMHeader::data, BMLoop::head, l, BMesh::ldata, NULL, t, 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 133 of file bmo_fill_grid.c.

References bm, CustomData_bmesh_interp(), BMHeader::data, BMLoop::head, l, BMesh::ldata, NULL, 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 91 of file bmo_fill_grid.c.

References BM_edge_exists(), e, and NULL.

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 115 of file bmo_fill_grid.c.

References NULL.

Referenced by bm_grid_fill_array().

◆ bmo_grid_fill_exec()

void bmo_grid_fill_exec ( BMesh bm,
BMOperator op 
)

◆ 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 31 of file bmo_fill_grid.c.

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