Tgif Home
----
About Tgif
Current Release & Download
FAQ
Copyright Info
A Screendump of Tgif
Release History
Tools That Tgif Uses
Tools That Work with Tgif
Author of Tgif
Miscellaneous Info
----
 
Return to Tgif's Home Page
William Chia-Wei Cheng
(bill.cheng@usc.edu)
 

Tgif FAQ - Creating Venn Diagrams

 
I want to fill different regions of a Venn diagram with different fill patterns and produce an EPS file. How can I do it in tgif?
In general, it's difficult to generate objects based on intersections of arbitrary geometrical objects. (Of course, getting the intersections of rectangles are easy.) So, if you want a vector-based object that represents an intersection of arbitrary objects, tgif won't be able to do that in general. However, for regularly shaped objects, such as circles, here is a way to do it if you can choose where to place them (as in the case where you are creating a Venn Diagram). If you are interested in generate GIF images only, please see the Intersections FAQ page.

Thanks to Chris Menzel <cmenzel@tamu.edu> for showing me how to do this.

Let's first look at intersecting two circles.

The most important thing to make this work is to overlap the circles at the right place! Since tgif can draw filled arcs, if the overlap can be somehow filled by arcs, we can get this right.

The trick is to realize that placing the center of one circle right on the other circle can make things easy for you!

image of two overlapping circles

Now, change the fill pattern and draw a wedge, centering at the center of one circle, starting from one intersecting point and ending at another (please notice that the original hollow circles are raised to the top, by selecting Front() from the Arrange Menu, to produce the clear outlines for the intersection).

image of two overlapping circles

Draw another wedge, centering at the other circle, starting from one intersecting point and ending at another.

image of two overlapping circles

The obj file that produces the above images is provided here.

Now, let's first look at intersecting three circles.

Once you know how to create the overlap between two circles, it's fairly straight-forward to do it for three circles.

The trick is to place the center of one circle right on the other circle!

image of two overlapping circles

The middle region requires 3 wedges. The 3 ``control points'' of each wedge are the 3 centers of the circles.

image of two overlapping circles

What about the non-interesting part of a circle? It quit simple. Just draw a pie that's the complement of a wedge and send it to the back by selecting Back() from the Arrange Menu.

image of two overlapping circles

The obj file that produces the above images is provided here.

Finally, creating an EPS file is easy. Just set print/export format to EPS from the Print/ExportFormat Submenu of the File Menu and select Print() from the File Menu.