void RotateZ(double theta) {
double sinTheta = Math.sin(theta);
double cosTheta = Math.cos(theta);
for (int v = 0; v < vertices.length; v++) {
int x = vertices[v][0]; //current x of vertices v
int y = vertices[v][1]; //current y of vertices v
vertices[v][0] = (int) (x * cosTheta - y * sinTheta); //new x of vertices v
vertices[v][1] = (int) (y * cosTheta + x * sinTheta); //new y of vertices v
}
}
形状完全脱离屏幕,我不知道为什么。