Added overloads for transforms that take a vector to allow for X/Y/Z doubles to be used directly

This commit is contained in:
Mike Smith 2016-02-07 11:49:29 -08:00
parent 43d9369187
commit 584049346f
2 changed files with 67 additions and 6 deletions

View File

@ -19,11 +19,11 @@ namespace OSCADSharp.ConsoleTests
};
cube = cube.Color("Red")
.Mirror(new Vector3(1, 0, 0))
.Resize(new Vector3(10, 20, 10))
.Rotate(new Vector3(90, 90, 0))
.Scale(new Vector3(1, 1, 2))
.Translate(new Vector3(10, 5, 2));
.Mirror(1, 0, 0)
.Resize(10, 20, 10)
.Rotate(90, 90, 0)
.Scale(1, 1, 2)
.Translate(10, 5, 2);
Console.WriteLine(cube.ToString());
Console.ReadKey();

View File

@ -19,7 +19,7 @@ namespace OSCADSharp
public OSCADObject Color(string colorName, double opacity = 1.0)
{
return new ColoredObject(this, colorName, opacity);
}
}
/// <summary>
/// Mirrors the object about a plane, as specified by the normal
@ -32,6 +32,19 @@ namespace OSCADSharp
return new MirroredObject(this, normal);
}
/// <summary>
/// Mirrors the object about a plane, as specified by the normal
/// described by the x/y/z components provided
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <param name="z"></param>
/// <returns>A mirrored object</returns>
public OSCADObject Mirror(double x, double y, double z)
{
return this.Mirror(new Vector3(x, y, z));
}
/// <summary>
/// Resizes to a specified set of X/Y/Z dimensions
/// </summary>
@ -42,6 +55,18 @@ namespace OSCADSharp
return new ResizedObject(this, newsize);
}
/// <summary>
/// Resizes to a specified set of X/Y/Z dimensions
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <param name="z"></param>
/// <returns>A resized object</returns>
public OSCADObject Resize(double x, double y, double z)
{
return this.Resize(new Vector3(x, y, z));
}
/// <summary>
/// Rotates about a specified X/Y/Z euler angle
/// </summary>
@ -52,6 +77,18 @@ namespace OSCADSharp
return new RotatedObject(this, angle);
}
/// <summary>
/// Rotates about a specified X/Y/Z euler angle
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <param name="z"></param>
/// <returns>A rotated object</returns>
public OSCADObject Rotate(double x, double y, double z)
{
return this.Rotate(new Vector3(x, y, z));
}
/// <summary>
/// Rescales an object by an X/Y/Z scale factor
/// </summary>
@ -62,6 +99,18 @@ namespace OSCADSharp
return new ScaledObject(this, scale);
}
/// <summary>
/// Rescales an object by an X/Y/Z scale factor
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <param name="z"></param>
/// <returns>A scaled object</returns>
public OSCADObject Scale(double x, double y, double z)
{
return this.Scale(new Vector3(x, y, z));
}
/// <summary>
/// Translates an object by the specified amount
/// </summary>
@ -71,6 +120,18 @@ namespace OSCADSharp
{
return new TranslatedObject(this, translation);
}
/// <summary>
/// Translates an object by the specified amount
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <param name="z"></param>
/// <returns>A translated object</returns>
public OSCADObject Translate(double x, double y, double z)
{
return this.Translate(new Vector3(x, y, z));
}
#endregion
}
}