Added IPoint.add(XY,Point).

We already had such a method for subtract(). Not sure how I managed to miss
add.
This commit is contained in:
Michael Bayne
2015-05-30 10:32:57 -07:00
parent 1ec8b53770
commit 70b83fd521
4 changed files with 22 additions and 4 deletions
@@ -57,17 +57,22 @@ public abstract class AbstractPoint implements IPoint
return result.set(x() + x, y() + y);
}
@Override // from IPoint
public Point add (XY other, Point result) {
return add(other.x(), other.y(), result);
}
@Override // from IPoint
public Point subtract (double x, double y) {
return subtract(x, y, new Point());
}
@Override
@Override // from IPoint
public Point subtract (double x, double y, Point result) {
return result.set(x() - x, y() - y);
}
@Override
@Override // from IPoint
public Point subtract (XY other, Point result) {
return subtract(other.x(), other.y(), result);
}
+4
View File
@@ -41,6 +41,10 @@ public interface IPoint extends XY, Cloneable
* @return a reference to the result, for chaining. */
Point add (double x, double y, Point result);
/** Translates this point by the specified offset and stores the result in the object provided.
* @return a reference to the result, for chaining. */
Point add (XY other, Point result);
/** Subtracts the supplied point from {@code this}.
* @return a new point containing the result. */
Point subtract (double x, double y);
@@ -57,17 +57,22 @@ public abstract class AbstractPoint implements IPoint
return result.set(x() + x, y() + y);
}
@Override // from IPoint
public Point add (XY other, Point result) {
return add(other.x(), other.y(), result);
}
@Override // from IPoint
public Point subtract (float x, float y) {
return subtract(x, y, new Point());
}
@Override
@Override // from IPoint
public Point subtract (float x, float y, Point result) {
return result.set(x() - x, y() - y);
}
@Override
@Override // from IPoint
public Point subtract (XY other, Point result) {
return subtract(other.x(), other.y(), result);
}
+4
View File
@@ -41,6 +41,10 @@ public interface IPoint extends XY, Cloneable
* @return a reference to the result, for chaining. */
Point add (float x, float y, Point result);
/** Translates this point by the specified offset and stores the result in the object provided.
* @return a reference to the result, for chaining. */
Point add (XY other, Point result);
/** Subtracts the supplied point from {@code this}.
* @return a new point containing the result. */
Point subtract (float x, float y);