pgfmathparse can disrupt coordinate transformations?

View: New views
2 Messages — Rating Filter:   Alert me  

pgfmathparse can disrupt coordinate transformations?

by Berteun Damman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I was playing a bit with the Lindenmayer libary of PGF-CVS, and I
wanted to use it to create a Penrose P3 Tiling  [1] (ideally,
something like this: http://berteun.nl/tmp/penrose.pdf); for which
Wikipedia has an L-system. But, to make things fancier, I decided not
to wait until the whole path was constructed, but to stroke and fill
as soon as a ] was hit. In order to decide what to do, I used some
calculations, but \pgfmathparse appears to be able to disrupt the
coordinate transformations, because a single usage of it can make the
tiles appear quite misplaced.

The above hopefully explains why I would stroke the path in between.
The culprit appears to be         \pgfmathparse{and(0>0,0<1)}, if I
remove the line, the picture comes out alright. Also, if I replace 0>0
by something which is true, like 1>0, the picture comes out alright.
The problem only occurs if the left hand side of the and is false (the
right hand side does not matter). This was as far as I was able to pin
down the problem. I tried to create a smaller example without a
Lindenmayer system, but I didn't succeed.

I also tried the latest CVS build on Kjells site (31-10-2008), which
still has the problem. I can work around it (and did to produce the
picture in the PDF), but it appears to be a bug to me.

Berteun

[1] http://en.wikipedia.org/wiki/Penrose_tiling

%%%
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{lindenmayersystems}
\begin{document}
\pgfdeclarelindenmayersystem{Penrose Tiling}{
    \symbol{]}{
        %Comment the next line, or replace 0>0 by 1>0 and the result is fine.
        \pgfmathparse{and(0>0,0<1)}
        \pgfusepath{stroke}
        \pgflsystemrestorestate
    }
    \rule{A -> [7]++[7]++[7]++[7]++[7]}
    \rule{6 -> 8F++9F----7F[-8F----6F]++}
    \rule{7 -> +8F--9F[---6F--7F]+}
    \rule{8 -> -6F++7F[+++8F++9F]-}
    \rule{9 -> --8F++++6F[+9F++++7F]--7F}
    \rule{F -> }
}

\begin{tikzpicture}
    \path[use as bounding box] (-5,5) rectangle (5, 5);
    \path[rotate=-18,lindenmayer system={Penrose Tiling, axiom=A,
        order=2, angle=36, step=1cm}] lindenmayer system;
\end{tikzpicture}

\end{document}
%%%%

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users

Re: pgfmathparse can disrupt coordinate transformations?

by Kjell Magne Fauske :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sat, Nov 1, 2008 at 11:21 AM, Berteun Damman <berteun@...> wrote:

> Hello,
>
> I was playing a bit with the Lindenmayer libary of PGF-CVS, and I
> wanted to use it to create a Penrose P3 Tiling  [1] (ideally,
> something like this: http://berteun.nl/tmp/penrose.pdf); for which
> Wikipedia has an L-system. But, to make things fancier, I decided not
> to wait until the whole path was constructed, but to stroke and fill
> as soon as a ] was hit. In order to decide what to do, I used some
> calculations, but \pgfmathparse appears to be able to disrupt the
> coordinate transformations, because a single usage of it can make the
> tiles appear quite misplaced.
>
> The above hopefully explains why I would stroke the path in between.
> The culprit appears to be         \pgfmathparse{and(0>0,0<1)}, if I
> remove the line, the picture comes out alright. Also, if I replace 0>0
> by something which is true, like 1>0, the picture comes out alright.
> The problem only occurs if the left hand side of the and is false (the
> right hand side does not matter). This was as far as I was able to pin
> down the problem. I tried to create a smaller example without a
> Lindenmayer system, but I didn't succeed.
>
> I also tried the latest CVS build on Kjells site (31-10-2008), which
> still has the problem. I can work around it (and did to produce the
> picture in the PDF), but it appears to be a bug to me.
>
> Berteun
>
> [1] http://en.wikipedia.org/wiki/Penrose_tiling
>
> %%%
> \documentclass{article}
> \usepackage{tikz}
> \usetikzlibrary{lindenmayersystems}
> \begin{document}
> \pgfdeclarelindenmayersystem{Penrose Tiling}{
>    \symbol{]}{
>        %Comment the next line, or replace 0>0 by 1>0 and the result is fine.
>        \pgfmathparse{and(0>0,0<1)}
>        \pgfusepath{stroke}
>        \pgflsystemrestorestate
>    }
>    \rule{A -> [7]++[7]++[7]++[7]++[7]}
>    \rule{6 -> 8F++9F----7F[-8F----6F]++}
>    \rule{7 -> +8F--9F[---6F--7F]+}
>    \rule{8 -> -6F++7F[+++8F++9F]-}
>    \rule{9 -> --8F++++6F[+9F++++7F]--7F}
>    \rule{F -> }
> }
>
> \begin{tikzpicture}
>    \path[use as bounding box] (-5,5) rectangle (5, 5);
>    \path[rotate=-18,lindenmayer system={Penrose Tiling, axiom=A,
>        order=2, angle=36, step=1cm}] lindenmayer system;
> \end{tikzpicture}
>
> \end{document}
> %%%%
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> pgf-users mailing list
> pgf-users@...
> https://lists.sourceforge.net/lists/listinfo/pgf-users
>

This issue seems to have been fixed in the current CVS version (2008-11-01).

- Kjell Magne Fauske

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users