Skip to content

Commit 5c4144d

Browse files
gridleypshriwise
andauthored
idiomatic thresholding
Co-authored-by: Patrick Shriwise <pshriwise@gmail.com>
1 parent 62859d3 commit 5c4144d

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎src/plot.cpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,9 +1436,9 @@ void ProjectionPlot::create_output() const
14361436
if (i * i + j * j < wireframe_thickness_ * wireframe_thickness_) {
14371437

14381438
// Check if wireframe pixel is out of bounds
1439-
if (horiz + i >= 0 && horiz + i < pixels_[0] && vert + j >= 0 &&
1440-
vert + j < pixels_[1])
1441-
data(horiz + i, vert + j) = wireframe_color_;
1439+
int w_i = std::max(std::min(horiz + i, pixels_[0]), 0);
1440+
int w_j = std::max(std::min(vert + j, pixels_[1]), 0);
1441+
data(i, j) = wireframe_color_;
14421442
}
14431443
}
14441444
}

0 commit comments

Comments
 (0)