Blender  V2.93
BLI_delaunay_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 
17 #pragma once
18 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
114 typedef struct CDT_input {
119  int (*edges)[2];
120  int *faces;
123  float epsilon;
125 
154 typedef struct CDT_result {
160  int (*edges)[2];
161  int *faces;
174 
176 typedef enum CDT_output_type {
191 
199 
201 
202 #ifdef __cplusplus
203 }
204 
205 /* C++ Interface. */
206 
207 # include "BLI_array.hh"
208 # include "BLI_double2.hh"
209 # include "BLI_math_mpq.hh"
210 # include "BLI_mpq2.hh"
211 # include "BLI_vector.hh"
212 
213 namespace blender::meshintersect {
214 
215 /* vec2<Arith_t> is a 2d vector with Arith_t as the type for coordinates. */
216 template<typename Arith_t> struct vec2_impl;
217 template<> struct vec2_impl<double> {
218  typedef double2 type;
219 };
220 
221 # ifdef WITH_GMP
222 template<> struct vec2_impl<mpq_class> {
223  typedef mpq2 type;
224 };
225 # endif
226 
227 template<typename Arith_t> using vec2 = typename vec2_impl<Arith_t>::type;
228 
229 template<typename Arith_t> class CDT_input {
230  public:
231  Array<vec2<Arith_t>> vert;
232  Array<std::pair<int, int>> edge;
233  Array<Vector<int>> face;
234  Arith_t epsilon{0};
235 };
236 
237 template<typename Arith_t> class CDT_result {
238  public:
239  Array<vec2<Arith_t>> vert;
240  Array<std::pair<int, int>> edge;
241  Array<Vector<int>> face;
243  Array<Vector<int>> vert_orig;
253  Array<Vector<int>> edge_orig;
255  Array<Vector<int>> face_orig;
257  int face_edge_offset;
258 };
259 
260 CDT_result<double> delaunay_2d_calc(const CDT_input<double> &input, CDT_output_type output_type);
261 
262 # ifdef WITH_GMP
263 CDT_result<mpq_class> delaunay_2d_calc(const CDT_input<mpq_class> &input,
264  CDT_output_type output_type);
265 # endif
266 
267 } /* namespace blender::meshintersect */
268 
269 #endif /* __cplusplus */
typedef float(TangentPoint)[2]
CDT_result * BLI_delaunay_2d_cdt_calc(const CDT_input *input, const CDT_output_type output_type)
struct CDT_result CDT_result
CDT_output_type
@ CDT_CONSTRAINTS_VALID_BMESH
@ CDT_CONSTRAINTS
@ CDT_INSIDE
@ CDT_FULL
struct CDT_input CDT_input
void BLI_delaunay_2d_cdt_free(CDT_result *result)
typedef double(DMatrix)[4][4]
_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 type
static double epsilon
float(* vert_coords)[2]
int(* edges)[2]
int * faces_len_table
int * faces_start_table
int * faces_start_table
int * verts_orig_len_table
int * edges_orig_len_table
int * verts_orig_start_table
int * faces_orig_start_table
int * edges_orig_start_table
int * faces_orig_len_table
int(* edges)[2]
int * faces_len_table
float(* vert_coords)[2]