sim.util
Class MutableDouble3D

java.lang.Object
  extended by sim.util.MutableDouble3D
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public final class MutableDouble3D
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

MutableDouble3D is more or less the same class as javax.vecmath.Point3d, except that it is hash-equivalent to Double3D.

Just as with MutableInt3D: you use MutableDouble3D as a STORED hash key at your peril: it has the same misfeature as javax.vecmath.Point3d, and you should read the warning in Double3D. However, you can look up Double3D-keyed objects in a hash table by passing in a MutableDouble3D instead.

See Also:
Serialized Form

Field Summary
 double x
           
 double y
           
 double z
           
 
Constructor Summary
MutableDouble3D()
           
MutableDouble3D(Double2D p)
          Explicitly assumes the z value is set to 0
MutableDouble3D(Double2D p, double z)
           
MutableDouble3D(Double3D p)
           
MutableDouble3D(double x, double y, double z)
           
MutableDouble3D(Int2D p)
          Explicitly assumes the z value is set to 0
MutableDouble3D(Int2D p, double z)
           
MutableDouble3D(Int3D p)
           
MutableDouble3D(MutableDouble2D p)
          Explicitly assumes the z value is set to 0
MutableDouble3D(MutableDouble2D p, double z)
           
MutableDouble3D(MutableDouble3D p)
           
MutableDouble3D(MutableInt2D p)
          Explicitly assumes the z value is set to 0
MutableDouble3D(MutableInt2D p, double z)
           
MutableDouble3D(MutableInt3D p)
           
 
Method Summary
 MutableDouble3D add(MutableDouble3D other1, MutableDouble3D other2)
          Sets me to the sum of other1 and other2, returning me.
 MutableDouble3D addIn(double x, double y, double z)
          Adds the x and y values into my x and y values, returning me.
 MutableDouble3D addIn(MutableDouble3D other)
          Adds other into me, returning me.
 java.lang.Object clone()
           
 double distance(Double3D p)
          Returns the distance FROM this Double3D TO the specified point.
 double distance(double x, double y, double z)
          Returns the distance FROM this Double3D TO the specified point
 double distance(Int3D p)
          Returns the distance FROM this Double3D TO the specified point.
 double distance(MutableInt3D p)
          Returns the distance FROM this Double3D TO the specified point.
 double distanceSq(Double3D p)
          Returns the squared distance FROM this Double3D TO the specified point.
 double distanceSq(double x, double y, double z)
          Returns the squared distance FROM this Double3D TO the specified point
 double distanceSq(Int3D p)
          Returns the squared distance FROM this Double3D TO the specified point.
 double distanceSq(MutableInt3D p)
          Returns the squared distance FROM this Double3D TO the specified point.
 double dot(MutableDouble3D other)
          Returns the dot product of myself against other, that is me DOT other.
 MutableDouble3D dup()
          Equivalent to (new MutableDouble3D(d)), but (d.dup()) shorter of course, but perhaps not quite as fast.
 boolean equals(java.lang.Object obj)
           
 double getX()
           
 double getY()
           
 double getZ()
           
 int hashCode()
           
 double length()
          Returns the length of the vector.
 double lengthSq()
          Returns the square of the length of the MutableDouble2D.
 MutableDouble3D multiply(MutableDouble3D other, double val)
          Multiplies other by val, setting me to the result and returning me.
 MutableDouble3D multiplyIn(double val)
          Extends my length so that it is multiplied by val, and returns me.
 void negate()
          Negates the MutableDouble2D's values
 MutableDouble3D normalize()
          Normalizes me (sets my length to 1.0), returning me.
 MutableDouble3D setLength(double val)
          Sets my length, which should be >= 0.
 void setTo(Double3D p)
           
 void setTo(double x, double y, double z)
           
 void setTo(Int3D p)
           
 void setTo(MutableDouble3D p)
           
 void setTo(MutableInt3D p)
           
 void setToMinus(MutableDouble3D b)
          Sets the values to the negation of the values in the provided MutableDouble2D
 void setX(double val)
           
 void setY(double val)
           
 void setZ(double val)
           
 MutableDouble3D subtract(MutableDouble3D other1, MutableDouble3D other2)
          Subtracts other2 from other1, setting me to the result and returning me.
 MutableDouble3D subtractIn(MutableDouble3D other)
          Sets me to me minus other, returning me.
 java.lang.String toCoordinates()
           
 java.lang.String toString()
           
 void zero()
          Sets the values to 0.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

x

public double x

y

public double y

z

public double z
Constructor Detail

MutableDouble3D

public MutableDouble3D()

MutableDouble3D

public MutableDouble3D(Int2D p)
Explicitly assumes the z value is set to 0


MutableDouble3D

public MutableDouble3D(Int2D p,
                       double z)

MutableDouble3D

public MutableDouble3D(Int3D p)

MutableDouble3D

public MutableDouble3D(MutableInt2D p)
Explicitly assumes the z value is set to 0


MutableDouble3D

public MutableDouble3D(MutableInt2D p,
                       double z)

MutableDouble3D

public MutableDouble3D(MutableInt3D p)

MutableDouble3D

public MutableDouble3D(Double2D p)
Explicitly assumes the z value is set to 0


MutableDouble3D

public MutableDouble3D(Double2D p,
                       double z)

MutableDouble3D

public MutableDouble3D(Double3D p)

MutableDouble3D

public MutableDouble3D(MutableDouble2D p)
Explicitly assumes the z value is set to 0


MutableDouble3D

public MutableDouble3D(MutableDouble2D p,
                       double z)

MutableDouble3D

public MutableDouble3D(MutableDouble3D p)

MutableDouble3D

public MutableDouble3D(double x,
                       double y,
                       double z)
Method Detail

getX

public final double getX()

getY

public final double getY()

getZ

public final double getZ()

setX

public final void setX(double val)

setY

public final void setY(double val)

setZ

public final void setZ(double val)

setTo

public void setTo(double x,
                  double y,
                  double z)

setTo

public void setTo(Int3D p)

setTo

public void setTo(MutableInt3D p)

setTo

public void setTo(Double3D p)

setTo

public void setTo(MutableDouble3D p)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toCoordinates

public java.lang.String toCoordinates()

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

distance

public double distance(double x,
                       double y,
                       double z)
Returns the distance FROM this Double3D TO the specified point


distance

public double distance(Double3D p)
Returns the distance FROM this Double3D TO the specified point.


distance

public double distance(Int3D p)
Returns the distance FROM this Double3D TO the specified point.


distance

public double distance(MutableInt3D p)
Returns the distance FROM this Double3D TO the specified point.


distanceSq

public double distanceSq(double x,
                         double y,
                         double z)
Returns the squared distance FROM this Double3D TO the specified point


distanceSq

public double distanceSq(Double3D p)
Returns the squared distance FROM this Double3D TO the specified point.


distanceSq

public double distanceSq(Int3D p)
Returns the squared distance FROM this Double3D TO the specified point.


distanceSq

public double distanceSq(MutableInt3D p)
Returns the squared distance FROM this Double3D TO the specified point.


addIn

public final MutableDouble3D addIn(MutableDouble3D other)
Adds other into me, returning me.


add

public final MutableDouble3D add(MutableDouble3D other1,
                                 MutableDouble3D other2)
Sets me to the sum of other1 and other2, returning me.


addIn

public final MutableDouble3D addIn(double x,
                                   double y,
                                   double z)
Adds the x and y values into my x and y values, returning me.


dup

public final MutableDouble3D dup()
Equivalent to (new MutableDouble3D(d)), but (d.dup()) shorter of course, but perhaps not quite as fast.


subtractIn

public final MutableDouble3D subtractIn(MutableDouble3D other)
Sets me to me minus other, returning me.


subtract

public final MutableDouble3D subtract(MutableDouble3D other1,
                                      MutableDouble3D other2)
Subtracts other2 from other1, setting me to the result and returning me.


length

public final double length()
Returns the length of the vector.


multiplyIn

public final MutableDouble3D multiplyIn(double val)
Extends my length so that it is multiplied by val, and returns me.


multiply

public final MutableDouble3D multiply(MutableDouble3D other,
                                      double val)
Multiplies other by val, setting me to the result and returning me.


normalize

public final MutableDouble3D normalize()
Normalizes me (sets my length to 1.0), returning me. Throws an error if my previous length was of length 0.


setLength

public final MutableDouble3D setLength(double val)
Sets my length, which should be >= 0.


dot

public final double dot(MutableDouble3D other)
Returns the dot product of myself against other, that is me DOT other.


zero

public final void zero()
Sets the values to 0.


setToMinus

public final void setToMinus(MutableDouble3D b)
Sets the values to the negation of the values in the provided MutableDouble2D


negate

public final void negate()
Negates the MutableDouble2D's values


lengthSq

public final double lengthSq()
Returns the square of the length of the MutableDouble2D.