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.

hyperfun.org_tut_html_e_images_rbox.jpghyperfun.org_tut_html_e_images_rsphere.jpg
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.

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.

hyperfun.org_tut_html_e_images_rface.jpg

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.org_tut_html_e_images_frog_face.jpg
hyperfun.org_tut_html_e_images_part1.jpghyperfun.org_tut_html_e_images_part2.jpghyperfun.org_tut_html_e_images_part3.jpghyperfun.org_tut_html_e_images_part4.jpghyperfun.org_tut_html_e_images_part5.jpg

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