|
Blender
V2.93
|
#include "MEM_guardedalloc.h"#include "BLI_listbase.h"#include "BLI_math.h"#include "BLI_utildefines.h"#include "BLI_voronoi_2d.h"Go to the source code of this file.
Classes | |
| struct | VoronoiEvent |
| struct | VoronoiParabola |
| struct | VoronoiProcess |
Macros | |
| #define | VORONOI_EPS 1e-2f |
Typedefs | |
| typedef struct VoronoiEvent | VoronoiEvent |
| typedef struct VoronoiParabola | VoronoiParabola |
| typedef struct VoronoiProcess | VoronoiProcess |
Enumerations | |
| enum | { voronoiEventType_Site = 0 , voronoiEventType_Circle = 1 } |
Fortune's algorithm implemented using explanation and some code snippets from http://blog.ivank.net/fortunes-algorithm-and-implementation.html
Definition in file voronoi_2d.c.
| #define VORONOI_EPS 1e-2f |
Definition at line 34 of file voronoi_2d.c.
| typedef struct VoronoiEvent VoronoiEvent |
| typedef struct VoronoiParabola VoronoiParabola |
| typedef struct VoronoiProcess VoronoiProcess |
| anonymous enum |
| Enumerator | |
|---|---|
| voronoiEventType_Site | |
| voronoiEventType_Circle | |
Definition at line 36 of file voronoi_2d.c.
| void BLI_voronoi_compute | ( | const VoronoiSite * | sites, |
| int | sites_total, | ||
| int | width, | ||
| int | height, | ||
| ListBase * | edges | ||
| ) |
Definition at line 667 of file voronoi_2d.c.
References BLI_freelinkN(), BLI_movelisttolist(), VoronoiSite::co, copy_v2_v2(), process::edges, VoronoiEdge::end, height, MEM_callocN, MEM_freeN, VoronoiEdge::neighbor, VoronoiEdge::next, process(), VoronoiEdge::start, voronoi_addParabola(), voronoi_finishEdge(), voronoi_insertEvent(), voronoi_removeParabola(), voronoiEventType_Site, and width.
Referenced by blender::compositor::KeyingScreenOperation::buildVoronoiTriangulation().
| 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 at line 792 of file voronoi_2d.c.
References BLI_freelistN(), VoronoiSite::color, VoronoiTriangulationPoint::color, VoronoiEdge::end, ListBase::first, height, mul_v3_fl(), VoronoiEdge::next, NULL, VoronoiTriangulationPoint::power, VoronoiEdge::start, testVoronoiEdge(), v1, v2, voronoi_addTriangle(), voronoi_addTriangulationPoint(), voronoi_clampEdges(), voronoi_createBoundaryEdges(), and width.
Referenced by blender::compositor::KeyingScreenOperation::buildVoronoiTriangulation().
|
static |
Definition at line 718 of file voronoi_2d.c.
References VoronoiEdge::end, isect_seg_seg_v2_point(), len_squared_v2v2(), VoronoiEdge::start, and VORONOI_EPS.
Referenced by BLI_voronoi_triangulate().
|
static |
Definition at line 359 of file voronoi_2d.c.
References BLI_addtail(), BLI_freelinkN(), VoronoiParabola::edge, process::edges, VoronoiParabola::event, VoronoiParabola::is_leaf, VoronoiParabola::left, VoronoiEdge::neighbor, NULL, VoronoiParabola::site, voronoi_checkCircle(), voronoi_getParabolaByX(), voronoi_getY(), voronoiEdge_new(), voronoiParabola_new(), voronoiParabola_newSite(), voronoiParabola_setLeft(), and voronoiParabola_setRight().
Referenced by BLI_voronoi_compute().
|
static |
Definition at line 771 of file voronoi_2d.c.
References MEM_callocN, MEM_reallocN, v1, and v2.
Referenced by BLI_voronoi_triangulate().
|
static |
Definition at line 732 of file voronoi_2d.c.
References add_v3_v3(), VoronoiTriangulationPoint::co, VoronoiTriangulationPoint::color, copy_v2_v2(), copy_v3_v3(), equals_v2v2(), MEM_callocN, MEM_reallocN, and VoronoiTriangulationPoint::power.
Referenced by BLI_voronoi_triangulate().
|
static |
Definition at line 316 of file voronoi_2d.c.
References Freestyle::a, Freestyle::c, VoronoiParabola::edge, VoronoiParabola::event, len_squared_v2v2(), MEM_callocN, VoronoiEvent::parabola, sqrtf, VORONOI_EPS, voronoi_getEdgeIntersection(), voronoi_insertEvent(), voronoiEventType_Circle, voronoiParabola_getLeftChild(), voronoiParabola_getLeftParent(), voronoiParabola_getRightChild(), and voronoiParabola_getRightParent().
Referenced by voronoi_addParabola(), and voronoi_removeParabola().
|
static |
Definition at line 567 of file voronoi_2d.c.
References BLI_addtail(), VoronoiEdge::end, ListBase::first, height, MEM_callocN, VoronoiEdge::next, VoronoiEdge::start, voronoi_clampEdgeVertex(), and width.
Referenced by BLI_voronoi_triangulate().
|
static |
Definition at line 525 of file voronoi_2d.c.
References copy_v2_v2(), height, IN_RANGE_INCL, isect_seg_seg_v2_point(), v1, v2, and width.
Referenced by voronoi_clampEdges().
|
static |
Definition at line 631 of file voronoi_2d.c.
References BLI_addtail(), copy_v2_v2(), VoronoiEdge::end, height, len_squared_v2v2(), MEM_callocN, VoronoiEdge::start, VORONOI_EPS, voronoi_getNextSideCoord(), and width.
Referenced by BLI_voronoi_triangulate().
|
static |
Definition at line 500 of file voronoi_2d.c.
References VoronoiEdge::direction, VoronoiParabola::edge, VoronoiEdge::end, VoronoiEdge::f, VoronoiEdge::g, VoronoiParabola::is_leaf, VoronoiParabola::left, max_ff(), MEM_freeN, min_ff(), VoronoiParabola::right, and VoronoiEdge::start.
Referenced by BLI_voronoi_compute().
|
static |
Definition at line 289 of file voronoi_2d.c.
References Freestyle::a, VoronoiEdge::direction, VoronoiEdge::f, VoronoiEdge::g, VoronoiEdge::start, x, and y.
Referenced by voronoi_checkCircle().
|
static |
Definition at line 585 of file voronoi_2d.c.
References copy_v2_v2(), distance(), VoronoiEdge::end, fabsf, ListBase::first, len_squared_v2v2(), VoronoiEdge::next, VoronoiEdge::start, and VORONOI_EPS.
Referenced by voronoi_createBoundaryEdges().
|
static |
Definition at line 269 of file voronoi_2d.c.
References VoronoiParabola::is_leaf, VoronoiParabola::left, VoronoiParabola::right, voronoi_getXOfEdge(), and x.
Referenced by voronoi_addParabola().
|
static |
Definition at line 230 of file voronoi_2d.c.
References Freestyle::a, Freestyle::c, copy_v2_v2(), left, max_ff(), min_ff(), r, right, sqrtf, voronoiParabola_getLeftChild(), voronoiParabola_getRightChild(), x2, and y.
Referenced by voronoi_getParabolaByX().
|
static |
Definition at line 218 of file voronoi_2d.c.
References x.
Referenced by voronoi_addParabola(), and voronoi_removeParabola().
|
static |
Definition at line 67 of file voronoi_2d.c.
References BLI_insertlinkbefore(), VoronoiEvent::next, VoronoiEvent::site, and VORONOI_EPS.
Referenced by BLI_voronoi_compute(), and voronoi_checkCircle().
|
static |
Definition at line 430 of file voronoi_2d.c.
References BLI_addtail(), BLI_freelinkN(), copy_v2_v2(), VoronoiParabola::edge, process::edges, VoronoiEdge::end, VoronoiParabola::event, VoronoiParabola::left, MEM_freeN, NULL, VoronoiParabola::parent, VoronoiParabola::right, VoronoiEvent::site, VoronoiParabola::site, voronoi_checkCircle(), voronoi_getY(), voronoiEdge_new(), voronoiParabola_getLeftChild(), voronoiParabola_getLeftParent(), voronoiParabola_getRightChild(), voronoiParabola_getRightParent(), voronoiParabola_setLeft(), and voronoiParabola_setRight().
Referenced by BLI_voronoi_compute().
|
static |
Definition at line 86 of file voronoi_2d.c.
References copy_v2_v2(), VoronoiEdge::direction, VoronoiEdge::end, VoronoiEdge::f, VoronoiEdge::g, VoronoiEdge::left, left, MEM_callocN, VoronoiEdge::neighbor, NULL, VoronoiEdge::right, right, and VoronoiEdge::start.
Referenced by voronoi_addParabola(), and voronoi_removeParabola().
|
static |
Definition at line 137 of file voronoi_2d.c.
References VoronoiParabola::is_leaf, VoronoiParabola::left, NULL, and VoronoiParabola::right.
Referenced by voronoi_checkCircle(), voronoi_getXOfEdge(), and voronoi_removeParabola().
|
static |
Definition at line 171 of file voronoi_2d.c.
References VoronoiParabola::left, NULL, and VoronoiParabola::parent.
Referenced by voronoi_checkCircle(), and voronoi_removeParabola().
|
static |
Definition at line 154 of file voronoi_2d.c.
References VoronoiParabola::is_leaf, VoronoiParabola::left, NULL, and VoronoiParabola::right.
Referenced by voronoi_checkCircle(), voronoi_getXOfEdge(), and voronoi_removeParabola().
|
static |
Definition at line 189 of file voronoi_2d.c.
References NULL, VoronoiParabola::parent, and VoronoiParabola::right.
Referenced by voronoi_checkCircle(), and voronoi_removeParabola().
|
static |
Definition at line 111 of file voronoi_2d.c.
References VoronoiParabola::edge, VoronoiParabola::event, VoronoiParabola::is_leaf, MEM_callocN, NULL, and VoronoiParabola::parent.
Referenced by voronoi_addParabola().
|
static |
Definition at line 123 of file voronoi_2d.c.
References copy_v2_v2(), VoronoiParabola::edge, VoronoiParabola::event, VoronoiParabola::is_leaf, MEM_callocN, NULL, VoronoiParabola::parent, and VoronoiParabola::site.
Referenced by voronoi_addParabola().
|
static |
Definition at line 206 of file voronoi_2d.c.
References VoronoiParabola::left, and left.
Referenced by voronoi_addParabola(), and voronoi_removeParabola().
|
static |
Definition at line 212 of file voronoi_2d.c.
References VoronoiParabola::right, and right.
Referenced by voronoi_addParabola(), and voronoi_removeParabola().