Newer
Older
CarrotServer / src / vecmath / Tuple4d.java
t-nakanishi on 18 Jul 2017 10 KB [add] project
// 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:   Tuple4d.java

package vecmath;

import java.io.Serializable;

// Referenced classes of package javax.vecmath:
//            Tuple4f

public abstract class Tuple4d
    implements Serializable, Cloneable
{

    public Tuple4d(double d, double d1, double d2, double d3)
    {
        x = d;
        y = d1;
        z = d2;
        w = d3;
    }

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

    public Tuple4d(Tuple4d tuple4d)
    {
        x = tuple4d.x;
        y = tuple4d.y;
        z = tuple4d.z;
        w = tuple4d.w;
    }

//    public Tuple4d(Tuple4f tuple4f)
//    {
//        x = tuple4f.x;
//        y = tuple4f.y;
//        z = tuple4f.z;
//        w = tuple4f.w;
//    }

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

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

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

    public final void set(Tuple4d tuple4d)
    {
        x = tuple4d.x;
        y = tuple4d.y;
        z = tuple4d.z;
        w = tuple4d.w;
    }

//    public final void set(Tuple4f tuple4f)
//    {
//        x = tuple4f.x;
//        y = tuple4f.y;
//        z = tuple4f.z;
//        w = tuple4f.w;
//    }

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

    public final void get(Tuple4d tuple4d)
    {
        tuple4d.x = x;
        tuple4d.y = y;
        tuple4d.z = z;
        tuple4d.w = w;
    }

    public final void add(Tuple4d tuple4d, Tuple4d tuple4d1)
    {
        x = tuple4d.x + tuple4d1.x;
        y = tuple4d.y + tuple4d1.y;
        z = tuple4d.z + tuple4d1.z;
        w = tuple4d.w + tuple4d1.w;
    }

    public final void add(Tuple4d tuple4d)
    {
        x += tuple4d.x;
        y += tuple4d.y;
        z += tuple4d.z;
        w += tuple4d.w;
    }

    public final void sub(Tuple4d tuple4d, Tuple4d tuple4d1)
    {
        x = tuple4d.x - tuple4d1.x;
        y = tuple4d.y - tuple4d1.y;
        z = tuple4d.z - tuple4d1.z;
        w = tuple4d.w - tuple4d1.w;
    }

    public final void sub(Tuple4d tuple4d)
    {
        x -= tuple4d.x;
        y -= tuple4d.y;
        z -= tuple4d.z;
        w -= tuple4d.w;
    }

    public final void negate(Tuple4d tuple4d)
    {
        x = -tuple4d.x;
        y = -tuple4d.y;
        z = -tuple4d.z;
        w = -tuple4d.w;
    }

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

    public final void scale(double d, Tuple4d tuple4d)
    {
        x = d * tuple4d.x;
        y = d * tuple4d.y;
        z = d * tuple4d.z;
        w = d * tuple4d.w;
    }

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

    public final void scaleAdd(double d, Tuple4d tuple4d, Tuple4d tuple4d1)
    {
        x = d * tuple4d.x + tuple4d1.x;
        y = d * tuple4d.y + tuple4d1.y;
        z = d * tuple4d.z + tuple4d1.z;
        w = d * tuple4d.w + tuple4d1.w;
    }

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

    public final void scaleAdd(float f, Tuple4d tuple4d)
    {
        scaleAdd(f, tuple4d);
    }

    public final void scaleAdd(double d, Tuple4d tuple4d)
    {
        x = d * x + tuple4d.x;
        y = d * y + tuple4d.y;
        z = d * z + tuple4d.z;
        w = d * w + tuple4d.w;
    }

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

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

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

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

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

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

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

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

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

    public final void clampMin(float f, Tuple4d tuple4d)
    {
        clampMin(f, tuple4d);
    }

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

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

    public final void clampMax(float f, Tuple4d tuple4d)
    {
        clampMax(f, tuple4d);
    }

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

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

    /**
     * @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;
        if(w > d1)
            w = d1;
        else
        if(w < d)
            w = 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;
        if(w < d)
            w = 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;
        if(w > d)
            w = d;
    }

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

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

    public void interpolate(Tuple4d tuple4d, Tuple4d tuple4d1, float f)
    {
        interpolate(tuple4d, tuple4d1, f);
    }

    public void interpolate(Tuple4d tuple4d, Tuple4d tuple4d1, double d)
    {
        x = (1.0D - d) * tuple4d.x + d * tuple4d1.x;
        y = (1.0D - d) * tuple4d.y + d * tuple4d1.y;
        z = (1.0D - d) * tuple4d.z + d * tuple4d1.z;
        w = (1.0D - d) * tuple4d.w + d * tuple4d1.w;
    }

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

    public void interpolate(Tuple4d tuple4d, float f)
    {
        interpolate(tuple4d, f);
    }

    public void interpolate(Tuple4d tuple4d, double d)
    {
        x = (1.0D - d) * x + d * tuple4d.x;
        y = (1.0D - d) * y + d * tuple4d.y;
        z = (1.0D - d) * z + d * tuple4d.z;
        w = (1.0D - d) * w + d * tuple4d.w;
    }

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

    static final long serialVersionUID = 0xbe1853c7936b40b4L;
    public double x;
    public double y;
    public double z;
    public double w;
}