Blender
V3.3
|
#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.
Definition at line 18 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 20 of file voronoi_2d.c.
void BLI_voronoi_compute | ( | const VoronoiSite * | sites, |
int | sites_total, | ||
int | width, | ||
int | height, | ||
ListBase * | edges | ||
) |
Definition at line 651 of file voronoi_2d.c.
References BLI_freelinkN(), BLI_movelisttolist(), VoronoiSite::co, copy_v2_v2(), process::edges, height, MEM_callocN, MEM_freeN, process(), voronoi_addParabola(), voronoi_finishEdge(), voronoi_insertEvent(), voronoi_removeParabola(), voronoiEventType_Site, and width.
Referenced by blender::compositor::KeyingScreenOperation::build_voronoi_triangulation().
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 776 of file voronoi_2d.c.
References BLI_freelistN(), VoronoiSite::color, VoronoiTriangulationPoint::color, color, ListBase::first, height, mul_v3_fl(), VoronoiEdge::next, NULL, VoronoiTriangulationPoint::power, testVoronoiEdge(), v1, v2, voronoi_addTriangle(), voronoi_addTriangulationPoint(), voronoi_clampEdges(), voronoi_createBoundaryEdges(), and width.
Referenced by blender::compositor::KeyingScreenOperation::build_voronoi_triangulation().
|
static |
Definition at line 702 of file voronoi_2d.c.
References isect_seg_seg_v2_point(), len_squared_v2v2(), point, and VORONOI_EPS.
Referenced by BLI_voronoi_triangulate().
|
static |
Definition at line 343 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 755 of file voronoi_2d.c.
References MEM_callocN, MEM_reallocN, v1, and v2.
Referenced by BLI_voronoi_triangulate().
|
static |
Definition at line 716 of file voronoi_2d.c.
References add_v3_v3(), VoronoiTriangulationPoint::co, VoronoiTriangulationPoint::color, 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 300 of file voronoi_2d.c.
References Freestyle::a, usdtokens::b(), Freestyle::c, VoronoiParabola::edge, 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 551 of file voronoi_2d.c.
References BLI_addtail(), ListBase::first, height, MEM_callocN, blender::nodes::node_geo_extrude_mesh_cc::new_edge(), voronoi_clampEdgeVertex(), and width.
Referenced by BLI_voronoi_triangulate().
|
static |
Definition at line 509 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().
Definition at line 615 of file voronoi_2d.c.
References BLI_addtail(), copy_v2_v2(), height, len_squared_v2v2(), MEM_callocN, VORONOI_EPS, voronoi_getNextSideCoord(), and width.
Referenced by BLI_voronoi_triangulate().
|
static |
Definition at line 484 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 273 of file voronoi_2d.c.
References Freestyle::a, usdtokens::b(), x, and y.
Referenced by voronoi_checkCircle().
|
static |
Definition at line 569 of file voronoi_2d.c.
References copy_v2_v2(), blender::math::distance(), fabsf, ListBase::first, len_squared_v2v2(), and VORONOI_EPS.
Referenced by voronoi_createBoundaryEdges().
|
static |
Definition at line 253 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 214 of file voronoi_2d.c.
References Freestyle::a, usdtokens::b(), 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 202 of file voronoi_2d.c.
References x.
Referenced by voronoi_addParabola(), and voronoi_removeParabola().
|
static |
Definition at line 51 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 414 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 70 of file voronoi_2d.c.
References copy_v2_v2(), left, MEM_callocN, NULL, and right.
Referenced by voronoi_addParabola(), and voronoi_removeParabola().
|
static |
Definition at line 121 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 155 of file voronoi_2d.c.
References VoronoiParabola::left, NULL, and VoronoiParabola::parent.
Referenced by voronoi_checkCircle(), and voronoi_removeParabola().
|
static |
Definition at line 138 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 173 of file voronoi_2d.c.
References NULL, VoronoiParabola::parent, and VoronoiParabola::right.
Referenced by voronoi_checkCircle(), and voronoi_removeParabola().
|
static |
Definition at line 95 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 107 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 190 of file voronoi_2d.c.
References VoronoiParabola::left, and left.
Referenced by voronoi_addParabola(), and voronoi_removeParabola().
|
static |
Definition at line 196 of file voronoi_2d.c.
References VoronoiParabola::right, and right.
Referenced by voronoi_addParabola(), and voronoi_removeParabola().