Skip to content

Incorrect formula to calculate the linnear position. #844

Open
@git-tomas

Description

@git-tomas

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;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions