-
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: Lagrange bases #999
feat: Lagrange bases #999
Conversation
Deploying with Cloudflare Pages
|
Codecov Report
@@ Coverage Diff @@
## main #999 +/- ##
==========================================
- Coverage 63.71% 63.63% -0.09%
==========================================
Files 62 62
Lines 7789 7801 +12
Branches 1782 1784 +2
==========================================
+ Hits 4963 4964 +1
- Misses 2714 2723 +9
- Partials 112 114 +2
Continue to review full report at Codecov.
|
y="408.9659586607471" | ||
width="65.1769202023942" | ||
width="-406.09798464016694" |
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.
Strange that the width
became negative...
|
||
`lagrange-bases` is a stub for a package that draws meshes made of higher-order Lagrange finite elements. Currently it supports only linear triangular and quadratic elements, because quadratic quadrilateral elements, and other higher-order elements, require so many constructor arguments that we run into the [exponential scaling bug in Style selectors](https://github.com/penrose/penrose/issues/566). | ||
|
||
The basic idea is that `Nodes` can be connected by `Elements` of any order. The rule for elements of type `QuadraticTriangle` in `lagrange-bases.sty` serves as a nice simple example of drawing quadratic Bézier curves; note that because we use the function `interpolateQuadraticFromPoints` rather than `quadraticCurveFromPoints`, these curves interpolate the three given points (rather than using the middle point as an approximated control point). There are some other cool things we could in principle do here (like automatically restricting edges that belong to multiple elements to polynomials of the lower degree), but see again the note about the bug above, which makes it hard to use long selectors. |
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.
Awesome, thanks for documenting this so well!
Description
This PR adds a new example
lagrange-bases
, which is described in the README. Mostly this is just a dogfooding example; in the process of dogfooding we (re)-discovered some things like exponential cost of long selectors (which put some limitations on the sophistication of this example). It also changes thecontains1D
function to use a simplemax
on the difference of interval endpoint values, rather thanifCond
on the square of the difference, which was causing the optimizer to hang on this and several other examples. Finally, this PR adds a new functioninterpolateQuadraticFromPoints
which draws a quadratic Bézier curve that interpolates the three given points, rather than using the 2nd point as a control point.Checklist
diagrams/
folder