Blender  V2.93
voronoi_2d.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2012 Blender Foundation.
17  * All rights reserved.
18  */
19 
27 #include "MEM_guardedalloc.h"
28 
29 #include "BLI_listbase.h"
30 #include "BLI_math.h"
31 #include "BLI_utildefines.h"
32 #include "BLI_voronoi_2d.h"
33 
34 #define VORONOI_EPS 1e-2f
35 
36 enum {
39 };
40 
41 typedef struct VoronoiEvent {
42  struct VoronoiEvent *next, *prev;
43 
44  int type; /* type of event (site or circle) */
45  float site[2]; /* site for which event was generated */
46 
47  struct VoronoiParabola *parabola; /* parabola for which event was generated */
49 
50 typedef struct VoronoiParabola {
54  float site[2];
55  bool is_leaf;
57 
58 typedef struct VoronoiProcess {
61  int width, height;
62  float current_y;
64 
65 /* event */
66 
68 {
69  VoronoiEvent *current_event = process->queue.first;
70 
71  while (current_event) {
72  if (current_event->site[1] < event->site[1]) {
73  break;
74  }
75  if (current_event->site[1] == event->site[1]) {
76  event->site[1] -= VORONOI_EPS;
77  }
78 
79  current_event = current_event->next;
80  }
81 
82  BLI_insertlinkbefore(&process->queue, current_event, event);
83 }
84 
85 /* edge */
86 static VoronoiEdge *voronoiEdge_new(const float start[2],
87  const float left[2],
88  const float right[2])
89 {
90  VoronoiEdge *edge = MEM_callocN(sizeof(VoronoiEdge), "voronoi edge");
91 
92  copy_v2_v2(edge->start, start);
93  copy_v2_v2(edge->left, left);
94  copy_v2_v2(edge->right, right);
95 
96  edge->neighbor = NULL;
97  edge->end[0] = 0;
98  edge->end[1] = 0;
99 
100  edge->f = (right[0] - left[0]) / (left[1] - right[1]);
101  edge->g = start[1] - edge->f * start[0];
102 
103  edge->direction[0] = right[1] - left[1];
104  edge->direction[1] = -(right[0] - left[0]);
105 
106  return edge;
107 }
108 
109 /* parabola */
110 
112 {
113  VoronoiParabola *parabola = MEM_callocN(sizeof(VoronoiParabola), "voronoi parabola");
114 
115  parabola->is_leaf = false;
116  parabola->event = NULL;
117  parabola->edge = NULL;
118  parabola->parent = NULL;
119 
120  return parabola;
121 }
122 
123 static VoronoiParabola *voronoiParabola_newSite(const float site[2])
124 {
125  VoronoiParabola *parabola = MEM_callocN(sizeof(VoronoiParabola), "voronoi parabola site");
126 
127  copy_v2_v2(parabola->site, site);
128  parabola->is_leaf = true;
129  parabola->event = NULL;
130  parabola->edge = NULL;
131  parabola->parent = NULL;
132 
133  return parabola;
134 }
135 
136 /* returns the closest leave which is on the left of current node */
138 {
139  VoronoiParabola *current_parabola;
140 
141  if (!parabola) {
142  return NULL;
143  }
144 
145  current_parabola = parabola->left;
146  while (!current_parabola->is_leaf) {
147  current_parabola = current_parabola->right;
148  }
149 
150  return current_parabola;
151 }
152 
153 /* returns the closest leave which is on the right of current node */
155 {
156  VoronoiParabola *current_parabola;
157 
158  if (!parabola) {
159  return NULL;
160  }
161 
162  current_parabola = parabola->right;
163  while (!current_parabola->is_leaf) {
164  current_parabola = current_parabola->left;
165  }
166 
167  return current_parabola;
168 }
169 
170 /* returns the closest parent which is on the left */
172 {
173  VoronoiParabola *current_par = parabola->parent;
174  VoronoiParabola *last_parabola = parabola;
175 
176  while (current_par->left == last_parabola) {
177  if (!current_par->parent) {
178  return NULL;
179  }
180 
181  last_parabola = current_par;
182  current_par = current_par->parent;
183  }
184 
185  return current_par;
186 }
187 
188 /* returns the closest parent which is on the right */
190 {
191  VoronoiParabola *current_parabola = parabola->parent;
192  VoronoiParabola *last_parabola = parabola;
193 
194  while (current_parabola->right == last_parabola) {
195  if (!current_parabola->parent) {
196  return NULL;
197  }
198 
199  last_parabola = current_parabola;
200  current_parabola = current_parabola->parent;
201  }
202 
203  return current_parabola;
204 }
205 
207 {
208  parabola->left = left;
209  left->parent = parabola;
210 }
211 
213 {
214  parabola->right = right;
215  right->parent = parabola;
216 }
217 
218 static float voronoi_getY(VoronoiProcess *process, const float p[2], float x)
219 {
220  float ly = process->current_y;
221 
222  float dp = 2 * (p[1] - ly);
223  float a1 = 1 / dp;
224  float b1 = -2 * p[0] / dp;
225  float c1 = ly + dp / 4 + p[0] * p[0] / dp;
226 
227  return a1 * x * x + b1 * x + c1;
228 }
229 
231 {
234  float p[2], r[2];
235  float dp, a1, b1, c1, a2, b2, c2, a, b, c, disc, ry, x1, x2;
236  float ly = process->current_y;
237 
238  copy_v2_v2(p, left->site);
239  copy_v2_v2(r, right->site);
240 
241  dp = 2.0f * (p[1] - y);
242  a1 = 1.0f / dp;
243  b1 = -2.0f * p[0] / dp;
244  c1 = y + dp / 4 + p[0] * p[0] / dp;
245 
246  dp = 2.0f * (r[1] - y);
247  a2 = 1.0f / dp;
248  b2 = -2.0f * r[0] / dp;
249  c2 = ly + dp / 4 + r[0] * r[0] / dp;
250 
251  a = a1 - a2;
252  b = b1 - b2;
253  c = c1 - c2;
254 
255  disc = b * b - 4 * a * c;
256  x1 = (-b + sqrtf(disc)) / (2 * a);
257  x2 = (-b - sqrtf(disc)) / (2 * a);
258 
259  if (p[1] < r[1]) {
260  ry = max_ff(x1, x2);
261  }
262  else {
263  ry = min_ff(x1, x2);
264  }
265 
266  return ry;
267 }
268 
270 {
271  VoronoiParabola *par = process->root;
272  float x = 0.0f;
273  float ly = process->current_y;
274 
275  while (!par->is_leaf) {
276  x = voronoi_getXOfEdge(process, par, ly);
277 
278  if (x > xx) {
279  par = par->left;
280  }
281  else {
282  par = par->right;
283  }
284  }
285 
286  return par;
287 }
288 
290 {
291  float x = (b->g - a->g) / (a->f - b->f);
292  float y = a->f * x + a->g;
293 
294  if ((x - a->start[0]) / a->direction[0] < 0) {
295  return 0;
296  }
297 
298  if ((y - a->start[1]) / a->direction[1] < 0) {
299  return 0;
300  }
301 
302  if ((x - b->start[0]) / b->direction[0] < 0) {
303  return 0;
304  }
305 
306  if ((y - b->start[1]) / b->direction[1] < 0) {
307  return 0;
308  }
309 
310  p[0] = x;
311  p[1] = y;
312 
313  return 1;
314 }
315 
317 {
320 
323 
324  VoronoiEvent *event;
325 
326  float ly = process->current_y;
327  float s[2], dx, dy, d;
328 
329  if (!a || !c || len_squared_v2v2(a->site, c->site) < VORONOI_EPS) {
330  return;
331  }
332 
333  if (!voronoi_getEdgeIntersection(lp->edge, rp->edge, s)) {
334  return;
335  }
336 
337  dx = a->site[0] - s[0];
338  dy = a->site[1] - s[1];
339 
340  d = sqrtf((dx * dx) + (dy * dy));
341 
342  if (s[1] - d >= ly) {
343  return;
344  }
345 
346  event = MEM_callocN(sizeof(VoronoiEvent), "voronoi circle event");
347 
348  event->type = voronoiEventType_Circle;
349 
350  event->site[0] = s[0];
351  event->site[1] = s[1] - d;
352 
353  b->event = event;
354  event->parabola = b;
355 
357 }
358 
359 static void voronoi_addParabola(VoronoiProcess *process, float site[2])
360 {
361  VoronoiParabola *root = process->root;
362  VoronoiParabola *par, *p0, *p1, *p2;
363  VoronoiEdge *el, *er;
364  float start[2];
365 
366  if (!process->root) {
367  process->root = voronoiParabola_newSite(site);
368 
369  return;
370  }
371 
372  if (root->is_leaf && root->site[1] - site[1] < 0) {
373  float *fp = root->site;
374  float s[2];
375 
376  root->is_leaf = false;
379 
380  s[0] = (site[0] + fp[0]) / 2.0f;
381  s[1] = process->height;
382 
383  if (site[0] > fp[0]) {
384  root->edge = voronoiEdge_new(s, fp, site);
385  }
386  else {
387  root->edge = voronoiEdge_new(s, site, fp);
388  }
389 
390  BLI_addtail(&process->edges, root->edge);
391 
392  return;
393  }
394 
395  par = voronoi_getParabolaByX(process, site[0]);
396 
397  if (par->event) {
398  BLI_freelinkN(&process->queue, par->event);
399 
400  par->event = NULL;
401  }
402 
403  start[0] = site[0];
404  start[1] = voronoi_getY(process, par->site, site[0]);
405 
406  el = voronoiEdge_new(start, par->site, site);
407  er = voronoiEdge_new(start, site, par->site);
408 
409  el->neighbor = er;
410  BLI_addtail(&process->edges, el);
411 
412  par->edge = er;
413  par->is_leaf = false;
414 
415  p0 = voronoiParabola_newSite(par->site);
416  p1 = voronoiParabola_newSite(site);
417  p2 = voronoiParabola_newSite(par->site);
418 
419  voronoiParabola_setRight(par, p2);
421  par->left->edge = el;
422 
423  voronoiParabola_setLeft(par->left, p0);
424  voronoiParabola_setRight(par->left, p1);
425 
428 }
429 
431 {
432  VoronoiParabola *p1 = event->parabola;
433 
436 
439 
440  VoronoiParabola *higher = NULL, *par, *gparent;
441 
442  float p[2];
443 
444  if (p0->event) {
445  BLI_freelinkN(&process->queue, p0->event);
446  p0->event = NULL;
447  }
448 
449  if (p2->event) {
450  BLI_freelinkN(&process->queue, p2->event);
451  p2->event = NULL;
452  }
453 
454  p[0] = event->site[0];
455  p[1] = voronoi_getY(process, p1->site, event->site[0]);
456 
457  copy_v2_v2(xl->edge->end, p);
458  copy_v2_v2(xr->edge->end, p);
459 
460  par = p1;
461  while (par != process->root) {
462  par = par->parent;
463 
464  if (par == xl) {
465  higher = xl;
466  }
467  if (par == xr) {
468  higher = xr;
469  }
470  }
471 
472  higher->edge = voronoiEdge_new(p, p0->site, p2->site);
473  BLI_addtail(&process->edges, higher->edge);
474 
475  gparent = p1->parent->parent;
476  if (p1->parent->left == p1) {
477  if (gparent->left == p1->parent) {
478  voronoiParabola_setLeft(gparent, p1->parent->right);
479  }
480  if (gparent->right == p1->parent) {
481  voronoiParabola_setRight(gparent, p1->parent->right);
482  }
483  }
484  else {
485  if (gparent->left == p1->parent) {
486  voronoiParabola_setLeft(gparent, p1->parent->left);
487  }
488  if (gparent->right == p1->parent) {
489  voronoiParabola_setRight(gparent, p1->parent->left);
490  }
491  }
492 
493  MEM_freeN(p1->parent);
494  MEM_freeN(p1);
495 
498 }
499 
501 {
502  float mx;
503 
504  if (parabola->is_leaf) {
505  MEM_freeN(parabola);
506  return;
507  }
508 
509  if (parabola->edge->direction[0] > 0.0f) {
510  mx = max_ff(process->width, parabola->edge->start[0] + 10);
511  }
512  else {
513  mx = min_ff(0.0f, parabola->edge->start[0] - 10.0f);
514  }
515 
516  parabola->edge->end[0] = mx;
517  parabola->edge->end[1] = mx * parabola->edge->f + parabola->edge->g;
518 
519  voronoi_finishEdge(process, parabola->left);
520  voronoi_finishEdge(process, parabola->right);
521 
522  MEM_freeN(parabola);
523 }
524 
525 static void voronoi_clampEdgeVertex(int width, int height, float *coord, float *other_coord)
526 {
527  const float corners[4][2] = {
528  {0.0f, 0.0f}, {width - 1, 0.0f}, {width - 1, height - 1}, {0.0f, height - 1}};
529  int i;
530 
531  if (IN_RANGE_INCL(coord[0], 0, width - 1) && IN_RANGE_INCL(coord[1], 0, height - 1)) {
532  return;
533  }
534 
535  for (i = 0; i < 4; i++) {
536  float v1[2], v2[2];
537  float p[2];
538 
539  copy_v2_v2(v1, corners[i]);
540 
541  if (i == 3) {
542  copy_v2_v2(v2, corners[0]);
543  }
544  else {
545  copy_v2_v2(v2, corners[i + 1]);
546  }
547 
548  if (isect_seg_seg_v2_point(v1, v2, coord, other_coord, p) == 1) {
549  if (i == 0 && coord[1] > p[1]) {
550  continue;
551  }
552  if (i == 1 && coord[0] < p[0]) {
553  continue;
554  }
555  if (i == 2 && coord[1] < p[1]) {
556  continue;
557  }
558  if (i == 3 && coord[0] > p[0]) {
559  continue;
560  }
561 
562  copy_v2_v2(coord, p);
563  }
564  }
565 }
566 
567 static void voronoi_clampEdges(ListBase *edges, int width, int height, ListBase *clamped_edges)
568 {
569  VoronoiEdge *edge;
570 
571  edge = edges->first;
572  while (edge) {
573  VoronoiEdge *new_edge = MEM_callocN(sizeof(VoronoiEdge), "clamped edge");
574 
575  *new_edge = *edge;
576  BLI_addtail(clamped_edges, new_edge);
577 
578  voronoi_clampEdgeVertex(width, height, new_edge->start, new_edge->end);
579  voronoi_clampEdgeVertex(width, height, new_edge->end, new_edge->start);
580 
581  edge = edge->next;
582  }
583 }
584 
586  ListBase *edges, const float coord[2], int dim, int dir, float next_coord[2])
587 {
588  VoronoiEdge *edge = edges->first;
589  float distance = FLT_MAX;
590  int other_dim = dim ? 0 : 1;
591 
592  while (edge) {
593  bool ok = false;
594  float co[2], cur_distance;
595 
596  if (fabsf(edge->start[other_dim] - coord[other_dim]) < VORONOI_EPS &&
597  len_squared_v2v2(coord, edge->start) > VORONOI_EPS) {
598  copy_v2_v2(co, edge->start);
599  ok = true;
600  }
601 
602  if (fabsf(edge->end[other_dim] - coord[other_dim]) < VORONOI_EPS &&
603  len_squared_v2v2(coord, edge->end) > VORONOI_EPS) {
604  copy_v2_v2(co, edge->end);
605  ok = true;
606  }
607 
608  if (ok) {
609  if (dir > 0 && coord[dim] > co[dim]) {
610  ok = false;
611  }
612  else if (dir < 0 && coord[dim] < co[dim]) {
613  ok = false;
614  }
615  }
616 
617  if (ok) {
618  cur_distance = len_squared_v2v2(coord, co);
619  if (cur_distance < distance) {
620  copy_v2_v2(next_coord, co);
621  distance = cur_distance;
622  }
623  }
624 
625  edge = edge->next;
626  }
627 
628  return distance < FLT_MAX;
629 }
630 
631 static void voronoi_createBoundaryEdges(ListBase *edges, int width, int height)
632 {
633  const float corners[4][2] = {
634  {width - 1, 0.0f}, {width - 1, height - 1}, {0.0f, height - 1}, {0.0f, 0.0f}};
635  int i, dim = 0, dir = 1;
636 
637  float coord[2] = {0.0f, 0.0f};
638  float next_coord[2] = {0.0f, 0.0f};
639 
640  for (i = 0; i < 4; i++) {
641  while (voronoi_getNextSideCoord(edges, coord, dim, dir, next_coord)) {
642  VoronoiEdge *edge = MEM_callocN(sizeof(VoronoiEdge), "boundary edge");
643 
644  copy_v2_v2(edge->start, coord);
645  copy_v2_v2(edge->end, next_coord);
646  BLI_addtail(edges, edge);
647 
648  copy_v2_v2(coord, next_coord);
649  }
650 
651  if (len_squared_v2v2(coord, corners[i]) > VORONOI_EPS) {
652  VoronoiEdge *edge = MEM_callocN(sizeof(VoronoiEdge), "boundary edge");
653 
654  copy_v2_v2(edge->start, coord);
655  copy_v2_v2(edge->end, corners[i]);
656  BLI_addtail(edges, edge);
657  copy_v2_v2(coord, corners[i]);
658  }
659 
660  dim = dim ? 0 : 1;
661  if (i == 1) {
662  dir = -1;
663  }
664  }
665 }
666 
668  const VoronoiSite *sites, int sites_total, int width, int height, ListBase *edges)
669 {
671  VoronoiEdge *edge;
672  int i;
673 
674  memset(&process, 0, sizeof(VoronoiProcess));
675 
676  process.width = width;
677  process.height = height;
678 
679  for (i = 0; i < sites_total; i++) {
680  VoronoiEvent *event = MEM_callocN(sizeof(VoronoiEvent), "voronoi site event");
681 
682  event->type = voronoiEventType_Site;
683  copy_v2_v2(event->site, sites[i].co);
684 
685  voronoi_insertEvent(&process, event);
686  }
687 
688  while (process.queue.first) {
689  VoronoiEvent *event = process.queue.first;
690 
691  process.current_y = event->site[1];
692 
693  if (event->type == voronoiEventType_Site) {
694  voronoi_addParabola(&process, event->site);
695  }
696  else {
698  }
699 
700  BLI_freelinkN(&process.queue, event);
701  }
702 
704 
705  edge = process.edges.first;
706  while (edge) {
707  if (edge->neighbor) {
708  copy_v2_v2(edge->start, edge->neighbor->end);
709  MEM_freeN(edge->neighbor);
710  }
711 
712  edge = edge->next;
713  }
714 
716 }
717 
718 static bool testVoronoiEdge(const float site[2], const float point[2], const VoronoiEdge *edge)
719 {
720  float p[2];
721 
722  if (isect_seg_seg_v2_point(site, point, edge->start, edge->end, p) == 1) {
723  if (len_squared_v2v2(p, edge->start) > VORONOI_EPS &&
724  len_squared_v2v2(p, edge->end) > VORONOI_EPS) {
725  return false;
726  }
727  }
728 
729  return true;
730 }
731 
732 static int voronoi_addTriangulationPoint(const float coord[2],
733  const float color[3],
734  VoronoiTriangulationPoint **triangulated_points,
735  int *triangulated_points_total)
736 {
737  VoronoiTriangulationPoint *triangulation_point;
738  int i;
739 
740  for (i = 0; i < *triangulated_points_total; i++) {
741  if (equals_v2v2(coord, (*triangulated_points)[i].co)) {
742  triangulation_point = &(*triangulated_points)[i];
743 
744  add_v3_v3(triangulation_point->color, color);
745  triangulation_point->power++;
746 
747  return i;
748  }
749  }
750 
751  if (*triangulated_points) {
752  *triangulated_points = MEM_reallocN(*triangulated_points,
753  sizeof(VoronoiTriangulationPoint) *
754  (*triangulated_points_total + 1));
755  }
756  else {
757  *triangulated_points = MEM_callocN(sizeof(VoronoiTriangulationPoint), "triangulation points");
758  }
759 
760  triangulation_point = &(*triangulated_points)[(*triangulated_points_total)];
761  copy_v2_v2(triangulation_point->co, coord);
762  copy_v3_v3(triangulation_point->color, color);
763 
764  triangulation_point->power = 1;
765 
766  (*triangulated_points_total)++;
767 
768  return (*triangulated_points_total) - 1;
769 }
770 
772  int v1, int v2, int v3, int (**r_triangles)[3], int *r_triangles_total)
773 {
774  int *triangle;
775 
776  if (*r_triangles) {
777  *r_triangles = MEM_reallocN(*r_triangles, sizeof(int[3]) * (*r_triangles_total + 1));
778  }
779  else {
780  *r_triangles = MEM_callocN(sizeof(int[3]), "trianglulation triangles");
781  }
782 
783  triangle = (int *)&(*r_triangles)[(*r_triangles_total)];
784 
785  triangle[0] = v1;
786  triangle[1] = v2;
787  triangle[2] = v3;
788 
789  (*r_triangles_total)++;
790 }
791 
793  int sites_total,
794  ListBase *edges,
795  int width,
796  int height,
797  VoronoiTriangulationPoint **r_triangulated_points,
798  int *r_triangulated_points_total,
799  int (**r_triangles)[3],
800  int *r_triangles_total)
801 {
802  VoronoiTriangulationPoint *triangulated_points = NULL;
803  int(*triangles)[3] = NULL;
804  int triangulated_points_total = 0, triangles_total = 0;
805  int i;
806  ListBase boundary_edges = {NULL, NULL};
807 
808  voronoi_clampEdges(edges, width, height, &boundary_edges);
809  voronoi_createBoundaryEdges(&boundary_edges, width, height);
810 
811  for (i = 0; i < sites_total; i++) {
812  VoronoiEdge *edge;
813  int v1;
814 
816  sites[i].co, sites[i].color, &triangulated_points, &triangulated_points_total);
817 
818  edge = boundary_edges.first;
819  while (edge) {
820  VoronoiEdge *test_edge = boundary_edges.first;
821  bool ok_start = true, ok_end = true;
822 
823  while (test_edge) {
824  if (ok_start && !testVoronoiEdge(sites[i].co, edge->start, test_edge)) {
825  ok_start = false;
826  break;
827  }
828 
829  if (ok_end && !testVoronoiEdge(sites[i].co, edge->end, test_edge)) {
830  ok_end = false;
831  break;
832  }
833 
834  test_edge = test_edge->next;
835  }
836 
837  if (ok_start && ok_end) {
838  int v2, v3;
839 
841  edge->start, sites[i].color, &triangulated_points, &triangulated_points_total);
843  edge->end, sites[i].color, &triangulated_points, &triangulated_points_total);
844 
845  voronoi_addTriangle(v1, v2, v3, &triangles, &triangles_total);
846  }
847 
848  edge = edge->next;
849  }
850  }
851 
852  for (i = 0; i < triangulated_points_total; i++) {
853  VoronoiTriangulationPoint *triangulation_point = &triangulated_points[i];
854 
855  mul_v3_fl(triangulation_point->color, 1.0f / triangulation_point->power);
856  }
857 
858  *r_triangulated_points = triangulated_points;
859  *r_triangulated_points_total = triangulated_points_total;
860 
861  *r_triangles = triangles;
862  *r_triangles_total = triangles_total;
863 
864  BLI_freelistN(&boundary_edges);
865 }
void BLI_freelinkN(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:281
void void void BLI_movelisttolist(struct ListBase *dst, struct ListBase *src) ATTR_NONNULL(1
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
Definition: listbase.c:547
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:110
void BLI_insertlinkbefore(struct ListBase *listbase, void *vnextlink, void *vnewlink) ATTR_NONNULL(1)
Definition: listbase.c:395
MINLINE float max_ff(float a, float b)
MINLINE float min_ff(float a, float b)
int isect_seg_seg_v2_point(const float v0[2], const float v1[2], const float v2[2], const float v3[2], float vi[2])
Definition: math_geom.c:1353
MINLINE float len_squared_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE bool equals_v2v2(const float v1[2], const float v2[2]) ATTR_WARN_UNUSED_RESULT
MINLINE void add_v3_v3(float r[3], const float a[3])
#define IN_RANGE_INCL(a, b, c)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble x2
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble right
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble v1
Read Guarded memory(de)allocation.
#define MEM_reallocN(vmemh, len)
ATTR_WARN_UNUSED_RESULT const BMVert * v2
void process(btMatrix3x3 &B, btMatrix3x3 &U, btVector3 &sigma, btMatrix3x3 &V)
Helper function of 3X3 SVD for processing 2X2 SVD.
#define fabsf(x)
#define sqrtf(x)
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:45
static int left
static unsigned c
Definition: RandGen.cpp:97
static unsigned a[3]
Definition: RandGen.cpp:92
void * first
Definition: DNA_listBase.h:47
float right[2]
float direction[2]
float left[2]
struct VoronoiEdge * next
float start[2]
struct VoronoiEdge * neighbor
float end[2]
struct VoronoiEvent * next
Definition: voronoi_2d.c:42
struct VoronoiEvent * prev
Definition: voronoi_2d.c:42
float site[2]
Definition: voronoi_2d.c:45
struct VoronoiParabola * parabola
Definition: voronoi_2d.c:47
float site[2]
Definition: voronoi_2d.c:54
struct VoronoiParabola * left
Definition: voronoi_2d.c:51
VoronoiEvent * event
Definition: voronoi_2d.c:52
VoronoiEdge * edge
Definition: voronoi_2d.c:53
struct VoronoiParabola * right
Definition: voronoi_2d.c:51
struct VoronoiParabola * parent
Definition: voronoi_2d.c:51
VoronoiParabola * root
Definition: voronoi_2d.c:60
ListBase edges
Definition: voronoi_2d.c:59
float current_y
Definition: voronoi_2d.c:62
ListBase queue
Definition: voronoi_2d.c:59
float co[2]
float color[3]
EDGELIST ** edges
ccl_device_inline float distance(const float2 &a, const float2 &b)
static VoronoiParabola * voronoiParabola_getLeftChild(VoronoiParabola *parabola)
Definition: voronoi_2d.c:137
static void voronoi_removeParabola(VoronoiProcess *process, VoronoiEvent *event)
Definition: voronoi_2d.c:430
@ voronoiEventType_Site
Definition: voronoi_2d.c:37
@ voronoiEventType_Circle
Definition: voronoi_2d.c:38
static VoronoiParabola * voronoiParabola_getRightParent(VoronoiParabola *parabola)
Definition: voronoi_2d.c:189
struct VoronoiEvent VoronoiEvent
static bool testVoronoiEdge(const float site[2], const float point[2], const VoronoiEdge *edge)
Definition: voronoi_2d.c:718
static VoronoiParabola * voronoiParabola_new(void)
Definition: voronoi_2d.c:111
static void voronoi_addParabola(VoronoiProcess *process, float site[2])
Definition: voronoi_2d.c:359
struct VoronoiProcess VoronoiProcess
static void voronoi_checkCircle(VoronoiProcess *process, VoronoiParabola *b)
Definition: voronoi_2d.c:316
static void voronoi_createBoundaryEdges(ListBase *edges, int width, int height)
Definition: voronoi_2d.c:631
static void voronoi_finishEdge(VoronoiProcess *process, VoronoiParabola *parabola)
Definition: voronoi_2d.c:500
static VoronoiParabola * voronoiParabola_getRightChild(VoronoiParabola *parabola)
Definition: voronoi_2d.c:154
#define VORONOI_EPS
Definition: voronoi_2d.c:34
static VoronoiParabola * voronoiParabola_getLeftParent(VoronoiParabola *parabola)
Definition: voronoi_2d.c:171
static void voronoi_insertEvent(VoronoiProcess *process, VoronoiEvent *event)
Definition: voronoi_2d.c:67
static void voronoiParabola_setRight(VoronoiParabola *parabola, VoronoiParabola *right)
Definition: voronoi_2d.c:212
static VoronoiEdge * voronoiEdge_new(const float start[2], const float left[2], const float right[2])
Definition: voronoi_2d.c:86
static int voronoi_getEdgeIntersection(VoronoiEdge *a, VoronoiEdge *b, float p[2])
Definition: voronoi_2d.c:289
static int voronoi_getNextSideCoord(ListBase *edges, const float coord[2], int dim, int dir, float next_coord[2])
Definition: voronoi_2d.c:585
struct VoronoiParabola VoronoiParabola
void BLI_voronoi_triangulate(const VoronoiSite *sites, int sites_total, ListBase *edges, int width, int height, VoronoiTriangulationPoint **r_triangulated_points, int *r_triangulated_points_total, int(**r_triangles)[3], int *r_triangles_total)
Definition: voronoi_2d.c:792
static void voronoi_addTriangle(int v1, int v2, int v3, int(**r_triangles)[3], int *r_triangles_total)
Definition: voronoi_2d.c:771
static float voronoi_getY(VoronoiProcess *process, const float p[2], float x)
Definition: voronoi_2d.c:218
static void voronoi_clampEdges(ListBase *edges, int width, int height, ListBase *clamped_edges)
Definition: voronoi_2d.c:567
static void voronoiParabola_setLeft(VoronoiParabola *parabola, VoronoiParabola *left)
Definition: voronoi_2d.c:206
static float voronoi_getXOfEdge(VoronoiProcess *process, VoronoiParabola *par, float y)
Definition: voronoi_2d.c:230
void BLI_voronoi_compute(const VoronoiSite *sites, int sites_total, int width, int height, ListBase *edges)
Definition: voronoi_2d.c:667
static void voronoi_clampEdgeVertex(int width, int height, float *coord, float *other_coord)
Definition: voronoi_2d.c:525
static VoronoiParabola * voronoiParabola_newSite(const float site[2])
Definition: voronoi_2d.c:123
static int voronoi_addTriangulationPoint(const float coord[2], const float color[3], VoronoiTriangulationPoint **triangulated_points, int *triangulated_points_total)
Definition: voronoi_2d.c:732
static VoronoiParabola * voronoi_getParabolaByX(VoronoiProcess *process, float xx)
Definition: voronoi_2d.c:269