Page 1 of 1

Creating/manipulating symmetric path?

Posted: Tue Aug 05, 2014 8:56 pm
by bugbear
I am currently working to create some stencil patterns;

(source material here, some lovely stuff
https://archive.org/details/ExcelsiorFrescoStencils
)

Many of the designs have symmetry. I can easily use inkscape's (superb!) clone feature
when a pattern element is repeated in its entirety.

But how do I make a path with symmetry? In the case of a solid colour
shape, this is fairly easy, since I can just make a closed path, and butt up a clone.
It's not a "true" symmetric path, but it is a symmetric image.

But if I want a more complex fill, or a stroke, I need a proper, single, symmetric path.

Image

I can create a path, copy and flip it, and then join the two pieces
up, but this is a "one-shot" deal; I can't then easily modify the resulting
symmetric path.

Suggestions and the pointing out of the obvious (to you) to the ignorant (that's me)
welcomed.

BugBear

Re: Creating/manipulating symmetric path?

Posted: Tue Aug 05, 2014 11:50 pm
by Lazur
Hi.

Just curious, stencils are mostly used to produce flat shaded shapes, with no outlines, so why do you want gradients?

Anyway.
There is an option in the fill and stroke panel, under the gradient dropdown menu, to use symmetric repeate.
With that, you would need to snap the starting handle of the gradient to a node above the mirror axis of the path, and hold Ctrl to drag the other handle in a horizontal direction.
Or similarly add a guide line to that axis and snap to that guide if there are no nodes available at those places.

Even more complex fills?
Like a group of two objects -a clone and a mirrored parent- clipped with a path?
Or like converting a group of two clones -one normal and one mirrored- to a fill pattern?
http://www.inkscapeforum.com/viewtopic.php?f=5&t=17638

Re: Creating/manipulating symmetric path?

Posted: Tue Aug 05, 2014 11:55 pm
by bugbear
Lazur URH wrote:Hi.

Just curious, stencils are mostly used to produce flat shaded shapes, with no outlines, so why do you want gradients?

Anyway.
There is an option in the fill and stroke panel, under the gradient dropdown menu, to use symmetric repeate.
With that, you would need to snap the starting handle of the gradient to a node above the mirror axis of the path, and hold Ctrl to drag the other handle in a horizontal direction.
Or similarly add a guide line to that axis and snap to that guide if there are no nodes available at those places.

Even more complex fills?
Like a group of two objects -a clone and a mirrored parent- clipped with a path?
Or like converting a group of two clones -one normal and one mirrored- to a fill pattern?
http://www.inkscapeforum.com/viewtopic.php?f=5&t=17638


Actually, I'm not (really) interested in the fill at all - my question was really about path creation/manipulation. The question would arise
with a simple stroked path.

BugBear

Re: Creating/manipulating symmetric path?

Posted: Wed Aug 06, 2014 12:11 am
by Lazur
As far as I know you can move the nodes symmetrically around, but cannot edit only at one side that the other would follow.
To do that you need to select a pair of nodes, and move the node's bounding box handles while holding Shift.
(May need that displaying of the bounding box to be set in the inkscape preferences too under the nodes tab.)

Re: Creating/manipulating symmetric path?

Posted: Wed Aug 06, 2014 12:32 am
by bugbear
Lazur URH wrote:As far as I know you can move the nodes symmetrically around, but cannot edit only at one side that the other would follow.
To do that you need to select a pair of nodes, and move the node's bounding box handles while holding Shift.
(May need that displaying of the bounding box to be set in the inkscape preferences too under the nodes tab.)


Thanks for that - it's hard to know wether I'm (at one extreme) asking for the moon, or
(at the other extreme) working too hard because I don't know the feature set.

BugBear

Re: Creating/manipulating symmetric path?

Posted: Wed Aug 06, 2014 1:17 am
by tylerdurden
It might be enough to clone the right half (flipped) and edit the left? The right will update as you release the mouse button.
SymmTest.jpg
SymmTest.jpg (65.85 KiB) Viewed 6332 times



When finished, combine the objects...?

Re: Creating/manipulating symmetric path?

Posted: Wed Aug 06, 2014 2:14 am
by tylerdurden
I worded that poorly.

Make the left half and clone it, flip it to the right side and edit the original on the left. When finished, join the two.

Re: Creating/manipulating symmetric path?

Posted: Wed Aug 06, 2014 5:46 pm
by bugbear
tylerdurden wrote:I worded that poorly.

Make the left half and clone it, flip it to the right side and edit the original on the left. When finished, join the two.


Ah - that's better than my "create, copy, flip, join"

Thank you.

BugBear

Re: Creating/manipulating symmetric path?

Posted: Thu Sep 18, 2014 12:03 pm
by RobA
Late to the game, but here is a way to create a mirrored clone of a layer:

1) Open the XML Editor (shift-ctrl-x)
2) Select the top node in the XML editor (will be <svg:svg id="xxxxxxxx"> where xxxxxxx is probably svg and some numbers) and click New Element Node (leftmost icon) xml<>+ and give it the name svg:use
3) I like to change the ID of this new node to reflect (ha!) the name of the layer I want to mirror, so if I am mirroring layer1, I make this new node's ID mirror#layer1. Just type in over the old attribute value and click set.
A bunch of new attributes get created. x and y are 0, width and height match the page. Now we will create a bunch of new attributes. This is done by typing a new attribute name in the one field and its value in the other then clicking set. If you make a mistake, just click on the attribute and use the Delete Attribute button/icon above the list of attributes.

4) Create a new attribute sodipodi:insensitive and set it to true. This makes it so you can't accidentally click on the clone layer.
5) Create a new attribute transform and set it to scale(-1,1) for a horizontal mirror.
6) Edit the x attribute by clicking on it and changing the value to -the_width_value. So if your width is 744.09448, set x to be -744.09448. Remember to click set to change it. This is for a horizontal mirror.
7) Create a new attribute xlink:href and set it to #the_id_of_the_source_layer so for layer1, make the value #layer1.
8) Optionally, to make it easier to differentiate the mirrored clone, create a new attribute style and set it to opacity:0.5 which will make it semi-transparent. You can delete this attribute when done.

To help draw shapes that connect right on the mirror-line, just create a guideline exactly 50% of the page width and turn on snap to guides.

When you are done, and if you want to edit the mirrored cloned layer objects (like merging them, combining them, changing the stack order, etc) just select the <svg:use> node you created in the XML editor and in the main inkscape menu selec Edit->Clone->Unlink Clone which turns the clone into a regular old layer you can edit all the items in.

TIP: For vertical mirroring, in step 5 make the transform attribute scale(1,-1), in step 6 instead of changing the x attribute, change the y attribute to -the_height_value

Super Expert TIP: for a 45degree mirror from the lower left corner, set x and y attributes BOTH to -the_height_value, and set the transform attribute to matrix(0,-1,-1,0,0,0) which is what you end up with if you try and set it to rotate(90) scale(-1,1)

I could probably make a video of this if it would help clarify things.

-Rob A>

Re: Creating/manipulating symmetric path?

Posted: Thu Sep 18, 2014 9:15 pm
by Xav
Symmetric designs using clones is the topic of my Inkscape tutorial in the *next* edition of Full Circle Magazine - due out near the start of October. It takes a more artistic approach - using symmetry to draw complex images, rather than just a single path.

The approach I take is to draw a large square or rectangle with stroke but no fill, then group it (so you get a group of one object). Clone the group, flip it, then send the clone to the back. Now you can double click the stroke to enter the original group, and anything you draw will be immediately mirrored (well, once you release the mouse button). Using a group like this lets you use multiple objects in your symmetric drawing without having to clone each of them individually.

For a simple path I would suggest using tylerdurden's approach, but I though it was worth mentioning for other readers who have more general requirements for symmetric drawing.

Re: Creating/manipulating symmetric path?

Posted: Thu Sep 18, 2014 11:10 pm
by RobA
Xav wrote:The approach I take is to draw a large square or rectangle with stroke but no fill, then group it (so you get a group of one object). Clone the group, flip it, then send the clone to the back. Now you can double click the stroke to enter the original group, and anything you draw will be immediately mirrored (well, once you release the mouse button). Using a group like this lets you use multiple objects in your symmetric drawing without having to clone each of them individually.


That is effectively what my technique is, as layers in Inkscape are actually groups with an Inkscape specific attribute.

-Rob A>

Re: Creating/manipulating symmetric path?

Posted: Thu Sep 18, 2014 11:20 pm
by Lazur
For the original post's sake, the question was meant to be on ONE single path.
Not that cloning isn't the most trivial solution, but
even with the best care it can produce a small gap between the two half if exported as a png, due to the anti-aliasing.

Re: Creating/manipulating symmetric path?

Posted: Fri Sep 19, 2014 12:42 am
by Xav
RobA wrote:That is effectively what my technique is, as layers in Inkscape are actually groups with an Inkscape specific attribute.


You're absolutely correct, but using an actual Inkscape group makes for an approach that's a bit easier if you're not the sort of user who wants to wade into the XML editor.

Lazur URH wrote:For the original post's sake, the question was meant to be on ONE single path.
Not that cloning isn't the most trivial solution, but
even with the best care it can produce a small gap between the two half if exported as a png, due to the anti-aliasing.


Indeed, which is why tylerdurden's suggestion - which I recommended for the original poster - finished with "combine the objects" (and BugBear's follow up post confirmed that his last step is "join").

Re: Creating/manipulating symmetric path?

Posted: Mon Sep 29, 2014 11:46 pm
by Xav
Xav wrote:Symmetric designs using clones is the topic of my Inkscape tutorial in the *next* edition of Full Circle Magazine - due out near the start of October.


As promised/threatened, my article is now available in issue 89 of 'Full Circle Magazine':

http://fullcirclemagazine.org/issue-89/