Cleanup: Move BLI_delaunay_2d.hh to C++

This commit is contained in:
Hans Goudey
2023-12-14 10:05:35 -05:00
parent 5b053204ed
commit 451aa56d9c
9 changed files with 20 additions and 30 deletions

View File

@@ -4,6 +4,12 @@
#pragma once
#include "BLI_array.hh"
#include "BLI_math_mpq.hh"
#include "BLI_math_vector_mpq_types.hh"
#include "BLI_math_vector_types.hh"
#include "BLI_vector.hh"
/** \file
* \ingroup bli
*
@@ -11,10 +17,6 @@
* to the 2D Constrained Delaunay Triangulation library routine.
*/
#ifdef __cplusplus
extern "C" {
#endif
/**
* Interface for Constrained Delaunay Triangulation (CDT) in 2D.
*
@@ -197,17 +199,8 @@ CDT_result *BLI_delaunay_2d_cdt_calc(const CDT_input *input, const CDT_output_ty
void BLI_delaunay_2d_cdt_free(CDT_result *result);
#ifdef __cplusplus
}
/* C++ Interface. */
# include "BLI_array.hh"
# include "BLI_math_mpq.hh"
# include "BLI_math_vector_mpq_types.hh"
# include "BLI_math_vector_types.hh"
# include "BLI_vector.hh"
namespace blender::meshintersect {
/** #vec2<Arith_t> is a 2d vector with #Arith_t as the type for coordinates. */
@@ -216,11 +209,11 @@ template<> struct vec2_impl<double> {
typedef double2 type;
};
# ifdef WITH_GMP
#ifdef WITH_GMP
template<> struct vec2_impl<mpq_class> {
typedef mpq2 type;
};
# endif
#endif
template<typename Arith_t> using vec2 = typename vec2_impl<Arith_t>::type;
@@ -259,11 +252,9 @@ template<typename Arith_t> class CDT_result {
CDT_result<double> delaunay_2d_calc(const CDT_input<double> &input, CDT_output_type output_type);
# ifdef WITH_GMP
#ifdef WITH_GMP
CDT_result<mpq_class> delaunay_2d_calc(const CDT_input<mpq_class> &input,
CDT_output_type output_type);
# endif
#endif
} /* namespace blender::meshintersect */
#endif /* __cplusplus */

View File

@@ -210,7 +210,7 @@ set(SRC
BLI_cpp_type_make.hh
BLI_cpp_types.hh
BLI_cpp_types_make.hh
BLI_delaunay_2d.h
BLI_delaunay_2d.hh
BLI_devirtualize_parameters.hh
BLI_dial_2d.h
BLI_disjoint_set.hh

View File

@@ -21,7 +21,7 @@
#include "BLI_task.hh"
#include "BLI_vector.hh"
#include "BLI_delaunay_2d.h"
#include "BLI_delaunay_2d.hh"
namespace blender::meshintersect {
@@ -2820,8 +2820,7 @@ blender::meshintersect::CDT_result<mpq_class> delaunay_2d_calc(const CDT_input<m
* and "len" array to say where the individual vectors start and how
* long they are.
*/
extern "C" ::CDT_result *BLI_delaunay_2d_cdt_calc(const ::CDT_input *input,
const CDT_output_type output_type)
::CDT_result *BLI_delaunay_2d_cdt_calc(const ::CDT_input *input, const CDT_output_type output_type)
{
blender::meshintersect::CDT_input<double> in;
in.vert = blender::Array<blender::meshintersect::vec2<double>>(input->verts_len);
@@ -2955,7 +2954,7 @@ extern "C" ::CDT_result *BLI_delaunay_2d_cdt_calc(const ::CDT_input *input,
return output;
}
extern "C" void BLI_delaunay_2d_cdt_free(::CDT_result *result)
void BLI_delaunay_2d_cdt_free(::CDT_result *result)
{
MEM_freeN(result->vert_coords);
MEM_freeN(result->edges);

View File

@@ -15,7 +15,7 @@
# include "BLI_array.hh"
# include "BLI_assert.h"
# include "BLI_delaunay_2d.h"
# include "BLI_delaunay_2d.hh"
# include "BLI_hash.hh"
# include "BLI_kdopbvh.h"
# include "BLI_map.hh"

View File

@@ -17,7 +17,7 @@
# include "BLI_allocator.hh"
# include "BLI_array.hh"
# include "BLI_assert.h"
# include "BLI_delaunay_2d.h"
# include "BLI_delaunay_2d.hh"
# include "BLI_hash.hh"
# include "BLI_kdopbvh.h"
# include "BLI_map.hh"

View File

@@ -25,7 +25,7 @@
#include "BLI_math_vector_mpq_types.hh"
#include "BLI_vector.hh"
#include "BLI_delaunay_2d.h"
#include "BLI_delaunay_2d.hh"
namespace blender::meshintersect {

View File

@@ -9,7 +9,7 @@
#include "BKE_mesh.hh"
#include "BKE_object.hh"
#include "BLI_delaunay_2d.h"
#include "BLI_delaunay_2d.hh"
#include "BLI_math_geom.h"
#include "BLI_math_matrix.h"
#include "BLI_math_rotation.h"

View File

@@ -3,7 +3,7 @@
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "BLI_array.hh"
#include "BLI_delaunay_2d.h"
#include "BLI_delaunay_2d.hh"
#include "BLI_math_vector_types.hh"
#include "DNA_mesh_types.h"

View File

@@ -18,7 +18,7 @@
# include "BLI_blenlib.h"
# include "BLI_boxpack_2d.h"
# include "BLI_convexhull_2d.h"
# include "BLI_delaunay_2d.h"
# include "BLI_delaunay_2d.hh"
# include "MEM_guardedalloc.h"
#endif /* !MATH_STANDALONE */