Re: question concerning coordinate transformations
Alain Matthes <alain.matthes <at> mac.com>
2009-10-03 18:39:31 GMT
Le 3 oct. 2009 à 13:09, koslowj a écrit :
>
> If somebody knows a better way of realizing these diagrams, please
> let me
> know.
Hi, (Sorry for my bad english)
I don't know if my way is better ...
Firstly, I think it's better to avoid the relevant
coordinates explicitly.
For example :
\begin{tikzpicture}[ baseline=(current bounding box.east),scale=1.75]
\node (00) at (0,0) {$A$};
\node (20) at (2,0) {$B$};
\node (01) at (0,1) {$C$};
\node (21) at (2,1) {$D$};
\draw[->] (00) to node[auto]{$f$} (01);
\draw[->] (01) to node[auto]{$g$} (21);
% (m1)
\path[] (00) to node(m1){} (20);
\draw[->] (00) to node[auto]{$h$} (20);
\draw[->,auto] (20) to node[swap]{$k$} (21);
\draw[->,out=-60,in=-120] (00) to node[label=below:$l$](m2){} (20);
\draw[-implies,double distance=1.2pt]
(m1) to node[auto,swap]{$\tau$} (m2);
\end{tikzpicture}
If I use a transformation, you are right : there is problem
with the nodes and the cm transformation. Perhaps the transformation
is applied to the intersection point of the curved
arrows and the node. So, I used shorten >=10pt,shorten <=10pt
and the anchor "center" but there is another problem (see the
end of the mail)
\begin{tikzpicture}[ baseline=(current bounding box.east),%
scale=1.75,cm={cos{30},-.5,cos{30},.5,(0,0)}]
\draw[help lines] (0,0) grid (3,2);
\node (00) at (0,0) {$A$};
\node (20) at (2,0) {$B$};
\node (01) at (0,1) {$C$};
\node (21) at (2,1) {$D$};
\node (a) at ($(1,-sqrt(2)$) {$a$};
\draw[lightgray,->](00)--(a);
\draw[lightgray,->](20)--(a);
\draw[->] (00) to node[auto]{$f$} (01);
\draw[->] (01) to node[auto]{$g$} (21);
\path[] (00) to node(m1){} (20);
\draw[->] (00) to node[auto]{$h$} (20);
\draw[->,auto] (20) to node[swap]{$k$} (21);
\draw[->,out=-60,in=-120,shorten >=10pt,shorten <=10pt]%
(00.center) to node[label=below:$l$](m2){} (20.center);
\draw[-implies,double distance=1.2pt]
(m1) to node[auto,swap]{$\tau$} (m2);
\end{tikzpicture}
I don't know exactly how work x= ... and y=... with polar coordinates
and
options out =... and in = ....
With cm, it's possible to use
\draw[help lines] (0,0) grid (3,2);
Perhaps you want exactly your first drawing and perhaps
you want the tau curved arrow vertically. It's possible to
calculate the intersection of tau with l (pgf 2 cvs)
Another way is to place the first part of the drawing in a scope
but it's not automatically
\begin{tikzpicture}[ baseline=(current bounding box.east),scale=1.75]
\begin{scope}[cm={cos{30},-.5,cos{30},.5,(0,0)}]
\draw[help lines] (0,0) grid (3,2);
\node (00) at (0,0) {$A$};
\node (20) at (2,0) {$B$};
\node (01) at (0,1) {$C$};
\node (21) at (2,1) {$D$};
\draw[->] (00) to node[auto]{$f$} (01);
\draw[->] (01) to node[auto]{$g$} (21);
\path[] (00) to node(m1){} (20);
\draw[->] (00) to node[auto]{$h$} (20);
\draw[->,auto] (20) to node[swap]{$k$} (21);
\end{scope}
\draw[reset cm,->,out=-80,in=-150,shorten >=8pt,shorten <=8pt]%
(00.center) to node[pos=.60](m2){} (20.center);
\draw[-implies,double distance=1.2pt]
(m1) to node[auto,swap]{$\tau$} (m2) node[]{$a$};
\end{tikzpicture}
but now there is another problem
\draw[reset cm,->,out=-80,in=-150,red]%
(00.center) to node[pos=.60](m2){} (20.center);
instead of
\draw[reset cm,->,out=-80,in=-150,shorten >=8pt,shorten <=8pt]%
(00.center) to node[pos=.60](m2){} (20.center);
gives a different arrow (perhaps it's normal)
Conclusion: I prefer to avoid coordinates and to draw automatically
the diagram but I seems there are some difficulties to use cm.
Best Regards
Alain Matthes
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf