@@ -717,11 +717,54 @@ protected virtual void fill_bridge_region(GeneralPolygon2d poly, IFillPathSchedu
717717 scheduler . AppendCurveSets ( fill_gen . GetFillCurves ( ) ) ;
718718 }
719719
720+ protected virtual void fill_bridge_region_decompose ( GeneralPolygon2d poly , IFillPathScheduler2d scheduler , PrintLayerData layer_data )
721+ {
722+ poly . Simplify ( 0.1 , 0.01 , true ) ;
723+
724+ double minLength = Settings . MaxBridgeWidthMM * 0.75 ;
725+ double minArea = minLength * minLength ;
726+
727+ var polys = PolygonDecomposer . Compute ( poly , minArea ) ;
728+
729+ double spacing = Settings . BridgeFillPathSpacingMM ( ) ;
730+
731+ foreach ( Polygon2d polypart in polys )
732+ {
720733
734+ Box2d box = polypart . MinimalBoundingBox ( 0.00001 ) ;
735+ Vector2d axis = ( box . Extent . x > box . Extent . y ) ? box . AxisY : box . AxisX ;
736+ double angle = Math . Atan2 ( axis . y , axis . x ) * MathUtil . Rad2Deg ;
721737
738+ GeneralPolygon2d gp = new GeneralPolygon2d ( polypart ) ;
722739
740+ ShellsFillPolygon shells_fill = new ShellsFillPolygon ( gp ) ;
741+ shells_fill . PathSpacing = Settings . SolidFillPathSpacingMM ( ) ;
742+ shells_fill . ToolWidth = Settings . Machine . NozzleDiamMM ;
743+ shells_fill . Layers = 1 ;
744+ shells_fill . InsetFromInputPolygonX = 0.25 ;
745+ shells_fill . ShellType = ShellsFillPolygon . ShellTypes . BridgeShell ;
746+ shells_fill . FilterSelfOverlaps = false ;
747+ shells_fill . Compute ( ) ;
748+ scheduler . AppendCurveSets ( shells_fill . GetFillCurves ( ) ) ;
749+ var fillPolys = shells_fill . InnerPolygons ;
723750
751+ double offset = Settings . Machine . NozzleDiamMM * Settings . SolidFillBorderOverlapX ;
752+ fillPolys = ClipperUtil . MiterOffset ( fillPolys , offset ) ;
724753
754+ foreach ( var fp in fillPolys )
755+ {
756+ BridgeLinesFillPolygon fill_gen = new BridgeLinesFillPolygon ( fp )
757+ {
758+ InsetFromInputPolygon = false ,
759+ PathSpacing = spacing ,
760+ ToolWidth = Settings . Machine . NozzleDiamMM ,
761+ AngleDeg = angle ,
762+ } ;
763+ fill_gen . Compute ( ) ;
764+ scheduler . AppendCurveSets ( fill_gen . GetFillCurves ( ) ) ;
765+ }
766+ }
767+ }
725768
726769 /// <summary>
727770 /// Determine the sparse infill and solid fill regions for a layer, given the input regions that
0 commit comments