~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

Viewing changes to source/blender/include/reeb.h

  • Committer: Bazaar Package Importer
  • Author(s): Kevin Roy
  • Date: 2011-02-08 22:20:54 UTC
  • mfrom: (1.4.2 upstream)
  • mto: (14.2.6 sid) (1.5.1)
  • mto: This revision was merged to the branch mainline in revision 27.
  • Revision ID: james.westby@ubuntu.com-20110208222054-kk0gwa4bu8h5lyq4
Tags: upstream-2.56.1-beta-svn34076
ImportĀ upstreamĀ versionĀ 2.56.1-beta-svn34076

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**
2
 
 * $Id: 
3
 
 *
4
 
 * ***** BEGIN GPL LICENSE BLOCK *****
5
 
 *
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
12
 
 * about this.
13
 
 *
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.
18
 
 *
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.
22
 
 *
23
 
 * Contributor(s): Martin Poirier
24
 
 *
25
 
 * ***** END GPL LICENSE BLOCK *****
26
 
 */
27
 
 
28
 
#ifndef REEB_H_
29
 
#define REEB_H_
30
 
 
31
 
#define WITH_BF_REEB
32
 
 
33
 
#include "DNA_listBase.h"
34
 
 
35
 
#include "BLI_graph.h"
36
 
 
37
 
struct GHash;
38
 
struct EdgeHash;
39
 
struct ReebArc;
40
 
struct ReebEdge;
41
 
struct ReebNode;
42
 
 
43
 
typedef struct ReebGraph {
44
 
        ListBase        arcs;
45
 
        ListBase        nodes;
46
 
        
47
 
        float length;
48
 
        
49
 
        FreeArc                 free_arc;
50
 
        FreeNode                free_node;
51
 
        RadialSymmetry  radial_symmetry;
52
 
        AxialSymmetry   axial_symmetry;
53
 
        /*********************************/
54
 
        
55
 
        int resolution;
56
 
        int totnodes;
57
 
        struct EdgeHash *emap;
58
 
        int multi_level;
59
 
        struct ReebGraph *link_up; /* for multi resolution filtering, points to higher levels */
60
 
} ReebGraph;
61
 
 
62
 
typedef struct EmbedBucket {
63
 
        float val;
64
 
        int       nv;
65
 
        float p[3];
66
 
        float no[3]; /* if non-null, normal of the bucket */
67
 
} EmbedBucket;
68
 
 
69
 
typedef struct ReebNode {
70
 
        void *next, *prev;
71
 
        float p[3];
72
 
        int flag;
73
 
 
74
 
        int degree;
75
 
        struct ReebArc **arcs;
76
 
 
77
 
        int subgraph_index;
78
 
 
79
 
        int symmetry_level;
80
 
        int symmetry_flag;
81
 
        float symmetry_axis[3];
82
 
        /*********************************/
83
 
        
84
 
        float no[3];
85
 
 
86
 
        int index;
87
 
        float weight;
88
 
        int     multi_level;
89
 
        struct ReebNode *link_down; /* for multi resolution filtering, points to lower levels, if present */
90
 
        struct ReebNode *link_up;
91
 
} ReebNode;
92
 
 
93
 
typedef struct ReebEdge {
94
 
        struct ReebEdge *next, *prev;
95
 
        struct ReebArc  *arc;
96
 
        struct ReebNode *v1, *v2;
97
 
        struct ReebEdge *nextEdge;
98
 
        int flag;
99
 
} ReebEdge;
100
 
 
101
 
typedef struct ReebArc {
102
 
        void *next, *prev;
103
 
        struct ReebNode *head, *tail;
104
 
        int flag;
105
 
 
106
 
        float length;
107
 
 
108
 
        int symmetry_level;
109
 
        int symmetry_group;
110
 
        int symmetry_flag;
111
 
        /*********************************/
112
 
 
113
 
        ListBase edges;
114
 
        int bcount;
115
 
        struct EmbedBucket *buckets;
116
 
 
117
 
        struct GHash *faces;    
118
 
        float angle;
119
 
        struct ReebArc *link_up; /* for multi resolution filtering, points to higher levels */
120
 
} ReebArc;
121
 
 
122
 
typedef struct ReebArcIterator {
123
 
        HeadFct         head;
124
 
        TailFct         tail;
125
 
        PeekFct         peek;
126
 
        NextFct         next;
127
 
        NextNFct        nextN;
128
 
        PreviousFct     previous;
129
 
        StoppedFct      stopped;
130
 
        
131
 
        float *p, *no;
132
 
        
133
 
        int length;
134
 
        int index;
135
 
        /*********************************/
136
 
        struct ReebArc  *arc;
137
 
        int start;
138
 
        int end;
139
 
        int stride;
140
 
} ReebArcIterator;
141
 
 
142
 
struct EditMesh;
143
 
struct EdgeIndex;
144
 
 
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);
152
 
 
153
 
ReebGraph * generateReebGraph(struct EditMesh *me, int subdivisions);
154
 
ReebGraph * newReebGraph();
155
 
 
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);
159
 
 
160
 
/* Filtering */
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);
165
 
 
166
 
/* Post-Build processing */
167
 
void repositionNodes(ReebGraph *rg);
168
 
void postprocessGraph(ReebGraph *rg, char mode);
169
 
void removeNormalNodes(ReebGraph *rg);
170
 
 
171
 
void sortNodes(ReebGraph *rg);
172
 
void sortArcs(ReebGraph *rg);
173
 
 
174
 
/*------------ Sanity check ------------*/
175
 
void verifyBuckets(ReebGraph *rg);
176
 
void verifyFaces(ReebGraph *rg);
177
 
 
178
 
/*********************** PUBLIC *********************************/
179
 
 
180
 
#define REEB_MAX_MULTI_LEVEL    10
181
 
 
182
 
ReebGraph *BIF_ReebGraphFromEditMesh(void);
183
 
ReebGraph *BIF_ReebGraphMultiFromEditMesh(void);
184
 
void BIF_flagMultiArcs(ReebGraph *rg, int flag);
185
 
 
186
 
void BIF_GlobalReebGraphFromEditMesh(void);
187
 
void BIF_GlobalReebFree(void);
188
 
 
189
 
ReebNode *BIF_otherNodeFromIndex(ReebArc *arc, ReebNode *node);
190
 
ReebNode *BIF_NodeFromIndex(ReebArc *arc, ReebNode *node);
191
 
ReebNode *BIF_lowestLevelNode(ReebNode *node);
192
 
 
193
 
ReebGraph *BIF_graphForMultiNode(ReebGraph *rg, ReebNode *node);
194
 
 
195
 
void REEB_freeGraph(ReebGraph *rg);
196
 
void REEB_freeArc(BArc *barc);
197
 
void REEB_exportGraph(ReebGraph *rg, int count);
198
 
void REEB_draw();
199
 
 
200
 
 
201
 
#endif /*REEB_H_*/