From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/25420 Path: news.gmane.org!not-for-mail From: Aditya Mahajan Newsgroups: gmane.comp.tex.context Subject: Re: Venn diagram Date: Fri, 20 Jan 2006 00:49:43 -0500 (EST) Message-ID: References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Trace: sea.gmane.org 1137736205 10544 80.91.229.2 (20 Jan 2006 05:50:05 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 20 Jan 2006 05:50:05 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Fri Jan 20 06:50:02 2006 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by ciao.gmane.org with esmtp (Exim 4.43) id 1Ezp9s-0003hd-FM for gctc-ntg-context-518@m.gmane.org; Fri, 20 Jan 2006 06:50:00 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 9848912837; Fri, 20 Jan 2006 06:49:59 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 15363-03; Fri, 20 Jan 2006 06:49:56 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 622F012823; Fri, 20 Jan 2006 06:49:56 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 5E96B12823 for ; Fri, 20 Jan 2006 06:49:55 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 15074-07 for ; Fri, 20 Jan 2006 06:49:54 +0100 (CET) Original-Received: from withoutevidence.mr.itd.umich.edu (withoutevidence.mr.itd.umich.edu [141.211.93.147]) by ronja.ntg.nl (Postfix) with SMTP id EC4EE1280B for ; Fri, 20 Jan 2006 06:49:53 +0100 (CET) Original-Received: from aditya.annarb01.mi.comcast.net (bgp996717bgs.nanarb01.mi.comcast.net [68.40.50.205]) by withoutevidence.mr.itd.umich.edu (smtp) with ESMTP id k0K5niHg003807 for ; Fri, 20 Jan 2006 00:49:51 -0500 Original-To: mailing list for ConTeXt users In-Reply-To: X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.5 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:25420 Archived-At: <--- On Jan 19, David Arnold wrote ---> > All, > > I have: > > \startMPpage %figure library name: intersection > > %initialize scale > numeric u; 10u=3in; > > %ellipses > path A, B; > A:=fullcircle xyscaled (4u,3u); > B:=A shifted (2u,0); > draw A withcolor red; > label.ulft(btex $A$ etex, point 3 of A) withcolor red; > draw B withcolor blue; > label.urt(btex $B$ etex, point 1 of B) withcolor blue; > > %bounding box > draw bbox currentpicture enlarged (0.5u,0.5u); > > \stopMPpage > > I need an easy way of shading these areas: > > 1. A intersect B > 2. A union B > 3. A intersect (complement of B) > 4. (complement of A) intersect B There is venn.mp on ctan. Using it you can do basic shading of intersection, union etc for 0,1,2 or 3 sets very quickly. Read the documentation in source for details. For example \startMPinclusions input venn; pair A,B,T[]; A = (.4venn_width-.5venn_circle_diameter,.5venn_height); B = (.6venn_width+.5venn_circle_diameter,.5venn_height); T1 = (.5venn_width , 0); T2 = (.5venn_width,.5venn_height-.5venn_circle_diameter); vardef venn_shade = red; \stopMPinclusions \startMPpage draw_venn_two(false,true,true,true); label.lft(btex $A$ etex,A); label.rt(btex $B$ etex,B); label.bot(btex $A\cup B$ etex,T2); \stopMPpage \startMPpage draw_venn_two(false,false,true,false); label.lft(btex $A$ etex,A); label.rt(btex $B$ etex,B); label.bot(btex $A\cap B$ etex,T2); \stopMPpage \startMPpage draw_venn_two(true,false,false,false); label.lft(btex $A$ etex,A); label.rt(btex $B$ etex,B); label.bot(btex $A'\cap B'$ etex,T2); \stopMPpage Perhaps one can combine the transparent color functionality of metapost with venn.mp to get really nice colors for intersections etc. Another related question, does anyone know of a good way to hash (hatch) a "set" (in general, any mp closed curve). I know that there is hatching.mp but I was wondering if there are better solutions. Aditya -- Aditya Mahajan, EECS Systems, University of Michigan http://www.eecs.umich.edu/~adityam || Ph: 7342624008