0

I have the following code

\def\aes{in*0.75}%%
\begin{tikzpicture}[scale=0.34mm]
  \coordinate (A) at (0,0);
  \coordinate (B) at ($(A)+(30:4\aes)$);
  \coordinate (C) at ($(B)+(-90:2.5\aes)$);

  \draw[line width=2pt,gray!60,postaction={draw,black,dashed,line width=1.4pt}] (A) circle (\aeRadiusA);

  \draw[red] (B) circle (\aeRadiusB);
  \draw[blue] (C) circle (\aeRadiusC);

  \coordinate (A1a) at ($(A)+(-20:\aeRadiusA*0.75)$);
  \coordinate (C1a) at ($(C)+(90+20:\aeRadiusC*0.75)$);
  \coordinate (A1b) at ($(A1a)+(3pt,2pt)$);
  \coordinate (C1b) at ($(C1a)+(0pt,-2pt)$);

  \coordinate (A2a) at ($(A)+(30:\aeRadiusA*0.65)$);
  \coordinate (B2a) at ($(B)+(140:\aeRadiusB*0.65)$);
  \coordinate (A2b) at ($(A2a)+(15pt,4pt)$);
  \coordinate (B2b) at ($(B2a)+(-4pt,3pt)$);

 \begin{scope}[rotate=280]
    \fill[red!20] (B2a) circle (4pt);
    \foreach \x in {-3,...,5}{
      \draw[blue,shorten >= rand*15] (B2a) -- (rand*\x:3);
      }      
      \fill[blue] (B2a) circle(2pt);
    \end{scope}

  \node[anchor=north west] at (A) {9-graph};
  \node                    at (B) {4-graph};
  \node                    at (C) {5-graph};
\end{tikzpicture}

which draws some lines from circle B to spots in circle A. I am unsure how to make it so that the lines are drawn to points inside circle C. Does anyone know how I would go about this?


As per request, the following image is what I want enter image description here

and is achieved with

\coordinate (A1a) at ($(A)+(-20:\aeRadiusA*0.75)$);
  \coordinate (C1a) at ($(C)+(90+20:\aeRadiusC*0.75)$);
  \coordinate (A1b) at ($(A1a)+(3pt,2pt)$);
  \coordinate (C1b) at ($(C1a)+(0pt,-2pt)$);
  \coordinate (C1c) at ($(C1b)+(5pt,-2pt)$);
  \coordinate (C1d) at ($(C1c)+(10pt,8pt)$); 
  \coordinate (C1e) at ($(C1d)+(10pt,8pt)$);  
  \coordinate (C1f) at ($(C1e)+(-5pt,-2pt)$);  
  \coordinate (C1g) at ($(C1e)+(-45pt,-20pt)$);   


  \coordinate (A2a) at ($(A)+(30:\aeRadiusA*0.65)$);
  \coordinate (B2a) at ($(B)+(140:\aeRadiusB*0.65)$);
  \coordinate (A2b) at ($(A2a)+(15pt,4pt)$);
  \coordinate (B2b) at ($(B2a)+(-4pt,3pt)$);

 \begin{scope}[rotate=100]
    \fill[red!20] (B2a) circle (4pt);

    \draw[blue] (B2a) -- (C1a);
    \draw[red] (B2a)  -- (C1b);
    \draw[blue] (B2a) -- (C1c);
    \draw[red] (B2a)  -- (C1d);
    \draw[blue] (B2a) -- (C1e);
    \draw[red] (B2a)  -- (C1f);
    \draw[blue] (B2a)  -- (C1g);
    \fill[red] (B2a) circle(2pt);
 \end{scope}

As you can see, the lines are hard-coded and not what I want.

6
  • It would be great to add some pictures to show what you want to achieve. Additionally, please tell us what you tried to solve the problem. Commented Dec 1, 2015 at 13:10
  • @JFMeier See the edit
    – RElon
    Commented Dec 1, 2015 at 13:24
  • @RElon Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem.
    – AboAmmar
    Commented Dec 1, 2015 at 13:38
  • Ah come on what else do you need ? The code is there...
    – percusse
    Commented Dec 1, 2015 at 14:10
  • BTW, you can use \newlength{\aes} and \setlength{\aes}{0.75in} which is how 4\aes is normally implemented. Commented Dec 1, 2015 at 14:17

1 Answer 1

1

If it is just about drawing the lines from one fixed point to a number of other points with two alternating colors you can do the following:

\documentclass[tikz, border=5mm]{standalone}

\begin{document}
  \begin{tikzpicture}
    \foreach [count=\i] \x in {a,...,g} {
        % use a mod() for swapping between red and blue
        \pgfmathparse{mod(\i, 2) ? "red" : "blue"}
        % draw from fixed point to point in foreach with color determined by mod()
        \draw [\pgfmathresult] (B2a) -- (C1\x);
    }
  \end{tikzpicture}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .