Add roots component to tree support for improved base stability#178
Add roots component to tree support for improved base stability#178jgphilpott merged 11 commits intomainfrom
Conversation
Co-authored-by: jgphilpott <4128208+jgphilpott@users.noreply.github.com>
|
This is a great start @copilot! Here are a few notes for improvement:
More notes will come but this is a good start for now :) |
…ight Co-authored-by: jgphilpott <4128208+jgphilpott@users.noreply.github.com>
Both issues addressed in commit Root connection height: Floating trunk case: Roots are now generated dynamically in |
|
Nice progress @copilot, here are some more notes:
More notes will come but this is a enough for now :) |
…e mode Co-authored-by: jgphilpott <4128208+jgphilpott@users.noreply.github.com>
Both fixed in commit 45° angle: The base spread was Hanging roots: Added |
|
Great progress @copilot but I think we need to address the issue of partial support/object overlap. Right now it looks like if a support structure overlaps even slightly with part of the printed object then it is removed/filtered out entirely. Instead what we should do is to clip the support structure, until full overlap is reached. This will allow the supports to get closer to the object and look less like they are hanging in the air when on curved surfaces. I also noticed that the sideways everywhere dome example Do you think you can investigate and resolve this issue for me? This could potential effect not only roots but the other components as well, like twigs. Thanks! |
… for curved surfaces - canGenerateSupportAt (everywhere mode): replace "solid ended in N layers" check with a per-layer embedded check (current layer only). Support is now clipped at each layer independently, so roots/twigs on curved surfaces are kept until they actually enter the object. - _validRootIndices: sample 0.5×/1.0×/1.5×/2.0× rootHeight along each root ray (ROOT_RAY_SAMPLE_FRACTIONS) to detect dome walls further from the trunk than the base endpoint alone. Removes ROOT_SUPPORT_LAYER_SEARCH_DEPTH constant. - Add Z_EPSILON (1e-9) to minimumSupportZ comparison to absorb FP accumulation in layer heights. - Tests: 2 new canGenerateSupportAt everywhere-mode tests, updated hanging-root test (tinyRadius derived from rootHeight), new broadened-ray-cast test. Co-authored-by: jgphilpott <4128208+jgphilpott@users.noreply.github.com>
Fixed in commit Clip instead of filter — Broadened ray-cast — |
There was a problem hiding this comment.
Pull request overview
Adds a “roots” component to tree supports to improve base stability and updates everywhere-mode collision logic to support clip-until-embedded behavior on curved surfaces.
Changes:
- Add dynamic root cross-sections in
generateTreePattern, anchored to an effective trunk base layer and suppressed ineverywheremode when no solid is detected along sampled rays. - Update
canGenerateSupportAt(everywheremode) to compute highest solid strictly below the current layer and block only when embedded at the current layer, with a small Z epsilon. - Extend/adjust support regression fixtures and expand unit tests for both tree roots and everywhere-mode support placement.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/slicer/support/tree/tree.coffee | Implements dynamic root generation, root sizing, and broadened ray-cast support checks in everywhere mode. |
| src/slicer/support/tree/tree.test.coffee | Adds tests for dynamic roots, effective base tracking, radius ordering, spread/angle constraints, and hanging-root suppression. |
| src/slicer/support/normal/normal.coffee | Adjusts everywhere-mode collision logic to “clip until embedded” and adds a Z epsilon for comparisons. |
| src/slicer/support/normal/normal.test.coffee | Adds/updates tests for everywhere-mode allow/block behavior (embedded, just-above-solid). |
| resources/gcode/support/tree/dome/upright.gcode | Updates LFS pointer for regenerated tree-support fixture output. |
| resources/gcode/support/tree/dome/sideways-everywhere.gcode | Updates LFS pointer for regenerated tree-support fixture output. |
| resources/gcode/support/tree/arch/upright.gcode | Updates LFS pointer for regenerated tree-support fixture output. |
| resources/gcode/support/tree/arch/sideways-everywhere.gcode | Updates LFS pointer for regenerated tree-support fixture output. |
| resources/gcode/support/normal/dome/sideways-everywhere.gcode | Updates LFS pointer for regenerated normal-support fixture output. |
| resources/gcode/support/normal/arch/sideways-everywhere.gcode | Updates LFS pointer for regenerated normal-support fixture output. |
|
@copilot apply changes based on the comments in this thread |
…NS, pre-filter layers, fix test comparison - Export ROOT_RAY_SAMPLE_FRACTIONS from module.exports so downstream code and tests can reference the constant (as documented in the PR description). - Pre-filter layerSolidRegions to relevantLayers (within rootHeight window of effectiveBaseZ) before the root × sampleFraction nested loop. Removes the per-iteration Z-range check and avoids iterating all layers on tall prints. - Fix 'base layer should have more extrusion moves than a layer above the root zone' test: actually generate a layer above the root zone (z=2.0) and compare the per-call extrusion counts, instead of comparing against the constant singleNodeExtrusions. Co-authored-by: jgphilpott <4128208+jgphilpott@users.noreply.github.com>
Applied all three reviewer suggestions in commit
|
canGenerateSupportAteverywhere mode: per-layer clip behaviour,Z_EPSILON_validRootIndicesray-cast:ROOT_RAY_SAMPLE_FRACTIONS = [0.5, 1.0, 1.5, 2.0]canGenerateSupportAteverywhere-mode tests; hanging-root + broadened-ray testsROOT_RAY_SAMPLE_FRACTIONSfrommodule.exportslayerSolidRegionstorelevantLayers(withinrootHeightwindow) before root ray-cast loop'base layer should have more extrusion moves than a layer above the root zone'test to actually compare against a generated above-root-zone layer💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.