Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random ConvexPolygon in O(n log n) #73

Merged
merged 5 commits into from
Dec 29, 2020

Conversation

lemmih
Copy link
Collaborator

@lemmih lemmih commented Dec 27, 2020

This PR includes:

  • Point orientation functions that operate without Data.Ext. Style matches ccw/ccw': sortAround/sortAround', 'ccwCmpAround/ccwCmpAround'`, etc.
  • Applicative and Additive instances for Point. Is there a reason not to have these?
  • A random generator for ConvexPolygon in O(n log n).

@lemmih lemmih added the review Ready for review and comments label Dec 27, 2020
@lemmih
Copy link
Collaborator Author

lemmih commented Dec 27, 2020

Possible QC properties:

  • All randomly generated ConvexPolygons should be convex.
  • extremes should give similar results to extremesLinear.
  • The minkowshiSum of two ConvexPolygons is itself convex.
  • What more can be tested?

@noinia
Copy link
Owner

noinia commented Dec 27, 2020

This PR includes:

* Point orientation functions that operate without Data.Ext. Style matches `ccw/ccw'`: `sortAround/sortAround'`, 'ccwCmpAround/ccwCmpAround'`, etc.

In terms of the SoS work I was actually wondering whether I should remove the pure 'ccw without Ext' versions. In most cases I where I used ccw I had some extra data lying around anyway, and I ended up using the ccw' version. It is kind of silly if that ends up being the more used version than the "pure" one.

* `Applicative` and `Additive` instances for `Point`. Is there a reason not to have these?

An Applicative instance seems fine. I don't want to have an Additive instance for points though: I don't think it makes sense to think about "adding points"; that is a nonsensical operation. What one can do is add vectors! I.e. this is one of the main reasons for having Point and Vector be distinct types.

* A random generator for ConvexPolygon in `O(n log n)`.

Cool! I'll have a more detailed look at how you are doing that, sicnce that seems interesting :).

@lemmih lemmih merged commit 63222ed into noinia:master Dec 29, 2020
@lemmih lemmih deleted the feature-random-convex branch December 29, 2020 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review Ready for review and comments
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants