Skip to content

Commit

Permalink
bugfix in grid.h and icons added
Browse files Browse the repository at this point in the history
  • Loading branch information
ponchio committed Dec 2, 2024
1 parent 2b5bbe5 commit 3705b75
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 14 deletions.
26 changes: 13 additions & 13 deletions external/assm/Grid.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ template <class T> class Grid: public std::vector<T> {
}
size_t rows() const { return _rows; }
size_t cols() const { return _cols; }
T &at(size_t row, size_t col) { return (*this)[row + col*_cols]; }
const T &at(size_t row, size_t col) const { return (*this)[row + col*_cols]; }
T &at(size_t y, size_t x) { return (*this)[x + y*_cols]; }
const T &at(size_t y, size_t x) const { return (*this)[x + y*_cols]; }
void fill(T t) {
for(T &v: *this)
v = t;
Expand Down Expand Up @@ -51,32 +51,32 @@ template <class T> class Grid: public std::vector<T> {

Grid convolve1D(const std::vector<float> &kernel, bool alongRows) const {
int radius = kernel.size() / 2;
Grid result(_rows, _cols, _zero);
Grid result(_cols, _rows, _zero);

if (alongRows) {
for (int i = 0; i < int(_rows); ++i) {
for (int j = 0; j < int(_cols); ++j) {
for (int y = 0; y < int(_rows); ++y) {
for (int x = 0; x < int(_cols); ++x) {
T sum = _zero;
for (int k = -radius; k <= radius; ++k) {
int idx = j + k;
int idx = x + k;
if (idx >= 0 && idx < _cols) {
sum += at(i, idx) * kernel[k + radius];
sum += at(y, idx) * kernel[k + radius];
}
}
result.at(i, j) = sum;
result.at(y, x) = sum;
}
}
} else {
for (int j = 0; j < int(_cols); ++j) {
for (int i = 0; i < int(_rows); ++i) {
for (int x = 0; x < int(_cols); ++x) {
for (int y = 0; y < int(_rows); ++y) {
T sum = _zero;
for (int k = -radius; k <= radius; ++k) {
int idx = i + k;
int idx = y + k;
if (idx >= 0 && idx < int(_rows)) {
sum += at(idx, j) * kernel[k + radius];
sum += at(idx, x) * kernel[k + radius];
}
}
result.at(i, j) = sum;
result.at(y, x) = sum;
}
}
}
Expand Down
1 change: 1 addition & 0 deletions relightlab/icons/dark/scalable/info.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions relightlab/icons/light/scalable/info.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion relightlab/roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
## Reinstate existing functions:

* lp saving
* normals filtering/flattening

## New Features

Expand Down Expand Up @@ -43,4 +42,5 @@
## Small Bugs

* Check version is properly written and read from the .relight file
* normal integrations callbacks.

2 changes: 2 additions & 0 deletions src/project.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,7 @@ void Project::loadLP(QString filename) {
ordered_dir[pos] = directions[i];
}

dome.directions.resize(directions.size());
if(success) {
for(size_t i = 0; i < size(); i++)
dome.directions[i] = ordered_dir[i];
Expand All @@ -578,6 +579,7 @@ void Project::loadLP(QString filename) {
"Filenames in .lp do not match with images in the .lp directory. Do you want to just use the filename order?");
if(response == QMessageBox::Cancel || response == QMessageBox::No)
return;

for(size_t i = 0; i < size(); i++)
dome.directions[i] = directions[i];
}
Expand Down

0 comments on commit 3705b75

Please sign in to comment.