Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect formula to calculate the linnear position. #844

Open
git-tomas opened this issue Feb 1, 2023 · 1 comment
Open

Incorrect formula to calculate the linnear position. #844

git-tomas opened this issue Feb 1, 2023 · 1 comment

Comments

@git-tomas
Copy link

protected function calculatePosition($x, $y)
{
if ($x < 0 || $y < 0 || $this->width <= $x || $this->height <= $y) {
throw new OutOfBoundsException(sprintf('There is no position (%s, %s) in this matrix', $x, $y));
}
return $y * $this->height + $x;
}

The formula must be return $y * $this->width + $x;

@ausi
Copy link
Contributor

ausi commented Feb 4, 2023

I think you are right. Would you mind creating a pull request (including a unit test) that fixes this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants