public static Node<int> BuildListFromArForword (int[] ar)
Node<int> lst = new Node<int>(ar[0]);
for (int i=1;i<ar.Length;i++)
pos.SetNext(new Node<int>(ar[i]));
public static Node<Point> BuildListFromPointsArForword (Point[] ar)
Node<Point> lst = new Node<Point>(ar[0]);
for (int i=1;i<ar.Length;i++)
pos.SetNext(new Node<Point>(ar[i]));
public static void Show (Node<int> lst)
Console.Write(pos.ToString());
public static void ShowPoints (Node<Point> lst)
Console.Write(pos.GetValue().ToString());
public static void Main ()
Console.WriteLine("Hello World");
Point p1 = new Point (1,1);
Point p2 = new Point (2,2);
Point p3 = new Point (3,3);
ShowPoints(BuildListFromPointsArForword(ar));
this.ls = new Node<Point>(p1);
public Polygon (Polygon other)
this.ls = new Node<Point>(new Point(0,0));
Node<Point> pLs = this.ls;
Node<Point> pOther = other.ls;
Point p1 = new Point(pOther.GetValue());
pLs.SetNext(new Node<Point>(p1));
pOther = pOther.GetNext();
this.ls = this.ls.GetNext();
private bool IsExist (Point p)
Node<Point> pos = this.ls;
if (pos.GetValue().Equals(p))
public void AddPointL (Point p)
this.ls = new Node<Point>(p1);
Node<Point> pos = this.ls;
while (pos.HasNext() && !pos.GetValue().Equals(p1))
if (pos.HasNext()==false)
if (!pos.GetValue().Equals(p1))
pos.SetNext(new Node<Point>(p1));
public void AddPointF (Point p)
Node<Point> pos = new Node<Point>(p1,this.ls);
public void DelPoint (Point p)
if (this.ls == null) return;
if (this.ls.GetValue().Equals(p))
this.ls = this.ls.GetNext();
Node<Point> pos = this.ls;
while (pos!=null && !pos.GetValue().Equals(p))
prev.SetNext(pos.GetNext());
public Point (double x, double y)
public Point (Point other)
public void SetX (double x)
public void SetY (double y)
public void ShiftPoint (double dx, double dy)
if (this.x>0 && this.y>0)
if (this.x<0 && this.y>0)
if (this.x<0 && this.y<0)
if (this.x>0 && this.y<0)
public bool Equals (Point other)
return (this.x==other.x && this.y==other.y);
public double Distance (Point other)
return Math.Sqrt(Math.Pow(other.y-this.y,2) + Math.Pow(other.x-this.x,2));
public double Distance00 (Point other)
return Math.Sqrt(Math.Pow(this.x,2)+Math.Pow(this.y,2));
public override string ToString ()
return "(" + this.x + "," + this.y + ")";
public Node (T value, Node<T> next)
public void SetValue (T value)
public void SetNext(Node<T> next)
return this.next != null;
public override String ToString()
return this.value.ToString();