Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Synchronisation between Polygon(triangle) and line while rotating by angle

843806Jan 24 2008 — edited Jan 25 2008
Hi

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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 22 2008
Added on Jan 24 2008
1 comment
162 views