Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to draw a symmetric object made of a large number of points. To make the code cleaner, I want to use reflection technique. It means I just specify points on one side of the symmetrical axis, the points on the other side will be obtained by reflecting the specified points.

Finally I want to concatenate those parts in \pscustom and do other operations such as filling or stroking.

The following code snippet is just a simple example that has been trimmed off for the sake of simplicity, but it failed to produce the required symmetric object.

\documentclass{article}

\usepackage{pstricks-add}

\usepackage[active,tightpage]{preview}
\PreviewEnvironment{pspicture}
\PreviewBorder=10pt\relax

\begin{document}
\begin{pspicture}[showgrid](-3,-3)(3,3)
    \def\left{\psline(0,2)(2,0)(0,-2)}%
    \pscustom[
        fillstyle=solid,
        fillcolor=yellow,
        linecolor=red
    ]{
        \left
        \psscalebox{-1 1}{\left}
    }
\end{pspicture}
\end{document}

How to concatenate a set of paths and a set of the reflected paths about a certain axis in a single \pscustom?

Note: I also want to get the corners on which the part and its reflected part meet properly glued as usual.

share|improve this question

1 Answer 1

up vote 1 down vote accepted
\documentclass{article}
\usepackage{pstricks}

\begin{document}
\begin{pspicture}[showgrid](-3,-3)(3,3)
\pscustom[fillstyle=solid,
          fillcolor=yellow,
          linecolor=red]{%
  \psline(0,2)(2,0)(0,-2)
  \code{ -1 1 scale }\moveto(0,2)
  \psline(0,2)(2,0)(0,-2)}
\end{pspicture}

\end{document}
share|improve this answer
    
I still don't understand why the top and bottom points look jagged. \pscustom should make the corners nice as usual. I give up! –  stalking is prohibited Mar 13 '12 at 7:27
1  
for the top use linejoin=1 the bottom is a problem, because the path is not really a closed one. –  Herbert Mar 13 '12 at 9:48
    
no, it is a very special case that you want to mirror a path and then filling it. It already works correct for a default path setting. –  Herbert Mar 13 '12 at 12:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.