Synchronisation between Polygon(triangle) and line while rotating by angle
843806Jan 24 2008 — edited Jan 25 2008Hi
My problem is to draw on a white board, and while drawing to join arrows at the end of the line I added triange(polygon) at its end.
I have calculated the angle based on location of line . While rotating triangle is moving many times than the line and hence it looks zigzag.
My code looks as fallows.
AffineTransform at2 = new AffineTransform();
at2 = AffineTransform.getTranslateInstance((int)sPTx, (int)sPTy);
at2.rotate(angle);
AffineTransform k2 = g2.getTransform();
g2.setTransform(at2);
g2.fillPolygon(xPoints2, yPoints2, 3);
g2.setTransform(k2);
xPoinyts2,yPoints2 are array of points collected from ends of triangle.
Guys
Please help me in this regard.
Thanx in advance,
Sunil.