// D3VecTo2D.java // 3次元 Vector => 2次元 // Copyright (C) 1996, 1997 Y.Nagatani // nagatani@eken.phys.nagoya-u.ac.jp public class D3VecToD2 { public int xCenter, yCenter; public double scale; public double depth; D3VecToD2 () { xCenter = 150; yCenter = 125; scale = 85; depth = 1.5; } D3VecToD2 (int xCent, int yCent, double scale, double depth) { this.xCenter = xCent; this.yCenter = yCent; this.scale = scale; this.depth = depth; } int [] transf (D3Vector V) { int XY[] = new int [2]; XY[0] = xCenter + (int) (V.x / (-V.z + depth) * depth * scale); XY[1] = yCenter + (int) (V.y / (-V.z + depth) * depth * scale); return XY; } }