/** * translate this coordinate to a new position * * @param vector the translationvector */ public void translate(Vector vector) { xCoord += vector.getxCoord(); yCoord += vector.getyCoord(); }
protected Coordinate add(Vector vector) { return new Coordinate(xCoord + vector.getxCoord(), yCoord + vector.getyCoord()); }
/** * translates the coordinate with a given vector and returns the new coordinate * * @param vector the translationvector * @return the translated coordinate */ public Coordinate translatedTo(Vector vector) { Coordinate transCoord = new Coordinate(xCoord + vector.getxCoord(), yCoord + vector.getyCoord()); return transCoord; }
protected Coordinate subtract(Vector vector) { return new Coordinate(xCoord - vector.getxCoord(), yCoord - vector.getyCoord()); }