gabzim / circle-to-polygon

Receives a Coordinate, a Radius and a Number of edges and aproximates a circle by creating a polygon that fills its area
ISC License
113 stars 29 forks source link

Adding tests #7

Closed johachi closed 4 years ago

johachi commented 4 years ago

I liked this project, so I decided to try and add some tests to it.

If i get this merged, I might also add the feature of getting the polygon drawn clockwise (since it coordinates of inner polygons (holes) has to be clockwise, but the outer polygon has to be counter-clockwise.

I might also add test for non-trivial center positions.

This tests the following: Input validation

Output validation

Trivial center positions:

Non-trivial center positions (not implemented):

Edit: Change min radius to >0m to not be a breaking change (previously set to >=1).

johachi commented 4 years ago

I forgot to add, I'm using Prettify, and prettified the files.

I will happily change my code if you follow some other code style (but even happier if you accept prettified code :) )

gabzim commented 4 years ago

Happy to merge this if you can fix the conflict!

johachi commented 4 years ago

@gabzim I just solved the merge conflict, please have a look!

johachi commented 4 years ago

@gabzim , pleasewait a sec with merging this, I need to fix the behavior when numberOfSegments is undefined.

Edit: Above has been fixed.