pgf icon indicating copy to clipboard operation
pgf copied to clipboard

Adding a simple way to do axial symmetry (or mirror or reflection) of a path

Open quark67 opened this issue 4 years ago • 4 comments

Brief outline of the proposed feature

It seems that to do an axial symmetry with Tikz, it is pain (unless the axe of symmetry is the x-axis our the y-axis). Here are code I found to do this: https://tex.stackexchange.com/questions/119914/can-we-mirror-a-part-in-tikz

It's a very complicated code with use of low internal commands (tikz@scan@one@point, \pgfextract@process etc.): https://tex.stackexchange.com/a/142491/132405

Usage example

The syntax used in the code gave in the previous link seems user friendly (with (@1) and (@2) the points which define the axe of the symmetry):

\begin{scope}[mirror=(@1)--(@2)]
  \draw[thick, blue] (1,1) -- (0,0) -- (1,2);
  \path[transform shape] (@1) -- node[above,sloped] {Mirror} (@2);
\end{scope}

Or have I forget a package for Tikz which provide this?

quark67 avatar May 19 '21 13:05 quark67

Search for spath3 from Andrew Stacey. Save the path and reuse it with flipped scales. Note that you can always mirror on x- or y-axis and rotate the scope the paths are in.

ilayn avatar May 19 '21 14:05 ilayn

What is then the code for mirror an object relative to the line between the points A(2,1) and B(5,3)? What combination of x-axis mirror, y-axis mirror and rotation with what angle must I use?

I don't have find the relation beetween axis symmetry relative to an arbitrary line, and the spath3 package. Where is the documentation ? I only found a pdf about Calligraphy (?) and knots (???). Where are the scolar symmetry?

quark67 avatar May 19 '21 15:05 quark67

You save the path. You open another scope. You set xscale=-1 you reuse the path. That gives the exact result you provided above.

Now you tell me how to mirror without a pain with respect to arbitrary axis. Where is the specification? What is your use case? Why can't you do it yourself? What else offers this? Did you even search online the usage of spath? There are like 100 cases in Tex.SX

As you can see our tone on a back and forth matters a lot. So it is quite mirrored if you excuse the pun.

ilayn avatar May 19 '21 15:05 ilayn

You use rude words :(.

quark67 avatar May 19 '21 17:05 quark67