tmillenaar / GridKit

MIT License
2 stars 0 forks source link

Rotated grids #51

Open tmillenaar opened 12 months ago

tmillenaar commented 12 months ago

Allow for the rotation of grids. The user should be able to supply the number of degrees to rotate. This would also make the "pointy" and "flat" grid shapes obsolete, for they would be equal to a rotation of 90 degrees.

Implementation

The number of degrees should be converted to a 2D rotation matrix. This rotation matrix is then applied to any coordinate. All actual calculations should be done in a reference system where the grid is straight. For bounded grids, the bounds should represent the outer points, i.e. the total bounds. For any calculation, the bounds are first rotated so the grid is oriented in a straight manner. The rotation should probably be normalized to 180 degrees, or whatever the first repeat corresponds to. We want grids that are rotated 0 and 360 degrees to be considered aligned for example.

Affected methods:

The rotation should obviousely be included when determining if grids are aligned.