Search This Blog

Showing posts with label draw polygon. Show all posts
Showing posts with label draw polygon. Show all posts

Java Program to Rotate Polygon - 2d Transformation Rotation in Java

This is a java program for rotation transformation in computer graphics. Rotation is one of the important 2d transformations in computer graphics. The program will tell you how to rotate points or polygon around a point (the pivot point). This CG lab program in java language reads the number of sides of polygon, co-ordinates of its vertices, the pivot point for rotation, and angle of rotation. It displays the original polygon and translated polygon in different colors in same screen. This program will tell you how to rotate a polygon in java. I override the paintComponent() method of JPanel to draw on a JPanel.