physicon.graphLib
Class DoubleRectangle

java.lang.Object
  |
  +--physicon.graphLib.DoubleRectangle

public final class DoubleRectangle
extends java.lang.Object

Help class for the library. Represents the rectangle with double coordinates and dimensions


Field Summary
 double height
           
 double width
           
 double x
           
 double y
           
 
Constructor Summary
DoubleRectangle(double _x, double _y, double _width, double _height)
          Constructor.
DoubleRectangle(DoublePoint _topLeft, DoublePoint _bottomRight)
          Constructor
 
Method Summary
 boolean contains(DoublePoint _dpt)
          Returns true if the given point is in the given object.
 boolean equals(DoubleRectangle _drct)
          Compares the current object with the given one.
 DoubleRectangle intersect(DoubleRectangle _rct)
          Returns the intersection of the current object with the given DoubleRectangle
 void move(double _x, double _y)
          Moves the current object to the given point.
 void move(DoublePoint _dpt)
          Moves the current object to the given point.
 void normilize()
          Converts the current object to the "normal" state.
 java.lang.String toString()
          Returns the string representation of the current object
 void translate(double _dx, double _dy)
          Translates the current object by the given vector
 void translate(DoublePoint _dpt)
          Translates the current object by the given vector
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

x

public double x

y

public double y

width

public double width

height

public double height
Constructor Detail

DoubleRectangle

public DoubleRectangle(double _x,
                       double _y,
                       double _width,
                       double _height)
Constructor.
Parameters:
_x - - the x coordinate of the closest to the reference point (0, 0) summit of the rectangle
_y - - the y coordinate of the closest to the reference point (0, 0) summit of the rectangle
_width - - the width of the rectangle
_height - - the height of the rectangle

DoubleRectangle

public DoubleRectangle(DoublePoint _topLeft,
                       DoublePoint _bottomRight)
Constructor
Parameters:
_topLeft - - coordinates of the closest to the reference point summit of the rectangle
_bottomRight - - coordinates of the opposite to the _topLeft summit of the rectangle
Method Detail

toString

public java.lang.String toString()
Returns the string representation of the current object
Overrides:
toString in class java.lang.Object

equals

public boolean equals(DoubleRectangle _drct)
Compares the current object with the given one. Two DoubleRectangles are equals each other if they have similar fields values.
Parameters:
_drct - - the DoubleRectangle to compare the current object with

move

public void move(double _x,
                 double _y)
Moves the current object to the given point.
Parameters:
_x - - the x coordinate of the closest to the refernce point summit of the current object
_y - - the y coordinate of the closest to the reference point summit of the current object

move

public void move(DoublePoint _dpt)
Moves the current object to the given point.
Parameters:
_dpt - - new coordinates of the closest to the refernce point summit of the current object

translate

public void translate(double _dx,
                      double _dy)
Translates the current object by the given vector
Parameters:
_dx - - displacement of the x coordinate of the current object
_dy - - displacement of the y coordinate of the current object

translate

public void translate(DoublePoint _dpt)
Translates the current object by the given vector
Parameters:
_dpt - - displacement of coordinates of the current object

intersect

public DoubleRectangle intersect(DoubleRectangle _rct)
Returns the intersection of the current object with the given DoubleRectangle
Parameters:
_rct - - gicen DoubleRectangle

contains

public boolean contains(DoublePoint _dpt)
Returns true if the given point is in the given object. Returns false otherwize.
Parameters:
_dpt - - the given point

normilize

public void normilize()
Converts the current object to the "normal" state. I.e. the values of width and height fields are to be >= 0.