Gets the arrowhead shape. @param ptA2 @param theta double the angle of the arrow @return Shape
(Double ptA, double theta)
| 187 | * @return Shape |
| 188 | */ |
| 189 | protected Shape getHead(Double ptA, double theta) { |
| 190 | if (theta == lastTheta && lastX == ptA.x && lastY == ptA.y && headSize == lastHeadSize) |
| 191 | return head; |
| 192 | lastTheta = theta; |
| 193 | lastX = ptA.x; |
| 194 | lastY = ptA.y; |
| 195 | lastHeadSize = headSize; |
| 196 | GeneralPath path = new GeneralPath(); |
| 197 | path.moveTo(1, 0); |
| 198 | path.lineTo(-headSize, -headSize / 2); |
| 199 | path.lineTo(-headSize, +headSize / 2); |
| 200 | path.closePath(); |
| 201 | trA.setToTranslation(ptA.x, ptA.y); |
| 202 | trA.rotate(-theta); |
| 203 | return head = trA.createTransformedShape(path); |
| 204 | } |
| 205 | |
| 206 | |
| 207 | /** |