// 直方体を xy-平面上に描く // 稜のみを描き, 隠線処理はしない import java.applet.Applet; import java.awt.*; public class cuboid1 extends Applet { public void paint(Graphics g) { final double RADIAN = Math.PI/180.0; double scale = 5.0; // 大きさ double theta = 30; // 回転角度 int a = 30; int b = 40; int c = 50; // 座標軸を描く graphics.SetColor(g,0x000000); graphics.DrawLine(g,-200,0,200,0); graphics.DrawLine(g,0,-200,0,200); // 稜を描く graphics.SetColor(g,0x0000ff00); //下底 graphics.DrawLine(g,a,0,a,0); graphics.DrawLine(g,0,0,a,0); graphics.DrawLine(g,0,0,0,0); graphics.DrawLine(g,0,0,a,0); //上底 graphics.DrawLine(g,a,b,a,b); graphics.DrawLine(g,0,b,a,b); graphics.DrawLine(g,0,b,0,b); graphics.DrawLine(g,0,b,a,b); //右側面 graphics.DrawLine(g,a,0,a,b); graphics.DrawLine(g,0,0,0,b); //左側面 graphics.DrawLine(g,a,0,a,b); graphics.DrawLine(g,0,0,0,b); } }