Editing Creating filled regions

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 8: Line 8:
 
So, what happens if you ask your Eggbot to draw a filled regions?  The Eggbot will simply draw the paths that make up the object, like it always does.  The "fill" attributes will be ignored.  The net result might be something like this:
 
So, what happens if you ask your Eggbot to draw a filled regions?  The Eggbot will simply draw the paths that make up the object, like it always does.  The "fill" attributes will be ignored.  The net result might be something like this:
  
https://cdn.evilmadscientist.com/wiki/eggbot/fill/fill1.png
+
http://wiki.evilmadscience.com/s3/eggbot/fill/fill1.png
  
 
Starting with the filled shapes on the left, the Eggbot will actually just plot their outlines, shown on the right.
 
Starting with the filled shapes on the left, the Eggbot will actually just plot their outlines, shown on the right.
Line 19: Line 19:
  
 
One final word before we get started: Plots where you fill solid regions can potentially take a long time with all that back-and-forth business.  Where possible, design around having to fill regions.
 
One final word before we get started: Plots where you fill solid regions can potentially take a long time with all that back-and-forth business.  Where possible, design around having to fill regions.
 
 
= Eggbot Hatch Fill extension =
 
 
The Eggbot [[Hatch fill]] extension is a newer method of creating filled regions.  This extension creates a series of lines or cross hatches that can fill even complex shapes.  The lines are not connected, so it is not as efficient as the Hatches (rough) method below, but it does work in more circumstances.  See the [[Hatch fill|Hatch Fill documentation]] for more information.
 
 
  
  
Line 31: Line 25:
 
These two fill methods can be used to fill closed shapes with pen paths.   
 
These two fill methods can be used to fill closed shapes with pen paths.   
  
== Hatch Path Effect Method ==
+
== Hatch Method ==
  
 
This method is described in detail in our [[Drawing_a_smiley_face|smiley face tutorial]].   
 
This method is described in detail in our [[Drawing_a_smiley_face|smiley face tutorial]].   
Line 39: Line 33:
 
* Open the live path effect editor: Path>Path Effect Editor
 
* Open the live path effect editor: Path>Path Effect Editor
 
* Apply new effect: Hatches (rough) and click "+Add"
 
* Apply new effect: Hatches (rough) and click "+Add"
* Use the extension to set defaults: Extensions>Eggbot>Preset hatch for fills. (Optional; this changes the hatch parameters to pleasant defaults.)
+
* Use the extension to set defaults: Extensions>Eggbot>Preset hatch for fills
 
* Use the "edit paths by node" tool to  set the angle, spacing, and bending of the lines.
 
* Use the "edit paths by node" tool to  set the angle, spacing, and bending of the lines.
  
Line 45: Line 39:
  
  
This "live path effect" hatching method can handle paths that consist of multiple disjoint regions, for example, a set of stars or non-intersecting circles, but it ''does not'' work with "hollow" regions, for example a ring or washer (2D torus) shape.
+
This "Hatch" method can handle paths that consist of multiple disjoint regions, for example, a set of stars or non-intersecting circles, but it ''does not'' work with "hollow" regions, for example a ring or washer (2D torus) shape.
  
https://cdn.evilmadscientist.com/wiki/eggbot/fill/fill2.png
+
http://wiki.evilmadscience.com/s3/eggbot/fill/fill2.png
  
 
Here are some concrete examples.  The four original (filled) shapes are on the left: A star, a square, a square with a star punched out-- essentially a hollow, ''ring-shaped'' fill region -- and a smaller square with a star punched out (a set of multiple disjoint regions).    In the middle set of four shapes, we've applied the hatch procedure as outlined above.  As you can see, it works well on three of the four shapes; but again it does not work on "hollow" areas. (It treats the inner cutout path as a separate path to be filled with hatching.)  The set of four shapes on the right have the same hatch applied, but we've also pasted a copy of the original outline shapes on top, to give more definition than you get from the fill alone.
 
Here are some concrete examples.  The four original (filled) shapes are on the left: A star, a square, a square with a star punched out-- essentially a hollow, ''ring-shaped'' fill region -- and a smaller square with a star punched out (a set of multiple disjoint regions).    In the middle set of four shapes, we've applied the hatch procedure as outlined above.  As you can see, it works well on three of the four shapes; but again it does not work on "hollow" areas. (It treats the inner cutout path as a separate path to be filled with hatching.)  The set of four shapes on the right have the same hatch applied, but we've also pasted a copy of the original outline shapes on top, to give more definition than you get from the fill alone.
  
While this hatch method is slightly complicated and does not work in every situation, it is without doubt ''the best method in any situation where it can be used''. It produces excellent results that plot smoothly and efficiently, with preset deceleration at each switchback and an absolute bare minimum of pen lifts.  Beyond all that, it's also a "live path effect," which means that it will automatically reflow as you change the shape of the filled region, and you can even remove the hatch at any time to restore your original object.
+
While the hatch method is slightly complicated and does not work in every situation, it is without doubt ''the best method in any situation where it can be used''. It produces excellent results that plot smoothly and efficiently, with preset deceleration at each switchback and an absolute bare minimum of pen lifts.  Beyond all that, it's also a "live path effect," which means that it will automatically reflow as you change the shape of the filled region, and you can even remove the hatch at any time to restore your original object.
  
  
Line 58: Line 52:
 
If you'd like to use the "hatch" method for geometries that fail, there are a few potential workarounds-- ways that you can simplify the geometry in generally unobtrusive ways, to fill the region that you want to.
 
If you'd like to use the "hatch" method for geometries that fail, there are a few potential workarounds-- ways that you can simplify the geometry in generally unobtrusive ways, to fill the region that you want to.
  
https://cdn.evilmadscientist.com/wiki/eggbot/fill/fill_alt1.png
+
http://wiki.evilmadscience.com/s3/eggbot/fill/fill_alt1.png
  
 
Here's our starting point: the square with the star punched out, on the left.  In the middle, with stroke visible but no fill.  And on the right with the hatch effect, failing to fill the correct region.
 
Here's our starting point: the square with the star punched out, on the left.  In the middle, with stroke visible but no fill.  And on the right with the hatch effect, failing to fill the correct region.
  
https://cdn.evilmadscientist.com/wiki/eggbot/fill/fill_alt4.png
+
http://wiki.evilmadscience.com/s3/eggbot/fill/fill_alt4.png
  
 
An obvious method of "fixing" the geometry is to split the object into two halves.  (You can do this by drawing a rectangle that covers half of the object, and alternately subtracting it from or intersecting it with the initial shape.)  The hatch effect can be applied to the two halves separately (as shown above, with contrasting hatch directions), or you can combine the two sections into a single path object (with the Path>Combine command) and apply the hatch effect.
 
An obvious method of "fixing" the geometry is to split the object into two halves.  (You can do this by drawing a rectangle that covers half of the object, and alternately subtracting it from or intersecting it with the initial shape.)  The hatch effect can be applied to the two halves separately (as shown above, with contrasting hatch directions), or you can combine the two sections into a single path object (with the Path>Combine command) and apply the hatch effect.
  
https://cdn.evilmadscientist.com/wiki/eggbot/fill/fill_alt2.png
+
http://wiki.evilmadscience.com/s3/eggbot/fill/fill_alt2.png
  
 
A less obvious (but usually better and easier) method is to create a tiny "cut" in the shape.  Here, we've drawn a tiny rectangle, 0.1 px tall, and positioned it to span the area from the inner cutout to the outline of the object.  We then subtract it from the shape, leaving a final geometry that is equivalent to a "C" shape, so far as the hatch extension is concerned.  You can then add the hatch effect and it will fill the correct region.  The "defect" that we've introduced is not generally visible if you use the pen to fill the whole region.
 
A less obvious (but usually better and easier) method is to create a tiny "cut" in the shape.  Here, we've drawn a tiny rectangle, 0.1 px tall, and positioned it to span the area from the inner cutout to the outline of the object.  We then subtract it from the shape, leaving a final geometry that is equivalent to a "C" shape, so far as the hatch extension is concerned.  You can then add the hatch effect and it will fill the correct region.  The "defect" that we've introduced is not generally visible if you use the pen to fill the whole region.
  
https://cdn.evilmadscientist.com/wiki/eggbot/fill/fill_alt3.png
+
http://wiki.evilmadscience.com/s3/eggbot/fill/fill_alt3.png
  
 
A much less ideal approach that may sometimes come in handy is as follows.  First, break the path apart, so that you can grab the outer and inner shapes separately.  Apply hatch to the outer object only.  Select Path>Object to path to convert the hatch fill to a simple path, instead of the hatch-filled object.  Then, subtract the inner shape from the outer shape.  This will ''cut'' the paths, leaving sharp corners at the edges, instead of the smooth paths that we prefer.
 
A much less ideal approach that may sometimes come in handy is as follows.  First, break the path apart, so that you can grab the outer and inner shapes separately.  Apply hatch to the outer object only.  Select Path>Object to path to convert the hatch fill to a simple path, instead of the hatch-filled object.  Then, subtract the inner shape from the outer shape.  This will ''cut'' the paths, leaving sharp corners at the edges, instead of the smooth paths that we prefer.
Line 88: Line 82:
 
Here's how it looks in practice:
 
Here's how it looks in practice:
  
https://cdn.evilmadscientist.com/wiki/eggbot/fill/fill3.png
+
http://wiki.evilmadscience.com/s3/eggbot/fill/fill3.png
  
 
Advantages: Can be applied to more than one object at once. Handles complex geometry.  
 
Advantages: Can be applied to more than one object at once. Handles complex geometry.  
Line 97: Line 91:
 
== Using Hatch and Inset together ==
 
== Using Hatch and Inset together ==
  
https://cdn.evilmadscientist.com/wiki/eggbot/fill/fill4.png
+
http://wiki.evilmadscience.com/s3/eggbot/fill/fill4.png
  
 
For non-hollow shapes where the hatch method works, it's often helpful to perform a single Inset operation before applying the hatch.  The result is shown above: The hatch marks do not go all the way to the edge of the filled region.  Using an initial inset like this is often a good way to compensate for pen width when filling a region.
 
For non-hollow shapes where the hatch method works, it's often helpful to perform a single Inset operation before applying the hatch.  The result is shown above: The hatch marks do not go all the way to the edge of the filled region.  Using an initial inset like this is often a good way to compensate for pen width when filling a region.
 +
 +
 +
= Eggbot Hatch Fill extension =
 +
 +
The Eggbot [[Hatch fill]] extension is a newer method of creating filled regions.  This extension creates a series of lines or cross hatches that can fill even complex shapes.  The lines are not connected, so it is not as efficient as the Hatches (rough) method above, but it does work in more circumstances.  See the [[Hatch fill|Hatch Fill documentation]] for more information.
 +
  
  
Line 108: Line 108:
 
== Interpolation ==
 
== Interpolation ==
  
https://cdn.evilmadscientist.com/wiki/eggbot/fill/fill5.png
+
http://wiki.evilmadscience.com/s3/eggbot/fill/fill5.png
  
 
Suppose that we start with the two curves shown on the left.  The interpolation method produces a series of curves between the two shapes, that can be used to fill in the region.
 
Suppose that we start with the two curves shown on the left.  The interpolation method produces a series of curves between the two shapes, that can be used to fill in the region.
Line 120: Line 120:
 
While you can't always see it, paths in Inkscape have distinct orientation, with "start" and "end" points.  The smooth result that you see above will only work if both paths are going the same direction-- for example, if you drew both of them with downward pen strokes. If necessary, you can use the Path>Reverse command to reverse the direction of one of the paths.
 
While you can't always see it, paths in Inkscape have distinct orientation, with "start" and "end" points.  The smooth result that you see above will only work if both paths are going the same direction-- for example, if you drew both of them with downward pen strokes. If necessary, you can use the Path>Reverse command to reverse the direction of one of the paths.
  
You can also read more about the Interpolate function in [https://inkscape.org/en/doc/tutorials/interpolate/tutorial-interpolate.en.html this tutorial].  There is also a standard extension that has a similar effect (Generate from path>Interpolate...), but the live path effect version is much more powerful.
+
You can also read more about the Interpolate function in [http://tavmjong.free.fr/INKSCAPE/MANUAL/html/Paths-LivePathEffects-InterpolateSubPaths.html this tutorial].  There is also a standard extension that has a similar effect (Generate from path>Interpolate...), but the live path effect version is much more powerful.
 +
 
  
 
== Stitch Paths ==
 
== Stitch Paths ==
  
https://cdn.evilmadscientist.com/wiki/eggbot/fill/fill6.png
+
http://wiki.evilmadscience.com/s3/eggbot/fill/fill6.png
  
 
Here, we've started with the same two curves that we used previously.  The Stitch Paths method produces not a series of lines parallel to our initial paths, but a set of lines perpendicular to them.
 
Here, we've started with the same two curves that we used previously.  The Stitch Paths method produces not a series of lines parallel to our initial paths, but a set of lines perpendicular to them.
Line 139: Line 140:
 
== Combining Interpolation and Stitch Paths ==
 
== Combining Interpolation and Stitch Paths ==
  
https://cdn.evilmadscientist.com/wiki/eggbot/fill/fill8.png
+
http://wiki.evilmadscience.com/s3/eggbot/fill/fill8.png
  
 
Here are two (more interesting) curves, on the left.  Then the results of using interpolate, stitch, and the combined results of using both.  As you can see, this can create an interesting filled region between the paths.
 
Here are two (more interesting) curves, on the left.  Then the results of using interpolate, stitch, and the combined results of using both.  As you can see, this can create an interesting filled region between the paths.
Line 146: Line 147:
  
  
https://cdn.evilmadscientist.com/wiki/eggbot/fill/fill9.png
+
http://wiki.evilmadscience.com/s3/eggbot/fill/fill9.png
  
 
We mentioned earlier the importance of path direction.  The figure above shows the same two curves and the same path effects, but where one of the path directions was reversed.  
 
We mentioned earlier the importance of path direction.  The figure above shows the same two curves and the same path effects, but where one of the path directions was reversed.  
  
  
https://cdn.evilmadscientist.com/wiki/eggbot/fill/fill10.png
+
http://wiki.evilmadscience.com/s3/eggbot/fill/fill10.png
  
 
Here's an example of something a little closer to a filled object.  The two paths are concentric, and the fills span the area between them.
 
Here's an example of something a little closer to a filled object.  The two paths are concentric, and the fills span the area between them.
 
 
 
= TSP Paths =
 
 
While not strictly a method of filling a region with a path, [[TSP_art|TSP art]] can be used to fill large areas with single lines that optically appear to form an image.
 

Please note that all contributions to Evil Mad Scientist Wiki are considered to be released under the GNU Free Documentation License 1.3 (see Evil Mad Scientist Wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel | Editing help (opens in new window)

Template used on this page: