Shapes for Graphics
Contains code to make and alter lines, rectangles, circles, triangles and polygons.
Primarily designed to be use with Buffer Graphics and Pixels graphics lib
Usage
Add this line to Cargo.toml
= "0.1.14"
# or with both features
= { = "0.1.14", = ["mint", "serde"] }
Examples
let rect = new;
assert!;
let triangle = new;
let rotated = triangle.rotate;
let start = new;
let dist = start.distance;
Shapes
All shapes have contains, rotate, scale and translate methods.
Each shape also has custom methods, for example, len
on Line
, union
on Rect
, angle_type
on Triangle
, etc
You should use Rect
or Triangle
over Polygon
where possible as their math methods are optimised.
Assertions
This library uses debug assertions for some methods.
Features
Both are off by default
Serde
serde
adds serde::{Serialize, Deserialize}
to Coord
, Line
, Rect
, Circle
, Triangle
, Polygon
Mint
mint
adds a From
impl for Point2<isize>
to Coord