diff --git a/OSCADSharp/OSCADSharp.ConsoleTests/Program.cs b/OSCADSharp/OSCADSharp.ConsoleTests/Program.cs
index be3eea2..c9450d3 100644
--- a/OSCADSharp/OSCADSharp.ConsoleTests/Program.cs
+++ b/OSCADSharp/OSCADSharp.ConsoleTests/Program.cs
@@ -31,7 +31,7 @@ namespace OSCADSharp.ConsoleTests
Height = 50.8
}.Translate(10, 5, 2);
- var combined = cube.Difference(cylinder);
+ var combined = cube.Intersection(cylinder);
Console.WriteLine(combined.ToString());
Console.ReadKey();
diff --git a/OSCADSharp/OSCADSharp/Booleans/Intersection.cs b/OSCADSharp/OSCADSharp/Booleans/Intersection.cs
new file mode 100644
index 0000000..c0c3d44
--- /dev/null
+++ b/OSCADSharp/OSCADSharp/Booleans/Intersection.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OSCADSharp.Booleans
+{
+ ///
+ /// Creates the intersection of all child nodes
+ ///
+ internal class Intersection : BlockStatementObject
+ {
+ ///
+ /// Creates the intersection of all child nodes
+ ///
+ ///
+ public Intersection(IEnumerable children) : base("intersection()", children)
+ {
+ }
+ }
+}
diff --git a/OSCADSharp/OSCADSharp/OSCADObject.cs b/OSCADSharp/OSCADSharp/OSCADObject.cs
index a74fd5d..7498ee3 100644
--- a/OSCADSharp/OSCADSharp/OSCADObject.cs
+++ b/OSCADSharp/OSCADSharp/OSCADObject.cs
@@ -147,11 +147,29 @@ namespace OSCADSharp
return doBoolean("Union", objects, (children) => { return new Union(children); });
}
+ ///
+ /// Subtracts the 2nd (and all further) child nodes from the first one (logical and not).
+ /// May be used with either 2D or 3D objects, but don't mix them.
+ ///
+ /// child nodes
+ ///
public OSCADObject Difference(params OSCADObject[] objects)
{
return doBoolean("Difference", objects, (children) => { return new Difference(children); });
}
-
+
+ ///
+ /// Creates the intersection of all child nodes. This keeps the overlapping portion (logical and).
+ /// Only the area which is common or shared by all children is retained.
+ /// May be used with either 2D or 3D objects, but don't mix them.
+ ///
+ /// child nodes
+ ///
+ public OSCADObject Intersection(params OSCADObject[] objects)
+ {
+ return doBoolean("Intersection", objects, (children) => { return new Intersection(children); });
+ }
+
private OSCADObject doBoolean(string name, OSCADObject[] objects, Func, OSCADObject> factory)
{
if (objects == null || objects.Length < 1)
diff --git a/OSCADSharp/OSCADSharp/OSCADSharp.csproj b/OSCADSharp/OSCADSharp/OSCADSharp.csproj
index 47ffa97..a336192 100644
--- a/OSCADSharp/OSCADSharp/OSCADSharp.csproj
+++ b/OSCADSharp/OSCADSharp/OSCADSharp.csproj
@@ -43,6 +43,7 @@
+