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

## j3deditor.bin.hierarchy.util
Class J3DePoint2D

    java.lang.Object
      j3deditor.bin.hierarchy.util.J3DePoint2D

    public class J3DePoint2D

extends java.lang.Object

A point representing a location in (x, y) coordinate space, specified in integer precision.

Author:
  Risto Seene

Constructor Summary
`J3DePoint2D()` Creates an instance of `J3DePoint2D` at (0, 0).
`J3DePoint2D(int x, int y)` Creates an instance of `J3DePoint2D` at (x, y).
`J3DePoint2D(J3DePoint2D p)` Creates an instance of `J3DePoint2D` with the same location as the specified `J3DePoint2D`.

Method Summary
`void` | `absolute()` Sets each component of this point to its absolute value.
`static J3DePoint2D` | `add(J3DePoint2D p1, J3DePoint2D p2)` Returns new `J3DePoint2D` which value is the vector sum of points p1 and p2.
`boolean` | `equals(java.lang.Object object)` Returns true if the Object object is of type J3DePoint2D and both coordinates in it are equal to the corresponding coordinates in this J3DePoint2D.
`double` | `getVectorAngle()` Returns the angle of the vector represented by this J3DePoint2D.
`double` | `getVectorLength()` Returns the length of the vector represented by this J3DePoint2D.
`int` | `getX()` Returns the x coordiante of this point.
`int` | `getY()` Returns the x coordiante of this point.
`void` | `negate()` Negates the value of this point.
`void` | `setCoordinates(int x, int y)` Sets the location of this point.
`void` | `setCoordinates(J3DePoint2D p)` Sets the location of this point.
`void` | `setX(int x)` Sets the x coordinate of this point.
`void` | `setY(int y)` Sets the y coordinate of this point.
`static J3DePoint2D` | `sub(J3DePoint2D p1, J3DePoint2D p2)` Returns new `J3DePoint2D` which value is the vector difference of points p1 and p2.
`java.lang.String` | `toString()` Returns the `String` representation of this object.

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

Constructor Detail

### J3DePoint2D

    public J3DePoint2D()

  Creates an instance of `J3DePoint2D` at (0, 0).

### J3DePoint2D

    public J3DePoint2D(int x,
                       int y)

  Creates an instance of `J3DePoint2D` at (x, y).

  Parameters:
    `x` - x coordinate
    `y` - y coordinate

### J3DePoint2D

    public J3DePoint2D(J3DePoint2D p)

  Creates an instance of `J3DePoint2D` with the same location as the specified `J3DePoint2D`.

  Parameters:
    `p` - a point

Method Detail

### setX

    public void setX(int x)

  Sets the x coordinate of this point.

  Parameters:
    `x` - new x coordinate value

### setY

    public void setY(int y)

  Sets the y coordinate of this point.

  Parameters:
    `y` - new y coordinate value

### setCoordinates

    public void setCoordinates(int x,
                               int y)

  Sets the location of this point.

  Parameters:
    `x` - new x coordinate value
    `y` - new y coordinate value

### setCoordinates

    public void setCoordinates(J3DePoint2D p)

  Sets the location of this point.

  Parameters:
    `p` - the specified location

### getX

    public int getX()

  Returns the x coordiante of this point.

  Returns:
    the x coordiante of this point

### getY

    public int getY()

  Returns the x coordiante of this point.

  Returns:
    the y coordiante of this point

### absolute

    public void absolute()

  Sets each component of this point to its absolute value.

### negate

    public void negate()

  Negates the value of this point.

### add

    public static J3DePoint2D add(J3DePoint2D p1,
                                  J3DePoint2D p2)

  Returns new `J3DePoint2D` which value is the vector sum of points p1 and p2.

  Parameters:
    `p1` - the first point
    `p2` - the second point
  Returns:
    new `J3DePoint2D` which value is the vector sum of points p1 and p2

### sub

    public static J3DePoint2D sub(J3DePoint2D p1,
                                  J3DePoint2D p2)

  Returns new `J3DePoint2D` which value is the vector difference of points p1 and p2.

  Parameters:
    `p1` - the first point
    `p2` - the second point
  Returns:
    new `J3DePoint2D` which value is the vector difference of points p1 and p2

### getVectorLength

    public double getVectorLength()

  Returns the length of the vector represented by this J3DePoint2D.

  Returns:
    Returns the length of the vector represented by this J3DePoint2D

### getVectorAngle

    public double getVectorAngle()

  Returns the angle of the vector represented by this J3DePoint2D.

  Returns:
    the angle of the vector represented by this J3DePoint2D

### equals

    public boolean equals(java.lang.Object object)

  Returns true if the Object object is of type J3DePoint2D and both coordinates in it are equal to the corresponding coordinates in this J3DePoint2D.

  Overrides:
    `equals` in class `java.lang.Object`
  Parameters:
    `object` - the Object with which the comparison is made
  Returns:
    true if the Object object is of type J3DePoint2D and both coordinates in it are equal to the corresponding coordinates in this J3DePoint2D

### toString

    public java.lang.String toString()

  Returns the `String` representation of this object.

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    the `String` representation of this object

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