노이즈 성분이 있는 임의의 점

노이즈 성분이 있는 임의의 점

지정된 영역을 점점으로 채우는 방법이 궁금합니다. 녹색 영역을 임의의 녹색 점으로 채우고 빨간색 영역 대신 빨간색 임의 점으로 흰색 영역을 파란색 임의 점으로 채우고 싶습니다. 내 코드는 다음과 같습니다.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}
%\usepackage{xcolor,pict2e}% to allow any radius

  \tikzset{pics/myarc/.style args={inner #1 and outer #2 with fill #3}{
  code={
    \draw[very thick, #1] (1,0) arc (0:90:1cm);
    \draw[very thick] (0,1) -- (0,2);
    \draw[very thick, #2] (0,2) arc (90:0:2cm);
    \draw[very thick] (2,0) -- (1,0);
    \fill[#3] (1,0) arc (0:90:1cm) -- (0,2) arc (90:0:2cm) -- cycle;
  }
}}
\begin{document}
\begin{tikzpicture}
\draw[very thick,<->] (-6,0) -- (6,0)node[anchor=north west] {$x$};
\pic [draw,very thick, rotate=-45]      {myarc={inner blue and outer blue with fill green!}};
\pic [draw, very thick, rotate=45]      {myarc={inner blue and outer blue with fill white}};
\pic [draw, very thick, rotate=135]      {myarc={inner blue and outer blue with fill red!40}};
\pic [draw, very thick, rotate=225]      {myarc={inner cyan and outer blue with fill white}};
\end{tikzpicture}

\end{document}

여기에 이미지 설명을 입력하세요

어떤 도움이라도 주시면 감사하겠습니다. 감사해요

답변1

일반 점으로.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing,patterns}
%\usepackage{xcolor,pict2e}% to allow any radius

  \tikzset{pics/myarc/.style args={inner #1 and outer #2 with fill #3}{
  code={
    \draw[very thick, #1] (1,0) arc (0:90:1cm);
    \draw[very thick] (0,1) -- (0,2);
    \draw[very thick, #2] (0,2) arc (90:0:2cm);
    \draw[very thick] (2,0) -- (1,0);
    \fill[pattern=dots,pattern color = #3] (1,0) arc (0:90:1cm) -- (0,2) arc (90:0:2cm) -- cycle;
  }
}}
\begin{document}
\begin{tikzpicture}
\draw[very thick,<->] (-6,0) -- (6,0)node[anchor=north west] {$x$};
\pic [draw,very thick, rotate=-45]      {myarc={inner blue and outer blue with fill green!}};
\pic [draw, very thick, rotate=45]      {myarc={inner blue and outer blue with fill blue}};
\pic [draw, very thick, rotate=135]      {myarc={inner blue and outer blue with fill red!40}};
\pic [draw, very thick, rotate=225]      {myarc={inner cyan and outer blue with fill blue}};
\end{tikzpicture}

\end{document}

여기에 이미지 설명을 입력하세요

무작위화에는 더 많은 작업이 필요하며이 질문그리고 그 대답은 미리 알려줄 것입니다.

그리고 여기에 전략을 사용한 시도가 있습니다.이 답변

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing,patterns}
%\usepackage{xcolor,pict2e}% to allow any radius

  \tikzset{pics/myarc/.style args={inner #1 and outer #2 with fill #3}{
  code={
    \draw[very thick, #1] (1,0) arc (0:90:1cm);
    \draw[very thick] (0,1) -- (0,2);
    \draw[very thick, #2] (0,2) arc (90:0:2cm);
    \draw[very thick] (2,0) -- (1,0);
    \clip (1,0) arc (0:90:1cm) -- (0,2) arc (90:0:2cm) -- cycle;
    \foreach \x in {1,...,300}
        {
            \pgfmathrandominteger{\a}{5}{300}
            \pgfmathrandominteger{\b}{5}{300}
            \pgfmathrandominteger{\c}{30}{30}
            \fill[#3] (0.01*\a,0.01*\b) circle (0.001*\c);
        };
  }
}}
\begin{document}
\begin{tikzpicture}
\draw[very thick,<->] (-6,0) -- (6,0)node[anchor=north west] {$x$};
\pic [draw,very thick, rotate=-45]      {myarc={inner blue and outer blue with fill green!}};
\pic [draw, very thick, rotate=45]      {myarc={inner blue and outer blue with fill blue}};
\pic [draw, very thick, rotate=135]      {myarc={inner blue and outer blue with fill red!40}};
\pic [draw, very thick, rotate=225]      {myarc={inner cyan and outer blue with fill blue}};
\end{tikzpicture}

\end{document}

여기에 이미지 설명을 입력하세요

관련 정보