module CSG

Defined in:

csg.cr
primitives/node.cr
primitives/plane.cr
primitives/polygon.cr
primitives/vector.cr
primitives/vector2d.cr
primitives/vertex.cr

Class Method Summary

Class Method Detail

def self.intersect(pa : Array(Polygon), pb : Array(Polygon)) #

Return an array of polygons representing space both the solid A and in the solid B. Neither this solid nor the solid B are modified.

CSG.intersect(A, B)

+-------+
|       |
|   A   |
|    +--+----+   =   +--+
+----+--+    |       +--+
     |   B   |
     |       |
     +-------+

[View source]
def self.inverse(pa : Array(Polygon)) #

Return an array of polygons with solid and empty space switched.


[View source]
def self.subtract(pa : Array(Polygon), pb : Array(Polygon)) #

Return an array of polygons representing space in the solid A but not in the solid B. Neither this solid nor the solid B are modified.

CSG.subtract(A, B)

+-------+            +-------+
|       |            |       |
|   A   |            |       |
|    +--+----+   =   |    +--+
+----+--+    |       +----+
     |   B   |
     |       |
     +-------+

[View source]
def self.union(pa : Array(Polygon), pb : Array(Polygon)) #

Return an array of polygons representing space in either the solid A or in the solid B. Neither the solid A nor the solid B are modified.

CSG.union(A,B)

+-------+            +-------+
|       |            |       |
|   A   |            |       |
|    +--+----+   =   |       +----+
+----+--+    |       +----+       |
     |   B   |            |       |
     |       |            |       |
     +-------+            +-------+

[View source]