Cleanup: move math_geom.c to c++

This commit is contained in:
Aras Pranckevicius
2023-11-06 13:33:52 +02:00
parent adb41fe6b2
commit 03bbdd804c
2 changed files with 8 additions and 15 deletions

View File

@@ -101,7 +101,7 @@ set(SRC
intern/math_color.c
intern/math_color_blend_inline.c
intern/math_color_inline.c
intern/math_geom.c
intern/math_geom.cc
intern/math_geom_inline.c
intern/math_interp.c
intern/math_matrix.c

View File

@@ -6,11 +6,10 @@
* \ingroup bli
*/
#include "BLI_array.hh"
#include "BLI_math_base.h"
#include "BLI_math_geom.h"
#include "MEM_guardedalloc.h"
#include "BLI_math_bits.h"
#include "BLI_math_matrix.h"
#include "BLI_math_rotation.h"
@@ -1466,7 +1465,7 @@ int isect_line_sphere_v2(const float l1[2],
bool isect_point_poly_v2(const float pt[2],
const float verts[][2],
const uint nr,
const bool UNUSED(use_holes))
[[maybe_unused]] const bool use_holes)
{
/* Keep in sync with #isect_point_poly_v2_int. */
@@ -1486,7 +1485,7 @@ bool isect_point_poly_v2(const float pt[2],
bool isect_point_poly_v2_int(const int pt[2],
const int verts[][2],
const uint nr,
const bool UNUSED(use_holes))
[[maybe_unused]] const bool use_holes)
{
/* Keep in sync with #isect_point_poly_v2. */
@@ -3953,11 +3952,11 @@ int interp_sparse_array(float *array, const int list_size, const float skipval)
float valid_last = skipval;
int valid_ofs = 0;
float *array_up = MEM_callocN(sizeof(float) * (size_t)list_size, "interp_sparse_array up");
float *array_down = MEM_callocN(sizeof(float) * (size_t)list_size, "interp_sparse_array up");
blender::Array<float> array_up(list_size);
blender::Array<float> array_down(list_size);
int *ofs_tot_up = MEM_callocN(sizeof(int) * (size_t)list_size, "interp_sparse_array tup");
int *ofs_tot_down = MEM_callocN(sizeof(int) * (size_t)list_size, "interp_sparse_array tdown");
blender::Array<int> ofs_tot_up(list_size);
blender::Array<int> ofs_tot_down(list_size);
for (i = 0; i < list_size; i++) {
if (array[i] == skipval) {
@@ -4001,12 +4000,6 @@ int interp_sparse_array(float *array, const int list_size, const float skipval)
}
}
MEM_freeN(array_up);
MEM_freeN(array_down);
MEM_freeN(ofs_tot_up);
MEM_freeN(ofs_tot_down);
return 1;
}