Exemple #1
0
  public CachedLine arrowForEnd(CachedLine c, float distanceBack, float size, float width) {
    Cursor cc = new Cursor(c).end();
    cc.forwardD(-distanceBack);

    Vector2 p = cc.position();
    Vector2 t = cc.tangentForward();

    if (t == null || t.mag() == 0 || t.isNaN()) t = cc.tangentBackward();

    Vector2 n = t.normalize();
    n.scale(size);

    return triangleAt(p, n, width);
  }
Exemple #2
0
  public CachedLine arrowFor(CachedLine c, float along, float size, float width) {
    Cursor cc = new Cursor(c);
    float len = cc.length();
    cc.forwardD(len * along);

    Vector2 p = cc.position();
    Vector2 t = cc.tangentForward();

    if (t == null || t.mag() == 0 || t.isNaN() || along == 1) t = cc.tangentBackward();

    Vector2 n = t.normalize();
    n.scale(size);

    return triangleAt(p, n, width);
  }