|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.columbia.cs.coms4701.geometry.AbstractVector<java.lang.Integer>
edu.columbia.cs.coms4701.geometry.DiscreteVector
edu.columbia.cs.coms4701.geometry.DiscretePoint2D
public class DiscretePoint2D
A 2-dimensional point in a lattice (i.e. with integer coordinates).
Field Summary |
---|
Fields inherited from class edu.columbia.cs.coms4701.geometry.DiscreteVector |
---|
DIRECTIONS, EAST, NORTH, NORTHEAST, NORTHWEST, SOUTH, SOUTHEAST, SOUTHWEST, WEST |
Fields inherited from class edu.columbia.cs.coms4701.geometry.AbstractVector |
---|
components, PRIME |
Fields inherited from interface edu.columbia.cs.coms4701.geometry.GeometricVector |
---|
X_DIM, Y_DIM, Z_DIM |
Constructor Summary | |
---|---|
DiscretePoint2D(GeometricVector<java.lang.Integer> theVector)
Constructs a new 2D discrete point from the given discrete vector |
|
DiscretePoint2D(java.lang.Integer x,
java.lang.Integer y)
Constructs a new 2-D discrete point at the specified coordinates. |
Method Summary | |
---|---|
double |
distanceFromOrigin()
Returns the distance of this point from the origin. |
double |
distanceFromPoint(Point2D<java.lang.Integer> thePoint)
Returns the distance between this point and the given point. |
java.lang.Integer |
getX()
Returns x coordinate |
java.lang.Integer |
getY()
Returns y coordinate |
DiscretePoint2D |
translateBy(GeometricVector<java.lang.Integer> theVector)
Returns a new point at the coordinate translated from this point's position by the given vector |
Methods inherited from class edu.columbia.cs.coms4701.geometry.DiscreteVector |
---|
add, getComponents, multiply |
Methods inherited from class edu.columbia.cs.coms4701.geometry.AbstractVector |
---|
checkDimension, checkEqualOrSmallerDimensionVector, equals, getComponent, getDimension, getLength, hashCode, iterator, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DiscretePoint2D(java.lang.Integer x, java.lang.Integer y)
x
- y
- public DiscretePoint2D(GeometricVector<java.lang.Integer> theVector)
Method Detail |
---|
public DiscretePoint2D translateBy(GeometricVector<java.lang.Integer> theVector)
translateBy
in interface Point2D<java.lang.Integer>
theVector
-
java.lang.IllegalArgumentException
- if the vector is > 2 dimensionalpublic double distanceFromOrigin()
distanceFromOrigin
in interface Point2D<java.lang.Integer>
public double distanceFromPoint(Point2D<java.lang.Integer> thePoint)
distanceFromPoint
in interface Point2D<java.lang.Integer>
thePoint
-
public java.lang.Integer getX()
getX
in interface Point2D<java.lang.Integer>
public java.lang.Integer getY()
getY
in interface Point2D<java.lang.Integer>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |