 ## Set-theoretic operations

Until now, we have used only one equation or the library function to model an object. But, it is not enough for complex objects. This page shows how to combine primitives to model more complex objects.

Suppose A is a blue box, B is a yellow sphere.  A B

### Union A and B

Union A and B is described as A | B in HyperFun.

The lower figure is the result of A | B. |  ### Intersection A and B

Intersection A and B is described as A & B in HyperFun. This operation removes all pieces that do NOT intersect.

The lower figure is the result of A & B. &  ### Subtraction B from A, A from B

Subtraction B from A or A from B is described as A \ B or B \ A respectively. Subtraction removes all intersecting parts of the objects.

The figures below are the result of A \ B and B \ A. \   \  For example, making eyes is possible by using subtraction. ### Combination of union, intersection, and subtraction

In the right hand figures, we can see the frog being constructed using union and subtraction. Similarly, we can make complex objects from simple parts using set-theoretic operations. This process, is called CSG (Constructive Solid Geometry).       