java.lang.Object | +--edu.gwu.geometry.Pointd
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 |
public double x
public double y
Constructor Detail |
public Pointd(double x, double y)
public Pointd()
Method Detail |
public Pointd translate(double xdelta, double ydelta)
public Pointd scale(double factor)
public java.lang.String toString()
toString
in class java.lang.Object
public void writeData(java.io.PrintWriter out) throws java.io.IOException
public double getx()
public double gety()
public final void setx(double x)
public void sety(double y)
public boolean before(Pointd p)
public boolean equals(Pointd p)
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
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.x
- a double
valuey
- a double
valueboolean
value