/*
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOUSE. See the GNU
 * General Public License for more details.
 *
 * You should have recieved a copy of the GNU General Public License
 * along with this program; if not write to the Free Software
 * Foundation, inc., 59 Temple Place, Suite 330, Boston MA 02111-1307
 * USA
 */
package j3d;
import java.awt.*;
import java.awt.geom.*;
/**
 * Insert the type's description here.
 *
 * @author: Yuriy Mikhaylovskiy
 */

public class shpPoint extends Rectangle2D.Double implements shp{
  private float sx,sy,sz;
  private Color color;
  private float z_sort;
  private boolean show;

  public void paint(Graphics2D g, Canvas3D j3d){
    g.setPaint(color);
    g.draw(this);
  }

  public shpPoint(float x, float y, float z, Color c){
    sx=x;
    sy=y;
    sz=z;
    color=c;
  }
  public void transform2D(Matrix3D t, Vector3D cor){
    sx += cor.x;
    sy += cor.y;
    sz += cor.z;
      
    x=sx*t.xx+sy*t.xy+sz*t.xz+t.xo-Canvas3D.POINTSIZE/2;
    y=sx*t.yx+sy*t.yy+sz*t.yz+t.yo-Canvas3D.POINTSIZE/2;
    z_sort=sx*t.zx+sy*t.zy+sz*t.zz+t.zo;
    this.width=Canvas3D.POINTSIZE;
    this.height=Canvas3D.POINTSIZE;

    sx -= cor.x;
    sy -= cor.y;
    sz -= cor.z;
    
  }

  public float get_Z(){
    return z_sort;
  }

  public boolean isPickPoint(int x, int y) {
      
      return this.contains((double)x, (double)y);
      
  }

  public boolean isPickPoint(Rectangle2D r) {
      
      return r.contains((double)x, (double)y);
      
  }
  public void setShow(boolean s) {
      show = s;
  }

  public boolean isShow() {
      return show;
  }
  
}