[solved] Sinusoidal 'Hatching'

Post questions on how to use or achieve an effect in Inkscape.
guest2390234

[solved] Sinusoidal 'Hatching'

Postby guest2390234 » Sun Sep 07, 2008 1:31 pm

I am trying to create a sinusoidal type hatching between two arbitrary bezier curves, and was wondering how to do it. I will try to describe what I wish to do better:

Image

I'd like to have a series of evenly spaced sine-like curves running between the two bezier curves at the top and bottom of the image above, such that the local minima and maxima of the sine curves touch the bezier curve. I'd like to use this to create a sort of hatched effect by having 30 or so curves each spaced a few mm apart, essentially shading in the region between the two bezier curves.

What is the best way to do this?

Thanks

User avatar
loonquawl
Posts: 135
Joined: Thu May 15, 2008 7:57 pm

Re: Sinusoidal 'Hatching'

Postby loonquawl » Sun Sep 07, 2008 7:55 pm

For this, you need one of the current development builds, but then it is fairly simple.

Make Sine Waves using the Effects->Render->Function Plotter. Best Make sinewaves with about 20 nodes per x, about 10 x long. (You need a rectangle for the funtion plotter to work in, the sine will inherit the linestyle, color, fill of the rectangle; The rectangle will be filled with the Sine, so make it a long, slender rectangle)

Make two bezier curves as you wish them. (Those will be the borders)

Select the Sine.

Use Path->Path Effects->PathEffects->Envelope Deformation.

Copy/Paste the upper bezier as upper curve, Lower Bezier as lower. -> Voilá!

For mulitple Sines all affected the same way, let the funtion plotter plot sines that differ in the "Start X Value" (Adjust End X Value accordingly, otherwise you alter the wavelength; and always use the same rectangle) and repeat the procedure

User avatar
prkos
Posts: 1625
Joined: Tue Nov 06, 2007 8:45 am
Location: Croatia

Re: Sinusoidal 'Hatching'

Postby prkos » Sun Sep 07, 2008 8:35 pm

I'm not sure if you can get nice hatching with envelope effect, it will distort the spacing between hatchings too. I'd suggest Stitch Subpaths.

Use the Stitch SubPaths Path Effect (you have it in official 0.46), but I'm not sure you'll be able to do it using the top and bottom curves, I'd create 2 new paths and then apply the stitches between them.

  • create top and bottom paths so we know the boundaries (you probably already have them)
  • decide where hatching paths will begin and end, in your image the beginning is along the bottom path on the left, and the end is between the top and bottom on the right. Create beginning and ending path there, they will serve as starting and ending points of hatching. The direction is important, if the beginning is from left to right, the ending should be too. If it's the reverse the hatching won't be "parallel". Also keep them simple, 2 nodes in each, it will make editing later easier
  • Combine the beginning and ending path into one Ctrl + K
  • Apply Stitch Subpaths to it Shift + Ctrl + 7, you will see a messy 5 straight stitch
  • Now draw the sinusoidal shape that you want to be the hatching (one of the in between lines from the image)
  • Copy the sinusoidal shape
  • Select the stitched path (with Path effects dialog still open) and click on the Paste path button in the dialog. Sinusoidal will replace the straight stitches.
  • Now you have to adjust the stitches so they touch the top and bottom path. Use the Edit on-canvas button from the Path Effects dialog. When you press it a green helper path will appear over the original sinusoidal path. You can edit it to increase or decrease crests, the stitches may extend past the beginning and ending paths.
  • Select the stitched path and use Node tool on it, this way you edit the beginning and ending paths, you can move the nodes up or down to compensate for any unwanted path effect stretching
  • To adjust the spacing of the hatchings change the Number of paths setting (you wanted 30), and use Node tool to shorten or make wider the beginning and ending paths.


Image
just hand over the chocolate and nobody gets hurt

Inkscape Manual on Floss
Inkscape FAQ
very comprehensive Inkscape guide
Inkscape 0.48 Illustrator's Cookbook - 109 recipes to learn and explore Inkscape - with SVG examples to download

guest2390234

Re: Sinusoidal 'Hatching'

Postby guest2390234 » Mon Sep 08, 2008 2:51 am

perfect, the envelope deformation is just what i needed, it preserves the spacing between hatchings nicely, for a very nice effect overall - see the sample below

Image

it also gave me a reason to install the development version, and wow, there are many more awesome features I have yet to try. Thanks!


Return to “Help with using Inkscape”