package yi.iu.processor.ort;

import java.io.*;

public class ORTPoint implements java.io.Serializable
{
  public double Col,Row;			/* Position of the point */

  public ORTPoint() {}

  public ORTPoint(double x, double y) {Col=x;Row=y;}

  public ORTPoint(ORTPoint p) {
    this(p.Col, p.Row);
  }

  /**
   * Return the distance of two ORTPoints.  Same as
   *   GeometricUtil.distance(p1, p2);
   * @param p1
   * @param p2
   * @return
   */
  public static double distance(ORTPoint p1, ORTPoint p2) {
    double dx=p1.Col-p2.Col, dy=p1.Row-p2.Row;
    return Math.sqrt(dx*dx+dy*dy);
  }

  /**
   * Return the distance to ORTPoint p.
   * @param p
   * @return
   */
  public double distance(ORTPoint p) {
    return distance(this, p);
  }

  public double getCol() {
    return Col;
  }

  public void setCol(double c) {
    Col = c;
  }

  public double getRow() {
    return Row;
  }

  public void setRow(double r) {
    Row = r;
  }
}