Blender  V2.93
BLI_voronoi_2d.h
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 
20 #pragma once
21 
22 struct ListBase;
23 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 typedef struct VoronoiSite {
33  float co[2];
34  float color[3];
36 
37 typedef struct VoronoiEdge {
38  struct VoronoiEdge *next, *prev;
39 
40  /* start and end points */
41  float start[2], end[2];
42 
43  /* this fields are used during diagram computation only */
44 
45  /* directional vector, from "start", points to "end", normal of |left, right| */
46  float direction[2];
47 
48  /* point on Voronoi place on the left side of edge */
49  float left[2];
50  /* point on Voronoi place on the right side of edge */
51  float right[2];
52 
53  /* Directional coefficients satisfying equation `y = f * x + g` (edge lies on this line). */
54  float f, g;
55 
56  /* some edges consist of two parts,
57  * so we add the pointer to another part to connect them at the end of an algorithm */
60 
61 typedef struct VoronoiTriangulationPoint {
62  float co[2];
63  float color[3];
64  int power;
66 
68  const VoronoiSite *sites, int sites_total, int width, int height, struct ListBase *edges);
69 
70 void BLI_voronoi_triangulate(const VoronoiSite *sites,
71  int sites_total,
72  struct ListBase *edges,
73  int width,
74  int height,
75  VoronoiTriangulationPoint **r_triangulated_points,
76  int *r_triangulated_points_total,
77  int (**r_triangles)[3],
78  int *r_triangles_total);
79 
80 #ifdef __cplusplus
81 }
82 #endif
struct VoronoiEdge VoronoiEdge
void BLI_voronoi_triangulate(const VoronoiSite *sites, int sites_total, struct 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
void BLI_voronoi_compute(const VoronoiSite *sites, int sites_total, int width, int height, struct ListBase *edges)
Definition: voronoi_2d.c:667
struct VoronoiTriangulationPoint VoronoiTriangulationPoint
struct VoronoiSite VoronoiSite
_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 height
float right[2]
struct VoronoiEdge * prev
float direction[2]
float left[2]
struct VoronoiEdge * next
float start[2]
struct VoronoiEdge * neighbor
float end[2]
float co[2]
float color[3]