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.


Union A and B

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

The lower figure is the result of A | B.

hyperfun.org_tut_html_e_images_rbox.jpg | hyperfun.org_tut_html_e_images_rsphere.jpghyperfun.org_tut_html_e_images_runion.jpg

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.

hyperfun.org_tut_html_e_images_rbox.jpg & hyperfun.org_tut_html_e_images_rsphere.jpghyperfun.org_tut_html_e_images_rintersection.jpg

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.

hyperfun.org_tut_html_e_images_rbox.jpg \ hyperfun.org_tut_html_e_images_rsphere.jpghyperfun.org_tut_html_e_images_rdifference1.jpg

hyperfun.org_tut_html_e_images_rsphere.jpg \ hyperfun.org_tut_html_e_images_rbox.jpghyperfun.org_tut_html_e_images_rdifference2.jpg

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).


hyperfun/tut_set.txt · Last modified: 2008/12/11 10:20 by admin
This site contains HyperFun and other software that is free to use and modify under the provisions of the CGPL agreement unless otherwise stated.
Project hosted by the Digital Materialization Group
HyperFun CGPL HyperFun on SourceForge Creative Commons License Valid CSS Driven by DokuWiki