예제 #1
0
  @Override
  public void update() {
    this.defined = false;

    // check parents are defined
    if (!parent1.isDefined()) return;
    if (!parent2.isDefined()) return;

    Shape2D shape;

    // extract first point
    shape = parent1.getShape();
    if (!(shape instanceof Point2D)) return;
    Point2D point1 = (Point2D) shape;

    // extract second point
    shape = parent2.getShape();
    if (!(shape instanceof Point2D)) return;
    Point2D point2 = (Point2D) shape;

    // update distance measure
    this.trans =
        AffineTransform2D.createTranslation(
            point2.getX() - point1.getX(), point2.getY() - point1.getY());

    this.defined = true;
  }
예제 #2
0
  @Override
  public void update() {
    this.defined = false;
    if (!parent1.isDefined()) return;

    Shape2D shape = parent1.getShape();
    if (!(shape instanceof Domain2D)) return;
    Domain2D domain = (Domain2D) shape;

    boundary = domain.getBoundary();
    this.defined = true;
  }