-
Notifications
You must be signed in to change notification settings - Fork 279
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
feat: Add examples with nonconvex shapes #893
Conversation
Deploying with Cloudflare Pages
|
Codecov Report
@@ Coverage Diff @@
## main #893 +/- ##
==========================================
+ Coverage 67.43% 68.17% +0.73%
==========================================
Files 62 62
Lines 8181 8115 -66
Branches 1771 1767 -4
==========================================
+ Hits 5517 5532 +15
+ Misses 2657 2576 -81
Partials 7 7
Continue to review full report at Codecov.
|
The poly-decomp.js library (linked from #877) links to this page describing an algorithm, which explains the circumstances under which it inserts these Steiner points: https://mpen.ca/406/bayazit |
I opened x6ud/poly-partition-js#1 which would allow make diff --git a/packages/core/src/contrib/Minkowski.ts b/packages/core/src/contrib/Minkowski.ts
index d774e67f0..cd235e3a4 100644
--- a/packages/core/src/contrib/Minkowski.ts
+++ b/packages/core/src/contrib/Minkowski.ts
@@ -161,6 +161,9 @@ export const convexPartitions = (p: VarAD[][]): VarAD[][][] => {
);
const contour = [...pointMap.keys()];
+ if (isClockwise(contour)) {
+ contour.reverse();
+ }
const convexPolygons = convexPartition(contour);
return convexPolygons.map((poly) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks @jiriminarcik! Do you want to add any of these to the registry?
I added the maze example. |
Description
Followup to #877.
Added new examples with non-convex shapes and fixed some issues with the convex partitioning algorithm by switching to library
poly-partition
(see comments below).Examples with steps to reproduce them
Run
npx roger watch maze.sub maze.sty maze.dsl
in folderexamples/minkowski-tests/maze
.Run
npx roger watch yin-yang.sub yin-yang.sty yin-yang.dsl
in folderexamples/minkowski-tests/yin-yang
.Checklist
diagrams/
folderOpen questions
The optimiser struggles with the Yin-Yang example and often get stuck at an undesirable local minimum.