Commit graph

22 commits

Author SHA1 Message Date
078520678d Figure out (finally!) the mouse coordinates in the MapWindow 2023-03-10 23:53:08 -08:00
1018febeab Fix a bug in Rect.__contains_point!
It was comparing point.y with the Rect's min_x.
2023-03-10 22:56:50 -08:00
040803fe61 Add Rect.from_raw_values 2023-03-06 19:23:43 -08:00
e6327deeef Geometry classes are no longer frozen 2023-03-05 16:53:34 -08:00
e3864d8468 Implement LE, LT, GE, GT on Point 2023-03-05 14:24:44 -08:00
85928a938d Some geometry updates
- Add Point.numpy_index to simplify converting Points to indexes
- Update the doc string of Point.direction_to_adjacent_point
- Add a Rect.__contains__ implementation for another Rect
- Refactor the contains implementations above into helper methods
2023-03-05 13:35:25 -08:00
be7198b16d Update the doc string of Rect.inset_rect 2023-02-20 18:00:41 -08:00
6aefff838d Implement Rect.__contains__ on a Point
Returns True if the Rect contains the point.
2023-02-20 18:00:29 -08:00
445c600bf9 Add a doc string to Rect.corners 2023-02-19 19:08:32 -08:00
22ad73af0b Fix Rect.corners based on the unit test 2023-02-19 19:06:24 -08:00
7428d95126 Fix the implementation of Point.is_adjacent_to 2023-02-18 22:51:58 -08:00
06d34a527b Add Point.manhattan_distance_to
Returns the manhattan distance to another Point.
2023-02-18 22:51:42 -08:00
462eebd95c Add Rect.corners
An iterator over the corners of the rectangle
2023-02-18 22:51:19 -08:00
633580e27a Add Rect.edges
Iterates the minimum and maximum x and y edges for the Rect.
2023-02-15 08:22:32 -08:00
36206b5cc0 Clean up __add__ on Point; add __sub__
The dunder add method only ever had one overload, so you don't need to
declare an overload
2023-02-12 19:44:28 -08:00
ec28f984da Add a couple geometry methods
- Vector.from_point to convert a point to a vector
- Rect.width and Rect.height convenience properties
2023-02-12 15:52:26 -08:00
cf31bcc272 Create a more semantic Size.numpy_shape property 2023-02-12 14:28:14 -08:00
727a0737c6 Use integer division for Rect.mid_y and Rect.mid_x 2023-02-10 21:13:49 -08:00
7b0b7ff5b6 Add Rect.intersects 2023-02-10 21:13:31 -08:00
391f84b21b Fix up the type annotations for geometry.Direction 2023-02-09 16:09:58 -08:00
9a04692539 Refactor map generator package
- Move room generators to map.generators.room
- Move corridor generators to map.generators.corridor

Generators have a generate() method that generates the things they place,
and an apply() method that applies their objects to a grid of tiles.
2023-02-09 16:07:29 -08:00
f6fe9d0f09 Move the roguebasin package to erynrl 2022-05-12 09:05:27 -07:00
Renamed from roguebasin/geometry.py (Browse further)