4

How to define a new command

\tkzDefRelativePoint[#1,#2,#3](20:2){C}

This command defines a point from #1 and takes the slope of the line #2 , #3 as x axis.

\tkzDefRelativePoint[A,A,B](20:2){C}

This command defines a point from A and takes the slope of the line A , B as x axis.

This is done here using

\tkzFindSlopeAngle(A,B)
\tkzGetAngle{tkzangle}
\begin{scope}[rotate=\tkzangle]
\tkzDefShiftPoint[A](20:2){C}
\end{scope}

MWE

\documentclass[border=2pt]{standalone}
\usepackage[usenames,dvipsnames,svgnames]{xcolor}
\usepackage{tkz-euclide}
\usetkzobj{all}
\definecolor{fondpaille}{cmyk}{0,0,0.1,0}
\pagecolor{fondpaille}
\color{Maroon} 

\begin{document}
\begin{tikzpicture}
\tkzInit[xmax=4, ymax=3]
\tkzAxeXY
\tkzGrid[color=orange]
\tkzDefPoint(1,0){A}
\tkzDefPoint(3,2){B}
\tkzDefShiftPoint[A](20:2){C'}
%
\tkzFindSlopeAngle(A,B)
\tkzGetAngle{tkzangle}
\begin{scope}[rotate=\tkzangle]
\tkzDefShiftPoint[A](20:2){C}
\end{scope}
%
%\tkzDefRelativePoint[A,A,B](20:2){C}
%
\tkzDrawSegment(A,B)
\tkzDrawSegment[color=red](A,C)

\tkzDrawPoints(A,B,C,C')
\tkzLabelPoints(A,B,C,C')
\end{tikzpicture}

\end{document}

enter image description here

4

Of course, in this case, the bracketed term is not "optional", but just part of the syntax.

\documentclass[border=2pt]{standalone}
\usepackage[usenames,dvipsnames,svgnames]{xcolor}
\usepackage{tkz-euclide}
\usetkzobj{all}
\definecolor{fondpaille}{cmyk}{0,0,0.1,0}
\pagecolor{fondpaille}
\color{Maroon} 
\def\tkzDefRelativePoint[#1,#2,#3](#4)#5{%
  \tkzFindSlopeAngle(#2,#3)
  \tkzGetAngle{tkzangle}
  \begin{scope}[rotate=\tkzangle]
  \tkzDefShiftPoint[#1](#4){#5}
  \end{scope}
}    
\begin{document}
\begin{tikzpicture}
\tkzInit[xmax=4, ymax=3]
\tkzAxeXY
\tkzGrid[color=orange]
\tkzDefPoint(1,0){A}
\tkzDefPoint(3,2){B}
\tkzDefShiftPoint[A](20:2){C'}
%
%\tkzFindSlopeAngle(A,B)
%\tkzGetAngle{tkzangle}
%\begin{scope}[rotate=\tkzangle]
%\tkzDefShiftPoint[A](20:2){C}
%\end{scope}
%
\tkzDefRelativePoint[A,A,B](20:2){C}
%
\tkzDrawSegment(A,B)
\tkzDrawSegment[color=red](A,C)

\tkzDrawPoints(A,B,C,C')
\tkzLabelPoints(A,B,C,C')
\end{tikzpicture}

\end{document}

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.