-
-
Notifications
You must be signed in to change notification settings - Fork 2
Signed Distance Functions #61
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add a `__hash__()` function and create missing bits of the context to allow for easy VM execution.
This allows creating meshes in new ways. Implementation is built on the existing `Model()` class hierarchy with a new `signed_distance()` method.
The positive outside convention is just more common in examples found online and so I think probably less confusing.
Picks 1/100th of the largest axis range.
Cython seems to be generating bad code with them being cpdef.
Also, ensure that we don't push a `!trim` through another CSG operation if either the `!trim` or the other operation involve boundary effects.
This is *very, very* slow and requires the `rtree` package be installed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
🚀 enhancement
New feature or request
🎨 render
Anything to do with rendering (windows, physics, etc.)
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support for generating meshes from signed distance functions (/fields). It adds a new
!sdfmodel node that takes either afunction=attribute or a set of sub-nodes.The
function=attribute takes an actual Flitter function taking a 3-vector position (in the model coordinate system) and returning a signed distance (with the positive is outside convention).If a set of sub-nodes is given instead then these are evaluated in the same way that a CSG model hierarchy is evaluated except all of the operations and primitives are SDFs. This hierarchy may contain
!sdfnodes specifying custom functions.The
!trim,!union,!intersectand!differencenodes are extended to have newsmooth=,fillet=andchamfer=attributes that allow for various boundary effects. These only work in an SDF hierarchy and are ignored for normal mesh CSG operations.The top level
!sdfnode should also be supplied withminimum=andmaximum=attributes taking 3-vectors of the model-coordinate bounds to evaluate the SDF over, and aresolution=attribute giving the density to evaluate the function over as a length in the model coordinate system – smaller values require greater computation.maximumdefaults to1andminimumdefaults to negativemaximum.