📄 cubeplane.java
字号:
// FrontEnd Plus GUI for JAD
// DeCompiled : CubePlane.class
import java.awt.Color;
class CubePlane extends Object3D
{
static final int XPlane = 0;
static final int YPlane = 1;
static final int ZPlane = 2;
private final int TransFace[][] = {
{
0, 1, 2, 3, 4, 5
}, {
2, 3, 4, 5, 0, 1
}, {
4, 5, 0, 1, 2, 3
}
};
private Vertex PlaneVertex[];
private Face PlaneFace[];
private int Plane;
private int Axis;
CubePlane(int i, int j)
{
PlaneVertex = new Vertex[8];
PlaneFace = new Face[6];
Plane = j;
Axis = i;
NewPlane(PlaneVertex, PlaneFace);
Define(PlaneVertex, 8, PlaneFace, 6);
}
public void Reset()
{
Define(PlaneVertex, 8, PlaneFace, 6);
}
public void SetMap(Color acolor[][][])
{
if(Plane == 0)
((CubeFace)Faces[0]).SetMap(acolor[TransFace[Axis][0]]);
if(Plane == 2)
((CubeFace)Faces[1]).SetMap(acolor[TransFace[Axis][1]]);
for(int i = 2; i <= 3; i++)
{
for(int j = 0; j < 3; j++)
((CubeFace)Faces[i]).SetMap(acolor[TransFace[Axis][i]][Plane][j], j, 0);
}
for(int k = 4; k <= 5; k++)
{
for(int l = 0; l < 3; l++)
((CubeFace)Faces[k]).SetMap(acolor[TransFace[Axis][k]][l][Plane], l, 0);
}
}
public void Spin(boolean flag)
{
double d = ((double)(flag ? 15 : -15) * 3.1415926535897931D) / 180D;
switch(Axis)
{
case 0: // '\0'
XRotate(d);
break;
case 1: // '\001'
YRotate(d);
break;
case 2: // '\002'
ZRotate(d);
break;
}
Transform();
}
private void NewPlane(Vertex avertex[], Face aface[])
{
switch(Axis)
{
case 0: // '\0'
avertex[0] = new Vertex(-3 + Plane * 2, -3F, -3F);
avertex[1] = new Vertex(-3 + Plane * 2, -3F, 3F);
avertex[2] = new Vertex(-3 + Plane * 2, 3F, 3F);
avertex[3] = new Vertex(-3 + Plane * 2, 3F, -3F);
avertex[4] = new Vertex(-1 + Plane * 2, -3F, -3F);
avertex[5] = new Vertex(-1 + Plane * 2, -3F, 3F);
avertex[6] = new Vertex(-1 + Plane * 2, 3F, 3F);
avertex[7] = new Vertex(-1 + Plane * 2, 3F, -3F);
break;
case 1: // '\001'
avertex[0] = new Vertex(-3F, -3 + Plane * 2, -3F);
avertex[1] = new Vertex(3F, -3 + Plane * 2, -3F);
avertex[2] = new Vertex(3F, -3 + Plane * 2, 3F);
avertex[3] = new Vertex(-3F, -3 + Plane * 2, 3F);
avertex[4] = new Vertex(-3F, -1 + Plane * 2, -3F);
avertex[5] = new Vertex(3F, -1 + Plane * 2, -3F);
avertex[6] = new Vertex(3F, -1 + Plane * 2, 3F);
avertex[7] = new Vertex(-3F, -1 + Plane * 2, 3F);
break;
case 2: // '\002'
avertex[0] = new Vertex(-3F, -3F, -3 + Plane * 2);
avertex[1] = new Vertex(-3F, 3F, -3 + Plane * 2);
avertex[2] = new Vertex(3F, 3F, -3 + Plane * 2);
avertex[3] = new Vertex(3F, -3F, -3 + Plane * 2);
avertex[4] = new Vertex(-3F, -3F, -1 + Plane * 2);
avertex[5] = new Vertex(-3F, 3F, -1 + Plane * 2);
avertex[6] = new Vertex(3F, 3F, -1 + Plane * 2);
avertex[7] = new Vertex(3F, -3F, -1 + Plane * 2);
break;
}
if(Plane == 0)
{
aface[0] = new CubeFace(3, 3);
} else
{
aface[0] = new Face(4);
aface[0].FaceColor = Color.black;
}
if(Plane == 2)
{
aface[1] = new CubeFace(3, 3);
} else
{
aface[1] = new Face(4);
aface[1].FaceColor = Color.black;
}
for(int i = 2; i < 6; i++)
aface[i] = new CubeFace(3, 1);
aface[0].Vertices[0] = avertex[0];
aface[0].Vertices[1] = avertex[3];
aface[0].Vertices[2] = avertex[2];
aface[0].Vertices[3] = avertex[1];
aface[1].Vertices[0] = avertex[4];
aface[1].Vertices[1] = avertex[7];
aface[1].Vertices[2] = avertex[6];
aface[1].Vertices[3] = avertex[5];
aface[2].Vertices[0] = avertex[0];
aface[2].Vertices[1] = avertex[4];
aface[2].Vertices[2] = avertex[5];
aface[2].Vertices[3] = avertex[1];
aface[3].Vertices[0] = avertex[3];
aface[3].Vertices[1] = avertex[7];
aface[3].Vertices[2] = avertex[6];
aface[3].Vertices[3] = avertex[2];
aface[4].Vertices[0] = avertex[0];
aface[4].Vertices[1] = avertex[4];
aface[4].Vertices[2] = avertex[7];
aface[4].Vertices[3] = avertex[3];
aface[5].Vertices[0] = avertex[1];
aface[5].Vertices[1] = avertex[5];
aface[5].Vertices[2] = avertex[6];
aface[5].Vertices[3] = avertex[2];
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -