Boolean 3D Library

Boolean is one of basic and well known operation on 3D models. This method was introduced in the beginning of 3D era - we can remember TRON (1982), where motorcycles were made from graphic primitives with help of boolean operations. Despite of such age, booleans still challenging and even high end packages can't guarantee perfect results even with standard geometry primitives, like cubes and spheres. Thin and long holes are quite common defects.

Source Objects - tube and 3d text A SUB B - subtract 3d text from tube B SUB A - subtract tube from 3d text A AND B - tube AND 3d text

We offer fast, reliable, high quality and feature rich 3D Boolean Library. See WebGL Demo.

Features

Background

How it may work

Concept of boolean algorithm looks easy. For instance A SUB B.

There are many problems on the way:

 

Highlights

We are very proud of our results. When everything works good, it looks natural.

Intersections

3D Boolean Challenge 1

Simple test scene with tube and torus. Just five segments tube and torus. Torus pipe has 6 segments. Scene is simple but just right for demonstration. In this particular case polygons of torus are fully inside or outside of tube. We should cut only polygons of tube. Problem here that there is no direct intersection of polygons - points of torus (marked with red) are eaxctly on edges. Of course floating point calculations may show intersection, but not always. BTW, how to use tolerance here?

Points marked with green shows another advantage. Let's explain. Side of tube was made from quad (or two triangles) diagonal goes from top-left to bottom-right and intersects torus at green points. As you may see on the right image - former surface of torus also has this point and additional triangle is added. This means no holes in the output. Additional, optional optimization may remove these green points by combining triangles on the both sides of edge.

Normals

One image below two objects (torus and cylinder) are combined. Surfaces are intersecting on obtuse angles and everything looks perfect.

3D Boolean Normals

In order to achieve such look, special treatment was applied.

 

Default, high quality normals processing.
Click on image for bigger version.

Normal treatment is switched off.
Click on image for bigger version.

Group of Objects

Just an ability to handle many objects as single operand.

Group Of Objects

From another point of view, this is tought case - many small objects penetrate one face. We have special code which detects such situation and process it in a best possible way. 

 

Samples

 

Before

After

 
 

API and Technical Information

Library supports two usage scenarios.

  1. First is just a boolean, it can process only triangles and can output triangles.
  2. Second can process polygons, even with holes and optimize output. Optimizations may include: remove holes, remove extra points, generate polygons from triangles.

#1

 

#2

 

How to check 3d booleans?

 

See boolean API documentation.

Sample Usage

ivbool3d::Processor*proc=CreateBoolean();// create boolean object
		ivbool3d::Object*obj0=proc->AddSource(0);// add empty object for A channel
		ivbool3d::Object*obj1=proc->AddSource(1);// add empty object for B channel
		
		// provide source points and triangles
		// set data of first object
		// set data of second object
		if(proc->Process(ivbool3d::M_SUB_AB,ivbool3d::EXTRA_INFO))
		{
			ivbool3d::Result rezult;
			if(proc->GetResult(&rezult))
			{
			// rezult contains list of points and triangles in flat array
			}
		}
		proc->Destroy();

That's it :)

Licensing

 

Test version is available on request.

Contact Us