1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

TikZでかいた図形

Last updated at Posted at 2021-01-30

TikZでかいた図形

image.png

\begin{tikzpicture}
%長さを描くためのマクロ
\def\preleng#1#2#3#4#5{
\draw (#1).. controls ($(#1)!.2!(#2)!{#4}!{#5}:(#2)$)
and ($(#1)!.8!(#2)!{#4}!{#5}:(#2)$) .. (#2)
node[midway, fill=white, inner sep = 0.3pt] (#1-#2) {#3}
}

%頂点
\tikzmath{
    \O{1} = 0;
    \O{2} = 0;
    \A{1} = 0;
    \A{2} = 4.5;
    \B{1} = 0;
    \B{2} = 0;
    \C{1} = 6;
    \C{2} = 0;
    \Radii{1} = 0.5*\C{1};
    \Radii{2} = 0.5*\A{2};
}
\coordinate (O) at (\O{1},\O{2});
\coordinate (A) at (\A{1},\A{2});
\coordinate (B) at (O);
\coordinate (C) at (\C{1},\C{2});


%三角形をかく
    \draw[very thick](A) -- (B) --(C) --cycle;

%頂点の名前
\node[above left] at (A) {A}
    node[below left] at (B) {B}
    node[below right] at (C) {C};


%半円を描く
%左側
    \draw[name path = C,very thick,samples=100,domain=-90:90] plot ({\Radii{2}*cos(\x)+0.5*\A{1}},{\Radii{2}*sin(\x)+0.5*\A{2}});
%右側
    \draw[name path = L,very thick,samples=100,domain=0:180] plot ({\Radii{1}*cos(\x)+0.5*\C{1}},{\Radii{1}*sin(\x)+0.5*\C{2}});


%交点を作成
\path[name intersections={of=L and C}] (intersection-1) coordinate (D);
    \node[above right] at (D) {D};




%斜線
\begin{scope}
\tikzmath{
    \hwidth = 0.2;
    \lineRange = 20;
    \dirVecx = 2;
    \dirVecy = 1;
}
\coordinate (dirVec) at (\dirVecx,\dirVecy);

\clip
[samples=100,domain=18:90] plot ({\Radii{2}*cos(\x)+0.5*\A{1}},{\Radii{2}*sin(\x)+0.5*\A{2}}) -- (D)
[samples=100,domain=0:107] plot ({\Radii{1}*cos(\x)+0.5*\C{1}},{\Radii{1}*sin(\x)+0.5*\C{2}}) -- (C)
[samples=100,domain=107:180] plot ({\Radii{1}*cos(\x)+0.5*\C{1}},{\Radii{1}*sin(\x)+0.5*\C{2}})
[samples=100,domain=-90:18] plot ({\Radii{2}*cos(\x)+0.5*\A{1}},{\Radii{2}*sin(\x)+0.5*\A{2}})
;
\foreach \x in {-100,...,100}
    {
    \draw ($(\x*\hwidth,0)+\lineRange*(dirVec)$) -- ($(\x*\hwidth,0)-\lineRange*(dirVec)$);
    }
\end{scope}

%長さを書く
\def\wrleng(#1-#2)#3{
\preleng{#1}{#2}{#3}{25pt}{-90}
}%
\wrleng (A-B){6 \unicm };

\def\wrleng(#1-#2)#3{
\preleng{#1}{#2}{#3}{25pt}{-90}
}%
\wrleng (A-C){10 \unicm };

\def\wrleng(#1-#2)#3{
\preleng{#1}{#2}{#3}{20pt}{-90}
}%
\wrleng (B-C){8 \unicm };

\def\wrleng(#1-#2)#3{
\preleng{#1}{#2}{#3}{25pt}{-90}
}%
\wrleng (A-C){10 \unicm };
\end{tikzpicture}
\end{preview}

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?