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

[Question/potential bug] Are negative coordinates supposed to work? #5

Open
sebovzeoueb opened this issue Dec 10, 2020 · 0 comments
Open

Comments

@sebovzeoueb
Copy link

I've been using the JavaScript version to do some map generation, and I noticed that it doesn't handle negative coordinates well. Is this intended?

I've just offset my coordinates by a large number to avoid this problem, but I wanted to check.

Also while I was poking around I noticed this function:

function tile(coordinate, period) {
	if (coordinate < 0) while (coordinate < 0)
		coordinate += period;
	else
		return coordinate % period;
}

I'm fairly sure that the else should be removed, right? Otherwise this just returns undefined for a negative coordinate. I was still unable to get satisfactory results from making that change though, so maybe the algorithm just isn't meant for negative numbers?

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

No branches or pull requests

1 participant