Class PolarPoint
- java.lang.Object
-
- org.jungrapht.visualization.layout.model.PolarPoint
-
public class PolarPoint extends Object
Immutable Point. Represents a point in polar coordinates: distance and angle from the origin. Includes conversions between polar and Cartesian coordinates (Point).- Author:
- Tom Nelson
-
-
Field Summary
Fields Modifier and Type Field Description static PolarPoint
ORIGIN
double
radius
double
theta
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PolarPoint
cartesianToPolar(double x, double y)
static PolarPoint
cartesianToPolar(Point point)
boolean
equals(Object o)
int
hashCode()
PolarPoint
newRadius(double radius)
static PolarPoint
of(double theta, double radius)
static Point
polarToCartesian(double theta, double radius)
static Point
polarToCartesian(PolarPoint polar)
String
toString()
-
-
-
Field Detail
-
theta
public final double theta
-
radius
public final double radius
-
ORIGIN
public static PolarPoint ORIGIN
-
-
Method Detail
-
of
public static PolarPoint of(double theta, double radius)
-
newRadius
public PolarPoint newRadius(double radius)
-
polarToCartesian
public static Point polarToCartesian(PolarPoint polar)
- Parameters:
polar
- the input location to convert- Returns:
- the result of converting
polar
to Cartesian coordinates.
-
polarToCartesian
public static Point polarToCartesian(double theta, double radius)
- 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
public static PolarPoint cartesianToPolar(Point point)
- Parameters:
point
- the input location- Returns:
- the result of converting
point
to polar coordinates.
-
cartesianToPolar
public static PolarPoint cartesianToPolar(double x, double y)
- 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.
-
-