Petr Mrázek 2012-04-02 13:42:18 +02:00
commit 2a998a5b8a
2 changed files with 4 additions and 4 deletions

@ -33,7 +33,7 @@ coord operator-(const coord &other) const
coord operator/(int number) const
{
return coord(x/number, y/number, z);
return coord((x < 0 ? x - number : x)/number, (y < 0 ? y - number : y)/number, z);
}
coord operator*(int number) const
{
@ -41,7 +41,7 @@ coord operator*(int number) const
}
coord operator%(int number) const
{
return coord(x%number, y%number, z);
return coord((x+number)%number, (y+number)%number, z);
}
coord operator-(int number) const

@ -29,7 +29,7 @@ coord2d operator-(const coord2d &other) const
coord2d operator/(int number) const
{
return coord2d(x/number, y/number);
return coord2d((x < 0 ? x - number : x)/number, (y < 0 ? y - number : y)/number);
}
coord2d operator*(int number) const
{
@ -37,5 +37,5 @@ coord2d operator*(int number) const
}
coord2d operator%(int number) const
{
return coord2d(x%number, y%number);
return coord2d((x+number)%number, (y+number)%number);
}