Skip to content

Add support configuration options: supportGap, supportDensity, and tree support settings#189

Merged
jgphilpott merged 6 commits into
mainfrom
copilot/add-support-configuration-options
Apr 17, 2026
Merged

Add support configuration options: supportGap, supportDensity, and tree support settings#189
jgphilpott merged 6 commits into
mainfrom
copilot/add-support-configuration-options

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 17, 2026

Summary

Adds 6 new configurable options for support structure generation. All defaults match the existing hardcoded implementation values so no existing behaviour changes.

New Options

Shared (normal and tree support)

Option Type Default Description
supportGap Number (mm) 0.2 Air gap between supports and the printed object. Previously hardcoded as nozzleDiameter / 2.

Normal support

Option Type Default Description
supportDensity Number (0–100) 50 Density percentage of the support grid. Previously hardcoded to spacing equivalent of 50%. Setting to 0 produces no support lines for that region.

Tree support

Option Type Default Description
supportRootsEnabled Boolean true Enable/disable root structures at the base of the trunk.
supportRootCount Number (1–8) 4 Number of roots spreading radially from the trunk base.
supportBranchAngle Number (degrees) 45 Angle of branches rising from the trunk (0° = horizontal, 90° = vertical).
supportTwigAngle Number (degrees) 45 Angle of twigs rising from branch nodes to contact tips.

Changes

  • src/polyslice.coffee — new constructor properties; new getter/setter methods delegating to accessors
  • src/utils/accessors.coffee — new get* and set* functions with validation
  • src/slicer/support/normal/normal.coffee — reads supportGap and supportDensity from slicer instead of hardcoded values
  • src/slicer/support/tree/tree.coffee — reads all tree-specific settings from slicer; buildTreeStructure parameters refactored into an opts object
  • src/slicer/support/support.test.coffee — 18 new tests for all getter/setter pairs
  • src/polyslice.test.coffee — default-value assertions for all new support options
  • src/utils/accessors.test.coffee — extended support settings test with getter/setter coverage for all 6 new options including boundary validation checks
  • src/slicer/support/normal/normal.test.coffee — new generateRegionSupportPattern tests covering supportDensity=0 early return, supportGap region collapse, and density-vs-line-count relationship
  • src/slicer/support/tree/tree.test.coffee — new buildTreeStructure opts tests covering supportGap collapse, gap effect on twig count, and branchAngle/twigAngle geometry effects
  • docs/slicer/support/SUPPORT.md — updated with all new options, tree support anatomy, and API reference
  • .github/instructions/slicer/support/overview.instructions.md — updated configuration table, tree support structure section, and usage examples

Validation

All 888 tests pass.

…ee support settings

Agent-Logs-Url: https://github.com/jgphilpott/polyslice/sessions/e344e2dc-96a5-4775-bb64-8d6638788ff3

Co-authored-by: jgphilpott <4128208+jgphilpott@users.noreply.github.com>
@jgphilpott
Copy link
Copy Markdown
Owner

Okay this is looking good @copilot, thanks! Could you please also make sure the support instructions (.github/instructions/slicer/support/overview.instructions.md) and support docs (docs/slicer/support/SUPPORT.md) are up-to-date with the current implementation?

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 17, 2026

Okay this is looking good @copilot, thanks! Could you please also make sure the support instructions (.github/instructions/slicer/support/overview.instructions.md) and support docs (`docs/slicer/sup...

Done in b10eb84. Both files have been updated:

docs/slicer/support/SUPPORT.md — usage example updated to show all new options; supportType now lists "tree" as implemented; added individual configuration sections for supportGap, supportDensity, supportRootsEnabled, supportRootCount, supportBranchAngle, and supportTwigAngle; tree support generation section added (anatomy diagram, node radii table, angle/root config); API reference and slicer methods table updated; file structure and limitations sections updated.

.github/instructions/slicer/support/overview.instructions.md — configuration parameters table expanded with all 6 new params; tree support sub-module description updated from "placeholder" to real implementation; support types table updated; grid parameters and gap sections updated to show configurable values; new "Tree Support Structure" section added with anatomy, radii, angle formulas, root config, and trunk accessibility details; both usage examples updated; important conventions updated with new items for density, gap, angle constraints, and root count.

@jgphilpott
Copy link
Copy Markdown
Owner

Excellent progress @copilot! We are almost ready to merge, before we do can you make sure all the relevant test files have also been updated?

  • src/polyslice.test.coffee
  • src/utils/accessors.test.coffee
  • src/slicer/support/support.test.coffee
  • src/slicer/support/normal/normal.test.coffee
  • src/slicer/support/tree/tree.test.coffee

Thanks!

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 17, 2026

Excellent progress @copilot! We are almost ready to merge, before we do can you make sure all the relevant test files have also been updated?

  • src/polyslice.test.coffee
    ...

Done in 34257a6. All five test files have been updated:

  • src/polyslice.test.coffee — default-value assertions added for all 7 support options (supportThreshold, supportGap, supportDensity, supportRootsEnabled, supportRootCount, supportBranchAngle, supportTwigAngle)
  • src/utils/accessors.test.coffee — the 'should set and get support settings' test extended with 6 new getter/setter pairs including validation boundary checks for each
  • src/slicer/support/support.test.coffee — two stale "not yet implemented" comments removed (tree support and everywhere placement are both fully implemented)
  • src/slicer/support/normal/normal.test.coffee — new generateRegionSupportPattern describe block with 4 tests: supportDensity=0 early return, supportGap region collapse, valid default case, and density-vs-line-count relationship
  • src/slicer/support/tree/tree.test.coffee — 4 new buildTreeStructure opts tests: supportGap collapse, larger gap producing fewer twigs, branchAngle effect on branch Z geometry, and twigAngle effect on twig Z geometry

All 209 tests across the 5 affected files pass.

@jgphilpott jgphilpott marked this pull request as ready for review April 17, 2026 11:41
Copilot AI review requested due to automatic review settings April 17, 2026 11:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds new configuration options to the slicer support-generation system (normal + tree) by extending the Polyslice API (constructor + accessors), wiring the options into support algorithms, and documenting/testing the new behavior.

Changes:

  • Introduces 6 new support-related settings (supportGap, supportDensity, and 4 tree-specific knobs) with getters/setters and default-value coverage.
  • Updates normal support grid generation to derive spacing from supportDensity and to use configurable supportGap.
  • Updates tree support to consume slicer-provided settings and refactors buildTreeStructure to accept an opts object; updates docs and bumps three/prettier.

Reviewed changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/utils/accessors.coffee Adds getters/setters + validation for new support settings.
src/utils/accessors.test.coffee Adds getter/setter tests for new support settings.
src/polyslice.coffee Adds new constructor properties and method delegates for support options.
src/polyslice.test.coffee Asserts default values for newly added support options.
src/slicer/support/normal/normal.coffee Derives spacing from supportDensity and uses supportGap instead of hardcoded constants.
src/slicer/support/normal/normal.test.coffee Adds tests for density=0 behavior, gap collapse, and density-vs-output relationship.
src/slicer/support/tree/tree.coffee Reads new tree settings from slicer and threads them into buildTreeStructure; enables configurable roots/rootCount.
src/slicer/support/tree/tree.test.coffee Adds tests for supportGap collapse and angle-driven geometry differences.
src/slicer/support/support.test.coffee Adds tests for new support option defaults and validation behavior.
docs/slicer/support/SUPPORT.md Documents new support options and adds detailed tree support explanation.
.github/instructions/slicer/support/overview.instructions.md Updates internal support-module overview with new options and tree support details.
package.json Bumps three and prettier versions.
package-lock.json Lockfile updates for the dependency bumps.

Comment thread src/slicer/support/tree/tree.coffee Outdated
Comment thread src/slicer/support/tree/tree.coffee
Comment thread docs/slicer/support/SUPPORT.md
Comment thread .github/instructions/slicer/support/overview.instructions.md
@jgphilpott
Copy link
Copy Markdown
Owner

@copilot I replied to all your comment, please review my notes and apply changes based on the conversation in this thread. Thanks!

…ption in docs

Agent-Logs-Url: https://github.com/jgphilpott/polyslice/sessions/baf9ce8d-4a77-400a-b329-d848c8c0c4b4

Co-authored-by: jgphilpott <4128208+jgphilpott@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 17, 2026

@copilot I replied to all your comment, please review my notes and apply changes based on the conversation in [this thread](#189 (review)...

All four items from the review thread addressed in ea3adaa — see the individual thread replies for details.

@jgphilpott jgphilpott merged commit f8bf3cf into main Apr 17, 2026
1 check passed
@jgphilpott jgphilpott deleted the copilot/add-support-configuration-options branch April 17, 2026 15:35
Copilot AI mentioned this pull request Apr 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants