Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Please ignore the binary numbers.

enter image description here

Without finding the intersection points in advance, is it possible to fill the complement of (A union B union C) with a solid color but the remaining regions remain transparent?

share|improve this question
1  
You have 8 regions and you can draw each region seperately as a closed path. So a macro can receive 8 bit number and pass fill=blue option to the path if it's 1 or 0 at the specific digit. –  percusse Aug 16 '12 at 13:28
    
@percusse: How can you get the 8 regions without finding the intersection points in advance? :-) –  Oh my ghost Aug 16 '12 at 13:39
    
Using geometry is one option (assuming that the circles are the same for all three and have predefined coordinates). –  percusse Aug 16 '12 at 13:40

2 Answers 2

up vote 15 down vote accepted

Using the approach described in How can I invert a 'clip' selection within TikZ?:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}
\tikzstyle{reverseclip}=[insert path={(current page.north east) --
  (current page.south east) --
  (current page.south west) --
  (current page.north west) --
  (current page.north east)}
]

\begin{tikzpicture}[remember picture]

\draw [gray!20, ultra thick] (-3,-3) grid (3,3);

\begin{pgfinterruptboundingbox}
\path  [clip] (90:0.7cm) circle [radius=1cm] [reverseclip];
\path  [clip] (-30:0.7cm) circle [radius=1cm] [reverseclip];
\path  [clip] (210:0.7cm) circle [radius=1cm] [reverseclip];
\end{pgfinterruptboundingbox}

\fill [orange] (-2,-2) rectangle (2,2);
\end{tikzpicture}
\end{document}
share|improve this answer
    
I haven't known whether or not PSTricks has reverse clip. –  Oh my ghost Aug 16 '12 at 14:09
    
I see you have defined a path around the whole page, can I use this path to fill the page with orange? –  qed Oct 25 '13 at 10:45
    
@qed: Sure. You can use \fill [orange] (current page.north west) rectangle (current page.south east);. Note that you need to have the options remember picture, overlay in your tikzpicture options, and you need to compile the document twice. –  Jake Oct 25 '13 at 11:04
    
why is it necessary to remember the position of current picture in this case? And what is the difference between current page and current picture? –  qed Oct 25 '13 at 11:15
    
@qed: Take a look at section 16.13.2 "Referencing the Current Page Node" in the PGF manual. –  Jake Oct 25 '13 at 11:17

needs the latest pstricks.tex from http://texnik.dante.de/tex/generic/pstricks/ available on CTAN in a few days

\documentclass{minimal}
\usepackage{pstricks}\SpecialCoor

\begin{document}

\begin{pspicture}(-3,-3)(3,3)\psgrid[gridlabels=0pt]
  \pscustom[linestyle=none]{%
  \pspolygon(-2,-2)(-2,2)(2,2)(2,-2)
  \moveto(0.7;90)\rmoveto(1,0)\pscircle(0.7;90){1}
  \moveto(0.7;-30)\rmoveto(1,0)\pscircle(0.7;-30){1}
  \moveto(0.7;210)\rmoveto(1,0)\pscircle(0.7;210){1}
  \closepath
  \code{eoclip}
  \pspolygon(-2,-2)(-2,2)(2,2)(2,-2)
  \fill[fillcolor=blue!60,fillstyle=solid,linestyle=none]}
\end{pspicture}

\end{document}

but there are still some small lines for the circles:

enter image description here

share|improve this answer
    
Can PSTricks have reverse clip feature as Tikz? –  Oh my ghost Aug 21 '12 at 13:09
    
sure, needs only one who implements it ... –  Herbert Aug 21 '12 at 13:17
    
I have not seen your PSTricks book because it is not available on the bookstore. Amazon.com also does not provide us with its table of contents. My question: what is the difference between the PSTricks package manuals and your PSTricks book? I am interested to know the details about PSTricks programming for hackers only (TVZ's manual on printed page number 38) and creating low/high level objects (TVZ's manual on printed page number 163-). Are both these topics elaborated in your PSTricks book? –  Oh my ghost Aug 21 '12 at 13:39
    
see archiv.dante.de/~herbert/Books –  Herbert Aug 21 '12 at 14:12
    
How to completely remove the unwanted thin but visible paths? –  Oh my ghost Oct 25 '13 at 8:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.