MCPcopy Create free account
hub / github.com/OpenSourcePhysics/osp / getHead

Method getHead

src/org/opensourcephysics/display/Arrow.java:189–204  ·  view source on GitHub ↗

Gets the arrowhead shape. @param ptA2 @param theta double the angle of the arrow @return Shape

(Double ptA, double theta)

Source from the content-addressed store, hash-verified

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 /**

Callers 1

drawMethod · 0.95

Calls 5

moveToMethod · 0.80
lineToMethod · 0.80
closePathMethod · 0.80
setToTranslationMethod · 0.80
rotateMethod · 0.45

Tested by

no test coverage detected