1

I know that \tkzDrawLine(A,B) tkz-euclide draws a line between points A and B. However, I need to draw a ray that starts at A and goes through B. How can I do this?

1
  • You can do that with -> in the option for drawing a segment. The code below doesn't have the arrow (to indicate the ray) you want. Replace the line in Brent's code drawing the segment with \tkzDrawSegment[->](A,C)
    – DJP
    Nov 6, 2016 at 16:00

2 Answers 2

5

Strictly speaking, I think, a ray is semi-infinite, and so impossible to draw. As an approximation, you can extend your line segment to a third point, and draw the 'truncated ray' thus:

\documentclass{article}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\noindent
\begin{tikzpicture}
\tkzInit[ymin=0,ymax=5,xmin=0,xmax=8]
\tkzClip
\tkzDefPoint(1,1){A}
\tkzDefPoint(3,2){B}
\tkzDefPointBy[homothety=center A ratio 1.5](B) \tkzGetPoint{C}
\tkzDrawSegments(A,C)
\tkzDrawPoints(A,B)
\tkzLabelPoints(A,B)
\end{tikzpicture}\\
\end{document}​

image of output

0

Simple manner, without tkzeuclide only using [pos = x] to set the position of the point on a path

enter image description here

\begin{document}

\begin{tikzpicture}

\node[draw,circle,label={A}] (A) at (0,0){};
\node[draw,circle,label={B}] (B) at (2,-3){};
\node[draw,circle,label={C}] (C) at (3,1){};

\draw (A) -- (C)  coordinate[pos=1.8](ff2) -- (ff2);
\path (A) -- (B) coordinate[pos=-0.5](dd) coordinate[pos=1.8](ff);
\draw (dd) -- (ff);
\end{tikzpicture}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .