Intersection area

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

Intersection area

by Dominique Würtz-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I try to fill the two intersection areas of two ring shapes (ie. an area
bounded by two concentric circles). Here is a little tikz code to give
you an idea of the problem:

\documentclass{article}
\usepackage{tikz}

\begin{document}
\pagestyle{empty}

\begin{tikzpicture}
   \filldraw[fill=red,even odd rule]
   (0,0) circle (2.5cm) (0,0) circle (3cm)
   (2,0) circle (2.5cm) (2,0) circle (3cm);
\end{tikzpicture}

\end{document}

So what I want is to have the intersection which does _not_ get filled
in the example above filled red, whereas the rest of the ring areas,
which is now filled red, should stay transparent. Any idea how to
achieve this? BTW, I'm using pgf-2.0.

Regards,
Dominique Würtz



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users

Re: Intersection area

by Hans Meine-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Am Mittwoch, 27. Februar 2008 12:15:14 schrieb Dominique Würtz:
> So what I want is to have the intersection which does _not_ get filled
> in the example above filled red, whereas the rest of the ring areas,
> which is now filled red, should stay transparent. Any idea how to
> achieve this? BTW, I'm using pgf-2.0.

Sure - just use one circle for clipping the other one.  (E.g. inside a scope,
to limit the clipping's effect.)

--
Ciao, /  /
     /--/
    /  / ANS

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users

Re: Intersection area

by Dominique Würtz-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for your response. I already experimented with clipping
paths--without success.

\documentclass{article}
\usepackage{tikz}

\begin{document}
\pagestyle{empty}

\begin{tikzpicture}
   \clip (2,0) circle (3cm);
   \filldraw[fill=even odd rule]
   (0,0) circle (2.5cm) (0,0) circle (3cm);
\end{tikzpicture}

\end{document}

What's missing here is clipping the left ring to the area _outside_ the
smaller circle of the right circle (2,0) circle (2.5cm). How to achieve
this?

Hans Meine schrieb:
>
> Sure - just use one circle for clipping the other one.  (E.g. inside a scope,
> to limit the clipping's effect.)
>


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users

Re: Intersection area

by Dominique Würtz-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

sorry, it should read

\filldraw[fill=red,even odd rule]

Dominique Würtz schrieb:

> \documentclass{article}
> \usepackage{tikz}
>
> \begin{document}
> \pagestyle{empty}
>
> \begin{tikzpicture}
>    \clip (2,0) circle (3cm);
>    \filldraw[fill=even odd rule]
>    (0,0) circle (2.5cm) (0,0) circle (3cm);
> \end{tikzpicture}
>
> \end{document}




-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users

Re: Intersection area

by Hans Meine-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Am Freitag, 29. Februar 2008 12:44:36 schrieb Dominique Würtz:
> What's missing here is clipping the left ring to the area _outside_ the
> smaller circle of the right circle (2,0) circle (2.5cm). How to achieve
> this?

Ah, that was not easy to understand, but I think I got you.  I would try to
simulate the effect (e.g. painting a white disc inside), since I don't know a
way to clip "everything but" the inside of a path.  If you really need this,
you could try to re-draw the clipping ring using splines (instead of
circles).

--
Ciao, /  /
     /--/
    /  / ANS

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users

Re: Intersection area

by Kjell Magne Fauske :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Feb 29, 2008 at 12:47 PM, Dominique Würtz <dwuertz@...> wrote:

> sorry, it should read
>
>
>  \filldraw[fill=red,even odd rule]
>
>  Dominique Würtz schrieb:
>
> > \documentclass{article}
>  > \usepackage{tikz}
>  >
>  > \begin{document}
>  > \pagestyle{empty}
>  >
>  > \begin{tikzpicture}
>  >    \clip (2,0) circle (3cm);
>  >    \filldraw[fill=even odd rule]
>  >    (0,0) circle (2.5cm) (0,0) circle (3cm);
>  > \end{tikzpicture}
>  >
>  > \end{document}
>
>

If you are satisfied with opaque rings you could try:

\documentclass{article}
\usepackage{tikz}

\begin{document}
\pagestyle{empty}

\def\circA{(0,0) circle (2.5cm) (0,0) circle (3cm)}
\def\circB{(2,0) circle (2.5cm) (2,0) circle (3cm)}
\begin{tikzpicture}
  \fill[even odd rule,green] \circA;
  \filldraw[even odd rule,fill=white] \circA \circB ;
\end{tikzpicture}

\end{document}

If the rings have to be transparent this will not work.

- Kjell Magne Fauske

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users

Re: Intersection area

by Dominique Würtz-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Again, thanks for all your answers, here is the complete solution I came
up with:

\begin{tikzpicture}
   \def\ringa{(-1,0) circle (2) (-1,0) circle (3)}
   \def\ringb{(1,0) circle (2) (1,0) circle (3)}

   \begin{scope}[even odd rule]
     \clip \ringa;
     \fill[fill=orange] \ringb;
   \end{scope}

   \draw \ringa;
   \draw \ringb;
\end{tikzpicture}

Dominique Würtz schrieb:
> Hi,
>
> I try to fill the two intersection areas of two ring shapes (ie. an area




-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users