grid_shapes

Crates.iogrid_shapes
lib.rsgrid_shapes
version0.1.3
sourcesrc
created_at2023-07-15 02:44:45.087405
updated_at2023-07-26 04:16:10.44634
descriptionA general purpose 2d grid shape library
homepagehttps://github.com/Laocoon7/grid_shapes
repositoryhttps://github.com/Laocoon7/grid_shapes
max_upload_size
id916943
size64,020
(Laocoon7)

documentation

README

Grid Shapes

###Features ["extentions"] - enables some grid extentions ["serde"] - enables serialization

grid_shapes was born from the need of a dedicated shapes library for drawing shapes on a grid. (eg. drawing a room in a roguelike dungeon)

There are many shapes libraries but most use floating point math and I needed something simple and grid based.

Each shape is defined inclusively, for example a rectangle with min and max coordinates of (0,0) and (4,4) would return a size of [5,5] as both (0,0) and (4,4) are considered legitimate positions in the rectangle.

###Currently the included shapes are: *Circle *Line *Rectangle

All shapes should impl Shape and Shape should remain object safe.

Accessing the coords which make up each shape is preferably done through iterators. A helper function (Shape).for_each(|coord| {}) has been provided.

I am open to suggestions and pr's.

##ChangeLog As of 0.1.3 we are now using coord_2d. This removes any generic shapes based on a Coord or Size trait, but allows trait Shape to become object safe.

Commit count: 24

cargo fmt