4
* ***** BEGIN GPL LICENSE BLOCK *****
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version. The Blender
10
* Foundation also sells licenses for use in proprietary software under
11
* the Blender License. See http://www.blender.org/BL/ for information
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
19
* You should have received a copy of the GNU General Public License
20
* along with this program; if not, write to the Free Software Foundation,
21
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23
* Contributor(s): Martin Poirier
25
* ***** END GPL LICENSE BLOCK *****
33
#include "DNA_listBase.h"
35
#include "BLI_graph.h"
43
typedef struct ReebGraph {
51
RadialSymmetry radial_symmetry;
52
AxialSymmetry axial_symmetry;
53
/*********************************/
57
struct EdgeHash *emap;
59
struct ReebGraph *link_up; /* for multi resolution filtering, points to higher levels */
62
typedef struct EmbedBucket {
66
float no[3]; /* if non-null, normal of the bucket */
69
typedef struct ReebNode {
75
struct ReebArc **arcs;
81
float symmetry_axis[3];
82
/*********************************/
89
struct ReebNode *link_down; /* for multi resolution filtering, points to lower levels, if present */
90
struct ReebNode *link_up;
93
typedef struct ReebEdge {
94
struct ReebEdge *next, *prev;
96
struct ReebNode *v1, *v2;
97
struct ReebEdge *nextEdge;
101
typedef struct ReebArc {
103
struct ReebNode *head, *tail;
111
/*********************************/
115
struct EmbedBucket *buckets;
119
struct ReebArc *link_up; /* for multi resolution filtering, points to higher levels */
122
typedef struct ReebArcIterator {
128
PreviousFct previous;
135
/*********************************/
145
int weightToHarmonic(struct EditMesh *em, struct EdgeIndex *indexed_edges);
146
int weightFromDistance(struct EditMesh *em, struct EdgeIndex *indexed_edges);
147
int weightFromLoc(struct EditMesh *me, int axis);
148
void weightToVCol(struct EditMesh *em, int index);
149
void arcToVCol(struct ReebGraph *rg, struct EditMesh *em, int index);
150
void angleToVCol(struct EditMesh *em, int index);
151
void renormalizeWeight(struct EditMesh *em, float newmax);
153
ReebGraph * generateReebGraph(struct EditMesh *me, int subdivisions);
154
ReebGraph * newReebGraph();
156
void initArcIterator(BArcIterator *iter, struct ReebArc *arc, struct ReebNode *head);
157
void initArcIterator2(BArcIterator *iter, struct ReebArc *arc, int start, int end);
158
void initArcIteratorStart(BArcIterator *iter, struct ReebArc *arc, struct ReebNode *head, int start);
161
void filterNullReebGraph(ReebGraph *rg);
162
int filterSmartReebGraph(ReebGraph *rg, float threshold);
163
int filterExternalReebGraph(ReebGraph *rg, float threshold);
164
int filterInternalReebGraph(ReebGraph *rg, float threshold);
166
/* Post-Build processing */
167
void repositionNodes(ReebGraph *rg);
168
void postprocessGraph(ReebGraph *rg, char mode);
169
void removeNormalNodes(ReebGraph *rg);
171
void sortNodes(ReebGraph *rg);
172
void sortArcs(ReebGraph *rg);
174
/*------------ Sanity check ------------*/
175
void verifyBuckets(ReebGraph *rg);
176
void verifyFaces(ReebGraph *rg);
178
/*********************** PUBLIC *********************************/
180
#define REEB_MAX_MULTI_LEVEL 10
182
ReebGraph *BIF_ReebGraphFromEditMesh(void);
183
ReebGraph *BIF_ReebGraphMultiFromEditMesh(void);
184
void BIF_flagMultiArcs(ReebGraph *rg, int flag);
186
void BIF_GlobalReebGraphFromEditMesh(void);
187
void BIF_GlobalReebFree(void);
189
ReebNode *BIF_otherNodeFromIndex(ReebArc *arc, ReebNode *node);
190
ReebNode *BIF_NodeFromIndex(ReebArc *arc, ReebNode *node);
191
ReebNode *BIF_lowestLevelNode(ReebNode *node);
193
ReebGraph *BIF_graphForMultiNode(ReebGraph *rg, ReebNode *node);
195
void REEB_freeGraph(ReebGraph *rg);
196
void REEB_freeArc(BArc *barc);
197
void REEB_exportGraph(ReebGraph *rg, int count);