33 using namespace GMap3d;
37 int index = getNewDirectInfo();
39 int markTreated = getNewMark();
41 bool matchOne =
false;
49 unsigned int oneMatching=0;
50 unsigned int * ptrOneMatching=NULL;
52 if ( ANbMatched!=NULL )
54 *ANbMatched=0; ptrOneMatching = &oneMatching;
60 for ( ; it1.
cont(); ++it1 )
61 setDirectInfo(*it1, index, NULL);
63 for ( it1.
reinit(); matchAll && it1.
cont(); ++it1 )
65 if ( getDirectInfo(*it1,index)==NULL )
68 for ( it2.
reinit(); !matchOne && it2.
cont(); ++it2 )
71 AMap, *it2, markTreated2,
75 AMap,*it2,(matchOne?-1:markTreated2));
77 if ( ANbMatched!=NULL && oneMatching>(*ANbMatched) )
78 (*ANbMatched) = oneMatching;
83 if ( !matchOne ) matchAll =
false;
87 freeMark(markTreated);
94 c.
display(
"Temps de recherche du motif");
99 freeDirectInfo(index);
107 unsigned int* ANbMatched )
109 unsigned int res = 0;
110 int index = getNewDirectInfo();
112 int markTreated = getNewMark();
116 unsigned int size = 0;
117 unsigned int oneMatching=0;
118 unsigned int * ptrOneMatching=NULL;
119 if ( ANbMatched!=NULL )
120 { *ANbMatched=0; ptrOneMatching = &oneMatching; }
125 for ( ; it1.
cont(); ++it1 )
127 setDirectInfo(*it1, index, NULL);
135 for ( ; it2.
cont(); ++it2 )
164 AMap, *it2, markTreated2,
168 AMap,*it2,(match?-1:markTreated2));
170 if ( ANbMatched!=NULL && oneMatching>(*ANbMatched) )
171 (*ANbMatched) = oneMatching;
180 c.
display(
"Temps de recherche de tout les motifs");
183 freeMark(markTreated);
186 freeDirectInfo(index);
196 if ( !isMarked(ADart, AMark) )
return;
198 stack<CDart*> toTreat;
199 stack<CDart*> toTreat2;
202 toTreat2.push(ADart2);
208 while (!toTreat.empty())
210 current = toTreat.top(); toTreat.pop();
211 other = toTreat2.top(); toTreat2.pop();
213 if ( isMarked(current, AMark) )
215 for ( i=0; i<=3; ++i )
216 if ( isMarked(alpha(current,i), AMark) )
218 toTreat.push(alpha(current,i));
219 toTreat2.push(AMap->
alpha(other,i));
222 unsetMark(current, AMark);
223 if ( AMark2!=-1 ) AMap->
unsetMark(other, AMark2);
224 if ( AIndex!=-1 ) setDirectInfo(current, AIndex, NULL);
232 unsigned int AMarkTreated2,
233 unsigned int* ANbMatched )
238 if ( ANbMatched!=NULL) *ANbMatched = 0;
241 stack<CDart*> toTreat;
242 stack<CDart*> toTreat2;
244 toTreat.push(AFromDart);
245 toTreat2.push(ADestDart);
251 while (match && !toTreat.empty())
254 current = toTreat.top(); toTreat.pop();
255 other = toTreat2.top(); toTreat2.pop();
257 if ( !isMarked(current, AMarkTreated) )
259 if ( ANbMatched!=NULL) ++(*ANbMatched);
261 if ( AMap->
isMarked(other, AMarkTreated2) )
266 setDirectInfo(current, AIndex, other);
268 setMark(current, AMarkTreated);
269 AMap->
setMark(other, AMarkTreated2);
273 for ( i=0; match && i<=3; ++i )
275 if ( !isFree(current,i) )
277 if (isMarked(alpha(current,i), AMarkTreated) )
280 AMap->
alpha(other,i) )
289 toTreat.push(alpha(current,i));
290 toTreat2.push(AMap->
alpha(other,i));
296 if (!AMap->
isFree(other,i) &&