8 double deltaX = rangeX.second - rangeX.first;
9 double deltaY = rangeY.second - rangeY.first;
10 double length = hypot(deltaX, deltaY);
14 int min_i, max_i, min_j, max_j;
15 if (rangeX.first < rangeX.second) {
16 min_i = (
int)
ceil(rangeX.first / stepX);
17 max_i = (
int)floor(rangeX.second / stepX) + 1;
19 min_i = (
int)
ceil(rangeX.second / stepX);
20 max_i = (
int)floor(rangeX.first / stepX) + 1;
22 if (rangeY.first < rangeY.second) {
23 min_j = (
int)
ceil(rangeY.first / stepY);
24 max_j = (
int)floor(rangeY.second / stepY) + 1;
26 min_j = (
int)
ceil(rangeY.second / stepY);
27 max_j = (
int)floor(rangeY.first / stepY) + 1;
30 int steps = max_i - min_i + max_j - min_j + 2;
31 std::vector<position>
v;
35 v.emplace_back(
position(0., rangeX.first, rangeY.first));
37 for (
int i = min_i;
i < max_i; ++
i) {
39 y = rangeY.first + (
x - rangeX.first) * deltaY / deltaX;
40 f = std::fabs((
x - rangeX.first) / deltaX);
43 for (
int i = min_j;
i < max_j; ++
i) {
45 x = rangeX.first + (
y - rangeY.first) * deltaX / deltaY;
46 f = std::fabs((
y - rangeY.first) / deltaY);
49 v.emplace_back(
position(1., rangeX.second, rangeY.second));
55 std::vector<position>
result;
57 for (
int i = 1,
s =
v.size();
i <
s; ++
i) {
58 double mx = (
v[
i].x +
v[
i - 1].x) / 2.;
59 double my = (
v[
i].y +
v[
i - 1].y) / 2.;
60 double df = (
v[
i].f -
v[
i - 1].f);
93 for (
size_t i = 0,
s =
v.size();
i <
s; ++
i) {
102 const Range&
x,
const Range&
y,
const std::vector<double>&
weight,
double norm,
unsigned int colour) {
106 for (
size_t i = 0,
s =
v.size();
i <
s; ++
i) {
120 (*m_normalization)[
i] = 1.;