2

What I want to get is the following picture, with a difference that the curve is an arc, not parabola or other curve. One way to achieve this is to make a path of circle and use intersections library, to find intersections of two lines(y=0, y=2). However, there is a problem since large bounding box will be generated since a path of full circle was drawn virtually. What I want is to draw an arc, while not making any margins. How can I do this?

\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}

enter image description here

Thruston
  • 42,268
Laplacian
  • 960
  • Sorry but there is no way to import pdf picture here. – Laplacian Apr 27 '17 at 11:50
  • View the pdf on the screen and make a screen shot. You can upload pictures. I'm afraid that without a picture it is not clear what you are asking. – gernot Apr 27 '17 at 11:53
  • 2
    Why don't you show the code with the arc (and the bad margins)? Anyway, https://tex.stackexchange.com/questions/85836/tikz-ignore-one-path-in-bounding-box-calculation might be helpful. – Torbjørn T. Apr 27 '17 at 11:55

3 Answers3

2

From your question i guess you want to achieve something like this: rendered image

For this you can use the arc-command and the mathematical engine of tikz which both are perfectly documented in the pgfmanual.

\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}

The shorten-commands are used to adjust the arrowtip's position to fit the arc.

moospit
  • 4,456
2

If you actually want to fit an arc to three points, I worked out the math:

math

John Kormylo
  • 79,712
  • 3
  • 50
  • 120
0

A variation on Moospit's solution using an elliptical arc.

\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}

demo

John Kormylo
  • 79,712
  • 3
  • 50
  • 120