DESY ACOP Beans Home

com.cosylab.gui.components.gauger
Class PolarPoint

java.lang.Object
  extended by com.cosylab.gui.components.gauger.PolarPoint

public class PolarPoint
extends java.lang.Object

Class representing polar point defined by radius and angle.

Version:
$id$
Author:
Ales Pucelj

Constructor Summary
PolarPoint()
          Creates a new PolarPoint object.
PolarPoint(double r, double phi)
          Creates a new PolarPoint object.
 
Method Summary
static double degToRad(double angle)
          Converts degrees to radians.
static java.awt.geom.Point2D polarToCartesian(double r, double phi)
          Converts polar point to cartesian coordinates.
static java.awt.geom.Point2D polarToCartesian(java.awt.geom.Point2D p, double r, double phi)
          Converts polar point to cartesian coordinates.
static void polarToCartesian(PolarPoint pp, java.awt.geom.Point2D p)
          Converts polar point to cartesian coordinates.
static double radToDeg(double angle)
          Converts radians to degrees.
 java.awt.geom.Point2D toPoint()
          Converts this point to cartesian coordinate representation.
 java.awt.geom.Point2D toPoint(java.awt.Point p)
          Converts this point to cartesian coordinates and puts result in provided instance of point.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PolarPoint

public PolarPoint()
Creates a new PolarPoint object.


PolarPoint

public PolarPoint(double r,
                  double phi)
Creates a new PolarPoint object.

Parameters:
r - Radius parameter.
phi - Angle parameter in radians.
Method Detail

degToRad

public static final double degToRad(double angle)
Converts degrees to radians.

Parameters:
angle - angle in degrees.
Returns:
Angle in radians.

radToDeg

public static final double radToDeg(double angle)
Converts radians to degrees.

Parameters:
angle - in radians.
Returns:
angle in degrees.

polarToCartesian

public static final java.awt.geom.Point2D polarToCartesian(double r,
                                                           double phi)
Converts polar point to cartesian coordinates.

Parameters:
r - Radius parameter.
phi - Angle parameter.
Returns:
Point in cartesian space.

polarToCartesian

public static final java.awt.geom.Point2D polarToCartesian(java.awt.geom.Point2D p,
                                                           double r,
                                                           double phi)
Converts polar point to cartesian coordinates. Result will be placed in point specified. This method will not create new instance of point to hold the result, but the provided instance will be returned.

Parameters:
p - Point which will hold the result.
r - Radius parameter.
phi - Angle parameter.
Returns:
p parameter.

polarToCartesian

public static final void polarToCartesian(PolarPoint pp,
                                          java.awt.geom.Point2D p)
Converts polar point to cartesian coordinates.

Parameters:
pp - Point in polar coordinates.
p - Point in cartesian coordinates.

toPoint

public java.awt.geom.Point2D toPoint()
Converts this point to cartesian coordinate representation.

Returns:
Point in cartesian coordinates.

toPoint

public java.awt.geom.Point2D toPoint(java.awt.Point p)
Converts this point to cartesian coordinates and puts result in provided instance of point.

Parameters:
p - Object that will hold the result.
Returns:
Resulting point, which is the same object as one passed as parameter.


Copyright © 2010. All Rights Reserved.