예제 #1
0
파일: SimpleArrows.java 프로젝트: EQ4/Field
  public CachedLine circleFor(CachedLine c, float along, float size) {
    Cursor cc = new Cursor(c);
    float len = cc.length();
    cc.forwardD(len * along);

    Vector2 p = cc.position();

    return circleAt(p, size);
  }
예제 #2
0
파일: SimpleArrows.java 프로젝트: EQ4/Field
  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);
  }
예제 #3
0
파일: SimpleArrows.java 프로젝트: EQ4/Field
  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);
  }