evil-mad / EggBot

Software for The Original EggBot
GNU General Public License v3.0
287 stars 140 forks source link

Bad hatch fill when user selects non-zero gap length #32

Closed ShelMi closed 8 years ago

ShelMi commented 8 years ago

When the raster traverses an object which is smaller than the selected gap length, the odd/even indicator for inside/outside of polygon gets reversed.

ShelMi commented 8 years ago

I have a proposed fix, and it tests OK, but I am not up-to-speed on using git - and don't want to screw things up.

ShelMi commented 8 years ago

Whoops - proves I don't know about git, I didn't mean to close the issue.

oskay commented 8 years ago

Can you please state the issue that you are referring to very clearly, including how to reproduce it?

ShelMi commented 8 years ago

[Whoops - didn't realize this was going thru github, so didn't realize I couldn't attach the .svg file. If you're interested, please email me directly. Crikey - I hate the way github narrow-formatted my text!]

Hi Windell...

        Wow - didn't realize you were a night-owl like me!  8^)  (I'm in Eastern time zone.)

            I have a very simple test image which shows the problem, the .svg file is attached.  Needless to say this is just a test image...I ran into the problem with a rather more complicated image, which I can supply if you want.

    Here is the Inkscape result image, with  the red lines being strokes of my                                   original svg rectangles of different sizes, and black being the output of                                   Extensions/Eggbot Contributed/Hatch Fill... with
                                        Hatch angle 90.0;
                                        Hatch spacing 6.0;
                                        Minimum hatch and gap length  4.0;
                                        Tolerance 20.0;
                                         unchecked Crosshatch:

I believe I have solved the problem, and can give further details if you wish.

                                         

There is an additional problem with this extension, where though I haven't cured the problem, I have markedly improved the behavior.  It's a little harder to document this one - call it bug 2, so I'll just stick with this one == bug 1, - until you are convinced that I'm a reliable reporter.  8^)

Bests, ...Shel Michaels, NH, USA  

On 2015-12-30 3:33 AM, Windell Oskay
  wrote:

  Can you please state the issue that you are referring to very
    clearly, including how to reproduce it?
  —
    Reply to this email directly or view
      it on GitHub.
ShelMi commented 8 years ago

Maybe a description of the problem from the user's standpoint: When doing a Hatch Fill from the contributed extensions in Inkscape, the hatch may have areas where it fills the space between edges, where there is supposed to be no fill. The result is hatch where you don't want it, and no hatch where you do want it.

This only happens when you specify a Minimum Hatch and Gap Length greater than zero.

The change I propose is in the insterstices procedure, in the "mind the gap" logic.

I propose changing the following snippet from this:

# Remember the relative start and end of this hatch segment
    last_sa = [ sa[i], sa[i+1] ]
    i = i + 2
else:
    i = i + 1

to this:

# Remember the relative start and end of this hatch segment
    last_sa = [ sa[i], sa[i+1] ]
    i = i + 2
else:
    i = i + 2   # Skip this hatch segment, but note that we must skip the segment entirely,
                  # not just skip its beginning point
oskay commented 8 years ago

Thank you @ShelMi, this looks like a definite improvement.