Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace DAF1
- {
- public class Point
- {
- public int x, y, sx, sy;
- public Point(int x, int y)
- {
- this.x = x;
- this.y = y;
- }
- public int GetX()
- {
- return x;
- }
- public int GetY()
- {
- return y;
- }
- public int SetX(int sx)
- {
- this.x = sx;
- return x;
- }
- public int SetY(int sy)
- {
- this.y = sy;
- return y;
- }
- public override string ToString()
- {
- return "(<"+x+">, <"+y+">)";
- }
- public double Distance(Point p)
- {
- return Math.Sqrt(Math.Pow((x - p.GetX()), 2) + Math.Pow((y - p.GetY()), 2));
- }
- public Point Middle(Point p)
- {
- Point middle = new Point((x + p.GetX()) / 2, (y + p.GetY()) / 2);
- return middle;
- }
- }
- }
Add Comment
Please, Sign In to add comment