5

I want to draw an image as follows. enter image description here

I can use some tricks to draw the shadow: I first draw a rectangle and then fill a circle in white in the corner. But I do not know how to make the red parts sharp. Is there a better way to draw the shadow?

enter image description here

I also want the circle to be tangent to the rounded corner if it is possible.

I try my best to produce this image, and the follows is my code. It is ugly enough, and I do not like my way of covering the corner of the rectangle.

\begin{tikzpicture}
    [
    scale = 1,
    set/.style = {draw, rounded corners},
    shadow/.style = {rounded corners, fill = gray}
    ]
    
    \node[shadow, minimum width = 3.4cm, minimum height = 2.1cm] (sG) at(0.1, -0.062) {};
    \node[rounded corners, fill = white, minimum width = 3.4cm, minimum height = 2.1cm] (G) at(0, 0) {};
    \node[set, minimum width = 2.1cm, minimum height = 1.3cm] (S) at(0.652, -0.398) {};
    \node[circle, fill = gray, minimum size = 0.7cm] (sv1) at (1.38, -0.72) {};
    \node[circle, fill = white, minimum size = 0.7cm] (v1) at (1.48, -0.782) {};

    \draw (1.38, -0.72) circle (0.35);
    \draw[rounded corners] (-1.7, 1.05) rectangle (1.7, -1.05);
    \node[rectangle, fill = white, minimum size = 0.45cm] (sv2) at (1.59, -0.89) {};
    \node[rectangle, fill = white, minimum size = 0.481cm ] (sv3) at (1.51, -0.818) {};
    \draw[white, very thick] (1.278, -1.04) -- (1.38, -1.09);
\end{tikzpicture}
0

1 Answer 1

9
\documentclass[tikz, border=1cm]{standalone}
\usetikzlibrary{shadows}
\begin{document}
\begin{tikzpicture}[very thick]
\newcommand{\myr}{0.5 cm}
\newcommand{\myx}{4 cm}
\newcommand{\myy}{3 cm}
\fill[white, drop shadow, save path=\pathA] {[rounded corners=\myr] (\myr,0) -- (0,0) -- (0,\myy) -- (\myx,\myy)} -- (\myx,\myr) arc[radius=\myr, start angle=0, end angle=270] -- cycle;
\clip[use path=\pathA];
\draw[line width/.expanded={2*\the\pgflinewidth}] [use path=\pathA];
\end{tikzpicture}
\end{document}

Rounded rectangle with missing circle corner

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .