package T3dobject; import java.awt.*; public class T3DPoint implements T3DObject { double x, y, z; int MAX_Z; Color color; boolean xy_correction; public T3DPoint() { x = y = z = 0; MAX_Z = 200; color = Color.black; xy_correction = true; } public T3DPoint (double x, double y, double z, int MAX_Z) { this.x = x; this.y = y; this.z = z; this.MAX_Z = MAX_Z; color = Color.black; xy_correction = true; } public T3DPoint(double x, double y, double z, int MAX_Z, Color color, boolean correction) { this.x = x; this.y = y; this.z = z; this.MAX_Z = MAX_Z; this.color = color; this.xy_correction = correction; } public void paint(Graphics g, int cx, int cy) {} protected double getCorrectionX() { if(!xy_correction) return x; if (z >= MAX_Z) return x*2; else if (z <= -MAX_Z) return 0; else return (1-(-z/MAX_Z))*x; } protected double getCorrectionY(){ if(!xy_correction) return y; if (z >= MAX_Z) return y*2; else if (z <= -MAX_Z) return 0; else return (1-(-z/MAX_Z))*y; } public void rotation(double xy_ra, double yz_ra) { /* xy_ra : £Ø£ÙºÂɸ¤Î²óž³ÑÅÙ */ /* yz_ra : £Ù£ÚºÂɸ¤Î²óž³ÑÅÙ */ xy_rotation(-xy_ra); yz_rotation(yz_ra); xy_rotation(xy_ra); } private void xy_rotation(double ra) { double old_x = x; double old_y = y; x = old_x * Math.cos(ra) - old_y * Math.sin(ra); y = old_x * Math.sin(ra) + old_y * Math.cos(ra); } private void yz_rotation(double ra) { double old_y = y; double old_z = z; y = old_y * Math.cos(ra) - old_z * Math.sin(ra); z = old_y * Math.sin(ra) + old_z * Math.cos(ra); } /* public double getZ(){ return z; }*/ public double getSortZ() { return z; } public double getX(){ return x; } public double getY(){ return y; } public Color getColor(){ return color; } }