Working on adding all primitives
This commit is contained in:
parent
516a3cdbc6
commit
7ef109e749
18 changed files with 332 additions and 26 deletions
|
|
@ -71,7 +71,6 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
|
||||
Polygons polygonShape = null;
|
||||
GenerateBase(polygonShape);
|
||||
Mesh.CleanAndMergeMesh(CancellationToken.None);
|
||||
if (aabb.ZSize > 0)
|
||||
{
|
||||
// If the part was already created and at a height, maintain the height.
|
||||
|
|
|
|||
|
|
@ -68,7 +68,6 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
path.LineTo(0, Height);
|
||||
|
||||
Mesh = VertexSourceToMesh.Revolve(path, Sides);
|
||||
Mesh.CleanAndMergeMesh(CancellationToken.None);
|
||||
if (aabb.ZSize > 0)
|
||||
{
|
||||
// If the part was already created and at a height, maintain the height.
|
||||
|
|
|
|||
|
|
@ -169,7 +169,6 @@ public class ChairFoot2 : MatterCadObject3D
|
|||
var aabb = this.GetAxisAlignedBoundingBox();
|
||||
|
||||
Mesh = PlatonicSolids.CreateCube(Width, Depth, Height);
|
||||
Mesh.CleanAndMergeMesh(CancellationToken.None);
|
||||
if (aabb.ZSize > 0)
|
||||
{
|
||||
// If the part was already created and at a height, maintain the height.
|
||||
|
|
|
|||
|
|
@ -103,8 +103,6 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
break;
|
||||
}
|
||||
|
||||
Mesh.CleanAndMergeMesh(CancellationToken.None);
|
||||
|
||||
if (aabb.ZSize > 0)
|
||||
{
|
||||
// If the part was already created and at a height, maintain the height.
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
path.LineTo(0, Height);
|
||||
|
||||
Mesh = VertexSourceToMesh.Revolve(path, Sides);
|
||||
Mesh.CleanAndMergeMesh(CancellationToken.None);
|
||||
|
||||
if (aabb.ZSize > 0)
|
||||
{
|
||||
// If the part was already created and at a height, maintain the height.
|
||||
|
|
|
|||
83
DesignTools/Primitives/HalfSphereObject3D.cs
Normal file
83
DesignTools/Primitives/HalfSphereObject3D.cs
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
/*
|
||||
Copyright (c) 2018, Lars Brubaker, John Lewin
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using MatterHackers.Agg.VertexSource;
|
||||
using MatterHackers.DataConverters3D;
|
||||
using MatterHackers.VectorMath;
|
||||
|
||||
namespace MatterHackers.MatterControl.DesignTools
|
||||
{
|
||||
public class HalfSphereObject3D : Object3D, IRebuildable
|
||||
{
|
||||
public override string ActiveEditor => "PublicPropertyEditor";
|
||||
|
||||
public HalfSphereObject3D()
|
||||
{
|
||||
}
|
||||
|
||||
public static HalfSphereObject3D Create()
|
||||
{
|
||||
var item = new HalfSphereObject3D();
|
||||
|
||||
item.Rebuild();
|
||||
return item;
|
||||
}
|
||||
|
||||
public double Diameter { get; set; } = 20;
|
||||
[DisplayName("Longitude Sides")]
|
||||
public int LongitudeSides { get; set; } = 30;
|
||||
[DisplayName("Latitude Sides")]
|
||||
public int LatitudeSides { get; set; } = 10;
|
||||
|
||||
public void Rebuild()
|
||||
{
|
||||
var aabb = this.GetAxisAlignedBoundingBox();
|
||||
|
||||
var radius = Diameter / 2;
|
||||
var angleDelta = MathHelper.Tau / 4 / LatitudeSides;
|
||||
var angle = 0.0;
|
||||
var path = new VertexStorage();
|
||||
path.MoveTo(new Vector2(radius * Math.Cos(angle), radius * Math.Sin(angle)));
|
||||
for (int i = 0; i < LatitudeSides; i++)
|
||||
{
|
||||
angle += angleDelta;
|
||||
path.LineTo(new Vector2(radius * Math.Cos(angle), radius * Math.Sin(angle)));
|
||||
}
|
||||
|
||||
Mesh = VertexSourceToMesh.Revolve(path, LongitudeSides);
|
||||
if (aabb.ZSize > 0)
|
||||
{
|
||||
// If the part was already created and at a height, maintain the height.
|
||||
PlatingHelper.PlaceMeshAtHeight(this, aabb.minXYZ.Z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -67,7 +67,6 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
Mesh = VertexSourceToMesh.Revolve(path, 4);
|
||||
Mesh.Transform(Matrix4X4.CreateRotationZ(MathHelper.DegreesToRadians(45)) * Matrix4X4.CreateScale(Width / 2, Depth / 2, 1));
|
||||
|
||||
Mesh.CleanAndMergeMesh(CancellationToken.None);
|
||||
if (aabb.ZSize > 0)
|
||||
{
|
||||
// If the part was already created and at a height, maintain the height.
|
||||
|
|
|
|||
75
DesignTools/Primitives/RoofObject3D.cs
Normal file
75
DesignTools/Primitives/RoofObject3D.cs
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
Copyright (c) 2018, Lars Brubaker, John Lewin
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using MatterHackers.Agg.VertexSource;
|
||||
using MatterHackers.DataConverters3D;
|
||||
using MatterHackers.VectorMath;
|
||||
|
||||
namespace MatterHackers.MatterControl.DesignTools
|
||||
{
|
||||
public class RoofObject3D : Object3D, IRebuildable
|
||||
{
|
||||
public override string ActiveEditor => "PublicPropertyEditor";
|
||||
|
||||
public RoofObject3D()
|
||||
{
|
||||
}
|
||||
|
||||
public static RoofObject3D Create()
|
||||
{
|
||||
var item = new RoofObject3D();
|
||||
|
||||
item.Rebuild();
|
||||
return item;
|
||||
}
|
||||
|
||||
public double Width { get; set; } = 20;
|
||||
public double Depth { get; set; } = 20;
|
||||
public double Height { get; set; } = 10;
|
||||
|
||||
public void Rebuild()
|
||||
{
|
||||
var aabb = this.GetAxisAlignedBoundingBox();
|
||||
|
||||
var path = new VertexStorage();
|
||||
path.MoveTo(0, 0);
|
||||
path.LineTo(Width, 0);
|
||||
path.LineTo(Height, Height);
|
||||
|
||||
Mesh = VertexSourceToMesh.Extrude(path, Depth);
|
||||
if (aabb.ZSize > 0)
|
||||
{
|
||||
// If the part was already created and at a height, maintain the height.
|
||||
PlatingHelper.PlaceMeshAtHeight(this, aabb.minXYZ.Z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
78
DesignTools/Primitives/RoundRoofObject3D.cs
Normal file
78
DesignTools/Primitives/RoundRoofObject3D.cs
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
Copyright (c) 2018, Lars Brubaker, John Lewin
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using MatterHackers.Agg.VertexSource;
|
||||
using MatterHackers.DataConverters3D;
|
||||
using MatterHackers.VectorMath;
|
||||
|
||||
namespace MatterHackers.MatterControl.DesignTools
|
||||
{
|
||||
public class RoundRoofObject3D : Object3D, IRebuildable
|
||||
{
|
||||
public override string ActiveEditor => "PublicPropertyEditor";
|
||||
|
||||
public RoundRoofObject3D()
|
||||
{
|
||||
}
|
||||
|
||||
public static RoundRoofObject3D Create()
|
||||
{
|
||||
var item = new RoundRoofObject3D();
|
||||
|
||||
item.Rebuild();
|
||||
return item;
|
||||
}
|
||||
|
||||
public double Width { get; set; } = 20;
|
||||
public double Depth { get; set; } = 20;
|
||||
public double Height { get; set; } = 10;
|
||||
public int Sides { get; set; } = 15;
|
||||
|
||||
public void Rebuild()
|
||||
{
|
||||
var aabb = this.GetAxisAlignedBoundingBox();
|
||||
|
||||
var path = new VertexStorage();
|
||||
path.MoveTo(0, 0);
|
||||
path.LineTo(Width / 2, 0);
|
||||
path.LineTo(Width / 2, Height);
|
||||
path.LineTo(0, Height);
|
||||
|
||||
Mesh = VertexSourceToMesh.Revolve(path, Sides, 0, MathHelper.Tau / 2);
|
||||
|
||||
if (aabb.ZSize > 0)
|
||||
{
|
||||
// If the part was already created and at a height, maintain the height.
|
||||
PlatingHelper.PlaceMeshAtHeight(this, aabb.minXYZ.Z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -79,7 +79,6 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
}
|
||||
|
||||
Mesh = VertexSourceToMesh.Revolve(path, ToroidSides);
|
||||
Mesh.CleanAndMergeMesh(CancellationToken.None);
|
||||
if (aabb.ZSize > 0)
|
||||
{
|
||||
// If the part was already created and at a height, maintain the height.
|
||||
|
|
|
|||
75
DesignTools/Primitives/WedgeObject3D.cs
Normal file
75
DesignTools/Primitives/WedgeObject3D.cs
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
Copyright (c) 2018, Lars Brubaker, John Lewin
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using MatterHackers.Agg.VertexSource;
|
||||
using MatterHackers.DataConverters3D;
|
||||
using MatterHackers.VectorMath;
|
||||
|
||||
namespace MatterHackers.MatterControl.DesignTools
|
||||
{
|
||||
public class WedgeObject3D : Object3D, IRebuildable
|
||||
{
|
||||
public override string ActiveEditor => "PublicPropertyEditor";
|
||||
|
||||
public WedgeObject3D()
|
||||
{
|
||||
}
|
||||
|
||||
public static WedgeObject3D Create()
|
||||
{
|
||||
var item = new WedgeObject3D();
|
||||
|
||||
item.Rebuild();
|
||||
return item;
|
||||
}
|
||||
|
||||
public double Width { get; set; } = 20;
|
||||
public double Depth { get; set; } = 20;
|
||||
public double Height { get; set; } = 20;
|
||||
|
||||
public void Rebuild()
|
||||
{
|
||||
var aabb = this.GetAxisAlignedBoundingBox();
|
||||
|
||||
var path = new VertexStorage();
|
||||
path.MoveTo(0, 0);
|
||||
path.LineTo(Width, 0);
|
||||
path.LineTo(0, Height);
|
||||
|
||||
Mesh = VertexSourceToMesh.Extrude(path, Depth);
|
||||
if (aabb.ZSize > 0)
|
||||
{
|
||||
// If the part was already created and at a height, maintain the height.
|
||||
PlatingHelper.PlaceMeshAtHeight(this, aabb.minXYZ.Z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue