summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-points.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-points.tex')
-rw-r--r--Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-points.tex146
1 files changed, 118 insertions, 28 deletions
diff --git a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-points.tex b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-points.tex
index ae7e3e142b2..931a6a7bcf9 100644
--- a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-points.tex
+++ b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-points.tex
@@ -38,7 +38,7 @@ coordinate.
\pgfpathcircle{\pgfpoint{2cm}{5pt}} {2pt}
\pgfpathcircle{\pgfpoint{0pt}{.5in}}{2pt}
\pgfusepath{fill}
-\end{tikzpicture}
+\end{tikzpicture}
\end{codeexample}
\end{command}
@@ -69,7 +69,7 @@ coordinate.
\foreach \angle in {0,10,...,90}
{\pgfpathcircle{\pgfpointpolar{\angle}{1cm/2cm}}{2pt}}
\pgfusepath{fill}
-\end{tikzpicture}
+\end{tikzpicture}
\end{codeexample}
\end{command}
@@ -94,19 +94,19 @@ $y$-vector do not necessarily point ``horizontally'' and
\pgfpathmoveto{\pgfpointxy{1}{0}}
\pgfpathlineto{\pgfpointxy{2}{2}}
\pgfusepath{stroke}
-\end{tikzpicture}
+\end{tikzpicture}
\end{codeexample}
\end{command}
\begin{command}{\pgfsetxvec\marg{point}}
Sets that current $x$-vector for usage in the $xyz$-coordinate
- system.
+ system.
\example
\begin{codeexample}[]
\begin{tikzpicture}
\draw[help lines] (0,0) grid (3,2);
-
+
\pgfpathmoveto{\pgfpointxy{1}{0}}
\pgfpathlineto{\pgfpointxy{2}{2}}
\pgfusepath{stroke}
@@ -116,7 +116,7 @@ $y$-vector do not necessarily point ``horizontally'' and
\pgfpathmoveto{\pgfpointxy{1}{0}}
\pgfpathlineto{\pgfpointxy{2}{2}}
\pgfusepath{stroke}
-\end{tikzpicture}
+\end{tikzpicture}
\end{codeexample}
\end{command}
@@ -131,7 +131,7 @@ $y$-vector do not necessarily point ``horizontally'' and
\meta{radius} is now a factor to be interpreted in the
$xy$-coordinate system. This means that a degree of |0| is the same
as the $x$-vector of the $xy$-coordinate system times \meta{radius}
- and a degree of |90| is the $y$-vecotr times \meta{radius}. As for
+ and a degree of |90| is the $y$-vector times \meta{radius}. As for
|\pgfpointpolar|, a \meta{radius} can also be a pair separated by a
slash. In this case, the $x$- and $y$-vectors are multiplied by
different factors.
@@ -163,7 +163,7 @@ three dimensional graphics.
\begin{codeexample}[]
\begin{pgfpicture}
\pgfsetarrowsend{to}
-
+
\pgfpathmoveto{\pgfpointorigin}
\pgfpathlineto{\pgfpointxyz{0}{0}{1}}
\pgfusepath{stroke}
@@ -214,7 +214,7 @@ using spherical and cylindrical coordinates.
\pgfsetfillcolor{lightgray}
\foreach \latitude in {-90,-75,...,30}
- {
+ {
\foreach \longitude in {0,20,...,360}
{
\pgfpathmoveto{\pgfpointspherical{\longitude}{\latitude}{1}}
@@ -245,7 +245,7 @@ coordinates.
\begin{tikzpicture}
\draw[help lines] (0,0) grid (3,2);
\pgfpathcircle{\pgfpointadd{\pgfpoint{1cm}{0cm}}{\pgfpoint{1cm}{1cm}}}{2pt}
- \pgfusepath{fill}
+ \pgfusepath{fill}
\end{tikzpicture}
\end{codeexample}
\end{command}
@@ -256,7 +256,7 @@ coordinates.
\begin{tikzpicture}
\draw[help lines] (0,0) grid (3,2);
\pgfpathcircle{\pgfpointscale{1.5}{\pgfpoint{1cm}{0cm}}}{2pt}
- \pgfusepath{fill}
+ \pgfusepath{fill}
\end{tikzpicture}
\end{codeexample}
\end{command}
@@ -267,7 +267,7 @@ coordinates.
\begin{tikzpicture}
\draw[help lines] (0,0) grid (3,2);
\pgfpathcircle{\pgfpointdiff{\pgfpoint{1cm}{0cm}}{\pgfpoint{1cm}{1cm}}}{2pt}
- \pgfusepath{fill}
+ \pgfusepath{fill}
\end{tikzpicture}
\end{codeexample}
\end{command}
@@ -293,9 +293,9 @@ coordinates.
\pgfpathcircle{\pgfpoint{2cm}{1cm}}{2pt}
\pgfpathcircle{\pgfpointscale{20}
{\pgfpointnormalised{\pgfpoint{2cm}{1cm}}}}{2pt}
- \pgfusepath{fill}
+ \pgfusepath{fill}
\end{tikzpicture}
-\end{codeexample}
+\end{codeexample}
\end{command}
@@ -331,7 +331,7 @@ on Bézier curves.
\foreach \t in {0,0.25,...,1.25}
{\pgftext[at=
\pgfpointlineattime{\t}{\pgfpointorigin}{\pgfpoint{2cm}{2cm}}]{\t}}
-\end{tikzpicture}
+\end{tikzpicture}
\end{codeexample}
\end{command}
@@ -350,12 +350,12 @@ on Bézier curves.
\foreach \d in {0pt,20pt,40pt,70pt}
{\pgftext[at=
\pgfpointlineatdistance{\d}{\pgfpointorigin}{\pgfpoint{3cm}{2cm}}]{\d}}
-\end{tikzpicture}
+\end{tikzpicture}
\end{codeexample}
\end{command}
\begin{command}{\pgfpointcurveattime\marg{time $t$}\marg{point
- $p$}\marg{point $s_1$}\marg{point $s_2$}\marg{point $q$}}
+ $p$}\marg{point $s_1$}\marg{point $s_2$}\marg{point $q$}}
Yields a point that is on the Bézier curve from $p$ to $q$ with the
support points $s_1$ and $s_2$. The time $t$ is used to determine
the location, where $t=0$ yields $p$ and $t=1$ yields $q$.
@@ -372,7 +372,7 @@ on Bézier curves.
{\pgfpoint{0cm}{2cm}}
{\pgfpoint{0cm}{2cm}}
{\pgfpoint{3cm}{2cm}}]{\t}}
-\end{tikzpicture}
+\end{tikzpicture}
\end{codeexample}
\end{command}
@@ -407,7 +407,7 @@ mechanism to determine border points of shapes.
\pgfpathcircle{\pgfpointborderrectangle
{\pgfpoint{-10pt}{5pt}}{\pgfpoint{1cm}{1.25cm}}}{2pt}
\pgfusepath{fill}
-\end{tikzpicture}
+\end{tikzpicture}
\end{codeexample}
\end{command}
@@ -432,7 +432,7 @@ mechanism to determine border points of shapes.
\pgfpathcircle{\pgfpointborderellipse
{\pgfpoint{-10pt}{5pt}}{\pgfpoint{1cm}{1.25cm}}}{2pt}
\pgfusepath{fill}
-\end{tikzpicture}
+\end{tikzpicture}
\end{codeexample}
\end{command}
@@ -456,7 +456,7 @@ mechanism to determine border points of shapes.
{\pgfpointxy{1}{2}}{\pgfpointxy{2}{0}}}
{2pt}
\pgfusepath{stroke}
-\end{tikzpicture}
+\end{tikzpicture}
\end{codeexample}
\end{command}
@@ -481,15 +481,92 @@ mechanism to determine border points of shapes.
{1cm}{0.8cm}{1}}
{2pt}
\pgfusepath{stroke}
-\end{tikzpicture}
+\end{tikzpicture}
\end{codeexample}
\end{command}
+\subsubsection{Points on the Intersection of Two Paths}
+
+
+\begin{pgflibrary}{intersections}
+ This library defines the below command and allows you to calculate
+ the intersections of two arbitrary paths. However, due to the low accuracy of
+ \TeX, the paths should not be ``too complicated''.
+ In particular, you should not try to intersect paths consisting
+ lots of very small segments such as plots or decorated paths.
+\end{pgflibrary}
+
+\begin{command}{\pgfintersectionofpaths\marg{path 1}\marg{path 2}}
+ This command finds the intersection points on the paths
+ \meta{path 1} and \meta{path 2}. The number of intersection points
+ (``solutions'') that are found will be stored, and each point
+ can be accessed afterward. The code for \meta{path 1} and
+ \meta{path 2} is executed within a \TeX{} group and so can contain
+ transformations (which will be in addition to any existing
+ transformations). The code should not use the path in any way,
+ unless the path is saved first and restored afterward.
+ \pgfname{} will regard solutions as ``a bit
+ special'', in that the points returned will be ``absolute'' and
+ unaffected by any further transformations.
+
+\begin{codeexample}[]
+\begin{pgfpicture}
+\pgfintersectionofpaths
+{
+ \pgfpathellipse{\pgfpointxy{0}{0}}{\pgfpointxy{1}{0}}{\pgfpointxy{0}{2}}
+ \pgfgetpath\temppath
+ \pgfusepath{stroke}
+ \pgfsetpath\temppath
+}
+{
+ \pgftransformrotate{-30}
+ \pgfpathrectangle{\pgfpointorigin}{\pgfpointxy{2}{2}}
+ \pgfgetpath\temppath
+ \pgfusepath{stroke}
+ \pgfsetpath\temppath
+}
+\foreach \s in {1,...,\pgfintersectionsolutions}
+ {\pgfpathcircle{\pgfpointintersectionsolution{\s}}{2pt}}
+\pgfusepath{stroke}
+\end{pgfpicture}
+\end{codeexample}
+
+ \begin{command}{\pgfintersectionsolutions}
+ After using the |\pgfintersectionofpaths| command, this \TeX-macro
+ will indicate the number of solutions found.
+ \end{command}
+
+ \begin{command}{\pgfpointintersectionsolution\marg{number}}
+ After using the |\pgfintersectionofpaths| command, this command
+ will return the point for solution \meta{number} or the origin
+ if this solution was not found.
+ By default, the intersections are simply returned in the order that
+ the intersection algorithm finds them. Unfortunately, this is not
+ necessarily a ``helpful'' ordering. However the following two
+ commands can be used to order the solutions more helpfully.
+ \end{command}
+
+\let\ifpgfintersectionsortbyfirstpath=\relax
+ \begin{command}{\pgfintersectionsortbyfirstpath}
+ Using this command will mean the solutions will be sorted along
+ \meta{path 1}.
+ \end{command}
+
+\let\ifpgfintersectionsortbysecondpath=\relax
+ \begin{command}{\pgfintersectionsortbysecondpath}
+ Using this command will mean the solutions will be sorted along
+ \meta{path 2}.
+ \end{command}
+
+\end{command}
+
+
+
\subsection{Extracting Coordinates}
There are two commands that can be used to ``extract'' the $x$- or
-$y$-coordinate of a coordinate.
+$y$-coordinate of a coordinate.
\begin{command}{\pgfextractx\marg{dimension}\marg{point}}
Sets the \TeX-\meta{dimension} to the $x$-coordinate of the point.
@@ -505,18 +582,31 @@ $y$-coordinate of a coordinate.
Like |\pgfextractx|, except for the $y$-coordinate.
\end{command}
+\begin{command}{\pgfgetlastxy\marg{macro for $x$}\marg{macro for $y$}}
+ Stores the most recently used $(x,y)$ coordinates into two macros.
+\begin{codeexample}[]
+\pgfpoint{2cm}{4cm}
+\pgfgetlastxy{\macrox}{\macroy}
+Macro $x$ is `\macrox' and macro $y$ is `\macroy'.
+\end{codeexample}
+ Since $(x,y)$ coordinates are usually assigned globally, it is safe to use this command after path operations.
+\end{command}
\subsection{Internals of How Point Commands Work}
+\label{section-internal-pointcmds}
+
As a normal user of \pgfname\ you do not need to read this section. It
is relevant only if you need to understand how the point commands work
-internally.
+internally.
When a command like |\pgfpoint{1cm}{2pt}| is called, all that happens
is that the two \TeX-dimension variables |\pgf@x| and |\pgf@y| are set
-to |1cm| and |2pt|, respectively. A command like |\pgfpathmoveto| that
+to |1cm| and |2pt|, respectively. These variables belong to the set of
+internal \pgfname\ registers, see section~\ref{section-internal-registers}
+for details. A command like |\pgfpathmoveto| that
takes a coordinate as parameter will just execute this parameter and
then use the values of |\pgf@x| and |\pgf@y| as the coordinates to
which it will move the pen on the current path.
@@ -534,7 +624,7 @@ command like |\pgfpoint| in a \TeX-scope and then make the changes of
\global\pgf@y=\pgf@y % make the change of \pgf@y persist past the scope
}
% \pgf@x and \pgf@y are now set correctly, all other variables are
-% unchanged
+% unchanged
\end{codeexample}
\makeatletter
@@ -564,7 +654,7 @@ the code of the command |\pgfpointadd|:
-%%% Local Variables:
+%%% Local Variables:
%%% mode: latex
%%% TeX-master: "pgfmanual"
-%%% End:
+%%% End: