Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## sim.util
Class MutableDouble2D

    java.lang.Object
      sim.util.MutableDouble2D

All Implemented Interfaces:
  java.io.Serializable

public final class MutableDouble2D
extends java.lang.Object
implements java.io.Serializable

MutableDouble2D is more or less the same class as java.awt.geom.Point2D.Double, except that it is hash-equivalent to Double2D.

Just as with MutableInt2D: you use MutableDouble2D as a STORED hash key at your peril: it has the same misfeature as java.awt.geom.Point2D.Double, and you should read the warning in Double2D. However, you can look up Double2D-keyed objects in a hash table by passing in a MutableDouble2D instead.

See Also:
  Serialized Form

Field Summary
`double` | `x`
`double` | `y`

Constructor Summary
`MutableDouble2D()`
`MutableDouble2D(Double2D p)`
`MutableDouble2D(double x, double y)`
`MutableDouble2D(Int2D p)`
`MutableDouble2D(MutableDouble2D p)`
`MutableDouble2D(MutableInt2D p)`
`MutableDouble2D(java.awt.Point p)`
`MutableDouble2D(java.awt.geom.Point2D.Double p)`
`MutableDouble2D(java.awt.geom.Point2D.Float p)`
`MutableDouble2D(java.awt.geom.Point2D p)` Only included for completeness' sakes, in case a new Point2D subclass is created in the future.

Method Summary
`MutableDouble2D` | `add(MutableDouble2D other1, MutableDouble2D other2)` Sets me to the sum of other1 and other2, returning me.
`MutableDouble2D` | `addIn(double x, double y)` Adds other into me, returning me.
`MutableDouble2D` | `addIn(MutableDouble2D other)` Adds other into me, returning me.
`double` | `distance(double x, double y)` Returns the distance FROM this MutableDouble2D TO the specified point
`double` | `distance(Int2D p)` Returns the distance FROM this MutableDouble2D TO the specified point.
`double` | `distance(MutableDouble2D p)` Returns the distance FROM this MutableDouble2D TO the specified point.
`double` | `distance(MutableInt2D p)` Returns the distance FROM this MutableDouble2D TO the specified point.
`double` | `distance(java.awt.geom.Point2D p)` Returns the distance FROM this MutableDouble2D TO the specified point.
`double` | `distanceSq(Double2D d)` Returns the distance FROM this Double2D TO the specified point
`double` | `distanceSq(double x, double y)` Returns the distance FROM this MutableDouble2D TO the specified point
`double` | `distanceSq(Int2D p)` Returns the distance FROM this MutableDouble2D TO the specified point.
`double` | `distanceSq(MutableDouble2D p)` Returns the distance FROM this MutableDouble2D TO the specified point.
`double` | `distanceSq(MutableInt2D p)` Returns the distance FROM this MutableDouble2D TO the specified point.
`double` | `distanceSq(java.awt.geom.Point2D p)` Returns the distance FROM this Point2D TO the specified point
`double` | `dot(MutableDouble2D other)` Returns the dot product of myself against other, that is me DOT other.
`MutableDouble2D` | `dup()` Equivalent to `(new MutableDouble2D(d))`, but `(d.dup())` shorter of course, but perhaps not quite as fast.
`boolean` | `equals(Double2D other)`
`boolean` | `equals(Int2D other)`
`boolean` | `equals(MutableDouble2D other)`
`boolean` | `equals(MutableInt2D other)`
`boolean` | `equals(java.lang.Object other)`
`double` | `getX()`
`double` | `getY()`
`int` | `hashCode()`
`double` | `length()` Returns the length of the vector.
`double` | `lengthSq()`
`MutableDouble2D` | `multiply(MutableDouble2D other, double val)` Multiplies other by val, setting me to the result and returning me.
`MutableDouble2D` | `multiplyIn(double val)` Extends my length so that it is multiplied by val, and returns me.
`void` | `negate()`
`MutableDouble2D` | `normalize()` Normalizes me (sets my length to 1.0), returning me.
`double` | `perpDot(MutableDouble2D other)` 2D version of the cross product: returns the dot product of me rotated 90 degrees dotted against the other vector.
`MutableDouble2D` | `rotate(double theta)` Rotates me by theta radians, returning me.
`void` | `setTo(Double2D b)`
`void` | `setTo(double bx, double by)`
`void` | `setTo(MutableDouble2D b)`
`void` | `setToMinus(MutableDouble2D b)`
`MutableDouble2D` | `subtract(MutableDouble2D other1, MutableDouble2D other2)` Subtracts other2 from other1, setting me to the result and returning me.
`MutableDouble2D` | `subtractIn(MutableDouble2D other)` Sets me to me minus other, returning me.
`java.lang.String` | `toCoordinates()`
`java.lang.String` | `toString()`
`void` | `zero()`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### x

    public double x

### y

    public double y

Constructor Detail

### MutableDouble2D

    public MutableDouble2D()

### MutableDouble2D

    public MutableDouble2D(Int2D p)

### MutableDouble2D

    public MutableDouble2D(MutableInt2D p)

### MutableDouble2D

    public MutableDouble2D(MutableDouble2D p)

### MutableDouble2D

    public MutableDouble2D(Double2D p)

### MutableDouble2D

    public MutableDouble2D(java.awt.Point p)

### MutableDouble2D

    public MutableDouble2D(java.awt.geom.Point2D.Double p)

### MutableDouble2D

    public MutableDouble2D(java.awt.geom.Point2D.Float p)

### MutableDouble2D

    public MutableDouble2D(java.awt.geom.Point2D p)

  Only included for completeness' sakes, in case a new Point2D subclass is created in the future.

### MutableDouble2D

    public MutableDouble2D(double x,
                           double y)

Method Detail

### getX

    public final double getX()

### getY

    public final double getY()

### toString

    public java.lang.String toString()

### toCoordinates

    public java.lang.String toCoordinates()

### hashCode

    public final int hashCode()

### equals

    public final boolean equals(Double2D other)

### equals

    public final boolean equals(MutableDouble2D other)

### equals

    public final boolean equals(Int2D other)

### equals

    public final boolean equals(MutableInt2D other)

### equals

    public boolean equals(java.lang.Object other)

### distance

    public double distance(double x,
                           double y)

  Returns the distance FROM this MutableDouble2D TO the specified point

### distance

    public double distance(MutableDouble2D p)

  Returns the distance FROM this MutableDouble2D TO the specified point.

### distance

    public double distance(Int2D p)

  Returns the distance FROM this MutableDouble2D TO the specified point.

### distance

    public double distance(MutableInt2D p)

  Returns the distance FROM this MutableDouble2D TO the specified point.

### distance

    public double distance(java.awt.geom.Point2D p)

  Returns the distance FROM this MutableDouble2D TO the specified point.

### distanceSq

    public double distanceSq(double x,
                             double y)

  Returns the distance FROM this MutableDouble2D TO the specified point

### distanceSq

    public double distanceSq(MutableDouble2D p)

  Returns the distance FROM this MutableDouble2D TO the specified point.

### distanceSq

    public double distanceSq(Int2D p)

  Returns the distance FROM this MutableDouble2D TO the specified point.

### distanceSq

    public double distanceSq(MutableInt2D p)

  Returns the distance FROM this MutableDouble2D TO the specified point.

### distanceSq

    public double distanceSq(java.awt.geom.Point2D p)

  Returns the distance FROM this Point2D TO the specified point

### addIn

    public final MutableDouble2D addIn(MutableDouble2D other)

  Adds other into me, returning me.

### distanceSq

    public double distanceSq(Double2D d)

  Returns the distance FROM this Double2D TO the specified point

### add

    public final MutableDouble2D add(MutableDouble2D other1,
                                     MutableDouble2D other2)

  Sets me to the sum of other1 and other2, returning me.

### dup

    public final MutableDouble2D dup()

  Equivalent to `(new MutableDouble2D(d))`, but `(d.dup())` shorter of course, but perhaps not quite as fast.

### subtractIn

    public final MutableDouble2D subtractIn(MutableDouble2D other)

  Sets me to me minus other, returning me.

### subtract

    public final MutableDouble2D subtract(MutableDouble2D other1,
                                          MutableDouble2D 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 MutableDouble2D multiplyIn(double val)

  Extends my length so that it is multiplied by val, and returns me.

### multiply

    public final MutableDouble2D multiply(MutableDouble2D other,
                                          double val)

  Multiplies other by val, setting me to the result and returning me.

### normalize

    public final MutableDouble2D normalize()

  Normalizes me (sets my length to 1.0), returning me. Throws an error if my previous length wasof length 0.

### rotate

    public final MutableDouble2D rotate(double theta)

  Rotates me by theta radians, returning me.

### dot

    public final double dot(MutableDouble2D other)

  Returns the dot product of myself against other, that is me DOT other.

### perpDot

    public double perpDot(MutableDouble2D other)

  2D version of the cross product: returns the dot product of me rotated 90 degrees dotted against the other vector. Does not modify either vector.

### zero

    public final void zero()

### setTo

    public final void setTo(double bx,
                            double by)

### setTo

    public final void setTo(MutableDouble2D b)

### setTo

    public final void setTo(Double2D b)

### setToMinus

    public final void setToMinus(MutableDouble2D b)

### negate

    public final void negate()

### lengthSq

    public final double lengthSq()

### addIn

    public final MutableDouble2D addIn(double x,
                                       double y)

  Adds other into me, returning me.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD