summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex')
-rw-r--r--Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex128
1 files changed, 114 insertions, 14 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex
index 26e63666e02..e4cde74a4f8 100644
--- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex
@@ -1,9 +1,13 @@
-\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorepoints.code.tex,v 1.1.1.1 2005/06/29 12:14:04 tantau Exp $
-
-% Copyright 2005 by Till Tantau <tantau@cs.tu-berlin.de>.
+% Copyright 2006 by Till Tantau
+%
+% This file may be distributed and/or modified
%
-% This program can be redistributed and/or modified under the terms
-% of the GNU Public License, version 2.
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the file doc/generic/pgf/licenses/LICENSE for more details.
+
+\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorepoints.code.tex,v 1.5 2006/10/11 15:22:25 tantau Exp $
\newdimen\pgf@picminx
\newdimen\pgf@picmaxx
@@ -53,12 +57,29 @@
%
% Example:
%
-% \pgfpathmoveto{\pgfpoint{2pt}{3cm}}
+% \pgfpathmoveto{\pgfpoint{2pt+3cm}{3cm}}
\def\pgfpoint#1#2{%
\setlength\pgf@x{#1}%
\setlength\pgf@y{#2}\ignorespaces}
+
+% Quickly a point
+%
+% #1 = x-coordinate of the point (no calculations done)
+% #2 = y-coordinate of the point (no calculations done)
+%
+% x = #1
+% y = #2
+%
+% Example:
+%
+% \pgfpathmoveto{\pgfqpoint{2pt}{3cm}}
+
+\def\pgfqpoint#1#2{\pgf@x=#1\pgf@y=#2}
+
+
+
% Return the origin.
%
% x = 0
@@ -283,6 +304,8 @@
%
% x = x-component of start + #1*(normalise(end-start))
% y = y-component of start + #1*(normalise(end-start))
+% xa = #1*(normalise(end-start))
+% ya = #1*(normalise(end-start))
%
% Example:
%
@@ -380,19 +403,19 @@
-% Store a value in polar-coordinates
+% A polar coordinate
%
% #1 = a degree
-% #2 = a radius
+% #2 = a radius -- either a dimension or two dimensions separated by a
+% slash.
%
-% x = #2 * cos(#1)
-% y = #2 * sin(#2)
+% x = (first dimension in #2) * cos(#1)
+% y = (second dimension in #2) * sin(#2)
%
% Example:
%
-% % Create a slanted rectangle
-%
% \pgfpathmoveto{\pgfpointpolar{30}{1cm}}
+% \pgfpathlineto{\pgfpointpolar{30}{1cm/2cm}}
\def\pgfpointpolar#1#2{%
\pgfsincos{#1}%
@@ -413,6 +436,83 @@
}
+% A polar coordinate in the xy plane.
+%
+% #1 = a degree
+% #2 = a radius given as a number or two radi
+%
+% result = (first dim in #2) * x-vector * cos(#1) +
+% (second dim in #2) * y-vector * sin(#1)
+%
+% Example:
+%
+% \pgfpathmoveto{\pgfpointpolarxy{30}{2}}
+
+\def\pgfpointpolarxy#1#2{%
+ \pgfsincos{#1}%
+ \in@/{#2}%
+ \ifin@%
+ \pgf@polarxy@#2\@@%
+ \else%
+ \pgf@polarxy@#2/#2\@@%
+ \fi%
+ \pgf@x=\pgf@sys@tonumber{\pgf@xa}\pgf@xx%
+ \advance\pgf@x by \pgf@sys@tonumber{\pgf@ya}\pgf@yx%
+ \pgf@y=\pgf@sys@tonumber{\pgf@xa}\pgf@xy%
+ \advance\pgf@y by \pgf@sys@tonumber{\pgf@ya}\pgf@yy}
+
+\def\pgf@polarxy@#1/#2\@@{%
+ \pgf@xa=#1\pgf@y%
+ \pgf@ya=#2\pgf@x%
+}
+
+
+
+% A cylindrical coordinate.
+%
+% #1 = a degree
+% #2 = a radius given as a number
+% #3 = a height given as a number
+%
+% result = #2*(x-vector * cos(#1) + y-vector * sin(#1)) + #3*z-vector
+%
+% Example:
+%
+% \pgfpathmoveto{\pgfpointcylindrical{30}{2}{1}}
+
+\def\pgfpointcylindrical#1#2#3{%
+ \pgfpointpolarxy{#1}{#2}%
+ \advance\pgf@x by #3\pgf@zx%
+ \advance\pgf@y by #3\pgf@zy}
+
+
+% A spherical coordinate.
+%
+% #1 = a longitude
+% #2 = a latitude
+% #3 = a radius
+%
+% result = #3*(cos(#2)*(x-vector * cos(#1) + y-vector * sin(#1)) + sin(#2)*z-vector)
+%
+% Example:
+%
+% \pgfpathmoveto{\pgfpointspherical{30}{30}{2}}
+
+\def\pgfpointspherical#1#2#3{%
+ \pgfsincos{#1}%
+ \pgf@xb=\pgf@sys@tonumber{\pgf@y}\pgf@xx%
+ \advance\pgf@xb by \pgf@sys@tonumber{\pgf@x}\pgf@yx%
+ \pgf@yb=\pgf@sys@tonumber{\pgf@y}\pgf@xy%
+ \advance\pgf@yb by \pgf@sys@tonumber{\pgf@x}\pgf@yy%
+ \pgfsincos{#2}%
+ \pgf@xc=\pgf@sys@tonumber{\pgf@y}\pgf@xb%
+ \advance\pgf@xc by \pgf@sys@tonumber{\pgf@x}\pgf@zx%
+ \pgf@yc=\pgf@sys@tonumber{\pgf@y}\pgf@yb%
+ \advance\pgf@yc by \pgf@sys@tonumber{\pgf@x}\pgf@zy%
+ \pgf@x=#3\pgf@xc%
+ \pgf@y=#3\pgf@yc%
+}
+
% Store the vector #1 * x-vec + #2 * y-vec
%
@@ -800,7 +900,7 @@
\def\pgfextractx#1#2{%
\pgf@process{#2}%
- #1=1.00374\pgf@x\relax}
+ #1=\pgf@x\relax}
% Extract the y-coordinate of a point to a dimensions
@@ -816,7 +916,7 @@
\def\pgfextracty#1#2{%
\pgf@process{#2}%
- #1=1.00374\pgf@y\relax}
+ #1=\pgf@y\relax}
\endinput