using System;
|
using System.Collections.Generic;
|
using System.Drawing;
|
using System.Linq;
|
using System.Text;
|
|
namespace Hydro.Model
|
{
|
|
public class Vector2d
|
{
|
double _x, _y;
|
|
public Vector2d(Point pt)
|
{
|
_x = pt.X;
|
_y = pt.Y;
|
}
|
|
public Vector2d(double x, double y)
|
{
|
_x = x; _y = y;
|
}
|
|
public Point ToPoint()
|
{
|
return new Point( _x, _y);
|
}
|
|
public double X
|
{
|
get { return _x; }
|
set { _x = value; }
|
}
|
|
public double Y
|
{
|
get { return _y; }
|
set { _y = value; }
|
}
|
|
public static Vector2d operator *(double c, Vector2d v)
|
{
|
return new Vector2d(c * v.X, c * v.Y);
|
}
|
|
public static Vector2d operator *(Vector2d v, double c)
|
{
|
return new Vector2d(c * v.X, c * v.Y);
|
}
|
|
public static Vector2d operator /(Vector2d v, double c)
|
{
|
return new Vector2d(v.X / c, v.Y / c);
|
}
|
|
public static Vector2d operator +(Vector2d v1, Vector2d v2)
|
{
|
return new Vector2d(v1.X + v2.X, v1.Y + v2.Y);
|
}
|
|
public static Vector2d operator -(Vector2d v1, Vector2d v2)
|
{
|
return new Vector2d(v1.X - v2.X, v1.Y - v2.Y);
|
}
|
}
|
|
}
|