Class PolarPoint
- java.lang.Object
-
- edu.uci.ics.jung.algorithms.layout.PolarPoint
-
public class PolarPoint extends java.lang.Object
Represents a point in polar coordinates: distance and angle from the origin. Includes conversions between polar and Cartesian coordinates (Point2D).
-
-
Constructor Summary
Constructors Constructor Description PolarPoint()
Creates a new instance with radius and angle each 0.PolarPoint(double theta, double radius)
Creates a new instance with radiusradius
and angletheta
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PolarPoint
cartesianToPolar(double x, double y)
Returns the result of converting(x, y)
to polar coordinates.static PolarPoint
cartesianToPolar(java.awt.geom.Point2D point)
Returns the result of convertingpoint
to polar coordinates.double
getRadius()
Returns the radius for this point.double
getTheta()
Returns the angle for this point.static java.awt.geom.Point2D
polarToCartesian(double theta, double radius)
Returns the result of converting(theta, radius)
to Cartesian coordinates.static java.awt.geom.Point2D
polarToCartesian(PolarPoint polar)
Returns the result of convertingpolar
to Cartesian coordinates.void
setLocation(PolarPoint p)
Sets the angle and radius of this point to those ofp
.void
setRadius(double radius)
Sets the radius for this point totheta
.void
setTheta(double theta)
Sets the angle for this point totheta
.java.lang.String
toString()
-
-
-
Method Detail
-
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)
Sets the angle for this point totheta
.
-
setRadius
public void setRadius(double radius)
Sets the radius for this point totheta
.
-
polarToCartesian
public static java.awt.geom.Point2D polarToCartesian(PolarPoint polar)
Returns the result of convertingpolar
to Cartesian coordinates.
-
polarToCartesian
public static java.awt.geom.Point2D polarToCartesian(double theta, double radius)
Returns the result of converting(theta, radius)
to Cartesian coordinates.
-
cartesianToPolar
public static PolarPoint cartesianToPolar(java.awt.geom.Point2D point)
Returns the result of convertingpoint
to polar coordinates.
-
cartesianToPolar
public static PolarPoint cartesianToPolar(double x, double y)
Returns the result of converting(x, y)
to polar coordinates.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
setLocation
public void setLocation(PolarPoint p)
Sets the angle and radius of this point to those ofp
.
-
-