Blender V2.61 - r43446
Defines | Functions

BME_eulers.c File Reference

#include "MEM_guardedalloc.h"
#include "BLI_listbase.h"
#include "BLI_utildefines.h"
#include "bmesh_private.h"

Go to the source code of this file.

Defines

#define RETCLEAR(bm)   {bm->rval->v = bm->rval->e = bm->rval->f = bm->rva->l = NULL;}
#define MF_CANDIDATE   1
#define MF_VISITED   2
#define MF_TAKEN   4

Functions

void * BME_exit (char *s)
BME_VertBME_MV (BME_Mesh *bm, float *vec)
BME_EdgeBME_ME (BME_Mesh *bm, BME_Vert *v1, BME_Vert *v2)
BME_PolyBME_MF (BME_Mesh *bm, BME_Vert *v1, BME_Vert *v2, BME_Edge **elist, int len)
int BME_KV (BME_Mesh *bm, BME_Vert *v)
int BME_KE (BME_Mesh *bm, BME_Edge *e)
int BME_KF (BME_Mesh *bm, BME_Poly *bply)
BME_VertBME_SEMV (BME_Mesh *bm, BME_Vert *tv, BME_Edge *e, BME_Edge **re)
BME_PolyBME_SFME (BME_Mesh *bm, BME_Poly *f, BME_Vert *v1, BME_Vert *v2, BME_Loop **rl)
int BME_JEKV (BME_Mesh *bm, BME_Edge *ke, BME_Vert *kv)
int BME_loop_reverse (BME_Mesh *bm, BME_Poly *f)
BME_PolyBME_JFKE (BME_Mesh *bm, BME_Poly *f1, BME_Poly *f2, BME_Edge *e)

Detailed Description

Definition in file BME_eulers.c.


Define Documentation

#define MF_CANDIDATE   1

BME_MF

MAKE FACE EULER: Takes a list of edge pointers which form a closed loop and makes a face from them. The first edge in elist is considered to be the start of the polygon, and v1 and v2 are its vertices and determine the winding of the face Other than the first edge, no other assumptions are made about the order of edges in the elist array. To verify that it is a single closed loop and derive the correct order a simple series of verifications is done and all elements are visited.

Returns - A BME_Poly pointer

Definition at line 186 of file BME_eulers.c.

Referenced by BME_MF().

#define MF_TAKEN   4

Definition at line 188 of file BME_eulers.c.

#define MF_VISITED   2

Definition at line 187 of file BME_eulers.c.

Referenced by BME_MF().

#define RETCLEAR (   bm)    {bm->rval->v = bm->rval->e = bm->rval->f = bm->rva->l = NULL;}

Definition at line 90 of file BME_eulers.c.


Function Documentation

void* BME_exit ( char *  s)

Definition at line 85 of file BME_eulers.c.

References NULL.

int BME_JEKV ( BME_Mesh bm,
BME_Edge ke,
BME_Vert kv 
)

BME_JEKV

JOIN EDGE KILL VERT: Takes a an edge and pointer to one of its vertices and collapses the edge on that vertex.

Before: OE KE ------- ------- | || | OV KV TV

After: OE --------------- | | OV TV

Restrictions: KV is a vertex that must have a valance of exactly two. Furthermore both edges in KV's disk cycle (OE and KE) must be unique (no double edges).

It should also be noted that this euler has the possibility of creating faces with just 2 edges. It is up to the caller to decide what to do with these faces.

Returns - 1 for success, 0 for failure.

Definition at line 687 of file BME_eulers.c.

References BLI_remlink(), BME_cycle_length(), BME_cycle_validate(), BME_disk_append_edge(), BME_disk_getpointer(), BME_disk_nextedge(), BME_disk_remove_edge(), BME_edge_getothervert(), BME_edge_swapverts(), BME_error(), BME_free_edge(), BME_free_loop(), BME_free_vert(), BME_radial_nextloop(), BME_vert_in_edge(), BME_verts_in_edge(), BME_CycleNode::data, BME_Vert::edge, BME_Mesh::edges, BME_Loop::f, i, len(), BME_Poly::len, BME_Edge::loop, BME_Poly::loopbase, BME_Mesh::lpar, BME_Mesh::lparlen, MEM_callocN(), MEM_freeN(), BME_Loop::next, BME_CycleNode::next, BME_Loop::prev, BME_Loop::radial, BME_Loop::v, and BME_Mesh::verts.

Referenced by BME_bevel_wire(), and BME_collapse_vert().

BME_Poly* BME_JFKE ( BME_Mesh bm,
BME_Poly f1,
BME_Poly f2,
BME_Edge e 
) [read]

BME_JFKE

JOIN FACE KILL EDGE:

Takes two faces joined by a single 2-manifold edge and fuses them togather. The edge shared by the faces must not be connected to any other edges which have Both faces in its radial cycle

Examples:

A B ---------- ---------- | | | | | f1 | | f1 | v1========v2 = Ok! v1==V2==v3 == Wrong! | f2 | | f2 | | | | | ---------- ----------

In the example A, faces f1 and f2 are joined by a single edge, and the euler can safely be used. In example B however, f1 and f2 are joined by multiple edges and will produce an error. The caller in this case should call BME_JEKV on the extra edges before attempting to fuse f1 and f2.

Also note that the order of arguments decides whether or not certain per-face attributes are present in the resultant face. For instance vertex winding, material index, smooth flags, ect are inherited from f1, not f2.

Returns - A BME_Poly pointer

Definition at line 898 of file BME_eulers.c.

References BLI_remlink(), BME_cycle_length(), BME_cycle_validate(), BME_disk_remove_edge(), BME_error(), BME_free_edge(), BME_free_loop(), BME_free_poly(), BME_radial_find_face(), BME_Loop::e, BME_Mesh::edges, BME_Loop::f, i, BME_Poly::len, BME_Poly::loopbase, BME_Loop::next, next, NULL, BME_Mesh::polys, BME_Loop::prev, BME_Loop::radial, BME_Loop::v, BME_Edge::v1, and BME_Edge::v2.

Referenced by BME_bevel_edge(), and BME_JFKE_safe().

int BME_KE ( BME_Mesh bm,
BME_Edge e 
)

BME_KE

KILL EDGE EULER:

Kills a wire edge.

Returns - 1 for success, 0 for failure.

Definition at line 350 of file BME_eulers.c.

References BLI_remlink(), BME_disk_hasedge(), BME_disk_remove_edge(), BME_error(), BME_free_edge(), BME_Mesh::edges, BME_Edge::loop, NULL, BME_Edge::v1, and BME_Edge::v2.

int BME_KF ( BME_Mesh bm,
BME_Poly bply 
)

BME_KF

KILL FACE EULER:

The logical inverse of BME_MF. Kills a face and removes each of its loops from the radial that it belongs to.

Returns - 1 for success, 0 for failure.

Definition at line 384 of file BME_eulers.c.

References BLI_remlink(), BME_cycle_length(), BME_cycle_remove(), BME_free_loop(), BME_free_poly(), BME_radial_remove_loop(), BME_Loop::e, i, len(), BME_Poly::loopbase, BME_Loop::next, next, and BME_Mesh::polys.

int BME_KV ( BME_Mesh bm,
BME_Vert v 
)

BME_KV

KILL VERT EULER:

Kills a single loose vertex.

Returns - 1 for success, 0 for failure.

Definition at line 330 of file BME_eulers.c.

References BLI_remlink(), BME_free_vert(), BME_Vert::edge, NULL, and BME_Mesh::verts.

int BME_loop_reverse ( BME_Mesh bm,
BME_Poly f 
)

BME_loop_reverse

FLIP FACE EULER

Changes the winding order of a face from CW to CCW or vice versa. This euler is a bit peculiar in compairson to others as it is its own inverse.

TODO: reinsert validation code.

Returns - 1 for success, 0 for failure.

Definition at line 807 of file BME_eulers.c.

References BME_cycle_length(), BME_cycle_validate(), BME_error(), BME_radial_append(), BME_radial_remove_loop(), BME_verts_in_edge(), BME_Loop::e, BME_Mesh::edar, BME_Mesh::edarlen, i, len(), BME_Poly::loopbase, MEM_callocN(), MEM_freeN(), BME_Loop::next, BME_Edge::next, NULL, and BME_Edge::prev.

Referenced by BME_JFKE_safe().

BME_Edge* BME_ME ( BME_Mesh bm,
BME_Vert v1,
BME_Vert v2 
) [read]

BME_ME

MAKE EDGE EULER:

Makes a single wire edge between two vertices. If the caller does not want there to be duplicate edges between the vertices, it is up to them to check for this condition beforehand.

Returns - A BME_Edge pointer.

Definition at line 124 of file BME_eulers.c.

References BME_addedgelist(), BME_cycle_length(), BME_cycle_validate(), BME_disk_append_edge(), BME_disk_getpointer(), BME_disk_hasedge(), BME_error(), credits_svn_gen::e, BME_Vert::edge, NULL, BME_Edge::v1, and BME_Edge::v2.

Referenced by BME_derivedmesh_to_bmesh(), and BME_editmesh_to_bmesh().

BME_Poly* BME_MF ( BME_Mesh bm,
BME_Vert v1,
BME_Vert v2,
BME_Edge **  elist,
int  len 
) [read]
BME_Vert* BME_MV ( BME_Mesh bm,
float *  vec 
) [read]

BME_MV

MAKE VERT EULER:

Makes a single loose vertex.

Returns - A BME_Vert pointer.

Definition at line 104 of file BME_eulers.c.

References BME_addvertlist(), BME_Vert::co, NULL, and VECCOPY.

Referenced by BME_derivedmesh_to_bmesh(), and BME_editmesh_to_bmesh().

BME_Vert* BME_SEMV ( BME_Mesh bm,
BME_Vert tv,
BME_Edge e,
BME_Edge **  re 
) [read]
BME_Poly* BME_SFME ( BME_Mesh bm,
BME_Poly f,
BME_Vert v1,
BME_Vert v2,
BME_Loop **  rl 
) [read]

BME_SFME

SPLIT FACE MAKE EDGE:

Takes as input two vertices in a single face. An edge is created which divides the original face into two distinct regions. One of the regions is assigned to the original face and it is closed off. The second region has a new face assigned to it.

Examples:

Before: After: ---------- ---------- | | | | | | | f1 | v1 f1 v2 v1======v2 | | | f2 | | | | | ---------- ----------

Note that the input vertices can be part of the same edge. This will result in a two edged face. This is desirable for advanced construction tools and particularly essential for edge bevel. Because of this it is up to the caller to decide what to do with the extra edge.

Returns - A BME_Poly pointer

Definition at line 595 of file BME_eulers.c.

References BME_addedgelist(), BME_addpolylist(), BME_create_loop(), BME_cycle_length(), BME_disk_append_edge(), BME_radial_append(), credits_svn_gen::e, i, len(), BME_Poly::len, BME_Poly::loopbase, BME_Loop::next, next, NULL, and BME_Loop::prev.

Referenced by BME_split_face().