public class PolarPoint extends Object
| Constructor and Description |
|---|
PolarPoint()
Creates a new instance with radius and angle each 0.
|
PolarPoint(double theta,
double radius)
Creates a new instance with the specified radius and angle.
|
| Modifier and Type | Method and Description |
|---|---|
static PolarPoint |
cartesianToPolar(double x,
double y) |
static PolarPoint |
cartesianToPolar(Point2D point) |
double |
getRadius() |
double |
getTheta() |
static Point2D |
polarToCartesian(double theta,
double radius) |
static Point2D |
polarToCartesian(PolarPoint polar) |
void |
setLocation(PolarPoint p)
Sets the angle and radius of this point to those of
p. |
void |
setRadius(double radius) |
void |
setTheta(double theta) |
String |
toString() |
public PolarPoint()
public PolarPoint(double theta,
double radius)
theta - the angle of the point to createradius - the distance from the origin of the point to createpublic double getTheta()
public double getRadius()
public void setTheta(double theta)
public void setRadius(double radius)
public static Point2D polarToCartesian(PolarPoint polar)
polar - the input location to convertpolar to Cartesian coordinates.public static Point2D polarToCartesian(double theta, double radius)
theta - the angle of the input locationradius - the distance from the origin of the input location(theta, radius) to Cartesian coordinates.public static PolarPoint cartesianToPolar(Point2D point)
point - the input locationpoint to polar coordinates.public static PolarPoint cartesianToPolar(double x, double y)
x - the x coordinate of the input locationy - the y coordinate of the input location(x, y) to polar coordinates.public void setLocation(PolarPoint p)
p.p - the point whose location is copied into this instanceCopyright © 2016. All rights reserved.