Reputation: 10112
Given two Point
s, is there a more native solution to get the area between these, than this?
new Dimension(one.x - other.x, one.y - other.y);
What I think of is something like
Dimension a = new Dimension(one, other);
Dimension b = one.towards(other);
Upvotes: 0
Views: 58
Reputation: 10112
The syntax is a bit odd, but here it is:
static Dimension sizeBetween(Point from, Point to) {
Rectangle box = new Rectangle(from);
box.add(to);
return box.getSize();
}
Upvotes: 1