https://github.com/0x1a8510f2/gopoints
A very simple Go library for creating shapes on a 2D plane out of points, using only the Go stdlib. Can be used for generating simple images for instance. Made for educational purposes.
https://github.com/0x1a8510f2/gopoints
2d 2d-plane go golang library points
Last synced: 8 months ago
JSON representation
A very simple Go library for creating shapes on a 2D plane out of points, using only the Go stdlib. Can be used for generating simple images for instance. Made for educational purposes.
- Host: GitHub
- URL: https://github.com/0x1a8510f2/gopoints
- Owner: 0x1a8510f2
- License: mpl-2.0
- Created: 2020-12-16T21:42:30.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-02-04T20:57:24.000Z (over 5 years ago)
- Last Synced: 2024-11-24T20:53:30.964Z (over 1 year ago)
- Topics: 2d, 2d-plane, go, golang, library, points
- Language: Go
- Homepage: https://pkg.go.dev/github.com/TR-SLimey/gopoints
- Size: 118 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# GoPoints
A very simple Go library for creating shapes on a 2D plane out of points, using only the Go stdlib. Supports some basic functions like:
- storing points in a `Plane` structure
- joining arbitrary points with lines (including diagonal)
- filling shapes with points
- flipping the whole plane or some points along the X or Y axis
- fetching all points from a plane
- fetching points from a plane based on the return value (boolean) of a given function (like a mathematical equation)
- *TODO*: Applying an arbitrary transformation based on a function to the points on the plane
## Use cases
Can be used for any number of things, but my primary use-case is generating images made of 2D shapes, such as the [example image](https://github.com/TR-SLimey/gopoints/blob/master/examples/CreatePngImage.png?raw=true) generated with `examples/CreatePngImage.go`:

## Usage examples
Some example code can be found in the `examples` directory in the root of this repository