protected Polygon createArrow(mxPoint p0,mxPoint pe){
  double spacing=mxConstants.ARROW_SPACING * scale;
  double width=mxConstants.ARROW_WIDTH * scale;
  double arrow=mxConstants.ARROW_SIZE * scale;
  double dx=pe.getX() - p0.getX();
  double dy=pe.getY() - p0.getY();
  double dist=Math.sqrt(dx * dx + dy * dy);
  double length=dist - 2 * spacing - arrow;
  double nx=dx / dist;
  double ny=dy / dist;
  double basex=length * nx;
  double basey=length * ny;
  double floorx=width * ny / 3;
  double floory=-width * nx / 3;
  double p0x=p0.getX() - floorx / 2 + spacing * nx;
  double p0y=p0.getY() - floory / 2 + spacing * ny;
  double p1x=p0x + floorx;
  double p1y=p0y + floory;
  double p2x=p1x + basex;
  double p2y=p1y + basey;
  double p3x=p2x + floorx;
  double p3y=p2y + floory;
  double p5x=p3x - 3 * floorx;
  double p5y=p3y - 3 * floory;
  Polygon poly=new Polygon();
  poly.addPoint((int)Math.round(p0x),(int)Math.round(p0y));
  poly.addPoint((int)Math.round(p1x),(int)Math.round(p1y));
  poly.addPoint((int)Math.round(p2x),(int)Math.round(p2y));
  poly.addPoint((int)Math.round(p3x),(int)Math.round(p3y));
  poly.addPoint((int)Math.round(pe.getX() - spacing * nx),(int)Math.round(pe.getY() - spacing * ny));
  poly.addPoint((int)Math.round(p5x),(int)Math.round(p5y));
  poly.addPoint((int)Math.round(p5x + floorx),(int)Math.round(p5y + floory));
  return poly;
}

protected Polygon createArrow ( mxPoint p0 , mxPoint pe ) { double spacing = mxConstants . ARROW_SPACING * scale ; double width = mxConstants . ARROW_WIDTH * scale ; double arrow = mxConstants . ARROW_SIZE * scale ; double dx = pe . getX ( ) - p0 . getX ( ) ; double dy = pe . getY ( ) - p0 . getY ( ) ; double dist = Math . sqrt ( dx * dx + dy * dy ) ; double length = dist - 2 * spacing - arrow ; double nx = dx / dist ; double ny = dy / dist ; double basex = length * nx ; double basey = length * ny ; double floorx = width * ny / 3 ; double floory = - width * nx / 3 ; double p0x = p0 . getX ( ) - floorx / 2 + spacing * nx ; double p0y = p0 . getY ( ) - floory / 2 + spacing * ny ; double p1x = p0x + floorx ; double p1y = p0y + floory ; double p2x = p1x + basex ; double p2y = p1y + basey ; double p3x = p2x + floorx ; double p3y = p2y + floory ; double p5x = p3x - 3 * floorx ; double p5y = p3y - 3 * floory ; Polygon poly = new Polygon ( ) ; poly . addPoint ( ( int ) Math . round ( p0x ) , ( int ) Math . round ( p0y ) ) ; poly . addPoint ( ( int ) Math . round ( p1x ) , ( int ) Math . round ( p1y ) ) ; poly . addPoint ( ( int ) Math . round ( p2x ) , ( int ) Math . round ( p2y ) ) ; poly . addPoint ( ( int ) Math . round ( p3x ) , ( int ) Math . round ( p3y ) ) ; poly . addPoint ( ( int ) Math . round ( pe . getX ( ) - spacing * nx ) , ( int ) Math . round ( pe . getY ( ) - spacing * ny ) ) ; poly . addPoint ( ( int ) Math . round ( p5x ) , ( int ) Math . round ( p5y ) ) ; poly . addPoint ( ( int ) Math . round ( p5x + floorx ) , ( int ) Math . round ( p5y + floory ) ) ; return poly ; }
creates a polygon that represents an arrow .
