Skip to content

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

@sebovzeoueb

Description

@sebovzeoueb

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions