Lines Matching refs:loop
82 #define ZERO 0.00001 /*determing whether a loop is a rectngle or not*/
86 static Int is_Convex(Arc_ptr loop)
88 if(area(loop->tail(), loop->head(), loop->next->head()) <0 )
90 for(Arc_ptr jarc = loop->next; jarc != loop; jarc = jarc->next)
102 static int is_U_monotone(Arc_ptr loop)
109 cur_sign = compV2InX(loop->head(), loop->tail());
111 n_changes = (compV2InX(loop->prev->head(), loop->prev->tail())
114 for(temp=loop->next; temp != loop; temp = temp->next)
143 void monoTriangulationLoop(Arc_ptr loop, Backend& backend, primStream* pStream)
151 top = bot = loop;
152 if(compInY(loop->tail(), loop->prev->tail()) < 0)
155 for(temp = loop->next; temp != loop; temp = temp->next)
162 for(temp=loop->prev; temp != loop; temp = temp->prev)
169 else //loop > loop->prev
171 for(temp=loop->next; temp != loop; temp = temp->next)
177 for(temp=loop->prev; temp != loop; temp = temp->prev)
218 static void triangulateRectGen(Arc_ptr loop, int n_ulines, int n_vlines, Backend& backend);
220 static Int is_rect(Arc_ptr loop)
223 for(Arc_ptr jarc = loop->next; jarc != loop; jarc = jarc->next)
235 printf("loop->tail=(%f,%f)\n", loop->tail()[0], loop->tail()[1]);
236 printf("loop->head=(%f,%f)\n", loop->head()[0], loop->head()[1]);
237 printf("loop->next->tail=(%f,%f)\n", loop->next->tail()[0], loop->next->tail()[1]);
238 printf("loop->next->head=(%f,%f)\n", loop->next->head()[0], loop->next->head()[1]);
239 if(fglu_abs(loop->tail()[0] - loop->head()[0])<0.000001)
241 if(loop->next->tail()[1] == loop->next->head()[1])
245 if( (glu_abs(loop->tail()[0] - loop->head()[0])<=ZERO) &&
246 (glu_abs(loop->next->tail()[1] - loop->next->head()[1])<=ZERO) &&
247 (glu_abs(loop->prev->tail()[1] - loop->prev->head()[1])<=ZERO) &&
248 (glu_abs(loop->prev->prev->tail()[0] - loop->prev->prev->head()[0])<=ZERO)
252 ( (glu_abs(loop->tail()[1] - loop->head()[1]) <= ZERO) &&
253 (glu_abs(loop->next->tail()[0] - loop->next->head()[0]) <= ZERO) &&
254 (glu_abs(loop->prev->tail()[0] - loop->prev->head()[0]) <= ZERO) &&
255 (glu_abs(loop->prev->prev->tail()[1] - loop->prev->prev->head()[1]) <= ZERO)
319 static void triangulateRect(Arc_ptr loop, Backend& backend, int TB_or_LR, int ulinear, int vlinear)
321 //we know the loop is a rectangle, but not sure which is top
323 if(loop->tail()[1] == loop->head()[1])
325 if(loop->tail()[1] > loop->prev->prev->tail()[1])
328 top = loop;
332 top = loop->prev->prev;
337 if(loop->tail()[0] > loop->prev->prev->tail()[0])
339 //loop is the right arc
341 top = loop->next;
346 top = loop->prev;
778 static void triangulateRectGen(Arc_ptr loop, int n_ulines, int n_vlines, Backend& backend)
782 //we know the loop is a rectangle, but not sure which is top
785 if(equalRect(loop->tail()[1] , loop->head()[1]))
788 if(loop->tail()[1] > loop->prev->prev->tail()[1])
791 top = loop;
795 top = loop->prev->prev;
800 if(loop->tail()[0] > loop->prev->prev->tail()[0])
802 //loop is the right arc
804 top = loop->next;
809 top = loop->prev;
818 num_triangles += loop->pwlArc->npts +
948 directedLine* arcLoopToDLineLoop(Arc_ptr loop)
952 if(loop == NULL)
954 ret = arcToMultDLines(NULL, loop);
956 for(Arc_ptr temp = loop->next; temp != loop; temp = temp->next){
1068 void Slicer::slice_new(Arc_ptr loop)
1080 uMin = uMax = loop->tail()[0];
1081 vMin = vMax = loop->tail()[1];
1085 for(Arc_ptr jarc=loop->next; jarc != loop; jarc = jarc->next)
1114 Int isRect = is_rect(loop);
1119 triangulateRect(loop, backend, 1, ulinear, vlinear);
1121 triangulateRect(loop, backend, -1, ulinear, vlinear);
1123 triangulateRect(loop, backend, 0, ulinear, vlinear);
1128 triangulateRectGen(loop, num_ulines-2, num_vlines-2, backend);
1132 monoTriangulationFunBackend(loop, compV2InY, &backend);
1136 monoTriangulationFunBackend(loop, compV2InY, &backend);
1140 directedLine* poly = arcLoopToDLineLoop(loop);
1165 void Slicer::slice(Arc_ptr loop)
1169 slice_new(loop);
1171 slice_old(loop);
1174 slice_new(loop);
1212 Slicer::slice_old( Arc_ptr loop )
1214 loop->markverts();
1217 loop->getextrema( extrema );
1219 unsigned int npts = loop->numpts();