Added HulledObject, Hull

This commit is contained in:
Mike Smith 2016-02-14 11:34:58 -08:00
parent 81b49cf994
commit ae3f9e4d2f
4 changed files with 31 additions and 1 deletions

View File

@ -15,7 +15,7 @@ namespace OSCADSharp.ConsoleTests
{
var cube = new Cube(null, true).Translate(10, 0, 5).Scale(1, 1, 5);
var sphere = new Sphere().Mimic(cube).Translate(0, 0, 10);
string script = cube.Minkowski(sphere, new Cylinder()).ToString();
string script = cube.Hull(sphere, new Cylinder()).ToString();
File.WriteAllLines("test.scad", new string[] { script.ToString() });
Console.ReadKey();

View File

@ -143,6 +143,16 @@ namespace OSCADSharp
{
return new MinkowskiedObject(nodes);
}
/// <summary>
/// Creates a conved hull from child nodes (including this object)
/// </summary>
/// <param name="nodes">Nodes to hull</param>
/// <returns>Hull of nodes</returns>
public OSCADObject Hull(params OSCADObject[] nodes)
{
return new HulledObject(nodes);
}
#endregion
#region Boolean Operations

View File

@ -41,6 +41,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Sizes.cs" />
<Compile Include="Transforms\HulledObject.cs" />
<Compile Include="Transforms\IMimicer.cs" />
<Compile Include="Transforms\LinearExtrudedObject.cs" />
<Compile Include="Scripting\SingleBlockFormatter.cs" />

View File

@ -0,0 +1,19 @@
using OSCADSharp.Scripting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OSCADSharp.Transforms
{
/// <summary>
/// Creates an object that's the convex hull of child objects
/// </summary>
internal class HulledObject : MultiBlockStatementObject
{
public HulledObject(IEnumerable<OSCADObject> children) : base("hull()", children)
{
}
}
}