public class Point3D {	// coordinate of vertex
    public float x, y, z;    
	/** Constructor for Point3D. Inits x, y, and z to 0.0f
	 */
    public Point3D() {
        x = 0.0f;
        y = 0.0f;
        z = 0.0f;    }	/** Constructor for Point3D. Inits x, y, and z to vals passed in
	 */
    public Point3D(float xval, float yval, float zval) {        x = xval;        y = yval;        z = zval;    }    
    /** Constructor for Point3D. Inits x, y, and z to x, y, and z of point passed in
     */
    public Point3D(Point3D p) {        copy(p);    }        /** Copies x, y, and z from point passed in to x, y, and z vals
     */
    public void copy(Point3D p) {        x = p.x;        y = p.y;        z = p.z;    }    
    /** Calculates the dot product of the vector with the vector passed in:
     *  returns this (dot) src
     */
    public float dot(Point3D src)
    {
       return (x*src.x)+(y*src.y)+(z*src.z);
    }

    /** Calculates the cross product of the vector/point with the vector
     *  passed in, returns a new Point3D: out = this x src
     */
    public Point3D cross(Point3D src)
    {
        float xval = (y*src.z) - (z*src.y);
        float yval = (z*src.x) - (x*src.z);
        float zval = (x*src.y) - (y*src.x);
        return new Point3D(xval,yval,zval);
    }

    /** Subtracts the src vector from the current vector, returns a new Point3D
     *  out = this - src
     */
    public Point3D subtract(Point3D src)
    {
        float xval = x-src.x;
        float yval = y-src.y;
        float zval = z-src.z;
        return new Point3D(xval,yval,zval);
    }
    
    /** Normalizes the vector: this = this/sqrt(lx^2 + ly^2 + lz^2)
     */
    public void normalize()
    {
        float d = (float)Math.sqrt((double)((x*x)+(y*y)+(z*z)));
        x = x/d;
        y = y/d;
        z = z/d;
    }        /** Scales all values of the Point by a float
     */    public void scale(float f)    {
        x = f*x;
        y = f*y;
        z = f*z;    }
}