I wrote a program that supports 3 actions : rotate ,translate and scaling .
The translation & scaling are working great , but I'm having some problems with the rotation.
At the beginning of the code , I parse the origin point from a file , and then draw the initial object in the 2D plane . Then ,instead of rotating around itself , the object is rotating around the origin .
I check all the matrices and mathematical equations but couldn't find the exact bug , any idea where did I go wrong here ?
I attached A partial code of the rotation , without the scaling and the transform.
Here is a SSCCE of the code :
import java.awt.BasicStroke;
import java.awt.BorderLayout;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.util.ArrayList;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.geom.Point2D;
import java.awt.geom.Line2D;
import java.io.IOException;
import javax.swing.JFrame;
public class SSCCE {
public static void main (String[] args) throws IOException
{
ClippingView1 CC = new ClippingView1();
CC.start();
}
}
- This SSCCE supports only rotation , since this is my main problem .
Any idea for the problem would be greatly appreciated !
Regards