Blender V5.3
bmo_connect_pair.cc File Reference

Go to the source code of this file.

Classes

struct  blender::PathContext
struct  blender::PathLinkState
struct  blender::MinDistDir

Namespaces

namespace  blender
 BMesh Iterators.

Macros

#define CONNECT_EPS   0.0001f
#define VERT_OUT   1
#define VERT_EXCLUDE   2
#define FACE_EXCLUDE   2
#define ELE_TOUCHED   4
#define FACE_WALK_TEST(f)
#define VERT_WALK_TEST(v)
#define ELE_TOUCH_MARK(e)
#define ELE_TOUCH_TEST_VERT(v)
#define ELE_TOUCH_TEST_EDGE(e)

Functions

static void blender::state_free (void *state)
static int blender::state_isect_co_pair (const PathContext *pc, const float co_a[3], const float co_b[3])
static int blender::state_isect_co_exact (const PathContext *pc, const float co[3])
static float blender::state_calc_co_pair_fac (const PathContext *pc, const float co_a[3], const float co_b[3])
static void blender::state_calc_co_pair (const PathContext *pc, const float co_a[3], const float co_b[3], float r_co[3])
static bool blender::state_link_find (const PathLinkState *state, BMElem *ele)
static void blender::state_link_add (PathContext *pc, PathLinkState *state, BMElem *ele, BMElem *ele_from)
static PathLinkState * blender::state_dupe_add (PathLinkState *state, const PathLinkState *state_orig)
static PathLinkState * blender::state_link_add_test (PathContext *pc, PathLinkState *state, const PathLinkState *state_orig, BMElem *ele, BMElem *ele_from)
static PathLinkState * blender::state_step__face_edges (PathContext *pc, PathLinkState *state, const PathLinkState *state_orig, BMLoop *l_iter, BMLoop *l_last, MinDistDir *mddir)
static PathLinkState * blender::state_step__face_verts (PathContext *pc, PathLinkState *state, const PathLinkState *state_orig, BMLoop *l_iter, BMLoop *l_last, MinDistDir *mddir)
static bool blender::state_step (PathContext *pc, PathLinkState *state)
static void blender::bm_vert_pair_to_matrix (BMVert *v_pair[2], float r_unit_mat[3][3])
void blender::bmo_connect_vert_pair_exec (BMesh *bm, BMOperator *op)

Min Dist Dir Utilities

Simply getting the closest intersecting vert/edge is not good enough. see #43792 we need to get the closest in both directions since the absolute closest may be a dead-end.

Logic is simple:

  • First intersection, store the direction.
  • Successive intersections will update the first distance if its aligned with the first hit. otherwise update the opposite distance.
  • Caller stores best outcome in both directions.
#define MIN_DIST_DIR_INIT
static int blender::min_dist_dir_test (MinDistDir *mddir, const float dist_dir[3], const float dist_sq)
static void blender::min_dist_dir_update (MinDistDir *dist, const float dist_dir[3])

Detailed Description

Connect vertex pair across multiple faces (splits faces).

Definition in file bmo_connect_pair.cc.

Macro Definition Documentation

◆ CONNECT_EPS

#define CONNECT_EPS   0.0001f

Method for connecting across many faces.

  • use the line between both verts and their normal average to construct a matrix.
  • using the matrix, we can find all intersecting verts/edges.
  • walk the connected data and find the shortest path.
    • store a heap of paths which are being scanned (#PathContext.states).
    • continuously search the shortest path in the heap.
    • never step over the same element twice (tag elements as ELE_TOUCHED). this avoids going into an eternal loop if there are many possible branches (see #45582).
    • when running into a branch, create a new #PathLinkState state and add to the heap.
    • when the target is reached, finish - since none of the other paths can be shorter than the one just found.
  • if the connection can't be found - fail.
  • with the connection found, split all edges tagging verts (or tag verts that sit on the intersection).
  • run the standard connect operator.

Definition at line 45 of file bmo_connect_pair.cc.

Referenced by blender::state_isect_co_exact(), and blender::state_isect_co_pair().

◆ ELE_TOUCH_MARK

#define ELE_TOUCH_MARK ( e)
Value:
{ \
CHECK_TYPE_ANY(e, BMVert *, BMEdge *, BMElem *, BMElemF *); \
BMO_elem_flag_enable(pc->bm_bmoflag, (BMElemF *)e, ELE_TOUCHED); \
} \
((void)0)
#define ELE_TOUCHED

Definition at line 65 of file bmo_connect_pair.cc.

Referenced by blender::state_link_add().

◆ ELE_TOUCH_TEST_EDGE

#define ELE_TOUCH_TEST_EDGE ( e)
Value:
BMO_edge_flag_test(pc->bm_bmoflag, e, ELE_TOUCHED)
#define BMO_edge_flag_test(bm, e, oflag)

Definition at line 75 of file bmo_connect_pair.cc.

Referenced by blender::state_step__face_edges().

◆ ELE_TOUCH_TEST_VERT

#define ELE_TOUCH_TEST_VERT ( v)
Value:
BMO_vert_flag_test(pc->bm_bmoflag, v, ELE_TOUCHED)
#define BMO_vert_flag_test(bm, e, oflag)

Definition at line 72 of file bmo_connect_pair.cc.

Referenced by blender::state_step(), and blender::state_step__face_verts().

◆ ELE_TOUCHED

#define ELE_TOUCHED   4

Definition at line 53 of file bmo_connect_pair.cc.

◆ FACE_EXCLUDE

#define FACE_EXCLUDE   2

Definition at line 50 of file bmo_connect_pair.cc.

◆ FACE_WALK_TEST

#define FACE_WALK_TEST ( f)
Value:
(CHECK_TYPE_INLINE(f, BMFace *), BMO_face_flag_test(pc->bm_bmoflag, f, FACE_EXCLUDE) == 0)
#define CHECK_TYPE_INLINE(val, type)
#define BMO_face_flag_test(bm, e, oflag)
#define FACE_EXCLUDE

Definition at line 55 of file bmo_connect_pair.cc.

Referenced by blender::state_step(), blender::state_step__face_edges(), and blender::state_step__face_verts().

◆ MIN_DIST_DIR_INIT

#define MIN_DIST_DIR_INIT
Value:
{ \
{ \
} \
}
#define FLT_MAX

Definition at line 140 of file bmo_connect_pair.cc.

Referenced by blender::state_step().

◆ VERT_EXCLUDE

#define VERT_EXCLUDE   2

Definition at line 47 of file bmo_connect_pair.cc.

Referenced by blender::bmo_connect_vert_pair_exec().

◆ VERT_OUT

#define VERT_OUT   1

◆ VERT_WALK_TEST

#define VERT_WALK_TEST ( v)
Value:
(CHECK_TYPE_INLINE(v, BMVert *), BMO_vert_flag_test(pc->bm_bmoflag, v, VERT_EXCLUDE) == 0)
#define VERT_EXCLUDE

Definition at line 57 of file bmo_connect_pair.cc.

Referenced by blender::state_step().