Skip to content

Diamond backgroundpath and anchorborder are wrong if diamond is not a rotated square #1396

@hammondkd

Description

@hammondkd

Brief outline of the bug

The diamond shape behaves as expected if used without either the minimum width or minimum height attributes (or if the two are set to the same value), but if they are different, the anchor border is wrong. Basically, if the diamond is not a rotated square, the anchor border is in the wrong place relative to the background path.

I am willing to fix this myself, but I have one question: should the solution be to force the object to have right-angle corners, or should a non-square diamond be allowed? I would assume the latter.

Minimal working example (MWE)

\documentclass[tikz]{standalone}
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{tikzpicture}
  \node [shape=diamond,draw=gray,line width=0.25cm,minimum height=3cm,
    minimum width=6cm] (s) {};
  \foreach \x in {0,...,359}
    \draw [red,shift=(s.\x)] plot [mark=x] coordinates {(0,0)};
\begin{scope}[yshift=-4cm]
  \node [shape=diamond,draw=gray,minimum size=4cm,line width=0.25cm] (t) {};
  \foreach \x in {0,...,359}
    \draw [orange,shift=(t.\x)] plot [mark=x] coordinates {(0,0)};
\end{scope}
\end{tikzpicture}
\end{document}
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions