xyz.luan.geometry.ShapeBase Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of geometry Show documentation
Show all versions of geometry Show documentation
Simple geometry package for Java, implementing set operations and area calculation for Polygons.
package xyz.luan.geometry;
public abstract class ShapeBase implements Shape {
protected abstract Shape op(Shape shape, OpType type);
public Shape intersection(Shape shape) {
return op(shape, OpType.INTERSECTION);
}
public Shape diff(Shape shape) {
return op(shape, OpType.DIFFERENCE);
}
public Shape xor(Shape shape) {
return op(shape, OpType.XOR);
}
public Shape union(Shape shape) {
return op(shape, OpType.UNION);
}
}