Füllen Sie das Innere eines zufällig konstruierten geschlossenen Pfades

Füllen Sie das Innere eines zufällig konstruierten geschlossenen Pfades

Ich bin nicht sicher, wie ich vorgehen soll, um das Innere eines zufällig generierten (über eine zufällige Dekoration) Pfades zu füllen.

Ich habe mit dem Code begonnen, der in der Antwort auf diese Frage angegeben ist.Frageund daran gearbeitet, da der grundlegende Zweck damit zusammenhing.

BildJa

Die Füllung und die gezeichnete Linie sind nicht ganz identisch, da auf beide eine zufällige Dekoration angewendet wurde.

FRAGE)

Wie wende ich die Füllung auf den durch die gezeichnete Linie begrenzten Innenraum an?

(Und übrigens, wie mache ich in diesem Fall die Dekorationspfeile größer? Kann ich Dekorationspfeile auch auf den gezeichneten Pfad anwenden, ohne die andere Dekoration zu zerstören?)

\documentclass[border=0pt]{standalone}\usepackage{mathtools,tikz,tkz-euclide}\usetikzlibrary{decorations.markings,arrows,decorations.pathmorphing}\usetkzobj{all}\begin{document}\begin{tikzpicture}[label]\tkzInit[xmin=-0.8,xmax=10,ymin=-0.4,ymax=8.4] \tkzClip
\tikzset{every node}=[font=\normalsize]

%here_we_make_such_a_dashing
\tikzstyle{finelydashed}=[dash pattern=on 4pt off 7pt]
\tikzstyle{coarselydashed}=[dash pattern=on 7pt off 8pt]

%here_we_make_such_a_shading
\pgfdeclarepatternformonly{ltrdiagonals}%
{\pgfqpoint{-1pt}{-1pt}}{\pgfqpoint{10pt}{10pt}}%
{\pgfqpoint{9pt}{9pt}}{\pgfsetlinewidth{0.4pt}\pgfpathmoveto{\pgfqpoint{0pt}{0pt}}%
\pgfpathlineto{\pgfqpoint{9.1pt}{9.1pt}}%
\pgfusepath{stroke}}%

%here_we_make_such_a_grid
\draw[help lines,color=black!90](0,0)grid(8,8);

%here_we_define_our_several_points
\tkzDefPoint(1,2){v}\tkzDefPoint(7,2){w}  
\tkzDefPointBy[rotation=center w angle -42](v)
\tkzGetPoint{C}
\tkzDefPointBy[rotation=center v angle 63](w)
\tkzGetPoint{D}
\tkzInterLL(v,D)(C,w)\tkzGetPoint{x}


\tkzDefMidPoint(v,x)\tkzGetPoint{M}

\draw[shade,top color=black!96,bottom color=black!16,fill opacity=0.64,decoration=   {random steps,segment length=22pt,amplitude=11pt},decorate,line width=2pt,rounded corners=8pt](v)--(1.7,3.2)--(4,4)--(6,3)--(w)--(7.4,1)--(0.4,0.4)--(v);
\fill[even odd rule,pattern=ltrdiagonals,pattern color=black!84,decoration={random steps,segment length=24pt,amplitude=0.24cm},decorate,line width=2pt,rounded corners=8pt](v)--(1.7,3.2)--(4,4)--(6,3)--(w)--(7.4,1)--(0.4,0.4)--(v);

%here_we_label_each_node_so
\tkzLabelPoint[above left](v){\LARGE $\boldsymbol{\mathbf{H}_{\;n\;v}}\,$}
\tkzLabelPoint[above left](x){\LARGE $\mathbf{x_{\;n}}$}  
\tkzLabelPoint[right](w){\LARGE $\;\boldsymbol{\mathbf{H}_{\;n\;w}}$}
\tkzLabelAngle[pos=0.64](v,x,w){\large $\boldsymbol{\varphi}$}
\tkzLabelAngle[pos=0.64](w,v,x){\large $\boldsymbol{\rho}$}
\tkzLabelPoint[left](M){$\boldsymbol{2\cdot\mu}\;$}

%here_we_construct_each_line_so
\begin{scope}[decoration={markings,mark=at position 0.5 with {\LARGE\arrow{triangle 45},color=black!96}}]
\draw[-,decorate](v)--(x);
\draw[-,decorate](v)--(w);
\draw[-,decorate](x)--(w);
\end{scope}
\draw[-,line width=1.2pt,coarselydashed,color=black!96](v)--(x);
\draw[-,line width=1.2pt,coarselydashed,color=black!96](v)--(w);
\draw[-,line width=1.2pt,coarselydashed,color=black!96](x)--(w);
\tkzDrawPoints[color=black,shape=circle,fill=black!64,size=16pt](v,x,w)
\tkzMarkAngle[scale=1,line width=1.2pt,finelydashed,color=black!96](v,x,w)
\tkzMarkAngle[scale=1,line width=1.2pt,finelydashed,color=black!96](w,v,x)
\end{tikzpicture}\end{document}

Bildbeschreibung hier eingeben

Antwort1

Sie müssen denselben Pfad mit postaction,preactionSchlüsseln wiederverwenden.

\documentclass[border=0pt]{standalone}
\usepackage{mathtools,tikz,tkz-euclide}\usetikzlibrary{decorations.markings,arrows,decorations.pathmorphing}
\usetkzobj{all}
\begin{document}
\begin{tikzpicture}[label]
\tkzInit[xmin=-0.8,xmax=10,ymin=-0.4,ymax=8.4] 
\tkzClip
\tikzset{every node}=[font=\normalsize]
%here_we_make_such_a_dashing
\tikzstyle{finelydashed}=[dash pattern=on 4pt off 7pt]
\tikzstyle{coarselydashed}=[dash pattern=on 7pt off 8pt]

%here_we_make_such_a_shading
\pgfdeclarepatternformonly{ltrdiagonals}%
{\pgfqpoint{-1pt}{-1pt}}{\pgfqpoint{10pt}{10pt}}%
{\pgfqpoint{9pt}{9pt}}{\pgfsetlinewidth{0.4pt}\pgfpathmoveto{\pgfqpoint{0pt}{0pt}}%
\pgfpathlineto{\pgfqpoint{9.1pt}{9.1pt}}%
\pgfusepath{stroke}}%

%here_we_make_such_a_grid
\draw[help lines,color=black!90](0,0)grid(8,8);

%here_we_define_our_several_points
\tkzDefPoint(1,2){v}\tkzDefPoint(7,2){w}  
\tkzDefPointBy[rotation=center w angle -42](v)
\tkzGetPoint{C}
\tkzDefPointBy[rotation=center v angle 63](w)
\tkzGetPoint{D}
\tkzInterLL(v,D)(C,w)\tkzGetPoint{x}


\tkzDefMidPoint(v,x)\tkzGetPoint{M}

\draw[%shade,
     top color=black!96,
     bottom color=black!16,
     fill opacity=0.64,
     decoration={random steps,segment length=22pt,amplitude=11pt},
     decorate,
     line width=2pt,
     rounded corners=8pt,
     postaction={fill,pattern=ltrdiagonals,pattern color=black!84}
     ](v)--(1.7,3.2)--(4,4)--(6,3)--(w)--(7.4,1)--(0.4,0.4)--(v);


%here_we_label_each_node_so
\tkzLabelPoint[above left](v){\LARGE $\boldsymbol{\mathbf{H}_{\;n\;v}}\,$}
\tkzLabelPoint[above left](x){\LARGE $\mathbf{x_{\;n}}$}  
\tkzLabelPoint[right](w){\LARGE $\;\boldsymbol{\mathbf{H}_{\;n\;w}}$}
\tkzLabelAngle[pos=0.64](v,x,w){\large $\boldsymbol{\varphi}$}
\tkzLabelAngle[pos=0.64](w,v,x){\large $\boldsymbol{\rho}$}
\tkzLabelPoint[left](M){$\boldsymbol{2\cdot\mu}\;$}

%here_we_construct_each_line_so
\begin{scope}[decoration={markings,mark=at position 0.5 with {\LARGE\arrow{triangle 45},color=black!96}}]
\draw[-,decorate](v)--(x);
\draw[-,decorate](v)--(w);
\draw[-,decorate](x)--(w);
\end{scope}
\draw[-,line width=1.2pt,coarselydashed,color=black!96](v)--(x);
\draw[-,line width=1.2pt,coarselydashed,color=black!96](v)--(w);
\draw[-,line width=1.2pt,coarselydashed,color=black!96](x)--(w);
\tkzDrawPoints[color=black,shape=circle,fill=black!64,size=16pt](v,x,w)
\tkzMarkAngle[scale=1,line width=1.2pt,finelydashed,color=black!96](v,x,w)
\tkzMarkAngle[scale=1,line width=1.2pt,finelydashed,color=black!96](w,v,x)
\end{tikzpicture}
\end{document}

Bildbeschreibung hier eingeben

Wie Sie sehen, random stepsfunktioniert die rounded cornersOption nicht gut. Schauen Sie sich auch anSollten \tikzset oder \tikzstyle zum Definieren von TikZ-Stilen verwendet werden?

verwandte Informationen