mhframework
Class MHPoint

java.lang.Object
  extended by mhframework.MHPoint

public class MHPoint
extends java.lang.Object

Represents a point in 2D space. This class also contains functions for translating this point along a vector and rotating it around another point.

Since:
2.01
Author:
Michael Henson

Constructor Summary
MHPoint()
          Default constructor.
MHPoint(double xValue, double yValue)
          Constructor.
MHPoint(MHPoint point)
          Constructor.
 
Method Summary
 MHPoint clone()
          Creates an exact copy of this point.
 double getX()
          Returns the x component of this point.
 double getY()
          Returns the y component of this point.
 void rotate(double originX, double originY, double angle)
          Rotates this point around (originX, originY) by the angle specified.
 void setLocation(double x, double y)
          Sets the location of this point.
 void setX(double x)
          Sets the x component of this point.
 void setY(double y)
          Sets the y component of this point.
 void translate(double angle, double distance)
          Translates this point in the direction specified by angle to the distance specified by distance.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MHPoint

public MHPoint()
Default constructor. Creates new point at the origin (0, 0).


MHPoint

public MHPoint(double xValue,
               double yValue)
Constructor. Creates new point at the location specified by the input x and y values.


MHPoint

public MHPoint(MHPoint point)
Constructor. Creates new point by copying the input point.

Method Detail

getX

public double getX()
Returns the x component of this point.

Returns:
The x component of this point.

setX

public void setX(double x)
Sets the x component of this point.


getY

public double getY()
Returns the y component of this point.

Returns:
The y component of this point.

setY

public void setY(double y)
Sets the y component of this point.


setLocation

public void setLocation(double x,
                        double y)
Sets the location of this point.


rotate

public void rotate(double originX,
                   double originY,
                   double angle)
Rotates this point around (originX, originY) by the angle specified.

Parameters:
originX - The x component of the point around which to rotate this point.
originY - The y component of the point around which to rotate this point.
angle - The angle by which to rotate this point.

translate

public void translate(double angle,
                      double distance)
Translates this point in the direction specified by angle to the distance specified by distance.

Parameters:
angle - The angle at which this point is to be translated.
distance - The distance that this point is to be translated.

clone

public MHPoint clone()
Creates an exact copy of this point.

Overrides:
clone in class java.lang.Object
Returns:
A new point at the same location as this point.