|
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
namespace MatrixMathHelpers
{
public class PointHelper
{
Point _value;
public Point Value
{
get { return _value; }
set { _value = value; }
}
public PointHelper(Point Input)
{
_value = Input;
}
public PointHelper()
{
}
//public static explicit operator Vector(PointHelper point)
//{
// return (new Vector(point._value.X, point._value.Y));
//}
public static Vector operator -(PointHelper point1, PointHelper point2)
{
return new Vector(point1._value.X - point2._value.X, point1._value.Y - point2._value.Y);
}
//
// Summary:
// Translates the specified System.Windows.Point by the specified System.Windows.Vector
// and returns the result.
//
// Parameters:
// point:
// The point to translate.
//
// vector:
// The amount by which to translate point.
//
// Returns:
// The result of translating the specified point by the specified vector.
public static PointHelper operator +(PointHelper point, Vector vector)
{
PointHelper result = new PointHelper();
result._value.X = vector.X + point.Value.X;
result._value.Y = vector.Y + point.Value.Y;
return result;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I work in the Bay Area primarily developing software on the Windows platform using C++, .NET/C#, WPF, and Silverlight.