limitations of the 'let' operation?

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

limitations of the 'let' operation?

by healyp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello pgf users,

According to the manual I can use the 'let' operation to create numbers and points.  What I would like to do is to create nodes temporarily (circles, actually) within a \foreach macro.  Is something like this possible?

More specifically, I would like to be able to achieve something like the following snippet of code (which fails compilation) for marking the intersections of two sets of concentric circles (level curves).

\foreach \rad in {.1cm,.2cm,.3cm,.4cm,.5cm}
{
  \path let \n1 = {0.5cm+\rad}, \p1 = (-30:\n1) in
  node (m1) at (c1) [circle through=(\p1)] {};  % not allowed, it seems
  \path let \n2 = {1.5cm+\rad}, \p2 = (230:\n2) in
  node (m2) at (c2) [circle through=(\p2)] {};  % ditto

  \coordinate [label=-135:$y$] (y) at (intersection 2 of m1 and m2);
  \fill [red] (y) circle (1pt);
}

If somebody could advise me on how I can compute these circle intersections within the \foreach macro I'd be most grateful.

Thanks to all,
Patrick Healy

Re: limitations of the 'let' operation?

by Till Tantau-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!

works for me. The following compiles fine and gives the expected  
(correct) results:


\documentclass[10pt,oneside]{article}

\usepackage{tikz}
\usetikzlibrary{calc,through}
\begin{document}

\begin{tikzpicture}

   \coordinate (c1) at (0,0);
   \coordinate (c2) at (-1,0);

   \foreach \rad in {.1cm,.2cm,.3cm,.4cm,.5cm}
   {
     \path let \n1 = {0.5cm+\rad}, \p1 = (-30:\n1) in
     node (m1) at (c1) [circle through=(\p1)] {};  %
     \path let \n2 = {1.5cm+\rad}, \p2 = (230:\n2) in
     node (m2) at (c2) [circle through=(\p2)] {};  %

     \coordinate [label=-135:$y$] (y) at (intersection 2 of m1 and m2);
     \fill [red] (y) circle (1pt);
   }
\end{tikzpicture}

\end{document}


Regards,
Till

Am 17.07.2008 um 11:49 schrieb healyp:

>
> Hello pgf users,
>
> According to the manual I can use the 'let' operation to create  
> numbers and
> points.  What I would like to do is to create nodes temporarily  
> (circles,
> actually) within a \foreach macro.  Is something like this possible?
>
> More specifically, I would like to be able to achieve something like  
> the
> following snippet of code (which fails compilation) for marking the
> intersections of two sets of concentric circles (level curves).
>
> \foreach \rad in {.1cm,.2cm,.3cm,.4cm,.5cm}
> {
>  \path let \n1 = {0.5cm+\rad}, \p1 = (-30:\n1) in
>  node (m1) at (c1) [circle through=(\p1)] {};  % not allowed, it seems
>  \path let \n2 = {1.5cm+\rad}, \p2 = (230:\n2) in
>  node (m2) at (c2) [circle through=(\p2)] {};  % ditto
>
>  \coordinate [label=-135:$y$] (y) at (intersection 2 of m1 and m2);
>  \fill [red] (y) circle (1pt);
> }
>
> If somebody could advise me on how I can compute these circle  
> intersections
> within the \foreach macro I'd be most grateful.
>
> Thanks to all,
> Patrick Healy
>
> --
> View this message in context: http://www.nabble.com/limitations-of-the-%27let%27-operation--tp18505015p18505015.html
> Sent from the pgf-users mailing list archive at Nabble.com.
>
>
> -------------------------------------------------------------------------
> 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
>

--
Prof. Dr. Till Tantau <tantau@...>
http://www.tcs.uni-luebeck.de


-------------------------------------------------------------------------
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
LightInTheBox - Buy quality products at wholesale price