Implementation with ray casting

Ray Casting is often used to implement CSG operation when objects are described with boundary representation. We fire a ray from the plane xy (which represent the screen). The surface limits for the composite object are determined by the specified set operation (see Table).

Operation

Surface Limit

Union

A, D

Intersection

C, B

Difference (Obj2 - Obj1)

B, D