|
using System;
using QRCodeUtility = ThoughtWorks.QRCode.Codec.Util.QRCodeUtility;
namespace ThoughtWorks.QRCode.Geom
{
public class Point
{
public const int RIGHT = 1;
public const int BOTTOM = 2;
public const int LEFT = 4;
public const int TOP = 8;
internal int x;
internal int y;
virtual public int X
{
get
{
return x;
}
set
{
this.x = value;
}
}
virtual public int Y
{
get
{
return y;
}
set
{
this.y = value;
}
}
public Point()
{
x = 0;
y = 0;
}
public Point(int x, int y)
{
this.x = x;
this.y = y;
}
public virtual void translate(int dx, int dy)
{
this.x += dx;
this.y += dy;
}
public virtual void set_Renamed(int x, int y)
{
this.x = x;
this.y = y;
}
public override String ToString()
{
return "(" + System.Convert.ToString(x) + "," + System.Convert.ToString(y) + ")";
}
public static Point getCenter(Point p1, Point p2)
{
return new Point((p1.X + p2.X) / 2, (p1.Y + p2.Y) / 2);
}
public bool equals(Point compare)
{
if (x == compare.x && y == compare.y)
return true;
else
return false;
}
public virtual int distanceOf(Point other)
{
int x2 = other.X;
int y2 = other.Y;
return QRCodeUtility.sqrt((x - x2) * (x - x2) + (y - y2) * (y - y2));
}
}
}
|
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.
Piyush has valuable experience in requirements gathering, designing, implementing, and maintaining data-driven, object-oriented and service based enterprise systems. In addition to his technical expertise, Piyush also published paper on knowledge management and he has excellent communication skills to cooperate with the clients.
He holds a Masters Degree in Computer Science from the University Of Michigan, USA