more header re-arranging.

Some function comments were in headers, some in the C files, some in both.
Moved function comments from headers into the C files.
This commit is contained in:
2012-02-28 18:28:30 +00:00
parent df0f0c63d3
commit d1d11bbe9b
23 changed files with 526 additions and 590 deletions

View File

@@ -81,7 +81,9 @@ set(SRC
operators/bmo_utils.c operators/bmo_utils.c
intern/bmesh_construct.c intern/bmesh_construct.c
intern/bmesh_construct.h
intern/bmesh_core.c intern/bmesh_core.c
intern/bmesh_core.h
intern/bmesh_inline.c intern/bmesh_inline.c
intern/bmesh_interp.c intern/bmesh_interp.c
intern/bmesh_interp.h intern/bmesh_interp.h
@@ -91,13 +93,16 @@ set(SRC
intern/bmesh_marking.c intern/bmesh_marking.c
intern/bmesh_marking.h intern/bmesh_marking.h
intern/bmesh_mesh.c intern/bmesh_mesh.c
intern/bmesh_mesh.h
intern/bmesh_mods.c intern/bmesh_mods.c
intern/bmesh_mods.h
intern/bmesh_opdefines.c intern/bmesh_opdefines.c
intern/bmesh_operator_api_inline.c intern/bmesh_operator_api_inline.c
intern/bmesh_operators.c intern/bmesh_operators.c
intern/bmesh_operators.h intern/bmesh_operators.h
intern/bmesh_operators_private.h intern/bmesh_operators_private.h
intern/bmesh_polygon.c intern/bmesh_polygon.c
intern/bmesh_polygon.h
intern/bmesh_private.h intern/bmesh_private.h
intern/bmesh_queries.c intern/bmesh_queries.c
intern/bmesh_queries.h intern/bmesh_queries.h

View File

@@ -193,7 +193,6 @@ extern "C" {
#include "bmesh_class.h" #include "bmesh_class.h"
/*forward declarations*/ /*forward declarations*/
struct Mesh;
/* /*
* BMHeader * BMHeader
@@ -245,32 +244,9 @@ enum {
/* Mesh Level Ops */ /* Mesh Level Ops */
extern int bm_mesh_allocsize_default[4]; extern int bm_mesh_allocsize_default[4];
/* ob is needed by multires */
BMesh *BM_mesh_create(struct Object *ob, const int allocsize[4]);
BMesh *BM_mesh_copy(BMesh *bmold);
void BM_mesh_free(BMesh *bm);
/* frees mesh, but not actual BMesh struct */ /* ------------------------------------------------------------------------- */
void BM_mesh_data_free(BMesh *bm); /* bmesh_inline.c */
void BM_mesh_normals_update(BMesh *bm, const short skip_hidden);
/* Construction */
BMVert *BM_vert_create(BMesh *bm, const float co[3], const BMVert *example);
BMEdge *BM_edge_create(BMesh *bm, BMVert *v1, BMVert *v2, const BMEdge *example, int nodouble);
BMFace *BM_face_create(BMesh *bm, BMVert **verts, BMEdge **edges, const int len, int nodouble);
BMFace *BM_face_create_quad_tri_v(BMesh *bm,
BMVert **verts, int len,
const BMFace *example, const int nodouble);
/* easier to use version of BM_face_create_quad_tri_v.
* creates edges if necassary. */
BMFace *BM_face_create_quad_tri(BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v3, BMVert *v4,
const BMFace *example, const int nodouble);
/* makes an ngon from an unordered list of edges. v1 and v2 must be the verts
* defining edges[0], and define the winding of the new face. */
BMFace *BM_face_create_ngon(BMesh *bm, BMVert *v1, BMVert *v2, BMEdge **edges, int len, int nodouble);
/* stuff for dealing with header flags */ /* stuff for dealing with header flags */
#define BM_elem_flag_test( ele, hflag) _bm_elem_flag_test (&(ele)->head, hflag) #define BM_elem_flag_test( ele, hflag) _bm_elem_flag_test (&(ele)->head, hflag)
@@ -321,128 +297,6 @@ BM_INLINE void _bm_elem_flag_merge(BMHeader *head_a, BMHeader *head_b);
BM_INLINE int _bm_elem_index_get(const BMHeader *ele); BM_INLINE int _bm_elem_index_get(const BMHeader *ele);
BM_INLINE void _bm_elem_index_set(BMHeader *ele, const int index); BM_INLINE void _bm_elem_index_set(BMHeader *ele, const int index);
/* todo */
BMFace *BM_face_copy(BMesh *bm, BMFace *f, const short copyverts, const short copyedges);
/* copies loop data from adjacent faces */
void BM_face_copy_shared(BMesh *bm, BMFace *f);
/* copies attributes, e.g. customdata, header flags, etc, from one element
* to another of the same type.*/
void BM_elem_attrs_copy(BMesh *source_mesh, BMesh *target_mesh, const void *source, void *target);
/* Modification */
/* join two adjacent faces together along an edge. note that
* the faces must only be joined by on edge. e is the edge you
* wish to dissolve.*/
BMFace *BM_faces_join_pair(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e);
/* generic, flexible join faces function; note that most everything uses
* this, including BM_faces_join_pair */
BMFace *BM_faces_join(BMesh *bm, BMFace **faces, int totface);
/* split a face along two vertices. returns the newly made face, and sets
* the nl member to a loop in the newly created edge.*/
BMFace *BM_face_split(BMesh *bm, BMFace *f,
BMVert *v1, BMVert *v2,
BMLoop **r_l, BMEdge *example);
/* these 2 functions are very similar */
BMEdge* BM_vert_collapse_faces(BMesh *bm, BMEdge *ke, BMVert *kv, float fac,
const short join_faces, const short kill_degenerate_faces);
BMEdge* BM_vert_collapse_edge(BMesh *bm, BMEdge *ke, BMVert *kv,
const short kill_degenerate_faces);
/* splits an edge. ne is set to the new edge created. */
BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float percent);
/* split an edge multiple times evenly */
BMVert *BM_edge_split_n(BMesh *bm, BMEdge *e, int numcuts);
/* connect two verts together, through a face they share. this function may
* be removed in the future. */
BMEdge *BM_verts_connect(BMesh *bm, BMVert *v1, BMVert *v2, BMFace **r_f);
/* rotates an edge topologically, either clockwise (if ccw=0) or counterclockwise
* (if ccw is 1). */
BMEdge *BM_edge_rotate(BMesh *bm, BMEdge *e, int ccw);
/* Rip a single face from a vertex fan */
BMVert *BM_vert_rip(BMesh *bm, BMFace *sf, BMVert *sv);
/*updates a face normal*/
void BM_face_normal_update(BMesh *bm, BMFace *f);
void BM_face_normal_update_vcos(BMesh *bm, BMFace *f, float no[3], float (*vertexCos)[3]);
/*updates face and vertex normals incident on an edge*/
void BM_edge_normals_update(BMesh *bm, BMEdge *e);
/*update a vert normal (but not the faces incident on it)*/
void BM_vert_normal_update(BMesh *bm, BMVert *v);
void BM_vert_normal_update_all(BMesh *bm, BMVert *v);
void BM_face_normal_flip(BMesh *bm, BMFace *f);
/*dissolves all faces around a vert, and removes it.*/
int BM_disk_dissolve(BMesh *bm, BMVert *v);
/* dissolves vert, in more situations then BM_disk_dissolve
* (e.g. if the vert is part of a wire edge, etc).*/
int BM_vert_dissolve(BMesh *bm, BMVert *v);
/* Projects co onto face f, and returns true if it is inside
* the face bounds. Note that this uses a best-axis projection
* test, instead of projecting co directly into f's orientation
* space, so there might be accuracy issues.*/
int BM_face_point_inside_test(BMesh *bm, BMFace *f, const float co[3]);
/* get the area of the face */
float BM_face_area_calc(BMesh *bm, BMFace *f);
/* computes the centroid of a face, using the center of the bounding box */
void BM_face_center_bounds_calc(BMesh *bm, BMFace *f, float center[3]);
/* computes the centroid of a face, using the mean average */
void BM_face_center_mean_calc(BMesh *bm, BMFace *f, float center[3]);
/* flag conversion funcs */
char BM_face_flag_from_mflag(const char mflag);
char BM_edge_flag_from_mflag(const short mflag);
char BM_vert_flag_from_mflag(const char mflag);
/* reverse */
char BM_face_flag_to_mflag(BMFace *f);
short BM_edge_flag_to_mflag(BMEdge *e);
char BM_vert_flag_to_mflag(BMVert *v);
void BM_loop_kill(BMesh *bm, BMLoop *l);
void BM_face_kill(BMesh *bm, BMFace *f);
void BM_edge_kill(BMesh *bm, BMEdge *e);
void BM_vert_kill(BMesh *bm, BMVert *v);
/* kills all edges associated with f, along with any other faces containing
* those edges*/
void BM_face_edges_kill(BMesh *bm, BMFace *f);
/* kills all verts associated with f, along with any other faces containing
* those vertices*/
void BM_face_verts_kill(BMesh *bm, BMFace *f);
/*clear all data in bm*/
void BM_mesh_clear(BMesh *bm);
void BM_mesh_elem_index_ensure(BMesh *bm, const char hflag);
void BM_mesh_elem_index_validate(BMesh *bm, const char *location, const char *func,
const char *msg_a, const char *msg_b);
BMVert *BM_vert_at_index(BMesh *bm, const int index);
BMEdge *BM_edge_at_index(BMesh *bm, const int index);
BMFace *BM_face_at_index(BMesh *bm, const int index);
/*start/stop edit*/
void bmesh_edit_begin(BMesh *bm, int flag);
void bmesh_edit_end(BMesh *bm, int flag);
#ifdef USE_BMESH_HOLES #ifdef USE_BMESH_HOLES
# define BM_FACE_FIRST_LOOP(p) (((BMLoopList *)((p)->loops.first))->first) # define BM_FACE_FIRST_LOOP(p) (((BMLoopList *)((p)->loops.first))->first)
#else #else
@@ -463,10 +317,15 @@ void bmesh_edit_end(BMesh *bm, int flag);
#include "bmesh_operator_api.h" #include "bmesh_operator_api.h"
#include "bmesh_error.h" #include "bmesh_error.h"
#include "intern/bmesh_construct.h"
#include "intern/bmesh_core.h"
#include "intern/bmesh_interp.h" #include "intern/bmesh_interp.h"
#include "intern/bmesh_iterators.h" #include "intern/bmesh_iterators.h"
#include "intern/bmesh_marking.h" #include "intern/bmesh_marking.h"
#include "intern/bmesh_mesh.h"
#include "intern/bmesh_mods.h"
#include "intern/bmesh_operators.h" #include "intern/bmesh_operators.h"
#include "intern/bmesh_polygon.h"
#include "intern/bmesh_queries.h" #include "intern/bmesh_queries.h"
#include "intern/bmesh_walkers.h" #include "intern/bmesh_walkers.h"
#include "intern/bmesh_walkers.h" #include "intern/bmesh_walkers.h"

View File

@@ -248,14 +248,6 @@ BMOpSlot *BMO_slot_get(BMOperator *op, const char *slotname);
void BMO_slot_copy(BMOperator *source_op, BMOperator *dest_op, void BMO_slot_copy(BMOperator *source_op, BMOperator *dest_op,
const char *src, const char *dst); const char *src, const char *dst);
/* remove tool flagged elements */
void BMO_remove_tagged_faces(BMesh *bm, const short oflag);
void BMO_remove_tagged_edges(BMesh *bm, const short oflag);
void BMO_remove_tagged_verts(BMesh *bm, const short oflag);
/* take care, uses operator flag DEL_WIREVERT */
void BMO_remove_tagged_context(BMesh *bm, const short oflag, const int type);
/* del "context" slot values, used for operator too */ /* del "context" slot values, used for operator too */
enum { enum {
DEL_VERTS = 1, DEL_VERTS = 1,

View File

@@ -73,7 +73,6 @@ BMFace *BM_face_create_quad_tri(BMesh *bm,
return BM_face_create_quad_tri_v(bm, vtar, v4 ? 4 : 3, example, nodouble); return BM_face_create_quad_tri_v(bm, vtar, v4 ? 4 : 3, example, nodouble);
} }
/* remove the edge array bits from this. Its not really needed? */
BMFace *BM_face_create_quad_tri_v(BMesh *bm, BMVert **verts, int len, const BMFace *example, const int nodouble) BMFace *BM_face_create_quad_tri_v(BMesh *bm, BMVert **verts, int len, const BMFace *example, const int nodouble)
{ {
BMFace *f = NULL; BMFace *f = NULL;
@@ -107,7 +106,6 @@ BMFace *BM_face_create_quad_tri_v(BMesh *bm, BMVert **verts, int len, const BMFa
return f; return f;
} }
/* copies face data from shared adjacent faces */ /* copies face data from shared adjacent faces */
void BM_face_copy_shared(BMesh *bm, BMFace *f) void BM_face_copy_shared(BMesh *bm, BMFace *f)
{ {
@@ -132,8 +130,8 @@ void BM_face_copy_shared(BMesh *bm, BMFace *f)
/** /**
* \brief BMESH MAKE NGON * \brief BMESH MAKE NGON
* *
* Attempts to make a new Ngon from a list of edges. * Makes an ngon from an unordered list of edges. v1 and v2 must be the verts
* If nodouble equals one, a check for overlaps or existing * defining edges[0], and define the winding of the new face.
* *
* The edges are not required to be ordered, simply to to form * The edges are not required to be ordered, simply to to form
* a single closed loop as a whole * a single closed loop as a whole
@@ -371,8 +369,12 @@ static void bmo_remove_tagged_context_edges(BMesh *bm, const short oflag)
#define DEL_WIREVERT (1 << 10) #define DEL_WIREVERT (1 << 10)
/* warning, oflag applies to different types in some contexts, /**
* not just the type being removed */ * \warning oflag applies to different types in some contexts,
* not just the type being removed.
*
* \warning take care, uses operator flag DEL_WIREVERT
*/
void BMO_remove_tagged_context(BMesh *bm, const short oflag, const int type) void BMO_remove_tagged_context(BMesh *bm, const short oflag, const int type)
{ {
BMVert *v; BMVert *v;
@@ -537,6 +539,10 @@ static void bm_face_attrs_copy(BMesh *source_mesh, BMesh *target_mesh,
/* BMESH_TODO: Special handling for hide flags? */ /* BMESH_TODO: Special handling for hide flags? */
/**
* Copies attributes, e.g. customdata, header flags, etc, from one element
* to another of the same type.
*/
void BM_elem_attrs_copy(BMesh *source_mesh, BMesh *target_mesh, const void *source, void *target) void BM_elem_attrs_copy(BMesh *source_mesh, BMesh *target_mesh, const void *source, void *target)
{ {
const BMHeader *sheader = source; const BMHeader *sheader = source;

View File

@@ -0,0 +1,58 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Contributor(s): Joseph Eagar.
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BMESH_CONSTRUCT_H__
#define __BMESH_CONSTRUCT_H__
/** \file blender/bmesh/intern/bmesh_construct.h
* \ingroup bmesh
*/
BMFace *BM_face_create_quad_tri_v(BMesh *bm,
BMVert **verts, int len,
const BMFace *example, const int nodouble);
BMFace *BM_face_create_quad_tri(BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v3, BMVert *v4,
const BMFace *example, const int nodouble);
void BM_face_copy_shared(BMesh *bm, BMFace *f);
BMFace *BM_face_create_ngon(BMesh *bm, BMVert *v1, BMVert *v2, BMEdge **edges, int len, int nodouble);
void BMO_remove_tagged_faces(BMesh *bm, const short oflag);
void BMO_remove_tagged_edges(BMesh *bm, const short oflag);
void BMO_remove_tagged_verts(BMesh *bm, const short oflag);
void BMO_remove_tagged_context(BMesh *bm, const short oflag, const int type);
void BM_elem_attrs_copy(BMesh *source_mesh, BMesh *target_mesh, const void *source, void *target);
BMesh *BM_mesh_copy(BMesh *bmold);
char BM_face_flag_from_mflag(const char mflag);
char BM_edge_flag_from_mflag(const short mflag);
char BM_vert_flag_from_mflag(const char mflag);
char BM_face_flag_to_mflag(BMFace *f);
short BM_edge_flag_to_mflag(BMEdge *e);
char BM_vert_flag_to_mflag(BMVert *v);
#endif /* __BMESH_CONSTRUCT_H__ */

View File

@@ -87,30 +87,6 @@ BMVert *BM_vert_create(BMesh *bm, const float co[3], const struct BMVert *exampl
return v; return v;
} }
/**
* BMESH EDGE EXIST
*
* Finds out if two vertices already have an edge
* connecting them. Note that multiple edges may
* exist between any two vertices, and therefore
* This function only returns the first one found.
*
* Returns -
* BMEdge pointer
*/
BMEdge *BM_edge_exists(BMVert *v1, BMVert *v2)
{
BMIter iter;
BMEdge *e;
BM_ITER(e, &iter, NULL, BM_EDGES_OF_VERT, v1) {
if (e->v1 == v2 || e->v2 == v2)
return e;
}
return NULL;
}
BMEdge *BM_edge_create(BMesh *bm, BMVert *v1, BMVert *v2, const BMEdge *example, int nodouble) BMEdge *BM_edge_create(BMesh *bm, BMVert *v1, BMVert *v2, const BMEdge *example, int nodouble)
{ {
BMEdge *e; BMEdge *e;
@@ -511,6 +487,10 @@ static void bmesh_kill_only_loop(BMesh *bm, BMLoop *l)
BLI_mempool_free(bm->lpool, l); BLI_mempool_free(bm->lpool, l);
} }
/**
* kills all edges associated with f, along with any other faces containing
* those edges
*/
void BM_face_edges_kill(BMesh *bm, BMFace *f) void BM_face_edges_kill(BMesh *bm, BMFace *f)
{ {
BMEdge **edges = NULL; BMEdge **edges = NULL;
@@ -531,6 +511,10 @@ void BM_face_edges_kill(BMesh *bm, BMFace *f)
BLI_array_free(edges); BLI_array_free(edges);
} }
/**
* kills all verts associated with f, along with any other faces containing
* those vertices
*/
void BM_face_verts_kill(BMesh *bm, BMFace *f) void BM_face_verts_kill(BMesh *bm, BMFace *f)
{ {
BMVert **verts = NULL; BMVert **verts = NULL;
@@ -858,9 +842,7 @@ static int disk_is_flagged(BMVert *v, int flag)
/* Midlevel Topology Manipulation Functions */ /* Midlevel Topology Manipulation Functions */
/* /**
* BM_faces_join
*
* Joins a collected group of faces into one. Only restriction on * Joins a collected group of faces into one. Only restriction on
* the input data is that the faces must be connected to each other. * the input data is that the faces must be connected to each other.
* *
@@ -868,6 +850,9 @@ static int disk_is_flagged(BMVert *v, int flag)
* faces will be joined at every edge. * faces will be joined at every edge.
* *
* Returns a pointer to the combined face. * Returns a pointer to the combined face.
*
* \note this is a generic, flexible join faces function, almost everything
* uses this, including #BM_faces_join_pair
*/ */
BMFace *BM_faces_join(BMesh *bm, BMFace **faces, int totface) BMFace *BM_faces_join(BMesh *bm, BMFace **faces, int totface)
{ {
@@ -1435,7 +1420,7 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e)
* Returns - * Returns -
* The resulting edge, NULL for failure. * The resulting edge, NULL for failure.
*/ */
struct BMEdge *bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv, const short check_edge_double) BMEdge *bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv, const short check_edge_double)
{ {
BMEdge *oe; BMEdge *oe;
BMVert *ov, *tv; BMVert *ov, *tv;

View File

@@ -0,0 +1,62 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Contributor(s): Joseph Eagar.
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BMESH_CORE_H__
#define __BMESH_CORE_H__
/** \file blender/bmesh/intern/bmesh_core.h
* \ingroup bmesh
*/
BMFace *BM_face_copy(BMesh *bm, BMFace *f, const short copyverts, const short copyedges);
BMVert *BM_vert_create(BMesh *bm, const float co[3], const BMVert *example);
BMEdge *BM_edge_create(BMesh *bm, BMVert *v1, BMVert *v2, const BMEdge *example, int nodouble);
BMFace *BM_face_create(BMesh *bm, BMVert **verts, BMEdge **edges, const int len, int nodouble);
void BM_face_edges_kill(BMesh *bm, BMFace *f);
void BM_face_verts_kill(BMesh *bm, BMFace *f);
void BM_loop_kill(BMesh *bm, BMLoop *l);
void BM_face_kill(BMesh *bm, BMFace *f);
void BM_edge_kill(BMesh *bm, BMEdge *e);
void BM_vert_kill(BMesh *bm, BMVert *v);
int bmesh_loop_reverse(BMesh *bm, BMFace *f);
BMFace *BM_faces_join(BMesh *bm, BMFace **faces, int totface);
/* EULER API - For modifying structure */
BMFace *bmesh_sfme(BMesh *bm, BMFace *f, BMVert *v1,
BMVert *v2, BMLoop **r_l,
#ifdef USE_BMESH_HOLES
ListBase *holes,
#endif
BMEdge *example
);
BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e);
BMEdge *bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv, const short check_edge_splice);
BMFace *bmesh_jfke(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e);
BMVert *bmesh_urmv(BMesh *bm, BMFace *sf, BMVert *sv);
#endif /* __BMESH_CORE_H__ */

View File

@@ -145,6 +145,8 @@ void BM_data_interp_face_vert_edge(BMesh *bm, BMVert *v1, BMVert *UNUSED(v2), BM
} while ((l_iter = l_iter->radial_next) != e1->l); } while ((l_iter = l_iter->radial_next) != e1->l);
} }
/* convert MLoop*** in a bmface to mtface and mcol in
* an MFace */
void BM_loops_to_corners(BMesh *bm, Mesh *me, int findex, void BM_loops_to_corners(BMesh *bm, Mesh *me, int findex,
BMFace *f, int numTex, int numCol) BMFace *f, int numTex, int numCol)
{ {
@@ -195,8 +197,7 @@ void BM_loops_to_corners(BMesh *bm, Mesh *me, int findex,
* projects target onto source, and pulls interpolated customdata from * projects target onto source, and pulls interpolated customdata from
* source. * source.
* *
* Returns - * \note only does loop customdata. multires is handled.
* Nothing
*/ */
void BM_face_interp_from_face(BMesh *bm, BMFace *target, BMFace *source) void BM_face_interp_from_face(BMesh *bm, BMFace *target, BMFace *source)
{ {
@@ -527,6 +528,10 @@ static void bmesh_loop_interp_mdisps(BMesh *bm, BMLoop *target, BMFace *source)
} }
} }
/**
* smoothes boundaries between multires grids,
* including some borders in adjacent faces
*/
void BM_face_multires_bounds_smooth(BMesh *bm, BMFace *f) void BM_face_multires_bounds_smooth(BMesh *bm, BMFace *f)
{ {
BMLoop *l; BMLoop *l;
@@ -629,11 +634,18 @@ void BM_face_multires_bounds_smooth(BMesh *bm, BMFace *f)
} }
} }
/**
* project the multires grid in target onto source's set of multires grids
*/
void BM_loop_interp_multires(BMesh *bm, BMLoop *target, BMFace *source) void BM_loop_interp_multires(BMesh *bm, BMLoop *target, BMFace *source)
{ {
bmesh_loop_interp_mdisps(bm, target, source); bmesh_loop_interp_mdisps(bm, target, source);
} }
/**
* projects a single loop, target, onto source for customdata interpolation. multires is handled.
* if do_vertex is true, target's vert data will also get interpolated.
*/
void BM_loop_interp_from_face(BMesh *bm, BMLoop *target, BMFace *source, void BM_loop_interp_from_face(BMesh *bm, BMLoop *target, BMFace *source,
int do_vertex, int do_multires) int do_vertex, int do_multires)
{ {

View File

@@ -27,11 +27,8 @@
* \ingroup bmesh * \ingroup bmesh
*/ */
#ifdef __cplusplus struct Mesh;
extern "C" {
#endif
/* project the multires grid in target onto source's set of multires grids */
void BM_loop_interp_multires(BMesh *bm, BMLoop *target, BMFace *source); void BM_loop_interp_multires(BMesh *bm, BMLoop *target, BMFace *source);
void BM_vert_interp_from_face(BMesh *bm, BMVert *v, BMFace *source); void BM_vert_interp_from_face(BMesh *bm, BMVert *v, BMFace *source);
@@ -44,27 +41,13 @@ void BM_data_layer_free_n(BMesh *bm, CustomData *data, int type, int n);
float BM_elem_float_data_get(CustomData *cd, void *element, int type); float BM_elem_float_data_get(CustomData *cd, void *element, int type);
void BM_elem_float_data_set(CustomData *cd, void *element, int type, const float val); void BM_elem_float_data_set(CustomData *cd, void *element, int type, const float val);
/**
* projects target onto source for customdata interpolation.
* \note only does loop customdata. multires is handled. */
void BM_face_interp_from_face(BMesh *bm, BMFace *target, BMFace *source); void BM_face_interp_from_face(BMesh *bm, BMFace *target, BMFace *source);
/* projects a single loop, target, onto source for customdata interpolation. multires is handled.
* if do_vertex is true, target's vert data will also get interpolated.*/
void BM_loop_interp_from_face(BMesh *bm, BMLoop *target, BMFace *source, void BM_loop_interp_from_face(BMesh *bm, BMLoop *target, BMFace *source,
int do_vertex, int do_multires); int do_vertex, int do_multires);
/* smoothes boundaries between multires grids, including some borders in adjacent faces */
void BM_face_multires_bounds_smooth(BMesh *bm, BMFace *f); void BM_face_multires_bounds_smooth(BMesh *bm, BMFace *f);
/* convert MLoop*** in a bmface to mtface and mcol in
* an MFace*/
void BM_loops_to_corners(BMesh *bm, struct Mesh *me, int findex, void BM_loops_to_corners(BMesh *bm, struct Mesh *me, int findex,
BMFace *f, int numTex, int numCol); BMFace *f, int numTex, int numCol);
#ifdef __cplusplus
}
#endif
#endif /* __BMESH_INTERP_H__ */ #endif /* __BMESH_INTERP_H__ */

View File

@@ -144,7 +144,9 @@ void BM_mesh_select_mode_flush(BMesh *bm)
recount_totsels(bm); recount_totsels(bm);
} }
/* BMESH NOTE: matches EM_deselect_flush() behavior from trunk */ /**
* mode independent flushing up/down
*/
void BM_mesh_deselect_flush(BMesh *bm) void BM_mesh_deselect_flush(BMesh *bm)
{ {
BMEdge *e; BMEdge *e;
@@ -193,7 +195,9 @@ void BM_mesh_deselect_flush(BMesh *bm)
} }
/* BMESH NOTE: matches EM_select_flush() behavior from trunk */ /**
* mode independent flushing up/down
*/
void BM_mesh_select_flush(BMesh *bm) void BM_mesh_select_flush(BMesh *bm)
{ {
BMEdge *e; BMEdge *e;
@@ -238,7 +242,7 @@ void BM_mesh_select_flush(BMesh *bm)
recount_totsels(bm); recount_totsels(bm);
} }
/* /**
* BMESH SELECT VERT * BMESH SELECT VERT
* *
* Changes selection state of a single vertex * Changes selection state of a single vertex
@@ -445,7 +449,9 @@ void BM_select_mode_set(BMesh *bm, int selectmode)
} }
} }
/**
* counts number of elements with flag set
*/
int BM_mesh_count_flag(struct BMesh *bm, const char htype, const char hflag, int respecthide) int BM_mesh_count_flag(struct BMesh *bm, const char htype, const char hflag, int respecthide)
{ {
BMElem *ele; BMElem *ele;
@@ -474,7 +480,10 @@ int BM_mesh_count_flag(struct BMesh *bm, const char htype, const char hflag, int
return tot; return tot;
} }
/* note: by design, this will not touch the editselection history stuff */ /**
* \note use BM_elem_flag_test(ele, BM_ELEM_SELECT) to test selection
* \note by design, this will not touch the editselection history stuff
*/
void _bm_elem_select_set(struct BMesh *bm, BMHeader *head, int select) void _bm_elem_select_set(struct BMesh *bm, BMHeader *head, int select)
{ {
switch (head->htype) { switch (head->htype) {

View File

@@ -45,8 +45,6 @@ void BM_face_hide_set(BMesh *bm, BMFace *f, int hide);
#define BM_elem_select_set(bm, ele, hide) _bm_elem_select_set(bm, &(ele)->head, hide) #define BM_elem_select_set(bm, ele, hide) _bm_elem_select_set(bm, &(ele)->head, hide)
void _bm_elem_select_set(BMesh *bm, BMHeader *ele, int select); void _bm_elem_select_set(BMesh *bm, BMHeader *ele, int select);
/* use BM_elem_flag_test(ele, BM_ELEM_SELECT) to test selection */
void BM_mesh_elem_flag_enable_all(BMesh *bm, const char htype, const char hflag); void BM_mesh_elem_flag_enable_all(BMesh *bm, const char htype, const char hflag);
void BM_mesh_elem_flag_disable_all(BMesh *bm, const char htype, const char hflag); void BM_mesh_elem_flag_disable_all(BMesh *bm, const char htype, const char hflag);
@@ -59,11 +57,9 @@ void BM_face_select_set(BMesh *bm, BMFace *f, int select);
void BM_select_mode_set(BMesh *bm, int selectmode); void BM_select_mode_set(BMesh *bm, int selectmode);
void BM_mesh_select_mode_flush(BMesh *bm); void BM_mesh_select_mode_flush(BMesh *bm);
/* mode independent flushing up/down */
void BM_mesh_deselect_flush(BMesh *bm); void BM_mesh_deselect_flush(BMesh *bm);
void BM_mesh_select_flush(BMesh *bm); void BM_mesh_select_flush(BMesh *bm);
/* counts number of elements with flag set */
int BM_mesh_count_flag(BMesh *bm, const char htype, const char hflag, int respecthide); int BM_mesh_count_flag(BMesh *bm, const char htype, const char hflag, int respecthide);
/* edit selection stuff */ /* edit selection stuff */

View File

@@ -30,17 +30,13 @@
#include "DNA_listBase.h" #include "DNA_listBase.h"
#include "DNA_object_types.h" #include "DNA_object_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_mesh_types.h"
#include "BLI_listbase.h" #include "BLI_listbase.h"
#include "BLI_math.h" #include "BLI_math.h"
#include "BLI_utildefines.h" #include "BLI_utildefines.h"
#include "BKE_utildefines.h"
#include "BKE_cdderivedmesh.h" #include "BKE_cdderivedmesh.h"
#include "BKE_tessmesh.h" #include "BKE_tessmesh.h"
#include "BKE_customdata.h"
#include "BKE_multires.h" #include "BKE_multires.h"
#include "ED_mesh.h" #include "ED_mesh.h"
@@ -65,13 +61,14 @@ static void bmesh_mempool_init(BMesh *bm, const int allocsize[4])
bm->toolflagpool = BLI_mempool_create(sizeof(BMFlagLayer), 512, 512, FALSE, FALSE); bm->toolflagpool = BLI_mempool_create(sizeof(BMFlagLayer), 512, 512, FALSE, FALSE);
} }
/* /**
* BMESH MAKE MESH * BMESH MAKE MESH
* *
* Allocates a new BMesh structure. * Allocates a new BMesh structure.
* Returns - * Returns -
* Pointer to a BM * Pointer to a BM
* *
* \note ob is needed by multires
*/ */
BMesh *BM_mesh_create(struct Object *ob, const int allocsize[4]) BMesh *BM_mesh_create(struct Object *ob, const int allocsize[4])
@@ -91,12 +88,13 @@ BMesh *BM_mesh_create(struct Object *ob, const int allocsize[4])
return bm; return bm;
} }
/* /**
* BMESH FREE MESH * BMESH FREE MESH
* *
* Frees a BMesh structure. * Frees a BMesh structure.
*
* \note frees mesh, but not actual BMesh struct
*/ */
void BM_mesh_data_free(BMesh *bm) void BM_mesh_data_free(BMesh *bm)
{ {
BMVert *v; BMVert *v;
@@ -159,6 +157,9 @@ void BM_mesh_data_free(BMesh *bm)
BMO_error_clear(bm); BMO_error_clear(bm);
} }
/**
* clear all data in bm
*/
void BM_mesh_clear(BMesh *bm) void BM_mesh_clear(BMesh *bm)
{ {
Object *ob = bm->ob; Object *ob = bm->ob;

View File

@@ -0,0 +1,49 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Contributor(s): Geoffrey Bantle, Levi Schooley.
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BMESH_MESH_H__
#define __BMESH_MESH_H__
/** \file blender/bmesh/intern/bmesh_mesh.h
* \ingroup bmesh
*/
BMesh *BM_mesh_create(struct Object *ob, const int allocsize[4]);
void BM_mesh_free(BMesh *bm);
void BM_mesh_data_free(BMesh *bm);
void BM_mesh_clear(BMesh *bm);
void BM_mesh_normals_update(BMesh *bm, const short skip_hidden);
void bmesh_edit_begin(BMesh *bm, int flag);
void bmesh_edit_end(BMesh *bm, int flag);
void BM_mesh_elem_index_ensure(BMesh *bm, const char hflag);
void BM_mesh_elem_index_validate(BMesh *bm, const char *location, const char *func,
const char *msg_a, const char *msg_b);
BMVert *BM_vert_at_index(BMesh *bm, const int index);
BMEdge *BM_edge_at_index(BMesh *bm, const int index);
BMFace *BM_face_at_index(BMesh *bm, const int index);
#endif /* __BMESH_MESH_H__ */

View File

@@ -55,6 +55,9 @@
* |=========| |=========| * |=========| |=========|
* *
* *
* \note dissolves vert, in more situations then BM_disk_dissolve
* (e.g. if the vert is part of a wire edge, etc).
*
*/ */
int BM_vert_dissolve(BMesh *bm, BMVert *v) int BM_vert_dissolve(BMesh *bm, BMVert *v)
{ {
@@ -92,6 +95,10 @@ int BM_vert_dissolve(BMesh *bm, BMVert *v)
} }
} }
/**
* dissolves all faces around a vert, and removes it.
*/
int BM_disk_dissolve(BMesh *bm, BMVert *v) int BM_disk_dissolve(BMesh *bm, BMVert *v)
{ {
BMFace *f, *f2; BMFace *f, *f2;
@@ -296,7 +303,8 @@ BMEdge *BM_verts_connect(BMesh *bm, BMVert *v1, BMVert *v2, BMFace **r_f)
/** /**
* Splits a single face into two. * Split a face along two vertices. returns the newly made face, and sets
* the 'r_l' member to a loop in the newly created edge.
* *
* \param the original face * \param the original face
* \param v1,v2 vertices which define the split edge, must be different * \param v1,v2 vertices which define the split edge, must be different
@@ -636,6 +644,7 @@ BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float perce
return nv; return nv;
} }
/* split an edge multiple times evenly */
BMVert *BM_edge_split_n(BMesh *bm, BMEdge *e, int numcuts) BMVert *BM_edge_split_n(BMesh *bm, BMEdge *e, int numcuts)
{ {
int i; int i;
@@ -649,6 +658,7 @@ BMVert *BM_edge_split_n(BMesh *bm, BMEdge *e, int numcuts)
return nv; return nv;
} }
/* checks if a face is valid in the data structure */
int BM_face_validate(BMesh *bm, BMFace *face, FILE *err) int BM_face_validate(BMesh *bm, BMFace *face, FILE *err)
{ {
BMIter iter; BMIter iter;
@@ -752,6 +762,7 @@ BMEdge *BM_edge_rotate(BMesh *bm, BMEdge *e, int ccw)
return nl->e; return nl->e;
} }
/* Rip a single face from a vertex fan */
BMVert *BM_vert_rip(BMesh *bm, BMFace *sf, BMVert *sv) BMVert *BM_vert_rip(BMesh *bm, BMFace *sf, BMVert *sv)
{ {
return bmesh_urmv(bm, sf, sv); return bmesh_urmv(bm, sf, sv);

View File

@@ -0,0 +1,60 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Contributor(s): Joseph Eagar.
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BMESH_MODS_H__
#define __BMESH_MODS_H__
/** \file blender/bmesh/intern/bmesh_mods.h
* \ingroup bmesh
*/
#include <stdio.h>
int BM_vert_dissolve(BMesh *bm, BMVert *v);
int BM_disk_dissolve(BMesh *bm, BMVert *v);
BMFace *BM_faces_join_pair(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e);
BMEdge *BM_verts_connect(BMesh *bm, BMVert *v1, BMVert *v2, BMFace **r_f);
BMFace *BM_face_split(BMesh *bm, BMFace *f,
BMVert *v1, BMVert *v2,
BMLoop **r_l, BMEdge *example);
BMEdge* BM_vert_collapse_faces(BMesh *bm, BMEdge *ke, BMVert *kv, float fac,
const short join_faces, const short kill_degenerate_faces);
BMEdge* BM_vert_collapse_edge(BMesh *bm, BMEdge *ke, BMVert *kv,
const short kill_degenerate_faces);
BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float percent);
BMVert *BM_edge_split_n(BMesh *bm, BMEdge *e, int numcuts);
int BM_face_validate(BMesh *bm, BMFace *face, FILE *err);
BMEdge *BM_edge_rotate(BMesh *bm, BMEdge *e, int ccw);
BMVert *BM_vert_rip(BMesh *bm, BMFace *sf, BMVert *sv);
#endif /* __BMESH_MODS_H__ */

View File

@@ -88,15 +88,8 @@ extern int bmesh_total_ops;
/*------specific operator helper functions-------*/ /*------specific operator helper functions-------*/
/* executes the duplicate operation, feeding elements of
* type flag etypeflag and header flag flag to it. note,
* to get more useful information (such as the mapping from
* original to new elements) you should run the dupe op manually.*/
struct Object; struct Object;
#if 0
void BMO_dupe_from_flag(BMesh *bm, int etypeflag, const char hflag);
#endif
void BM_mesh_esubdivideflag(struct Object *obedit, BMesh *bm, int flag, float smooth, void BM_mesh_esubdivideflag(struct Object *obedit, BMesh *bm, int flag, float smooth,
float fractal, int beauty, int numcuts, int seltype, float fractal, int beauty, int numcuts, int seltype,
int cornertype, int singleedge, int gridfill, int seed); int cornertype, int singleedge, int gridfill, int seed);

View File

@@ -221,6 +221,9 @@ static int compute_poly_center(float center[3], float *r_area, float (*verts)[3]
return FALSE; return FALSE;
} }
/**
* get the area of the face
*/
float BM_face_area_calc(BMesh *bm, BMFace *f) float BM_face_area_calc(BMesh *bm, BMFace *f)
{ {
BMLoop *l; BMLoop *l;
@@ -245,7 +248,7 @@ float BM_face_area_calc(BMesh *bm, BMFace *f)
return area; return area;
} }
/* /**
* computes center of face in 3d. uses center of bounding box. * computes center of face in 3d. uses center of bounding box.
*/ */
void BM_face_center_bounds_calc(BMesh *bm, BMFace *f, float r_cent[3]) void BM_face_center_bounds_calc(BMesh *bm, BMFace *f, float r_cent[3])
@@ -264,6 +267,9 @@ void BM_face_center_bounds_calc(BMesh *bm, BMFace *f, float r_cent[3])
mid_v3_v3v3(r_cent, min, max); mid_v3_v3v3(r_cent, min, max);
} }
/**
* computes the centroid of a face, using the mean average
*/
void BM_face_center_mean_calc(BMesh *bm, BMFace *f, float r_cent[3]) void BM_face_center_mean_calc(BMesh *bm, BMFace *f, float r_cent[3])
{ {
BMIter iter; BMIter iter;
@@ -280,7 +286,7 @@ void BM_face_center_mean_calc(BMesh *bm, BMFace *f, float r_cent[3])
if (f->len) mul_v3_fl(r_cent, 1.0f / (float)f->len); if (f->len) mul_v3_fl(r_cent, 1.0f / (float)f->len);
} }
/* /**
* COMPUTE POLY PLANE * COMPUTE POLY PLANE
* *
* Projects a set polygon's vertices to * Projects a set polygon's vertices to
@@ -340,23 +346,6 @@ void compute_poly_plane(float (*verts)[3], int nverts)
* the list that bridges a concave region of the face or intersects * the list that bridges a concave region of the face or intersects
* any of the faces's edges. * any of the faces's edges.
*/ */
#if 0 /* needs BLI math double versions of these functions */
static void shrink_edged(double *v1, double *v2, double fac)
{
double mid[3];
mid_v3_v3v3(mid, v1, v2);
sub_v3_v3v3(v1, v1, mid);
sub_v3_v3v3(v2, v2, mid);
mul_v3_fl(v1, fac);
mul_v3_fl(v2, fac);
add_v3_v3v3(v1, v1, mid);
add_v3_v3v3(v2, v2, mid);
}
#endif
static void shrink_edgef(float v1[3], float v2[3], const float fac) static void shrink_edgef(float v1[3], float v2[3], const float fac)
{ {
@@ -441,6 +430,9 @@ void BM_face_normal_update_vcos(BMesh *bm, BMFace *f, float no[3], float (*verte
} }
} }
/**
* updates face and vertex normals incident on an edge
*/
void BM_edge_normals_update(BMesh *bm, BMEdge *e) void BM_edge_normals_update(BMesh *bm, BMEdge *e)
{ {
BMIter iter; BMIter iter;
@@ -455,6 +447,9 @@ void BM_edge_normals_update(BMesh *bm, BMEdge *e)
BM_vert_normal_update(bm, e->v2); BM_vert_normal_update(bm, e->v2);
} }
/**
* update a vert normal (but not the faces incident on it)
*/
void BM_vert_normal_update(BMesh *bm, BMVert *v) void BM_vert_normal_update(BMesh *bm, BMVert *v)
{ {
/* TODO, we can normalize each edge only once, then compare with previous edge */ /* TODO, we can normalize each edge only once, then compare with previous edge */
@@ -651,13 +646,15 @@ static int linecrossesf(const float v1[2], const float v2[2], const float v3[2],
return FALSE; return FALSE;
} }
/* /**
* BM POINT IN FACE * BM POINT IN FACE
* *
* Projects co onto face f, and returns true if it is inside * Projects co onto face f, and returns true if it is inside
* the face bounds. Note that this uses a best-axis projection * the face bounds.
* test, instead of projecting co directly into f's orientation *
* space, so there might be accuracy issues. * \note this uses a best-axis projection test,
* instead of projecting co directly into f's orientation space,
* so there might be accuracy issues.
*/ */
int BM_face_point_inside_test(BMesh *bm, BMFace *f, const float co[3]) int BM_face_point_inside_test(BMesh *bm, BMFace *f, const float co[3])
{ {
@@ -802,21 +799,20 @@ static BMLoop *find_ear(BMesh *UNUSED(bm), BMFace *f, float (*verts)[3], const i
return bestear; return bestear;
} }
/* /**
* BMESH TRIANGULATE FACE * BMESH TRIANGULATE FACE
* *
* Triangulates a face using a * Triangulates a face using a simple 'ear clipping' algorithm that tries to
* simple 'ear clipping' algorithm * favor non-skinny triangles (angles less than 90 degrees).
* that tries to favor non-skinny *
* triangles (angles less than * If the triangulator has bits left over (or cannot triangulate at all)
* 90 degrees). If the triangulator * it uses a simple fan triangulation,
* has bits left over (or cannot
* triangulate at all) it uses a
* simple fan triangulation
* *
* newfaces, if non-null, must be an array of BMFace pointers, * newfaces, if non-null, must be an array of BMFace pointers,
* with a length equal to f->len. it will be filled with the new * with a length equal to f->len. it will be filled with the new
* triangles, and will be NULL-terminated. * triangles, and will be NULL-terminated.
*
* \note newedgeflag sets a flag layer flag, obviously not the header flag.
*/ */
void BM_face_triangulate(BMesh *bm, BMFace *f, float (*projectverts)[3], void BM_face_triangulate(BMesh *bm, BMFace *f, float (*projectverts)[3],
const short newedge_oflag, const short newface_oflag, BMFace **newfaces) const short newedge_oflag, const short newface_oflag, BMFace **newfaces)
@@ -909,12 +905,14 @@ void BM_face_triangulate(BMesh *bm, BMFace *f, float (*projectverts)[3],
if (newfaces) newfaces[nf_i] = NULL; if (newfaces) newfaces[nf_i] = NULL;
} }
/* each pair of loops defines a new edge, a split. this function goes /**
* each pair of loops defines a new edge, a split. this function goes
* through and sets pairs that are geometrically invalid to null. a * through and sets pairs that are geometrically invalid to null. a
* split is invalid, if it forms a concave angle or it intersects other * split is invalid, if it forms a concave angle or it intersects other
* edges in the face, or it intersects another split. in the case of * edges in the face, or it intersects another split. in the case of
* intersecting splits, only the first of the set of intersecting * intersecting splits, only the first of the set of intersecting
* splits survives */ * splits survives
*/
void BM_face_legal_splits(BMesh *bm, BMFace *f, BMLoop *(*loops)[2], int len) void BM_face_legal_splits(BMesh *bm, BMFace *f, BMLoop *(*loops)[2], int len)
{ {
BMIter iter; BMIter iter;

View File

@@ -0,0 +1,50 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Contributor(s): Joseph Eagar.
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BMESH_POLYGON_H__
#define __BMESH_POLYGON_H__
/** \file blender/bmesh/intern/bmesh_polygon.h
* \ingroup bmesh
*/
float BM_face_area_calc(BMesh *bm, BMFace *f);
void BM_face_center_bounds_calc(BMesh *bm, BMFace *f, float center[3]);
void BM_face_center_mean_calc(BMesh *bm, BMFace *f, float center[3]);
void BM_face_normal_update(BMesh *bm, BMFace *f);
void BM_face_normal_update_vcos(BMesh *bm, BMFace *f, float no[3], float (*vertexCos)[3]);
void BM_edge_normals_update(BMesh *bm, BMEdge *e);
void BM_vert_normal_update(BMesh *bm, BMVert *v);
void BM_vert_normal_update_all(BMesh *bm, BMVert *v);
void BM_face_normal_flip(BMesh *bm, BMFace *f);
int BM_face_point_inside_test(BMesh *bm, BMFace *f, const float co[3]);
void BM_face_triangulate(BMesh *bm, BMFace *f, float (*projectverts)[3],
const short newedge_oflag, const short newface_oflag, BMFace **newfaces);
void BM_face_legal_splits(BMesh *bm, BMFace *f, BMLoop *(*loops)[2], int len);
#endif /* __BMESH_POLYGON_H__ */

View File

@@ -65,10 +65,6 @@ int bmesh_disk_count(BMVert *v);
#define BM_ELEM_API_FLAG_DISABLE(element, f) ((element)->oflags[0].pflag &= ~(f)) #define BM_ELEM_API_FLAG_DISABLE(element, f) ((element)->oflags[0].pflag &= ~(f))
#define BM_ELEM_API_FLAG_TEST(element, f) ((element)->oflags[0].pflag & (f)) #define BM_ELEM_API_FLAG_TEST(element, f) ((element)->oflags[0].pflag & (f))
/* Polygon Utilities ? FIXME... where do these each go? */
/* newedgeflag sets a flag layer flag, obviously not the header flag. */
void BM_face_triangulate(BMesh *bm, BMFace *f, float (*projectverts)[3],
const short newedge_oflag, const short newface_oflag, BMFace **newfaces);
void bmesh_face_normal_update(BMesh *bm, BMFace *f, float no[3], void bmesh_face_normal_update(BMesh *bm, BMFace *f, float no[3],
float (*projectverts)[3]); float (*projectverts)[3]);
void bmesh_face_normal_update_vertex_cos(BMesh *bm, BMFace *f, float no[3], void bmesh_face_normal_update_vertex_cos(BMesh *bm, BMFace *f, float no[3],

View File

@@ -41,13 +41,9 @@
#define BM_OVERLAP (1 << 13) #define BM_OVERLAP (1 << 13)
/* /**
* BMESH COUNT ELEMENT * Return the amount of element of type 'type' in a given bmesh.
*
* Return the amount of element of
* type 'type' in a given bmesh.
*/ */
int BM_mesh_elem_count(BMesh *bm, const char htype) int BM_mesh_elem_count(BMesh *bm, const char htype)
{ {
if (htype == BM_VERT) return bm->totvert; if (htype == BM_VERT) return bm->totvert;
@@ -57,27 +53,20 @@ int BM_mesh_elem_count(BMesh *bm, const char htype)
return 0; return 0;
} }
/**
/*
* BMESH VERT IN EDGE
*
* Returns whether or not a given vertex is * Returns whether or not a given vertex is
* is part of a given edge. * is part of a given edge.
*
*/ */
int BM_vert_in_edge(BMEdge *e, BMVert *v) int BM_vert_in_edge(BMEdge *e, BMVert *v)
{ {
return bmesh_vert_in_edge(e, v); return bmesh_vert_in_edge(e, v);
} }
/* /**
* BMESH OTHER EDGE IN FACE SHARING A VERTEX * BMESH OTHER EDGE IN FACE SHARING A VERTEX
* *
* Returns an opposing loop that shares the same face. * Finds the other loop that shares 'v' with 'e's loop in 'f'.
*
*/ */
BMLoop *BM_face_other_loop(BMEdge *e, BMFace *f, BMVert *v) BMLoop *BM_face_other_loop(BMEdge *e, BMFace *f, BMVert *v)
{ {
BMLoop *l_iter; BMLoop *l_iter;
@@ -94,12 +83,8 @@ BMLoop *BM_face_other_loop(BMEdge *e, BMFace *f, BMVert *v)
return l_iter->v == v ? l_iter->prev : l_iter->next; return l_iter->v == v ? l_iter->prev : l_iter->next;
} }
/* /**
* BMESH VERT IN FACE * Returns TRUE if the vertex is used in a given face.
*
* Returns whether or not a given vertex is
* is part of a given face.
*
*/ */
int BM_vert_in_face(BMFace *f, BMVert *v) int BM_vert_in_face(BMFace *f, BMVert *v)
@@ -126,12 +111,9 @@ int BM_vert_in_face(BMFace *f, BMVert *v)
return FALSE; return FALSE;
} }
/* /**
* BMESH VERTS IN FACE
*
* Compares the number of vertices in an array * Compares the number of vertices in an array
* that appear in a given face * that appear in a given face
*
*/ */
int BM_verts_in_face(BMesh *bm, BMFace *f, BMVert **varr, int len) int BM_verts_in_face(BMesh *bm, BMFace *f, BMVert **varr, int len)
{ {
@@ -171,14 +153,9 @@ int BM_verts_in_face(BMesh *bm, BMFace *f, BMVert **varr, int len)
return count; return count;
} }
/* /**
* BMESH EDGE IN FACE * Returns whether or not a given edge is is part of a given face.
*
* Returns whether or not a given edge is
* is part of a given face.
*
*/ */
int BM_edge_in_face(BMFace *f, BMEdge *e) int BM_edge_in_face(BMFace *f, BMEdge *e)
{ {
BMLoop *l_iter; BMLoop *l_iter;
@@ -195,49 +172,35 @@ int BM_edge_in_face(BMFace *f, BMEdge *e)
return FALSE; return FALSE;
} }
/* /**
* BMESH VERTS IN EDGE
*
* Returns whether or not two vertices are in * Returns whether or not two vertices are in
* a given edge * a given edge
*
*/ */
int BM_verts_in_edge(BMVert *v1, BMVert *v2, BMEdge *e) int BM_verts_in_edge(BMVert *v1, BMVert *v2, BMEdge *e)
{ {
return bmesh_verts_in_edge(v1, v2, e); return bmesh_verts_in_edge(v1, v2, e);
} }
/* /**
* BMESH GET OTHER EDGEVERT
*
* Given a edge and one of its vertices, returns * Given a edge and one of its vertices, returns
* the other vertex. * the other vertex.
*
*/ */
BMVert *BM_edge_other_vert(BMEdge *e, BMVert *v) BMVert *BM_edge_other_vert(BMEdge *e, BMVert *v)
{ {
return bmesh_edge_other_vert_get(e, v); return bmesh_edge_other_vert_get(e, v);
} }
/* /**
* BMESH VERT EDGECOUNT
*
* Returns the number of edges around this vertex. * Returns the number of edges around this vertex.
*/ */
int BM_vert_edge_count(BMVert *v) int BM_vert_edge_count(BMVert *v)
{ {
return bmesh_disk_count(v); return bmesh_disk_count(v);
} }
/* /**
* BMESH EDGE FACECOUNT
*
* Returns the number of faces around this edge * Returns the number of faces around this edge
*/ */
int BM_edge_face_count(BMEdge *e) int BM_edge_face_count(BMEdge *e)
{ {
int count = 0; int count = 0;
@@ -253,12 +216,9 @@ int BM_edge_face_count(BMEdge *e)
return count; return count;
} }
/* /**
* BMESH VERT FACECOUNT
*
* Returns the number of faces around this vert * Returns the number of faces around this vert
*/ */
int BM_vert_face_count(BMVert *v) int BM_vert_face_count(BMVert *v)
{ {
int count = 0; int count = 0;
@@ -284,16 +244,10 @@ int BM_vert_face_count(BMVert *v)
#endif #endif
} }
/* /**
* BMESH WIRE VERT
*
* Tests whether or not the vertex is part of a wire edge. * Tests whether or not the vertex is part of a wire edge.
* (ie: has no faces attached to it) * (ie: has no faces attached to it)
*
* Returns -
* 1 for true, 0 for false.
*/ */
int BM_vert_is_wire(BMesh *UNUSED(bm), BMVert *v) int BM_vert_is_wire(BMesh *UNUSED(bm), BMVert *v)
{ {
BMEdge *curedge; BMEdge *curedge;
@@ -314,34 +268,22 @@ int BM_vert_is_wire(BMesh *UNUSED(bm), BMVert *v)
return TRUE; return TRUE;
} }
/* /**
* BMESH WIRE EDGE
*
* Tests whether or not the edge is part of a wire. * Tests whether or not the edge is part of a wire.
* (ie: has no faces attached to it) * (ie: has no faces attached to it)
*
* Returns -
* 1 for true, 0 for false.
*/ */
int BM_edge_is_wire(BMesh *UNUSED(bm), BMEdge *e) int BM_edge_is_wire(BMesh *UNUSED(bm), BMEdge *e)
{ {
return (e->l) ? FALSE : TRUE; return (e->l) ? FALSE : TRUE;
} }
/* /**
* BMESH NONMANIFOLD VERT
*
* A vertex is non-manifold if it meets the following conditions: * A vertex is non-manifold if it meets the following conditions:
* 1: Loose - (has no edges/faces incident upon it) * 1: Loose - (has no edges/faces incident upon it)
* 2: Joins two distinct regions - (two pyramids joined at the tip) * 2: Joins two distinct regions - (two pyramids joined at the tip)
* 3: Is part of a non-manifold edge (edge with more than 2 faces) * 3: Is part of a non-manifold edge (edge with more than 2 faces)
* 4: Is part of a wire edge * 4: Is part of a wire edge
*
* Returns -
* 1 for true, 0 for false.
*/ */
int BM_vert_is_manifold(BMesh *UNUSED(bm), BMVert *v) int BM_vert_is_manifold(BMesh *UNUSED(bm), BMVert *v)
{ {
BMEdge *e, *oe; BMEdge *e, *oe;
@@ -402,17 +344,10 @@ int BM_vert_is_manifold(BMesh *UNUSED(bm), BMVert *v)
return TRUE; return TRUE;
} }
/* /**
* BMESH NONMANIFOLD EDGE
*
* Tests whether or not this edge is manifold. * Tests whether or not this edge is manifold.
* A manifold edge either has 1 or 2 faces attached * A manifold edge either has 1 or 2 faces attached to it.
* to it.
*
* Returns -
* 1 for true, 0 for false.
*/ */
int BM_edge_is_manifold(BMesh *UNUSED(bm), BMEdge *e) int BM_edge_is_manifold(BMesh *UNUSED(bm), BMEdge *e)
{ {
int count = BM_edge_face_count(e); int count = BM_edge_face_count(e);
@@ -422,16 +357,10 @@ int BM_edge_is_manifold(BMesh *UNUSED(bm), BMEdge *e)
return TRUE; return TRUE;
} }
/* /**
* BMESH BOUNDARY EDGE
*
* Tests whether or not an edge is on the boundary * Tests whether or not an edge is on the boundary
* of a shell (has one face associated with it) * of a shell (has one face associated with it)
*
* Returns -
* 1 for true, 0 for false.
*/ */
int BM_edge_is_boundary(BMEdge *e) int BM_edge_is_boundary(BMEdge *e)
{ {
int count = BM_edge_face_count(e); int count = BM_edge_face_count(e);
@@ -441,18 +370,9 @@ int BM_edge_is_boundary(BMEdge *e)
return FALSE; return FALSE;
} }
/* /**
* BMESH FACE SHAREDEDGES
*
* Counts the number of edges two faces share (if any) * Counts the number of edges two faces share (if any)
*
* BMESH_TODO:
* Move this to structure, and wrap.
*
* Returns -
* Integer
*/ */
int BM_face_share_edge_count(BMFace *f1, BMFace *f2) int BM_face_share_edge_count(BMFace *f1, BMFace *f2)
{ {
BMLoop *l_iter; BMLoop *l_iter;
@@ -469,14 +389,9 @@ int BM_face_share_edge_count(BMFace *f1, BMFace *f2)
return count; return count;
} }
/* /**
* * Test if e1 shares any faces with e2
* BMESH EDGE SHARE FACES
*
* Tests to see if e1 shares any faces with e2
*
*/ */
int BM_edge_share_face_count(BMEdge *e1, BMEdge *e2) int BM_edge_share_face_count(BMEdge *e1, BMEdge *e2)
{ {
BMLoop *l; BMLoop *l;
@@ -496,13 +411,8 @@ int BM_edge_share_face_count(BMEdge *e1, BMEdge *e2)
} }
/** /**
*
* BMESH EDGE SHARE A VERTEX
*
* Tests to see if e1 shares a vertex with e2 * Tests to see if e1 shares a vertex with e2
*
*/ */
int BM_edge_share_vert_count(struct BMEdge *e1, struct BMEdge *e2) int BM_edge_share_vert_count(struct BMEdge *e1, struct BMEdge *e2)
{ {
return (e1->v1 == e2->v1 || return (e1->v1 == e2->v1 ||
@@ -512,13 +422,8 @@ int BM_edge_share_vert_count(struct BMEdge *e1, struct BMEdge *e2)
} }
/** /**
*
* BMESH EDGE SHARE A VERTEX
*
* Return the shared vertex between the two edges or NULL * Return the shared vertex between the two edges or NULL
*
*/ */
BMVert *BM_edge_share_vert(struct BMEdge *e1, struct BMEdge *e2) BMVert *BM_edge_share_vert(struct BMEdge *e1, struct BMEdge *e2)
{ {
if (BM_vert_in_edge(e2, e1->v1)) { if (BM_vert_in_edge(e2, e1->v1)) {
@@ -533,18 +438,13 @@ BMVert *BM_edge_share_vert(struct BMEdge *e1, struct BMEdge *e2)
} }
/** /**
*
* BMESH EDGE ORDERED VERTS
*
* Returns the verts of an edge as used in a face * Returns the verts of an edge as used in a face
* if used in a face at all, otherwise just assign as used in the edge. * if used in a face at all, otherwise just assign as used in the edge.
* *
* Useful to get a determanistic winding order when calling * Useful to get a determanistic winding order when calling
* BM_face_create_ngon() on an arbitrary array of verts, * BM_face_create_ngon() on an arbitrary array of verts,
* though be sure to pick an edge which has a face. * though be sure to pick an edge which has a face.
*
*/ */
void BM_edge_ordered_verts(BMEdge *edge, BMVert **r_v1, BMVert **r_v2) void BM_edge_ordered_verts(BMEdge *edge, BMVert **r_v1, BMVert **r_v2)
{ {
if ((edge->l == NULL) || if ((edge->l == NULL) ||
@@ -561,16 +461,12 @@ void BM_edge_ordered_verts(BMEdge *edge, BMVert **r_v1, BMVert **r_v2)
} }
} }
/* /**
* BMESH LOOP ANGLE
*
* Calculates the angle between the previous and next loops * Calculates the angle between the previous and next loops
* (angle at this loops face corner). * (angle at this loops face corner).
* *
* Returns - * \return angle in radians
* Float.
*/ */
float BM_loop_face_angle(BMesh *UNUSED(bm), BMLoop *l) float BM_loop_face_angle(BMesh *UNUSED(bm), BMLoop *l)
{ {
return angle_v3v3v3(l->prev->v->co, return angle_v3v3v3(l->prev->v->co,
@@ -578,16 +474,12 @@ float BM_loop_face_angle(BMesh *UNUSED(bm), BMLoop *l)
l->next->v->co); l->next->v->co);
} }
/* /**
* BMESH FACE ANGLE
*
* Calculates the angle between two faces. * Calculates the angle between two faces.
* Assumes the face normals are correct. * Assumes the face normals are correct.
* *
* Returns - * \return angle in radians
* Float.
*/ */
float BM_edge_face_angle(BMesh *UNUSED(bm), BMEdge *e) float BM_edge_face_angle(BMesh *UNUSED(bm), BMEdge *e)
{ {
if (BM_edge_face_count(e) == 2) { if (BM_edge_face_count(e) == 2) {
@@ -630,8 +522,25 @@ float BM_vert_edge_angle(BMesh *UNUSED(bm), BMVert *v)
} }
/** /**
* BMESH EXIST FACE OVERLAPS * Returns the edge existing between v1 and v2, or NULL if there isn't one.
* *
* \note multiple edges may exist between any two vertices, and therefore
* this function only returns the first one found.
*/
BMEdge *BM_edge_exists(BMVert *v1, BMVert *v2)
{
BMIter iter;
BMEdge *e;
BM_ITER(e, &iter, NULL, BM_EDGES_OF_VERT, v1) {
if (e->v1 == v2 || e->v2 == v2)
return e;
}
return NULL;
}
/**
* Given a set of vertices (varr), find out if * Given a set of vertices (varr), find out if
* all those vertices overlap an existing face. * all those vertices overlap an existing face.
* *
@@ -666,18 +575,11 @@ int BM_face_exists_overlap(BMesh *bm, BMVert **varr, int len, BMFace **r_overlap
return FALSE; return FALSE;
} }
/* /**
* BMESH FACE EXISTS
*
* Given a set of vertices (varr), find out if * Given a set of vertices (varr), find out if
* there is a face with exactly those vertices * there is a face with exactly those vertices
* (and only those vertices). * (and only those vertices).
*
* Returns:
* 0 for no face found
* 1 for face found
*/ */
int BM_face_exists(BMesh *bm, BMVert **varr, int len, BMFace **r_existface) int BM_face_exists(BMesh *bm, BMVert **varr, int len, BMFace **r_existface)
{ {
BMIter viter; BMIter viter;
@@ -703,9 +605,7 @@ int BM_face_exists(BMesh *bm, BMVert **varr, int len, BMFace **r_existface)
} }
/* /**
* BMESH EXIST FACE MULTI
*
* Given a set of vertices and edges (varr, earr), find out if * Given a set of vertices and edges (varr, earr), find out if
* all those vertices are filled in by existing faces that _only_ use those vertices. * all those vertices are filled in by existing faces that _only_ use those vertices.
* *
@@ -716,13 +616,7 @@ int BM_face_exists(BMesh *bm, BMVert **varr, int len, BMFace **r_existface)
* pressing Fkey would make a new overlapping quad (without a check like this) * pressing Fkey would make a new overlapping quad (without a check like this)
* *
* 'earr' and 'varr' can be in any order, however they _must_ form a closed loop. * 'earr' and 'varr' can be in any order, however they _must_ form a closed loop.
*
* Returns:
* 0 for no overlap
* 1 for overlap
*
*/ */
int BM_face_exists_multi(BMesh *bm, BMVert **varr, BMEdge **earr, int len) int BM_face_exists_multi(BMesh *bm, BMVert **varr, BMEdge **earr, int len)
{ {
BMFace *f; BMFace *f;

View File

@@ -23,108 +23,54 @@
#ifndef __BMESH_QUERIES_H__ #ifndef __BMESH_QUERIES_H__
#define __BMESH_QUERIES_H__ #define __BMESH_QUERIES_H__
/** \file blender/bmesh/bmesh_queries.h /** \file blender/bmesh/intern/bmesh_queries.h
* \ingroup bmesh * \ingroup bmesh
*/ */
#include <stdio.h>
/* Queries */
/* counts number of elements of type type are in the mesh. */
int BM_mesh_elem_count(BMesh *bm, const char htype); int BM_mesh_elem_count(BMesh *bm, const char htype);
/*returns true if v is in f*/
int BM_vert_in_face(BMFace *f, BMVert *v); int BM_vert_in_face(BMFace *f, BMVert *v);
// int BM_verts_in_face(BMFace *f, BMVert **varr, int len);
int BM_verts_in_face(BMesh *bm, BMFace *f, BMVert **varr, int len); int BM_verts_in_face(BMesh *bm, BMFace *f, BMVert **varr, int len);
int BM_edge_in_face(BMFace *f, BMEdge *e); int BM_edge_in_face(BMFace *f, BMEdge *e);
int BM_vert_in_edge(BMEdge *e, BMVert *v); int BM_vert_in_edge(BMEdge *e, BMVert *v);
int BM_verts_in_edge(BMVert *v1, BMVert *v2, BMEdge *e); int BM_verts_in_edge(BMVert *v1, BMVert *v2, BMEdge *e);
/*get opposing vert from v in edge e.*/
BMVert *BM_edge_other_vert(BMEdge *e, BMVert *v); BMVert *BM_edge_other_vert(BMEdge *e, BMVert *v);
/*finds other loop that shares v with e's loop in f.*/
BMLoop *BM_face_other_loop(BMEdge *e, BMFace *f, BMVert *v); BMLoop *BM_face_other_loop(BMEdge *e, BMFace *f, BMVert *v);
/*returns the edge existing between v1 and v2, or NULL if there isn't one.*/
BMEdge *BM_edge_exists(BMVert *v1, BMVert *v2);
/*returns number of edges aroudn a vert*/
int BM_vert_edge_count(BMVert *v); int BM_vert_edge_count(BMVert *v);
/*returns number of faces around an edge*/
int BM_edge_face_count(BMEdge *e); int BM_edge_face_count(BMEdge *e);
/*returns number of faces around a vert.*/
int BM_vert_face_count(BMVert *v); int BM_vert_face_count(BMVert *v);
/*returns true if v is a wire vert*/
int BM_vert_is_wire(BMesh *bm, BMVert *v); int BM_vert_is_wire(BMesh *bm, BMVert *v);
/*returns true if e is a wire edge*/
int BM_edge_is_wire(BMesh *bm, BMEdge *e); int BM_edge_is_wire(BMesh *bm, BMEdge *e);
/* returns FALSE if v is part of a non-manifold edge in the mesh,
* I believe this includes if it's part of both a wire edge and
* a face.*/
int BM_vert_is_manifold(BMesh *bm, BMVert *v); int BM_vert_is_manifold(BMesh *bm, BMVert *v);
/* returns FALSE if e is shared by more then two faces. */
int BM_edge_is_manifold(BMesh *bm, BMEdge *e); int BM_edge_is_manifold(BMesh *bm, BMEdge *e);
/* returns true if e is a boundary edge, e.g. has only 1 face bordering it. */
int BM_edge_is_boundary(BMEdge *e); int BM_edge_is_boundary(BMEdge *e);
/* returns the face corner angle */
float BM_loop_face_angle(BMesh *bm, BMLoop *l); float BM_loop_face_angle(BMesh *bm, BMLoop *l);
/* returns angle of two faces surrounding an edge. note there must be
* exactly two faces sharing the edge.*/
float BM_edge_face_angle(BMesh *bm, BMEdge *e); float BM_edge_face_angle(BMesh *bm, BMEdge *e);
/* returns angle of two faces surrounding edges. note there must be
* exactly two edges sharing the vertex.*/
float BM_vert_edge_angle(BMesh *bm, BMVert *v); float BM_vert_edge_angle(BMesh *bm, BMVert *v);
/* checks overlapping of existing faces with the verts in varr. */ BMEdge *BM_edge_exists(BMVert *v1, BMVert *v2);
int BM_face_exists_overlap(BMesh *bm, BMVert **varr, int len, BMFace **r_existface); int BM_face_exists_overlap(BMesh *bm, BMVert **varr, int len, BMFace **r_existface);
/* checks if a face defined by varr already exists. */
int BM_face_exists(BMesh *bm, BMVert **varr, int len, BMFace **r_existface); int BM_face_exists(BMesh *bm, BMVert **varr, int len, BMFace **r_existface);
/* checks if many existing faces overlap the faces defined by varr */
int BM_face_exists_multi(BMesh *bm, BMVert **varr, BMEdge **earr, int len); int BM_face_exists_multi(BMesh *bm, BMVert **varr, BMEdge **earr, int len);
int BM_face_exists_multi_edge(BMesh *bm, BMEdge **earr, int len); int BM_face_exists_multi_edge(BMesh *bm, BMEdge **earr, int len);
/* returns number of edges f1 and f2 share. */
int BM_face_share_edge_count(BMFace *f1, BMFace *f2); int BM_face_share_edge_count(BMFace *f1, BMFace *f2);
/* returns number of faces e1 and e2 share. */
int BM_edge_share_face_count(BMEdge *e1, BMEdge *e2); int BM_edge_share_face_count(BMEdge *e1, BMEdge *e2);
/* returns bool 1/0 if the edges share a vertex */
int BM_edge_share_vert_count(BMEdge *e1, BMEdge *e2); int BM_edge_share_vert_count(BMEdge *e1, BMEdge *e2);
BMVert *BM_edge_share_vert(BMEdge *e1, BMEdge *e2); BMVert *BM_edge_share_vert(BMEdge *e1, BMEdge *e2);
/* edge verts in winding order from face */
void BM_edge_ordered_verts(BMEdge *edge, BMVert **r_v1, BMVert **r_v2); void BM_edge_ordered_verts(BMEdge *edge, BMVert **r_v1, BMVert **r_v2);
/* checks if a face is valid in the data structure */
int BM_face_validate(BMesh *bm, BMFace *face, FILE *err);
/* each pair of loops defines a new edge, a split. this function goes
* through and sets pairs that are geometrically invalid to null. a
* split is invalid, if it forms a concave angle or it intersects other
* edges in the face.*/
void BM_face_legal_splits(BMesh *bm, BMFace *f, BMLoop *(*loops)[2], int len);
#endif /* __BMESH_QUERIES_H__ */ #endif /* __BMESH_QUERIES_H__ */

View File

@@ -70,20 +70,4 @@ BMVert *bmesh_edge_other_vert_get(BMEdge *e, BMVert *v);
BMEdge *bmesh_disk_edge_exists(BMVert *v1, BMVert *v2); BMEdge *bmesh_disk_edge_exists(BMVert *v1, BMVert *v2);
int bmesh_disk_validate(int len, BMEdge *e, BMVert *v); int bmesh_disk_validate(int len, BMEdge *e, BMVert *v);
/* EULER API - For modifying structure */
BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e);
BMFace *bmesh_sfme(BMesh *bm, BMFace *f, BMVert *v1,
BMVert *v2, BMLoop **r_l,
#ifdef USE_BMESH_HOLES
ListBase *holes,
#endif
BMEdge *example
);
BMEdge *bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv, const short check_edge_splice);
int bmesh_loop_reverse(BMesh *bm, BMFace *f);
BMFace *bmesh_jfke(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e);
BMVert *bmesh_urmv(BMesh *bm, BMFace *sf, BMVert *sv);
#endif /* __BMESH_STRUCTURE_H__ */ #endif /* __BMESH_STRUCTURE_H__ */

View File

@@ -32,17 +32,14 @@
#include "bmesh_private.h" #include "bmesh_private.h"
#include "bmesh_walkers_private.h" #include "bmesh_walkers_private.h"
/* Shell Walker: /**
* Shell Walker:
* *
* Starts at a vertex on the mesh and walks over the 'shell' it belongs * Starts at a vertex on the mesh and walks over the 'shell' it belongs
* to via visiting connected edges. * to via visiting connected edges.
* *
* TODO: * \todo Add restriction flag/callback for wire edges.
*
* Add restriction flag/callback for wire edges.
*
*/ */
static void shellWalker_visitEdge(BMWalker *walker, BMEdge *e) static void shellWalker_visitEdge(BMWalker *walker, BMEdge *e)
{ {
shellWalker *shellWalk = NULL; shellWalker *shellWalk = NULL;
@@ -164,12 +161,11 @@ static void *shellWalker_step(BMWalker *walker)
} }
#endif #endif
/* Connected Vertex Walker: /**
* Connected Vertex Walker:
* *
* Similar to shell walker, but visits vertices instead of edges. * Similar to shell walker, but visits vertices instead of edges.
*
*/ */
static void connectedVertexWalker_visitVertex(BMWalker *walker, BMVert *v) static void connectedVertexWalker_visitVertex(BMWalker *walker, BMVert *v)
{ {
connectedVertexWalker *vwalk; connectedVertexWalker *vwalk;
@@ -221,17 +217,13 @@ static void *connectedVertexWalker_step(BMWalker *walker)
return v; return v;
} }
/* Island Boundary Walker: /**
* Island Boundary Walker:
* *
* Starts at a edge on the mesh and walks over the boundary of an * Starts at a edge on the mesh and walks over the boundary of an island it belongs to.
* island it belongs to.
*
* TODO:
*
* Add restriction flag/callback for wire edges.
* *
* \todo Add restriction flag/callback for wire edges.
*/ */
static void islandboundWalker_begin(BMWalker *walker, void *data) static void islandboundWalker_begin(BMWalker *walker, void *data)
{ {
BMLoop *l = data; BMLoop *l = data;
@@ -318,16 +310,13 @@ static void *islandboundWalker_step(BMWalker *walker)
} }
/* Island Walker: /**
* Island Walker:
* *
* Starts at a tool flagged-face and walks over the face region * Starts at a tool flagged-face and walks over the face region
* *
* TODO: * \todo Add restriction flag/callback for wire edges.
*
* Add restriction flag/callback for wire edges.
*
*/ */
static void islandWalker_begin(BMWalker *walker, void *data) static void islandWalker_begin(BMWalker *walker, void *data)
{ {
islandWalker *iwalk = NULL; islandWalker *iwalk = NULL;
@@ -384,12 +373,11 @@ static void *islandWalker_step(BMWalker *walker)
} }
/* Edge Loop Walker: /**
* Edge Loop Walker:
* *
* Starts at a tool-flagged edge and walks over the edge loop * Starts at a tool-flagged edge and walks over the edge loop
*
*/ */
static void loopWalker_begin(BMWalker *walker, void *data) static void loopWalker_begin(BMWalker *walker, void *data)
{ {
loopWalker *lwalk = NULL, owalk; loopWalker *lwalk = NULL, owalk;
@@ -516,12 +504,12 @@ static void *loopWalker_step(BMWalker *walker)
return owalk.cur; return owalk.cur;
} }
/* Face Loop Walker: /**
* Face Loop Walker:
* *
* Starts at a tool-flagged face and walks over the face loop * Starts at a tool-flagged face and walks over the face loop
* Conditions for starting and stepping the face loop have been * Conditions for starting and stepping the face loop have been
* tuned in an attempt to match the face loops built by EditMesh * tuned in an attempt to match the face loops built by EditMesh
*
*/ */
/* Check whether the face loop should includes the face specified /* Check whether the face loop should includes the face specified
@@ -648,14 +636,13 @@ static void *faceloopWalker_step(BMWalker *walker)
return f; return f;
} }
/* Edge Ring Walker: /**
* Edge Ring Walker:
* *
* Starts at a tool-flagged edge and walks over the edge ring * Starts at a tool-flagged edge and walks over the edge ring
* Conditions for starting and stepping the edge ring have been * Conditions for starting and stepping the edge ring have been
* tuned in an attempt to match the edge rings built by EditMesh * tuned in an attempt to match the edge rings built by EditMesh
*
*/ */
static void edgeringWalker_begin(BMWalker *walker, void *data) static void edgeringWalker_begin(BMWalker *walker, void *data)
{ {
edgeringWalker *lwalk, owalk; edgeringWalker *lwalk, owalk;