緊畫圓弧(無邊距)

緊畫圓弧(無邊距)

我想要得到的是下面的圖片,不同的是曲線是圓弧,而不是拋物線或其他曲線。實現此目的的一種方法是製作一條圓路徑並使用交集庫來尋找兩條線的交點(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}

示範

相關內容