Module primitives

Source
Expand description

This module contains basic geometry primitives that implement CanDraw, such as Line or Triangle

Structs§

Line
A line primitive which implements CanDraw, and so can be drawn to Canvases
Pixel
A singular point with a Vec2D position and ColChar
Polygon
A polygon primitive which implements CanDraw, and so can be drawn to Canvases
Rect
A rectangle primitive which implements CanDraw, and so can be drawn to Canvases
Triangle
A triangle primitive which implements CanDraw, and so can be drawn to Canvases

Functions§

interpolate
Draw a pseudo-line between the independent and dependent positions. Returns rounded values as i64s. If you don’t want the values rounded, use interpolate_floating
interpolate_floating
Draw a pseudo-line between the independent and dependent positions
triangulate
Split a polygon up into triangles using the ear cutting algorithm. Returns a vec of coordinate sets for each triangle