diff --git a/OSCADSharp/OSCADSharp.ConsoleTests/Program.cs b/OSCADSharp/OSCADSharp.ConsoleTests/Program.cs
index 2e3d040..bed8d06 100644
--- a/OSCADSharp/OSCADSharp.ConsoleTests/Program.cs
+++ b/OSCADSharp/OSCADSharp.ConsoleTests/Program.cs
@@ -33,7 +33,13 @@ namespace OSCADSharp.ConsoleTests
string script = text.ToString();
- File.WriteAllLines("test.scad", new string[] { script.ToString() });
+ File.WriteAllLines("test.scad", new string[] { script.ToString() });
+
+ var vec1 = new Vector3(5, 5, 5);
+ var vec2 = new Vector3(10, 10, 10);
+ Console.WriteLine(vec1 - vec2);
+
+ Console.ReadKey();
}
}
}
diff --git a/OSCADSharp/OSCADSharp/Vector3.cs b/OSCADSharp/OSCADSharp/Vector3.cs
index 0bf45f3..72a9ae1 100644
--- a/OSCADSharp/OSCADSharp/Vector3.cs
+++ b/OSCADSharp/OSCADSharp/Vector3.cs
@@ -13,9 +13,11 @@ namespace OSCADSharp
///
public class Vector3
{
+ #region Attributes
public double X { get; set; }
public double Y { get; set; }
public double Z { get; set; }
+ #endregion
public Vector3(double x = 0, double y = 0, double z = 0)
{
@@ -23,5 +25,41 @@ namespace OSCADSharp
this.Y = y;
this.Z = z;
}
+
+ ///
+ /// Negates the values of this vector, returning an inverse of it
+ ///
+ /// A negated vector
+ public Vector3 Negate()
+ {
+ return new Vector3(-this.X, -this.Y, -this.Z);
+ }
+
+ ///
+ /// Creates a copy of this vector that's a new instance
+ /// with the same values
+ ///
+ /// A clone of this vector
+ public Vector3 Clone()
+ {
+ return new Vector3(this.X, this.Y, this.Z);
+ }
+
+ #region Operators
+ public static Vector3 operator +(Vector3 left, Vector3 right)
+ {
+ return new Vector3(left.X + right.X, left.Y + right.Y, left.Z + right.Z);
+ }
+
+ public static Vector3 operator -(Vector3 left, Vector3 right)
+ {
+ return new Vector3(left.X - right.X, left.Y - right.Y, left.Z - right.Z);
+ }
+ #endregion
+
+ public override string ToString()
+ {
+ return String.Format("[X: {0}, Y: {1}, Z: {2}]", this.X.ToString(), this.Y.ToString(), this.Z.ToString());
+ }
}
}