edu.gwu.geometry
Class Pointd

java.lang.Object
  |
  +--edu.gwu.geometry.Pointd

public class Pointd
extends java.lang.Object

Pointd class implements a class corresponding to 2-dimensional points in the plane specified by type double x and y coordinates.


Field Summary
 double x
          Variables specifying a point instance.
 double y
           
 
Constructor Summary
Pointd()
          Default Pointd constructor: x=y=0.
Pointd(double x, double y)
          Pointd constructor.
 
Method Summary
 boolean before(Pointd p)
          Return true if the point instance occurs before point p during a vertical line sweep.
 boolean equals(double x, double y)
          equals will compare based on x and y values alone, which is useful when x and y values are obtained from lines.
 boolean equals(java.lang.Object obj)
          Return true if the point instance equals the input point instance.
 boolean equals(Pointd p)
          Return true if the point instance equals point p.
 double getx()
          Accessor for x-coordinate.
 double gety()
          Accessor for y-coordinate.
 Pointd scale(double factor)
          Scale point coordinate values by a scalar factor.
 void setx(double x)
          Settor for x-coordinate.
 void sety(double y)
          Settor for y-coordinate.
 java.lang.String toString()
          Return string representation of Pointd instance.
 Pointd translate(double xdelta, double ydelta)
          Translate point location by xdelta and ydelta.
 void writeData(java.io.PrintWriter out)
          Format and write the point data to a text file.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

x

public double x
Variables specifying a point instance.

y

public double y
Constructor Detail

Pointd

public Pointd(double x,
              double y)
Pointd constructor.

Pointd

public Pointd()
Default Pointd constructor: x=y=0.
Method Detail

translate

public Pointd translate(double xdelta,
                        double ydelta)
Translate point location by xdelta and ydelta.

scale

public Pointd scale(double factor)
Scale point coordinate values by a scalar factor.

toString

public java.lang.String toString()
Return string representation of Pointd instance.
Overrides:
toString in class java.lang.Object

writeData

public void writeData(java.io.PrintWriter out)
               throws java.io.IOException
Format and write the point data to a text file.

getx

public double getx()
Accessor for x-coordinate.

gety

public double gety()
Accessor for y-coordinate.

setx

public final void setx(double x)
Settor for x-coordinate.

sety

public void sety(double y)
Settor for y-coordinate.

before

public boolean before(Pointd p)
Return true if the point instance occurs before point p during a vertical line sweep.

equals

public boolean equals(Pointd p)
Return true if the point instance equals point p. Exact or inexact comparison is supported.

equals

public boolean equals(java.lang.Object obj)
Return true if the point instance equals the input point instance. Exact or inexact comparison is supported.
Overrides:
equals in class java.lang.Object

equals

public boolean equals(double x,
                      double y)
equals will compare based on x and y values alone, which is useful when x and y values are obtained from lines.
Parameters:
x - a double value
y - a double value
Returns:
a boolean value