public class Midpoint extends PointElement {

  PointElement A,B;

  Midpoint (PointElement Aval, PointElement Bval) {
    dimension = 0;
    A = Aval;  B = Bval;
  }

  Midpoint (LineElement AB) {
    dimension = 0;
    A = AB.A;  B = AB.B;
  }

  protected void update() {
    x = (A.x + B.x) / 2.0;
    y = (A.y + B.y) / 2.0;
} }
