Blender V2.61 - r43446
Functions

BME_structure.c File Reference

#include <limits.h>
#include "MEM_guardedalloc.h"
#include "BLI_listbase.h"
#include "BLI_utildefines.h"
#include "BKE_bmesh.h"

Go to the source code of this file.

Functions

int BME_vert_in_edge (BME_Edge *e, BME_Vert *v)
int BME_verts_in_edge (BME_Vert *v1, BME_Vert *v2, BME_Edge *e)
BME_VertBME_edge_getothervert (BME_Edge *e, BME_Vert *v)
int BME_edge_swapverts (BME_Edge *e, BME_Vert *orig, BME_Vert *new)
BME_VertBME_addvertlist (BME_Mesh *bm, BME_Vert *example)
BME_EdgeBME_addedgelist (BME_Mesh *bm, BME_Vert *v1, BME_Vert *v2, BME_Edge *example)
BME_LoopBME_create_loop (BME_Mesh *bm, BME_Vert *v, BME_Edge *e, BME_Poly *f, BME_Loop *example)
BME_PolyBME_addpolylist (BME_Mesh *bm, BME_Poly *example)
void BME_free_vert (BME_Mesh *bm, BME_Vert *v)
void BME_free_edge (BME_Mesh *bm, BME_Edge *e)
void BME_free_poly (BME_Mesh *bm, BME_Poly *f)
void BME_free_loop (BME_Mesh *bm, BME_Loop *l)
void BME_cycle_append (void *h, void *nt)
int BME_cycle_length (void *h)
int BME_cycle_remove (void *h, void *remn)
int BME_cycle_validate (int len, void *h)
BME_EdgeBME_disk_nextedge (BME_Edge *e, BME_Vert *v)
BME_CycleNodeBME_disk_getpointer (BME_Edge *e, BME_Vert *v)
int BME_disk_append_edge (BME_Edge *e, BME_Vert *v)
void BME_disk_remove_edge (BME_Edge *e, BME_Vert *v)
BME_EdgeBME_disk_next_edgeflag (BME_Edge *e, BME_Vert *v, int eflag, int tflag)
int BME_disk_count_edgeflag (BME_Vert *v, int eflag, int tflag)
int BME_disk_hasedge (BME_Vert *v, BME_Edge *e)
BME_LoopBME_radial_nextloop (BME_Loop *l)
void BME_radial_append (BME_Edge *e, BME_Loop *l)
void BME_radial_remove_loop (BME_Loop *l, BME_Edge *e)
int BME_radial_find_face (BME_Edge *e, BME_Poly *f)
struct BME_LoopBME_loop_find_loop (struct BME_Poly *f, struct BME_Vert *v)

Detailed Description

Definition in file BME_structure.c.


Function Documentation

BME_Edge* BME_addedgelist ( BME_Mesh bm,
BME_Vert v1,
BME_Vert v2,
BME_Edge example 
) [read]
BME_Poly* BME_addpolylist ( BME_Mesh bm,
BME_Poly example 
) [read]
BME_Vert* BME_addvertlist ( BME_Mesh bm,
BME_Vert example 
) [read]
BME_Loop* BME_create_loop ( BME_Mesh bm,
BME_Vert v,
BME_Edge e,
BME_Poly f,
BME_Loop example 
) [read]
void BME_cycle_append ( void *  h,
void *  nt 
)

BMESH CYCLES

Cycles are circular doubly linked lists that form the basis of adjacency information in the BME modeller. Full adjacency relations can be derived from examining these cycles very quickly. Although each cycle is a double circular linked list, each one is considered to have a 'base' or 'head', and care must be taken by Euler code when modifying the contents of a cycle.

The contents of this file are split into two parts. First there are the BME_cycle family of functions which are generic circular double linked list procedures. The second part contains higher level procedures for supporting modification of specific cycle types.

The three cycles explicitly stored in the BMesh data structure are as follows:

1: The Disk Cycle - A circle of edges around a vertex Base: vertex->edge pointer.

This cycle is the most complicated in terms of its structure. Each BME_Edge contains two BME_CycleNode structures to keep track of that edge's membership in the disk cycle of each of its vertices. However for any given vertex it may be the first in some edges in its disk cycle and the second for others. The BME_disk_XXX family of functions contain some nice utilities for navigating disk cycles in a way that hides this detail from the tool writer.

Note that the disk cycle is completley independant from face data. One advantage of this is that wire edges are fully integrated into the topology database. Another is that the the disk cycle has no problems dealing with non-manifold conditions involving faces.

Functions relating to this cycle:

BME_disk_append_edge BME_disk_remove_edge BME_disk_nextedge BME_disk_getpointer

2: The Radial Cycle - A circle of face edges (BME_Loop) around an edge Base: edge->loop->radial structure.

The radial cycle is similar to the radial cycle in the radial edge data structure.* Unlike the radial edge however, the radial cycle does not require a large amount of memory to store non-manifold conditions since BMesh does not keep track of region/shell information.

Functions relating to this cycle:

BME_radial_append BME_radial_remove_loop BME_radial_nextloop BME_radial_find_face

3: The Loop Cycle - A circle of face edges around a polygon. Base: polygon->loopbase.

The loop cycle keeps track of a faces vertices and edges. It should be noted that the direction of a loop cycle is either CW or CCW depending on the face normal, and is not oriented to the faces editedges.

Functions relating to this cycle:

BME_cycle_XXX family of functions.

Note that the order of elements in all cycles except the loop cycle is undefined. This leads to slightly increased seek time for deriving some adjacency relations, however the advantage is that no intrinsic properties of the data structures are dependant upon the cycle order and all non-manifold conditions are represented trivially.

Definition at line 281 of file BME_structure.c.

References BME_CycleNode::next, NULL, and BME_CycleNode::prev.

Referenced by BME_disk_append_edge(), BME_MF(), BME_radial_append(), and BME_SEMV().

int BME_cycle_length ( void *  h)
int BME_cycle_remove ( void *  h,
void *  remn 
)

BME_cycle_remove

Removes a node from a cycle.

Returns - 1 for success, 0 for failure.

Definition at line 341 of file BME_structure.c.

References BME_cycle_length(), i, len(), BME_CycleNode::next, NULL, and BME_CycleNode::prev.

Referenced by BME_disk_remove_edge(), BME_KF(), and BME_radial_remove_loop().

int BME_cycle_validate ( int  len,
void *  h 
)

BME_cycle_validate

Validates a cycle. Takes as an argument the expected length of the cycle and a pointer to the cycle head or base.

Returns - 1 for success, 0 for failure.

Definition at line 382 of file BME_structure.c.

References i, len(), and BME_CycleNode::next.

Referenced by BME_JEKV(), BME_JFKE(), BME_loop_reverse(), BME_ME(), BME_MF(), BME_SEMV(), and BME_validate_mesh().

int BME_disk_append_edge ( BME_Edge e,
BME_Vert v 
)

BME_disk_append_edge

Appends edge to the end of a vertex disk cycle.

Returns - 1 for success, 0 for failure

Definition at line 442 of file BME_structure.c.

References BME_cycle_append(), BME_disk_getpointer(), BME_vert_in_edge(), credits_svn_gen::e, BME_Vert::edge, and NULL.

Referenced by BME_JEKV(), BME_ME(), BME_SEMV(), and BME_SFME().

int BME_disk_count_edgeflag ( BME_Vert v,
int  eflag,
int  tflag 
)

BME_disk_count_edgeflag

Counts number of edges in this verts disk cycle which have either eflag or tflag (but not both!)

Returns - Integer.

Definition at line 540 of file BME_structure.c.

References BME_cycle_length(), BME_disk_getpointer(), BME_disk_nextedge(), BME_Vert::edge, BME_Edge::eflag1, i, len(), and BME_Edge::tflag1.

Referenced by BME_MF().

BME_CycleNode* BME_disk_getpointer ( BME_Edge e,
BME_Vert v 
) [read]

BME_disk_getpointer

Given an edge and one of its vertices, find the apporpriate CycleNode

Returns - Pointer to BME_CycleNode.

Definition at line 426 of file BME_structure.c.

References BME_Edge::d2, NULL, BME_Edge::v1, and BME_Edge::v2.

Referenced by BME_bevel_initialize(), BME_bevel_mesh(), BME_disk_append_edge(), BME_disk_count_edgeflag(), BME_disk_hasedge(), BME_disk_remove_edge(), BME_JEKV(), BME_ME(), BME_SEMV(), and BME_validate_mesh().

int BME_disk_hasedge ( BME_Vert v,
BME_Edge e 
)
BME_Edge* BME_disk_next_edgeflag ( BME_Edge e,
BME_Vert v,
int  eflag,
int  tflag 
) [read]

BME_disk_next_edgeflag

Searches the disk cycle of v, starting with e, for the next edge that has either eflag or tflag.

BME_Edge pointer.

Definition at line 504 of file BME_structure.c.

References BME_disk_nextedge(), BME_vert_in_edge(), BME_Edge::eflag1, NULL, and BME_Edge::tflag1.

Referenced by BME_bevel_mesh(), and BME_MF().

BME_Edge* BME_disk_nextedge ( BME_Edge e,
BME_Vert v 
) [read]

BME_disk_nextedge

Find the next edge in a disk cycle

Returns - Pointer to the next edge in the disk cycle for the vertex v.

Definition at line 409 of file BME_structure.c.

References BME_vert_in_edge(), BME_Edge::d2, BME_Edge::data, BME_CycleNode::data, BME_CycleNode::next, BME_Edge::next, NULL, BME_Edge::v1, and BME_Edge::v2.

Referenced by BME_bevel_mesh(), BME_bevel_split_edge(), BME_bevel_wire(), BME_disk_count_edgeflag(), BME_disk_hasedge(), BME_disk_next_edgeflag(), BME_is_nonmanifold_vert(), BME_JEKV(), BME_validate_mesh(), and bmesh_dissolve_disk().

void BME_disk_remove_edge ( BME_Edge e,
BME_Vert v 
)

BME_disk_remove_edge

Removes an edge from a disk cycle. If the edge to be removed is at the base of the cycle, the next edge becomes the new base.

Returns - Nothing

Definition at line 475 of file BME_structure.c.

References BME_cycle_length(), BME_cycle_remove(), BME_disk_getpointer(), data, BME_Vert::edge, len(), BME_CycleNode::next, and NULL.

Referenced by BME_JEKV(), BME_JFKE(), BME_KE(), and BME_SEMV().

BME_Vert* BME_edge_getothervert ( BME_Edge e,
BME_Vert v 
) [read]
int BME_edge_swapverts ( BME_Edge e,
BME_Vert orig,
BME_Vert new 
)
void BME_free_edge ( BME_Mesh bm,
BME_Edge e 
)
void BME_free_loop ( BME_Mesh bm,
BME_Loop l 
)
void BME_free_poly ( BME_Mesh bm,
BME_Poly f 
)
void BME_free_vert ( BME_Mesh bm,
BME_Vert v 
)
struct BME_Loop* BME_loop_find_loop ( struct BME_Poly f,
struct BME_Vert v 
) [read]

Definition at line 619 of file BME_structure.c.

References BME_cycle_length(), i, len(), BME_Poly::loopbase, next, NULL, and BME_Loop::v.

void BME_radial_append ( BME_Edge e,
BME_Loop l 
)

Definition at line 585 of file BME_structure.c.

References BME_cycle_append(), BME_Edge::loop, NULL, and BME_Loop::radial.

Referenced by BME_loop_reverse(), BME_MF(), and BME_SFME().

int BME_radial_find_face ( BME_Edge e,
BME_Poly f 
)
BME_Loop* BME_radial_nextloop ( BME_Loop l) [read]

Definition at line 581 of file BME_structure.c.

References BME_CycleNode::data, BME_CycleNode::next, and BME_Loop::radial.

Referenced by BME_JEKV().

void BME_radial_remove_loop ( BME_Loop l,
BME_Edge e 
)
int BME_vert_in_edge ( BME_Edge e,
BME_Vert v 
)

MISC utility functions.

Definition at line 50 of file BME_structure.c.

References BME_Edge::v1, and BME_Edge::v2.

Referenced by BME_disk_append_edge(), BME_disk_next_edgeflag(), BME_disk_nextedge(), BME_JEKV(), BME_SEMV(), and BME_validate_mesh().

int BME_verts_in_edge ( BME_Vert v1,
BME_Vert v2,
BME_Edge e 
)

Definition at line 54 of file BME_structure.c.

References BME_Edge::v1, and BME_Edge::v2.

Referenced by BME_JEKV(), BME_loop_reverse(), BME_MF(), BME_SEMV(), and BME_validate_mesh().