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

  • Sorry but there is no way to import pdf picture here. – eigenvalue 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, tex.stackexchange.com/questions/85836/… might be helpful. – Torbjørn T. Apr 27 '17 at 11:55
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.

1

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

math

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

  • Alternatively \pgfmathsetmacro{\xr}{1.4/cos(asin(0.93/1.6))}, or quite simply x radius={1.4/cos(asin(0.93/1.6))}. – Torbjørn T. Apr 27 '17 at 14:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.