Blender  V3.3
BLI_voronoi_2d.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2012 Blender Foundation. All rights reserved. */
3 
4 #pragma once
5 
6 struct ListBase;
7 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 typedef struct VoronoiSite {
17  float co[2];
18  float color[3];
20 
21 typedef struct VoronoiEdge {
22  struct VoronoiEdge *next, *prev;
23 
24  /* start and end points */
25  float start[2], end[2];
26 
27  /* this fields are used during diagram computation only */
28 
29  /* directional vector, from "start", points to "end", normal of |left, right| */
30  float direction[2];
31 
32  /* point on Voronoi place on the left side of edge */
33  float left[2];
34  /* point on Voronoi place on the right side of edge */
35  float right[2];
36 
37  /* Directional coefficients satisfying equation `y = f * x + g` (edge lies on this line). */
38  float f, g;
39 
40  /* some edges consist of two parts,
41  * so we add the pointer to another part to connect them at the end of an algorithm */
44 
45 typedef struct VoronoiTriangulationPoint {
46  float co[2];
47  float color[3];
48  int power;
50 
52  const VoronoiSite *sites, int sites_total, int width, int height, struct ListBase *edges);
53 
54 void BLI_voronoi_triangulate(const VoronoiSite *sites,
55  int sites_total,
56  struct ListBase *edges,
57  int width,
58  int height,
59  VoronoiTriangulationPoint **r_triangulated_points,
60  int *r_triangulated_points_total,
61  int (**r_triangles)[3],
62  int *r_triangles_total);
63 
64 #ifdef __cplusplus
65 }
66 #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:776
void BLI_voronoi_compute(const VoronoiSite *sites, int sites_total, int width, int height, struct ListBase *edges)
Definition: voronoi_2d.c:651
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 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 GLsizei width
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]