mirror of
https://github.com/eliasstepanik/OSCADSharpDotnet7.git
synced 2026-01-27 04:48:27 +00:00
Added MinkowskiedObject, Minkowski
This commit is contained in:
parent
7e8cc89e6b
commit
e1aa360635
@ -14,8 +14,8 @@ namespace OSCADSharp.ConsoleTests
|
|||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
var cube = new Cube(null, true).Translate(10, 0, 5).Scale(1, 1, 5);
|
var cube = new Cube(null, true).Translate(10, 0, 5).Scale(1, 1, 5);
|
||||||
var sphere = new Sphere().Mimic(cube).Translate(0, 0, 5);
|
var sphere = new Sphere().Mimic(cube).Translate(0, 0, 10);
|
||||||
string script = cube.Union(sphere).ToString();
|
string script = cube.Minkowski(sphere, new Cylinder()).ToString();
|
||||||
|
|
||||||
File.WriteAllLines("test.scad", new string[] { script.ToString() });
|
File.WriteAllLines("test.scad", new string[] { script.ToString() });
|
||||||
Console.ReadKey();
|
Console.ReadKey();
|
||||||
|
|||||||
@ -133,6 +133,16 @@ namespace OSCADSharp
|
|||||||
{
|
{
|
||||||
return this.Translate(new Vector3(x, y, z));
|
return this.Translate(new Vector3(x, y, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a minkowski sum of child nodes (including this object)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="nodes">Nodes to sum with</param>
|
||||||
|
/// <returns>A minkowski sum</returns>
|
||||||
|
public OSCADObject Minkowski(params OSCADObject[] nodes)
|
||||||
|
{
|
||||||
|
return new MinkowskiedObject(nodes);
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Boolean Operations
|
#region Boolean Operations
|
||||||
@ -183,6 +193,7 @@ namespace OSCADSharp
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Utility Methods
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a copy of this object and all of its children
|
/// Creates a copy of this object and all of its children
|
||||||
///
|
///
|
||||||
@ -232,7 +243,7 @@ namespace OSCADSharp
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Copies the transforms that have been applied to another OSCADObject, and applies
|
/// Copies the transforms that have been applied to another OSCADObject, and applies
|
||||||
/// the same transforms to this object. (Only transforms)
|
/// the same transforms to this object. (Only pure transforms, like Translate, Rotate, Scale, Color)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="other"></param>
|
/// <param name="other"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
@ -255,5 +266,6 @@ namespace OSCADSharp
|
|||||||
|
|
||||||
return finalObject;
|
return finalObject;
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,6 +55,7 @@
|
|||||||
<Compile Include="Solids\Sphere.cs" />
|
<Compile Include="Solids\Sphere.cs" />
|
||||||
<Compile Include="Solids\Text3D.cs" />
|
<Compile Include="Solids\Text3D.cs" />
|
||||||
<Compile Include="Transforms\ColoredObject.cs" />
|
<Compile Include="Transforms\ColoredObject.cs" />
|
||||||
|
<Compile Include="Transforms\MinkowskiedObject.cs" />
|
||||||
<Compile Include="Transforms\MirroredObject.cs" />
|
<Compile Include="Transforms\MirroredObject.cs" />
|
||||||
<Compile Include="Transforms\ResizedObject.cs" />
|
<Compile Include="Transforms\ResizedObject.cs" />
|
||||||
<Compile Include="Transforms\RotatedObject.cs" />
|
<Compile Include="Transforms\RotatedObject.cs" />
|
||||||
|
|||||||
20
OSCADSharp/OSCADSharp/Transforms/MinkowskiedObject.cs
Normal file
20
OSCADSharp/OSCADSharp/Transforms/MinkowskiedObject.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
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 minkowski sum of child objects
|
||||||
|
/// </summary>
|
||||||
|
internal class MinkowskiedObject : BlockStatementObject
|
||||||
|
{
|
||||||
|
|
||||||
|
public MinkowskiedObject(IEnumerable<OSCADObject> children) : base("minkowski()", children)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user