public InheritanceArrow() {
super(getInheritanceArrow(2000, 200));
}
private static PolyPolygon getInheritanceArrow(int size, int lineWith) {
Polygon polygon = new Polygon();
PolygonFlags flag = PolygonFlags.NORMAL;
double high = Math.sqrt(0.75 * size * size);
double sceleLength = size;
double baseLength = size * 0.9;
double baseAngle = Math.asin(high / sceleLength);
double topAngle = Math.PI - 2 * baseAngle;
Point p;
p = new Point(0, round(high));
polygon.addPoint(p, flag);
p = new Point(round(baseLength / 2), 0);
polygon.addPoint(p, flag);
p = new Point(round(baseLength), round(high));
polygon.addPoint(p, flag);
double x = lineWith / Math.sin(baseAngle);
double tolerance = 1;
p = new Point(round(x + tolerance), round(high));
polygon.addPoint(p, flag);
double y = lineWith / Math.tan(baseAngle);
p = new Point(round(x + y + tolerance), round(high) - lineWith);
polygon.addPoint(p, flag);
p = new Point(round(baseLength - x - y), round(high - lineWith));
polygon.addPoint(p, flag);
double f = lineWith / Math.sin(topAngle / 2);
p = new Point(round(baseLength / 2), (int) Math.round(f));
polygon.addPoint(p, flag);
p = new Point(round(x), round(high));
polygon.addPoint(p, flag);
PolyPolygon polyPolygon = new PolyPolygon();
polyPolygon.getPolygons().add(polygon);
return polyPolygon;
}