diff options
author | Karl Berry <karl@freefriends.org> | 2011-06-06 17:17:55 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-06-06 17:17:55 +0000 |
commit | 1116c441adede647c4931c6553046c8d9eb53e0c (patch) | |
tree | eecba89f578294208292dcfcc70db6b8fb3432e8 /Master/texmf-dist/tex/latex/tkz-euclide/tkz-obj-angles.tex | |
parent | 68598d9c664b3d4c11acabdd625b410e3f3d696a (diff) |
new graphics package tkz-euclide (5jun11)
git-svn-id: svn://tug.org/texlive/trunk@22830 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/tkz-euclide/tkz-obj-angles.tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/tkz-euclide/tkz-obj-angles.tex | 332 |
1 files changed, 332 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/tkz-euclide/tkz-obj-angles.tex b/Master/texmf-dist/tex/latex/tkz-euclide/tkz-obj-angles.tex new file mode 100644 index 00000000000..a5acdd76c11 --- /dev/null +++ b/Master/texmf-dist/tex/latex/tkz-euclide/tkz-obj-angles.tex @@ -0,0 +1,332 @@ +% Copyright 2011 by Alain Matthes +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. + + +\def\fileversion{1.16 c} +\def\filedate{2011/06/01} + + %<-------------------------------------------------------------------------–> +\def\tkzGetAngle#1{% +\global\expandafter\edef\csname #1\endcsname{\tkzAngleResult}} + +%<--------------------------------------------------------------------------–> +%<--------------------------------------------------------------------------–> + +%<--------------------------------------------------------------------------–> +% Angle +% Recherche l'angle formé par #1 et #2 par rapport à l'horizontale +%<--------------------------------------------------------------------------–> +\def\tkzFindSlopeAngle(#1,#2){% +\begingroup +\tkzmathanglebetweenpoints{\pgfpointanchor{#1}{center}}{% + \pgfpointanchor{#2}{center}} +\global\let\tkzAngleResult\pgfmathresult +\endgroup +} +%<--------------------------------------------------------------------------–> +% Angle avec trois nodes +%<--------------------------------------------------------------------------–> +\def\tkzFindAngle(#1,#2,#3){% +\begingroup + \tkzFindSlopeAngle(#2,#1)\tkzGetAngle{tkz@FirstAngle} + \tkzFindSlopeAngle(#2,#3)\tkzGetAngle{tkz@SecondAngle} + \FPadd\tkz@Angle{\tkz@SecondAngle}{-\tkz@FirstAngle} + \global\let\tkzAngleResult\tkz@Angle +\endgroup +} +%<--------------------------------------------------------------------------–> +% Find angle +%<--------------------------------------------------------------------------–> +\def\tkzGetAngle#1{% +\global\expandafter\edef\csname #1\endcsname{\tkzAngleResult}} + +%<--------------------------------------------------------------------------–> +% FillAngle +%<--------------------------------------------------------------------------–> +\pgfkeys{/tkzFill/.cd, + size/.code = \global\def\tkz@size{#1}, + /tkzFill/.unknown/.code = {\let\searchname=\pgfkeyscurrentname + \pgfkeysalso{\searchname/.try=#1, + /tikz/\searchname/.retry=#1}}} +%<--------------------------------------------------------------------------–> +\def\tkzFillAngle{\pgfutil@ifnextchar[{\tkz@FillAngle}{\tkz@FillAngle[]}} +\def\tkz@FillAngle[#1](#2,#3,#4){% +\begingroup +\pgfkeys{tkzFill/.cd,size=0.4 cm} +\pgfqkeys{/tkzFill}{#1} +\tkzFindSlopeAngle(#3,#2)\tkzGetAngle{tkz@dirOne} +\tkzFindSlopeAngle(#3,#4)\tkzGetAngle{tkz@dirTwo} +\pgfmathgreaterthan{\tkz@dirOne}{\tkz@dirTwo} + \ifdim\pgfmathresult pt=1 pt\relax% + \pgfmathsubtract{\tkz@dirOne}{360} + \edef\tkz@dirOne{\pgfmathresult}% + \fi + + \path[shift = {(#3)},/tkzFill/.cd,#1]% + (#3) -- (\tkz@dirOne:\tkz@size) arc% + (\tkz@dirOne:\tkz@dirTwo:\tkz@size)--cycle; +\endgroup +} +%<--------------------------------------------------------------------------–> +%<--------------------------------------------------------------------------–> +\def\tkzDrawArcRAN[#1](#2,#3)(#4,#5){% + \begingroup + \pgfmathparse{#4}\edef\tkz@FirstAngle{\pgfmathresult}% + \pgfmathparse{#5}\edef\tkz@SecondAngle{\pgfmathresult}% + \pgfmathgreaterthan{\tkz@FirstAngle}{0} + \ifdim\pgfmathresult pt=1 pt\relax% + \pgfmathgreaterthan{\tkz@FirstAngle}{\tkz@SecondAngle} + \ifdim\pgfmathresult pt=1 pt\relax% + \pgfmathsubtract{\tkz@FirstAngle}{360} + \edef\tkz@FirstAngle{\pgfmathresult}% + \fi + \else + \pgfmathgreaterthan{\tkz@FirstAngle}{\tkz@SecondAngle} + \ifdim\pgfmathresult pt=1 pt\relax% + \pgfmathadd{\tkz@SecondAngle}{360} + \edef\tkz@SecondAngle{\pgfmathresult}% + \fi + \fi + \draw[shift = {(#2)},/drawarc/.cd,#1]% + (\tkz@FirstAngle:#3) arc (\tkz@FirstAngle:\tkz@SecondAngle:#3); +\endgroup +} +%<--------------------------------------------------------------------------–> +% \tkzMarkAngle(B, A, C) +% +% Marque d'angle +% arc de cercle (simple/double/triple) et marque d'églité. +% +% Par défaut: +% arc = simple +% longueur = 1cm (rayon de l'arc) +% style traits pleins +% position: 0.5 (position de la marque) +% mark rien du tout (ignoré si type est utilisé) +% +% Paramètres (optionnels) +% arc : l, ll, lll +% length : 1cm +% gap : 2pt +% style : type de traits +% type : none, |, ||,|||, z, s, x, o, oo +% position: 0.5 +% mark : none , |, ||,|||, z, s, x, o, oo mais tous les +% % symboles de tikz sont permis +%<--------------------------------------------------------------------------–> +\edef\tkz@arcsimple{l} +\edef\tkz@arctriple{lll} +\edef\tkz@arcdouble{ll} +\tikzset{lbstyle/.style ={color=\tkz@mainlinecolor}} + +\pgfkeys{/tkzmkangle/.cd, +mark/.code = {\global\def\tkz@mark{#1}}, +size/.code = {\global\def\tkz@size{#1}}, +mkpos/.code = {\global\edef\tkz@mkpos{#1}}, +mksize/.code = {\global\def\tkz@mksize{#1}}, +mkcolor/.code = {\global\def\tkz@mkcolor{#1}}, +label/.code = {\global\def\tkz@mklabel{#1}}, +arc/.code = {\global\def\tkz@arc{#1}}, +dist/.code = {\global\def\tkz@dist{#1}}, +label style/.code = {\tikzset{lbstyle/.append style ={#1}}}, +/tkzmkangle/.unknown/.code = {\let\searchname=\pgfkeyscurrentname + \pgfkeysalso{\searchname/.try=#1, + /tikz/\searchname/.retry=#1} + } +} \def\tkzMarkAngle{\pgfutil@ifnextchar[{\tkz@MarkAngle}{\tkz@MarkAngle[]}} +\def\tkz@MarkAngle[#1](#2,#3,#4){% +\begingroup +\pgfkeys{tkzmkangle/.cd, + arc = l, + size = 1, + mksize = 4pt, + mkcolor = \tkz@mainlinecolor, + mkpos = 0.5, + mark = none, + dist = 1, + label = {} + } + +\pgfqkeys{/tkzmkangle}{#1} +%<--------------------------------------------------------------------------–> +\tkzFindSlopeAngle(#3,#2)\tkzGetAngle{tkz@dirOne} +\tkzFindSlopeAngle(#3,#4)\tkzGetAngle{tkz@dirTwo} +\begin{scope} + \ifx\tkz@arc\tkz@arcsimple + \tkzDrawArcRAN[#1,fill=none](#3,\tkz@size)(\tkz@dirOne,\tkz@dirTwo) + \else + \ifx\tkz@arc\tkz@arcdouble + \tkzDrawArcRAN[#1,fill=none](#3,\tkz@size-1.5\pgflinewidth)% + (\tkz@dirOne,\tkz@dirTwo) + \tkzDrawArcRAN[#1,fill=none](#3,\tkz@size+1.5\pgflinewidth)% + (\tkz@dirOne,\tkz@dirTwo) + \else + \ifx\tkz@arc\tkz@arctriple + \tkzDrawArcRAN[#1,fill=none](#3,\tkz@size)(\tkz@dirOne,\tkz@dirTwo) + \tkzDrawArcRAN[#1,fill=none](#3,\tkz@size-2\pgflinewidth)% + (\tkz@dirOne,\tkz@dirTwo) + \tkzDrawArcRAN[#1,fill=none](#3,\tkz@size+2\pgflinewidth)% + (\tkz@dirOne,\tkz@dirTwo) + \fi + \fi + \fi +\end{scope} +\FPeval\labelangle{(\tkz@dirTwo + \tkz@dirOne)/2} +\tkz@@extractxy{#3} + \tkz@ax=\pgf@x% + \tkz@ay=\pgf@y% +\begin{scope} + \node[lbstyle,shift={(\tkz@ax,\tkz@ay)}] at (\labelangle:\tkz@dist ){\tkz@mklabel}; +\end{scope} + +%<--------------------------------------------------------------------------–> +% les marques, aucune si mktype = none +\global\def\tkz@mymark{% + \pgfsetplotmarksize{\tkz@mksize} + \pgfuseplotmark{\tkz@mark} +} +\begin{scope}[decoration={markings,mark=at position \tkz@mkpos with {\tkz@mymark}}] + \pgfmathgreaterthan{\tkz@dirOne}{\tkz@dirTwo} + \ifdim\pgfmathresult pt=1 pt\relax% + \pgfmathsubtract{\tkz@dirOne}{360} + \edef\tkz@dirOne{\pgfmathresult}% + \fi + \path [\tkz@mkcolor,postaction={decorate},/tkzmkangle/.cd,#1]% +(#3)--++(\tkz@dirOne:\tkz@size) arc(\tkz@dirOne:\tkz@dirTwo:\tkz@size)--cycle; +\end{scope} +\endgroup +} +%<--------------------------------------------------------------------------–> +%<--------------------------------------------------------------------------–> +%<--------------------------------------------------------------------------–> +% multiple +\def\tkz@multiMA#1 #2\@nil{% + \protected@edef\tkz@temp{ + \noexpand \tkzMarkAngle[\tkz@optma](#1)}\tkz@temp% + \def\tkz@nextArg{#2}% + \ifx\tkzutil@empty\tkz@nextArg + \let\next\@gobble + \fi + \next#2\@nil +} +%<--------------------------------------------------------------------------–> +\def\tkzMarkAngles{\pgfutil@ifnextchar[{\tkz@MarkAngles}{\tkz@MarkAngles[]}} +\def\tkz@MarkAngles[#1](#2){% +\global\edef\tkz@optma{#1} + \begingroup + \let\next\tkz@multiMA + \next#2 \@nil % +\endgroup +} +%<--------------------------------------------------------------------------–> +% % % fin de \tkzMarkAngle +% %<--------------------------------------------------------------------------–> +%<--------------------------------------------------------------------------–> +%<------------------------- Label on angle -------------------------------–> +%<--------------------------------------------------------------------------–> +\pgfkeys{tkzlabelangle/.cd, +dist/.code = {\global\def\labeldist{#1}}, +/tkzlabelangle/.unknown/.code = {\let\searchname=\pgfkeyscurrentname + \pgfkeysalso{\searchname/.try=#1, + /tikz/\searchname/.retry=#1} + } +} +\def\tkzLabelAngle{\pgfutil@ifnextchar[{\tkz@LabelAngle}{% + \tkz@LabelAngle[]}} +\def\tkz@LabelAngle[#1](#2,#3,#4)#5{% +\begingroup +\pgfkeys{tkzlabelangle/.cd, + dist = 1} +\pgfqkeys{/tkzlabelangle}{#1} +\tkzFindSlopeAngle(#3,#2)\tkzGetAngle{tkz@dirOne} +\tkzFindSlopeAngle(#3,#4)\tkzGetAngle{tkz@dirTwo} +\FPeval\labelAngle{( \tkz@dirOne +\tkz@dirTwo)/2} +\path (#3) --+(\labelAngle:\labeldist) node[/tkzmkangle/.cd,#1] {#5}; +\endgroup +} +%<--------------------------------------------------------------------------–> +%<--------------------------------------------------------------------------–> +% multiple labels +\def\tkz@multiLBA#1 #2\@nil{% + \protected@edef\tkz@temp{ + \noexpand \tkzLabelAngle[\tkz@optlba](#1){\tkz@labelangle}}\tkz@temp% + \def\tkz@nextArg{#2}% + \ifx\tkzutil@empty\tkz@nextArg + \let\next\@gobble + \fi + \next#2\@nil +} +% %<--------------------------------------------------------------------------–> +\def\tkzLabelAngles{\pgfutil@ifnextchar[{\tkz@LabelAngles}{% + \tkz@LabelAngles[]}} +\def\tkz@LabelAngles[#1](#2)#3{% + \global\edef\tkz@optlba{#1} + \global\def\tkz@labelangle{#3} + \begingroup + \let\next\tkz@multiLBA + \next#2 \@nil % + \endgroup +} +%<--------------------------------------------------------------------------–> +%<--------------------------------------------------------------------------–> +% Symbole droites perpendiculaires MAUVAIS +%<--------------------------------------------------------------------------–> + \pgfkeys{tkzright/.cd, + size/.code = {\global\def\tkz@ra@size{#1}}, + /tkzright/.unknown/.code = {\let\searchname=\pgfkeyscurrentname + \pgfkeysalso{\searchname/.try=#1, + /tikz/\searchname/.retry=#1} + } +} + +\newcommand*{\tkzMarkRightAngle}[1][]{\tkz@RightAngle[#1]} +\def\tkz@RightAngle[#1](#2,#3,#4){% +\begingroup +\pgfkeys{tkzright/.cd, + size = .22} +\pgfqkeys{/tkzright}{#1} + \tkzpointnormalised{\pgfpointdiff{\pgfpointanchor{#3}{center}}{% + \pgfpointanchor{#2}{center}}} + \tkz@ax=\pgf@x\relax% + \tkz@ay=\pgf@y\relax% + + \tkzpointnormalised{\pgfpointdiff{\pgfpointanchor{#3}{center}}{% + \pgfpointanchor{#4}{center}}} + \tkz@bx=\pgf@x\relax% + \tkz@by=\pgf@y\relax% + \path[]% + (#3)--++% + ( 28.45274*\tkz@ra@size\tkz@ax , 28.45274*\tkz@ra@size\tkz@ay)% + coordinate (tkz@ra1)--++% + ( 28.45274*\tkz@ra@size\tkz@bx ,28.45274*\tkz@ra@size\tkz@by) + coordinate (tkz@ra2)--++% + (-28.45274*\tkz@ra@size\tkz@ax ,-28.45274*\tkz@ra@size\tkz@ay) + coordinate (tkz@ra3);% + \draw[/tkzright/.cd,#1] (#3)--(tkz@ra1)--(tkz@ra2)--(tkz@ra3)--cycle; +\endgroup +} + +\def\tkz@multiRA#1 #2\@nil{% + \protected@edef\tkz@temp{ + \noexpand \tkzMarkRightAngle[\tkz@optRA](#1)}\tkz@temp% + \def\tkz@nextArg{#2}% + \ifx\tkzutil@empty\tkz@nextArg + \let\next\@gobble + \fi + \next#2\@nil +} +\def\tkzMarkRightAngles{\pgfutil@ifnextchar[{\tkz@RightAngles}{% + \tkz@RightAngles[]}} +\def\tkz@RightAngles[#1](#2){% +\global\edef\tkz@optRA{#1} + \begingroup + \let\next\tkz@multiRA + \next#2 \@nil % +\endgroup +} +\endinput +
\ No newline at end of file |