Circle Boundary
A single purpose library. This library's aim is to return a circle boundary as represented in discrete pixels as shown in the following diagram.

Usage
Include the library into your application with the following line at the top of your main file.
extern crate circle_boundary;
And then get access to the public calculate function by adding the following line at the top of the file you want to use it in.
use calculate;
use Boundary;
Then you can use the calculate function to get a vector of boundary data structures back. Each boundary structure holds a pair of cartesian coordinates (x and y) where x is represented by a single number indicating it's position, and y is represented by a range to show where on the y-axis the boundary applies.
The calculate function expects the origin as represented by the first two arguments, a x value as an i32 integer and a y value as an i32 integer. The final argument is the radius of the circle you want a boundary for as represented as a i32 integer.
let bounds = calculate;
As noted above the value returned is a vector that represents the boundary as such:
vec!;
Which could be represented as in the following diagram. Where the dark grey square represents the origin, the green squares represent the lower bounds of the y range, and the red squares represent the upper bounds of the y range.

Off origin example
As noted the calculate function can be given coordinates that offset the results from a (0,0) origin. If you pass in an offset like:
calculate;
This returns the following vector:
vec!;
Which represents the following circle boundary where the black square represents the (0,0) origin:

Examples
For more examples on how to use this library you can look in the examples/ folder in this repository. You can run each one with the following command:
For example:
Would run the introductory example file examples/introduction.rs.
Development
Building for Rust
Have Rust and Cargo installed, then run:
cargo build
Building for the Web
Install wasm-pack, then run:
wasm-pack build
- Copy over the
README_NPM.mdfile into the/pkgfolder asREADME.md. - Make sure the
imagesfile is copied over into the generated/pkgfolder as well.
Runing the tests
Use the Cargo command:
cargo test