mirror of
https://github.com/eliasstepanik/OSCADSharpDotnet7.git
synced 2026-01-11 21:48:34 +00:00
Introduced basic Transform classes
This commit is contained in:
parent
6288a63fdd
commit
60286df583
@ -45,11 +45,15 @@
|
||||
<Compile Include="Solids\Cube.cs" />
|
||||
<Compile Include="Solids\Cylinder.cs" />
|
||||
<Compile Include="Solids\Sphere.cs" />
|
||||
<Compile Include="Transforms\ColoredObject.cs" />
|
||||
<Compile Include="Transforms\MirroredObject.cs" />
|
||||
<Compile Include="Transforms\ResizedObject.cs" />
|
||||
<Compile Include="Transforms\RotatedObject.cs" />
|
||||
<Compile Include="Transforms\ScaledObject.cs" />
|
||||
<Compile Include="Transforms\TranslatedObject.cs" />
|
||||
<Compile Include="Vector3.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Transforms\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
||||
24
OSCADSharp/OSCADSharp/Transforms/ColoredObject.cs
Normal file
24
OSCADSharp/OSCADSharp/Transforms/ColoredObject.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OSCADSharp.Transforms
|
||||
{
|
||||
/// <summary>
|
||||
/// An object that has color and/or opacity applied to it
|
||||
/// </summary>
|
||||
public class ColoredObject
|
||||
{
|
||||
#region Attributes
|
||||
public string Color { get; set; } = "Yellow";
|
||||
public double Opacity { get; set; } = 1.0;
|
||||
#endregion
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Format("color(\"{0}\", {1})", this.Color, this.Opacity);
|
||||
}
|
||||
}
|
||||
}
|
||||
25
OSCADSharp/OSCADSharp/Transforms/MirroredObject.cs
Normal file
25
OSCADSharp/OSCADSharp/Transforms/MirroredObject.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OSCADSharp.Transforms
|
||||
{
|
||||
/// <summary>
|
||||
/// An object that's mirrored on a plane
|
||||
/// </summary>
|
||||
public class MirroredObject
|
||||
{
|
||||
/// <summary>
|
||||
/// The normal vector of a plane intersecting the origin of the object,
|
||||
/// through which to mirror it.
|
||||
/// </summary>
|
||||
public Vector3 Normal { get; set; } = new Vector3();
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Format("mirror([{0}, {1}, {2}])", this.Normal.X, this.Normal.Y, this.Normal.Z);
|
||||
}
|
||||
}
|
||||
}
|
||||
22
OSCADSharp/OSCADSharp/Transforms/ResizedObject.cs
Normal file
22
OSCADSharp/OSCADSharp/Transforms/ResizedObject.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OSCADSharp.Transforms
|
||||
{
|
||||
/// <summary>
|
||||
/// An object that's been resized to a specified set of X/Y/Z dimensions
|
||||
/// </summary>
|
||||
public class ResizedObject
|
||||
{
|
||||
public Vector3 Size { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Format("resize([{0}, {1}, {2}])", this.Size.X.ToString(),
|
||||
this.Size.Y.ToString(), this.Size.Z.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
22
OSCADSharp/OSCADSharp/Transforms/RotatedObject.cs
Normal file
22
OSCADSharp/OSCADSharp/Transforms/RotatedObject.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OSCADSharp.Transforms
|
||||
{
|
||||
/// <summary>
|
||||
/// An object with rotation applied
|
||||
/// </summary>
|
||||
public class RotatedObject
|
||||
{
|
||||
public Vector3 Angle { get; set; } = new Vector3();
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Format("rotate([{0}, {1}, {2}])",
|
||||
this.Angle.X.ToString(), this.Angle.Y.ToString(), this.Angle.Z.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
22
OSCADSharp/OSCADSharp/Transforms/ScaledObject.cs
Normal file
22
OSCADSharp/OSCADSharp/Transforms/ScaledObject.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OSCADSharp.Transforms
|
||||
{
|
||||
/// <summary>
|
||||
/// An object that's been rescaled
|
||||
/// </summary>
|
||||
public class ScaledObject
|
||||
{
|
||||
public Vector3 Scale { get; set; } = new Vector3(1, 1, 1);
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Format("scale(v = [{0}, {1}, {2}])",
|
||||
this.Scale.X.ToString(), this.Scale.Y.ToString(), this.Scale.Z.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
23
OSCADSharp/OSCADSharp/Transforms/TranslatedObject.cs
Normal file
23
OSCADSharp/OSCADSharp/Transforms/TranslatedObject.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OSCADSharp.Transforms
|
||||
{
|
||||
/// <summary>
|
||||
/// An object or objects that have been moved along the specified vector
|
||||
/// </summary>
|
||||
public class TranslatedObject
|
||||
{
|
||||
public Vector3 Vector { get; set; }
|
||||
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Format("translate(v = [{0}, {1}, {2}])",
|
||||
this.Vector.X.ToString(), this.Vector.Y.ToString(), this.Vector.Z.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user