feat: Add Z Anti-Aliasing (ZAA) contouring support

Port Z Anti-Aliasing from BambuStudio-ZAA (https://github.com/adob/BambuStudio-ZAA)
to OrcaSlicer. ZAA eliminates stair-stepping on curved and sloped top surfaces
by raycasting each extrusion point against the original 3D mesh and micro-adjusting
Z height to follow the actual surface geometry.

Key changes:
- Add ContourZ.cpp raycasting algorithm (~330 lines)
- Extend geometry with 3D support (Point3, Line3, Polyline3, MultiPoint3)
- Template arc fitting for 2D/3D compatibility
- Change ExtrusionPath::polyline from Polyline to Polyline3
- Add 5 ZAA config options (zaa_enabled, zaa_min_z, etc.)
- Add posContouring pipeline step in PrintObject
- Update GCode writer for 3D coordinate output
- Add ZAA settings UI in Print Settings > Quality
- Add docs/ZAA.md with usage and implementation details

ZAA is opt-in and disabled by default. When disabled, the slicing pipeline
is unchanged.
This commit is contained in:
Matthias Nott
2026-02-09 20:38:46 +01:00
parent cae1567726
commit 963f8d86b7
57 changed files with 1817 additions and 204 deletions

View File

@@ -4005,6 +4005,57 @@ void PrintConfigDef::init_fff_params()
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionBool(false));
def = this->add("ironing_expansion", coFloat);
def->label = L("Ironing expansion");
def->category = L("Quality");
def->tooltip = L("Expand or contract the ironing area.");
def->sidetext = L("mm");
def->min = -100;
def->max = 100;
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(0));
def = this->add("zaa_region_disable", coBool);
def->label = L("Disable Z contouring for region");
def->category = L("Quality");
def->tooltip = L("Disable Z contouring for this specific region");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionBool(false));
def = this->add("zaa_enabled", coBool);
def->label = L("Z contouring enabled");
def->category = L("Quality");
def->tooltip = L("Enable Z-layer contouring (aka Z-layer anti-aliasing)");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionBool(false));
def = this->add("zaa_minimize_perimeter_height", coFloat);
def->label = L("Minimize wall height angle");
def->category = L("Quality");
def->tooltip = L("Reduce top surface perimeter heights to match height of edge for perimeters less than this angle. Set 0 to disable.");
def->sidetext = L("°");
def->min = 0;
def->max = 90;
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(35));
def = this->add("zaa_dont_alternate_fill_direction", coBool);
def->label = L("Don't alternate fill direction");
def->category = L("Quality");
def->tooltip = L("Disable alternating fill direction when using Z contouring");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionBool(false));
def = this->add("zaa_min_z", coFloat);
def->label = L("Minimum z height");
def->category = L("Quality");
def->tooltip = L("Minimum z layer height. Also controls slicing plane");
def->sidetext = L("mm");
def->min = 0;
def->max = 100;
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(0.05));
def = this->add("layer_change_gcode", coString);
def->label = L("Layer change G-code");
def->tooltip = L("This G-code is inserted at every layer change after the Z lift.");