Skip to content

Commit

Permalink
histogram: fix compilation on macos
Browse files Browse the repository at this point in the history
  • Loading branch information
kidanger committed Mar 19, 2021
1 parent 61e000b commit 36b2e3c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/Histogram.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <vector>
#include "imgui.h"
#define IMGUI_DEFINE_MATH_OPERATORS
#include "imgui_internal.h"
Expand Down Expand Up @@ -57,15 +58,15 @@ namespace imscript {
return !(q[0] < q[1] && q[1] < q[2] && q[2] < q[3]);
}

static void integrate_values(long double (*o)[2], int n)
static void integrate_values(std::vector<std::array<long double,2>>& o, int n)
{
// TODO : multiply each increment by the span of the interval
for (int i = 1; i < n; i++)
o[i][1] += o[i-1][1];// * (o[i][0] - o[i-1][0]);
//o[0][1] = 0;
}

static void accumulate_jumps_for_one_cell(long double (*o)[2],
static void accumulate_jumps_for_one_cell(std::vector<std::array<long double,2>>& o,
int n, float m, float M, float q[4])
{
// discard degenerate cells
Expand Down Expand Up @@ -102,7 +103,7 @@ namespace imscript {
}

static void fill_continuous_histogram_simple(
long double (*o)[2], // output histogram array of (value,density) pairs
std::vector<std::array<long double,2>>& o, // output histogram array of (value,density) pairs
int n, // requested number of bins for the histogram
float m, // requested minimum of the histogram
float M, // requested maximum of the histogram
Expand Down Expand Up @@ -199,9 +200,9 @@ void Histogram::progress()
}
}
} else if (mode == SMOOTH) {
std::vector<long double[2]> bins(3+nbins);
std::vector<std::array<long double,2>> bins(3+nbins);
for (size_t d = 0; d < image->c; d++) {
imscript::fill_continuous_histogram_simple(&bins[0], nbins, min, max, image->pixels+d,
imscript::fill_continuous_histogram_simple(bins, nbins, min, max, image->pixels+d,
image->w, image->h, image->c);
for (int b = 0; b < nbins; b++) {
valuescopy[d][b] = bins[b][1];
Expand Down

0 comments on commit 36b2e3c

Please sign in to comment.