私が得たいのは次の図です。違いは、曲線が放物線や他の曲線ではなく円弧であることです。これを実現する 1 つの方法は、円のパスを作成し、交差ライブラリを使用して 2 本の線の交点 (y=0、y=2) を見つけることです。ただし、完全な円のパスが仮想的に描画されるため、大きな境界ボックスが生成されるため、問題が発生します。私が望んでいるのは、余白を作らずに円弧を描くことです。どうすればよいでしょうか?
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[auto, scale=1.5]
\draw[fill=gray!50] (0,1.6) -- (0,0) -- (2,0);
\draw[densely dashed] (0,1.6) |- (2, 2.7) -- (2, 1.1);
\coordinate (a) at (0,1.6);
\coordinate (b) at (2,1.1);
\coordinate (o) at (1.4, 2.7);
\draw[|<->|] (0.08, 1.6) -- node {$H$} (0.08, 0);
\draw[|<->|] (1.4, 0.93) -- node {$h$} (1.4, 0);
\end{tikzpicture}
\end{document}
答え1
あなたの質問から、次のようなことを達成したいのだと思います:
arc
これには、コマンドと数学エンジンを使用できます。tikz
どちらも、pgfマニュアル。
\documentclass[tikz, border=2mm]{standalone}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}[scale=2]
\draw [help lines, <->] (0,1.2) |- (1.2,0);
\draw (1,0) arc (0:90:1);
\begin{scope}[|<->|, shorten <= -.2pt, shorten >= -.2pt]
\draw (0,0) -- (0,1) node [midway, right] {$H$};
\draw ({sin(45)},0) -- ({sin(45)}, {cos(45)}) node [midway, right] {$h$};
\end{scope}
\end{tikzpicture}
\end{document}
-コマンドshorten
は、円弧に合わせて矢印の先端の位置を調整するために使用されます。
答え2
答え3
楕円弧を使用した Moospit のソリューションのバリエーション。
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[auto, scale=1.5]
\draw[fill=gray!50] (0,1.6) -- (0,0) -- (2,0);
%\draw[densely dashed] (0,1.6) |- (2, 2.7) -- (2, 1.1);
\coordinate (a) at (0,1.6);
\coordinate (b) at (2,1.1);
\coordinate (o) at (1.4, 2.7);
\draw[|<->|] (0.08, 1.6) -- node {$H$} (0.08, 0);
\draw[|<->|] (1.4, 0.93) -- node {$h$} (1.4, 0);
% compute x radius (assume y radius = 1.6)
\pgfmathparse{1.4/cos(asin(0.93/1.6))}
\let\xr=\pgfmathresult
\draw[densely dashed] (0,1.6) arc[y radius= 1.6,x radius={\xr},start angle=90, end angle=0];
\end{tikzpicture}
\end{document}