DrawArc - desenhando arcos

2 respostas
J

Olá estou precisando desenhar arcos com o Java 2D.

Os parâmetros são os seguintes:

x - the x coordinate of the upper-left corner of the arc to be drawn.
y - the y coordinate of the upper-left corner of the arc to be drawn.
width - the width of the arc to be drawn.
height - the height of the arc to be drawn.
startAngle - the beginning angle.
arcAngle - the angular extent of the arc, relative to the start angle.

Acontece que eu preciso desenhar um arco que vai de [x,y] a [x1,y1]…

Alguém sabe como posso calcular os ângulos, a largura e a altura do arco de modo que eu consiga desenhar um arco entre esss dois pontos?

Agradeço desde já.

2 Respostas

ViniGodoy

Ao invés do drawArc, desenhe uma curva quadrática, usando a QuadCurve2D.

http://java.sun.com/docs/books/tutorial/2d/overview/primitives.html

QuadCurve2D quadCurve = QuadCurve2D.float(x1, y1, x2, y2, x1, y2); g2d.draw(quadCurve);

J

Que mancada a minha! Não cheguei a olhar esses outros métodos, hehe…

Valeu aí Godoy…Sempre ajudando a galera com dificuldades gráficas :slight_smile:

Criado 16 de outubro de 2009
Ultima resposta 16 de out. de 2009
Respostas 2
Participantes 2