// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   Tuple3d.java

package vecmath;

import java.io.Serializable;

// Referenced classes of package javax.vecmath:
//            Point3d, Tuple3f

public abstract class Tuple3d
    implements Serializable, Cloneable
{

    public Tuple3d(double d, double d1, double d2)
    {
        x = d;
        y = d1;
        z = d2;
    }

    public Tuple3d(double ad[])
    {
        x = ad[0];
        y = ad[1];
        z = ad[2];
    }

    public Tuple3d(Tuple3d tuple3d)
    {
        x = tuple3d.x;
        y = tuple3d.y;
        z = tuple3d.z;
    }

//    public Tuple3d(Tuple3f tuple3f)
//    {
//        x = tuple3f.x;
//        y = tuple3f.y;
//        z = tuple3f.z;
//    }

    public Tuple3d()
    {
        x = 0.0D;
        y = 0.0D;
        z = 0.0D;
    }

    public final void set(double d, double d1, double d2)
    {
        x = d;
        y = d1;
        z = d2;
    }

    public final void set(double ad[])
    {
        x = ad[0];
        y = ad[1];
        z = ad[2];
    }

    public final void set(Tuple3d tuple3d)
    {
        x = tuple3d.x;
        y = tuple3d.y;
        z = tuple3d.z;
    }

//    public final void set(Tuple3f tuple3f)
//    {
//        x = tuple3f.x;
//        y = tuple3f.y;
//        z = tuple3f.z;
//    }

    public final void get(double ad[])
    {
        ad[0] = x;
        ad[1] = y;
        ad[2] = z;
    }

    public final void get(Tuple3d tuple3d)
    {
        tuple3d.x = x;
        tuple3d.y = y;
        tuple3d.z = z;
    }

    public final void add(Tuple3d tuple3d, Tuple3d tuple3d1)
    {
        x = tuple3d.x + tuple3d1.x;
        y = tuple3d.y + tuple3d1.y;
        z = tuple3d.z + tuple3d1.z;
    }

    public final void add(Tuple3d tuple3d)
    {
        x += tuple3d.x;
        y += tuple3d.y;
        z += tuple3d.z;
    }

    public final void sub(Tuple3d tuple3d, Tuple3d tuple3d1)
    {
        x = tuple3d.x - tuple3d1.x;
        y = tuple3d.y - tuple3d1.y;
        z = tuple3d.z - tuple3d1.z;
    }

    public final void sub(Tuple3d tuple3d)
    {
        x -= tuple3d.x;
        y -= tuple3d.y;
        z -= tuple3d.z;
    }

    public final void negate(Tuple3d tuple3d)
    {
        x = -tuple3d.x;
        y = -tuple3d.y;
        z = -tuple3d.z;
    }

    public final void negate()
    {
        x = -x;
        y = -y;
        z = -z;
    }

    public final void scale(double d, Tuple3d tuple3d)
    {
        x = d * tuple3d.x;
        y = d * tuple3d.y;
        z = d * tuple3d.z;
    }

    public final void scale(double d)
    {
        x *= d;
        y *= d;
        z *= d;
    }

    public final void scaleAdd(double d, Tuple3d tuple3d, Tuple3d tuple3d1)
    {
        x = d * tuple3d.x + tuple3d1.x;
        y = d * tuple3d.y + tuple3d1.y;
        z = d * tuple3d.z + tuple3d1.z;
    }

    /**
     * @deprecated Method scaleAdd is deprecated
     */

//    public final void scaleAdd(double d, Tuple3f tuple3f)
//    {
//        scaleAdd(d, ((Tuple3d) (new Point3d(tuple3f))));
//    }

    public final void scaleAdd(double d, Tuple3d tuple3d)
    {
        x = d * x + tuple3d.x;
        y = d * y + tuple3d.y;
        z = d * z + tuple3d.z;
    }

    public String toString()
    {
        return "(" + x + ", " + y + ", " + z + ")";
    }

    public int hashCode()
    {
        long l = 1L;
        l = 31L * l + Double.doubleToLongBits(x);
        l = 31L * l + Double.doubleToLongBits(y);
        l = 31L * l + Double.doubleToLongBits(z);
        return (int)(l ^ l >> 32);
    }

    public boolean equals(Tuple3d tuple3d)
    {
        try
        {
            return x == tuple3d.x && y == tuple3d.y && z == tuple3d.z;
        }
        catch(NullPointerException nullpointerexception)
        {
            return false;
        }
    }

    public boolean equals(Object obj)
    {
        try
        {
            Tuple3d tuple3d = (Tuple3d)obj;
            return x == tuple3d.x && y == tuple3d.y && z == tuple3d.z;
        }
        catch(ClassCastException classcastexception)
        {
            return false;
        }
        catch(NullPointerException nullpointerexception)
        {
            return false;
        }
    }

    public boolean epsilonEquals(Tuple3d tuple3d, double d)
    {
        double d1 = x - tuple3d.x;
        if((d1 >= 0.0D ? d1 : -d1) > d)
            return false;
        d1 = y - tuple3d.y;
        if((d1 >= 0.0D ? d1 : -d1) > d)
            return false;
        d1 = z - tuple3d.z;
        return (d1 >= 0.0D ? d1 : -d1) <= d;
    }

    /**
     * @deprecated Method clamp is deprecated
     */

    public final void clamp(float f, float f1, Tuple3d tuple3d)
    {
        clamp(f, f1, tuple3d);
    }

    public final void clamp(double d, double d1, Tuple3d tuple3d)
    {
        if(tuple3d.x > d1)
            x = d1;
        else
        if(tuple3d.x < d)
            x = d;
        else
            x = tuple3d.x;
        if(tuple3d.y > d1)
            y = d1;
        else
        if(tuple3d.y < d)
            y = d;
        else
            y = tuple3d.y;
        if(tuple3d.z > d1)
            z = d1;
        else
        if(tuple3d.z < d)
            z = d;
        else
            z = tuple3d.z;
    }

    /**
     * @deprecated Method clampMin is deprecated
     */

    public final void clampMin(float f, Tuple3d tuple3d)
    {
        clampMin(f, tuple3d);
    }

    public final void clampMin(double d, Tuple3d tuple3d)
    {
        if(tuple3d.x < d)
            x = d;
        else
            x = tuple3d.x;
        if(tuple3d.y < d)
            y = d;
        else
            y = tuple3d.y;
        if(tuple3d.z < d)
            z = d;
        else
            z = tuple3d.z;
    }

    /**
     * @deprecated Method clampMax is deprecated
     */

    public final void clampMax(float f, Tuple3d tuple3d)
    {
        clampMax(f, tuple3d);
    }

    public final void clampMax(double d, Tuple3d tuple3d)
    {
        if(tuple3d.x > d)
            x = d;
        else
            x = tuple3d.x;
        if(tuple3d.y > d)
            y = d;
        else
            y = tuple3d.y;
        if(tuple3d.z > d)
            z = d;
        else
            z = tuple3d.z;
    }

    public final void absolute(Tuple3d tuple3d)
    {
        x = Math.abs(tuple3d.x);
        y = Math.abs(tuple3d.y);
        z = Math.abs(tuple3d.z);
    }

    /**
     * @deprecated Method clamp is deprecated
     */

    public final void clamp(float f, float f1)
    {
        clamp(f, f1);
    }

    public final void clamp(double d, double d1)
    {
        if(x > d1)
            x = d1;
        else
        if(x < d)
            x = d;
        if(y > d1)
            y = d1;
        else
        if(y < d)
            y = d;
        if(z > d1)
            z = d1;
        else
        if(z < d)
            z = d;
    }

    /**
     * @deprecated Method clampMin is deprecated
     */

    public final void clampMin(float f)
    {
        clampMin(f);
    }

    public final void clampMin(double d)
    {
        if(x < d)
            x = d;
        if(y < d)
            y = d;
        if(z < d)
            z = d;
    }

    /**
     * @deprecated Method clampMax is deprecated
     */

    public final void clampMax(float f)
    {
        clampMax(f);
    }

    public final void clampMax(double d)
    {
        if(x > d)
            x = d;
        if(y > d)
            y = d;
        if(z > d)
            z = d;
    }

    public final void absolute()
    {
        x = Math.abs(x);
        y = Math.abs(y);
        z = Math.abs(z);
    }

    /**
     * @deprecated Method interpolate is deprecated
     */

    public final void interpolate(Tuple3d tuple3d, Tuple3d tuple3d1, float f)
    {
        interpolate(tuple3d, tuple3d1, f);
    }

    public final void interpolate(Tuple3d tuple3d, Tuple3d tuple3d1, double d)
    {
        x = (1.0D - d) * tuple3d.x + d * tuple3d1.x;
        y = (1.0D - d) * tuple3d.y + d * tuple3d1.y;
        z = (1.0D - d) * tuple3d.z + d * tuple3d1.z;
    }

    /**
     * @deprecated Method interpolate is deprecated
     */

    public final void interpolate(Tuple3d tuple3d, float f)
    {
        interpolate(tuple3d, f);
    }

    public final void interpolate(Tuple3d tuple3d, double d)
    {
        x = (1.0D - d) * x + d * tuple3d.x;
        y = (1.0D - d) * y + d * tuple3d.y;
        z = (1.0D - d) * z + d * tuple3d.z;
    }

    public Object clone()
    {
        try
        {
            return super.clone();
        }
        catch(CloneNotSupportedException clonenotsupportedexception)
        {
            throw new InternalError();
        }
    }

    static final long serialVersionUID = 0x4ce97b820b91b15fL;
    public double x;
    public double y;
    public double z;
	public double getX() {
		return x;
	}

	public void setX(double x) {
		this.x = x;
	}

	public double getY() {
		return y;
	}

	public void setY(double y) {
		this.y = y;
	}

	public double getZ() {
		return z;
	}

	public void setZ(double z) {
		this.z = z;
	}
    
    
}
