public final class IPoint3D extends Object
IPoint3D
as an x and a y
coordinate.Constructor and Description |
---|
IPoint3D()
Constructs a point with coordinates
(0.0, 0.0, 0.0) . |
IPoint3D(double x,
double y, double z)
Constructs a point with coordinates
(x, y, z) . |
Modifier and Type | Method and Description |
---|---|
double |
distanceTo(IPoint3D other)
Returns the distance between
this point and another
point. |
boolean |
equals(Object obj)
Compares this point to another object.
|
double |
getX()
Returns the
x coordinate of this point. |
double |
getY()
Returns the
y coordinate of this point. |
double |
getZ()
Returns the
z coordinate of this point. |
String |
toString()
Returns a string containing the coordinates of the point separated by
a space and a comma and inside square brackets.
|
public IPoint3D()
(0.0, 0.0)
.public IPoint3D(double x, double y)
(x, y)
.x
- the x
coordinatey
- the y
coordinatepublic double getX()
x
coordinate of this
point.x
coordinate of this
pointpublic double getY()
y
coordinate of this
point.y
coordinate of this
pointpublic double getZ()
z
coordinate of this
point.z
coordinate of this
pointpublic double distanceTo(IPoint3D other)
this
point and another
point.other
- the point to compute the distance tothis
point and other
public boolean equals(Object obj)
true
if and only if the argument is not null
and is an
IPoint3D
object that has the same coordinates of
this
object.equals
in class Object
Object.equals(java.lang.Object)
obj
- the other object to comparetrue
if obj
is an IPoint3D
object with the same coordinates as this
objectpublic String toString()
(new IPoint3D(-1.5, 3.1415)).toString()
returns the string "(-1.5, 3.1415)"
.toString
in class Object
Object.toString()