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:
@@ -57,17 +57,22 @@ public abstract class AbstractPoint implements IPoint
|
|||||||
return result.set(x() + x, y() + y);
|
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
|
@Override // from IPoint
|
||||||
public Point subtract (double x, double y) {
|
public Point subtract (double x, double y) {
|
||||||
return subtract(x, y, new Point());
|
return subtract(x, y, new Point());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override // from IPoint
|
||||||
public Point subtract (double x, double y, Point result) {
|
public Point subtract (double x, double y, Point result) {
|
||||||
return result.set(x() - x, y() - y);
|
return result.set(x() - x, y() - y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override // from IPoint
|
||||||
public Point subtract (XY other, Point result) {
|
public Point subtract (XY other, Point result) {
|
||||||
return subtract(other.x(), other.y(), result);
|
return subtract(other.x(), other.y(), result);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,10 @@ public interface IPoint extends XY, Cloneable
|
|||||||
* @return a reference to the result, for chaining. */
|
* @return a reference to the result, for chaining. */
|
||||||
Point add (double x, double y, Point result);
|
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}.
|
/** Subtracts the supplied point from {@code this}.
|
||||||
* @return a new point containing the result. */
|
* @return a new point containing the result. */
|
||||||
Point subtract (double x, double y);
|
Point subtract (double x, double y);
|
||||||
|
|||||||
@@ -57,17 +57,22 @@ public abstract class AbstractPoint implements IPoint
|
|||||||
return result.set(x() + x, y() + y);
|
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
|
@Override // from IPoint
|
||||||
public Point subtract (float x, float y) {
|
public Point subtract (float x, float y) {
|
||||||
return subtract(x, y, new Point());
|
return subtract(x, y, new Point());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override // from IPoint
|
||||||
public Point subtract (float x, float y, Point result) {
|
public Point subtract (float x, float y, Point result) {
|
||||||
return result.set(x() - x, y() - y);
|
return result.set(x() - x, y() - y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override // from IPoint
|
||||||
public Point subtract (XY other, Point result) {
|
public Point subtract (XY other, Point result) {
|
||||||
return subtract(other.x(), other.y(), result);
|
return subtract(other.x(), other.y(), result);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,10 @@ public interface IPoint extends XY, Cloneable
|
|||||||
* @return a reference to the result, for chaining. */
|
* @return a reference to the result, for chaining. */
|
||||||
Point add (float x, float y, Point result);
|
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}.
|
/** Subtracts the supplied point from {@code this}.
|
||||||
* @return a new point containing the result. */
|
* @return a new point containing the result. */
|
||||||
Point subtract (float x, float y);
|
Point subtract (float x, float y);
|
||||||
|
|||||||
Reference in New Issue
Block a user