attempt to fix division by zero
This commit is contained in:
parent
0ddea4a393
commit
451a55a6df
@ -31,7 +31,7 @@ Shape::Shape(Shape &&other) noexcept
|
|||||||
void Shape::update(cv::Point &&t_max_pos, int const t_max_size,
|
void Shape::update(cv::Point &&t_max_pos, int const t_max_size,
|
||||||
int const t_min_size) noexcept
|
int const t_min_size) noexcept
|
||||||
{
|
{
|
||||||
int const size = (rand() % (t_max_size - t_min_size)) + t_min_size;
|
int const size = (rand() % (t_max_size - t_min_size)) + t_min_size + 1;
|
||||||
cv::Point const top_left
|
cv::Point const top_left
|
||||||
= {rand() % (t_max_pos.x - size), rand() % (t_max_pos.y - size)};
|
= {rand() % (t_max_pos.x - size), rand() % (t_max_pos.y - size)};
|
||||||
if (type_ == ShapeType::Triangle) {
|
if (type_ == ShapeType::Triangle) {
|
||||||
@ -45,7 +45,7 @@ void Shape::create_triangle_points(cv::Point const &t_top_left,
|
|||||||
int const t_size) noexcept
|
int const t_size) noexcept
|
||||||
{
|
{
|
||||||
bool top_left = rand() % 2 == 0;
|
bool top_left = rand() % 2 == 0;
|
||||||
points_ = {
|
points_ = {
|
||||||
cv::Point{top_left ? t_top_left.x : t_top_left.x + t_size, t_top_left.y},
|
cv::Point{top_left ? t_top_left.x : t_top_left.x + t_size, t_top_left.y},
|
||||||
cv::Point{top_left ? t_top_left.x + t_size : t_top_left.x,
|
cv::Point{top_left ? t_top_left.x + t_size : t_top_left.x,
|
||||||
t_top_left.y + rand() % t_size},
|
t_top_left.y + rand() % t_size},
|
||||||
|
Loading…
Reference in New Issue
Block a user