Class PolarPoint
java.lang.Object
edu.uci.ics.jung.algorithms.layout.PolarPoint
Represents a point in polar coordinates: distance and angle from the origin.
Includes conversions between polar and Cartesian
coordinates (Point2D).
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance with radius and angle each 0.PolarPoint
(double theta, double radius) Creates a new instance with the specified radius and angle. -
Method Summary
Modifier and TypeMethodDescriptionstatic PolarPoint
cartesianToPolar
(double x, double y) static PolarPoint
cartesianToPolar
(Point2D point) double
double
getTheta()
static Point2D
polarToCartesian
(double theta, double radius) static Point2D
polarToCartesian
(PolarPoint polar) void
Sets the angle and radius of this point to those ofp
.void
setRadius
(double radius) void
setTheta
(double theta) toString()
-
Field Details
-
theta
double theta -
radius
double radius
-
-
Constructor Details
-
PolarPoint
public PolarPoint()Creates a new instance with radius and angle each 0. -
PolarPoint
public PolarPoint(double theta, double radius) Creates a new instance with the specified radius and angle.- Parameters:
theta
- the angle of the point to createradius
- the distance from the origin of the point to create
-
-
Method Details
-
getTheta
public double getTheta()- Returns:
- the angle for this point
-
getRadius
public double getRadius()- Returns:
- the radius for this point
-
setTheta
public void setTheta(double theta) -
setRadius
public void setRadius(double radius) -
polarToCartesian
- Parameters:
polar
- the input location to convert- Returns:
- the result of converting
polar
to Cartesian coordinates.
-
polarToCartesian
- Parameters:
theta
- the angle of the input locationradius
- the distance from the origin of the input location- Returns:
- the result of converting
(theta, radius)
to Cartesian coordinates.
-
cartesianToPolar
- Parameters:
point
- the input location- Returns:
- the result of converting
point
to polar coordinates.
-
cartesianToPolar
- Parameters:
x
- the x coordinate of the input locationy
- the y coordinate of the input location- Returns:
- the result of converting
(x, y)
to polar coordinates.
-
toString
-
setLocation
Sets the angle and radius of this point to those ofp
.- Parameters:
p
- the point whose location is copied into this instance
-