vec_math
Class polar2D

java.lang.Object
  extended by vec_math.VectorG
      extended by vec_math.vector2D
          extended by vec_math.polar2D
All Implemented Interfaces:
Serializable, Cloneable

public class polar2D
extends vector2D

Extends the vector2D for capabilities to convert (x,y) into (r,phi).

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class vec_math.VectorG
VectorG.CloneTest, VectorG.EuclidianMetric, VectorG.LengthComparator, VectorG.Metric
 
Field Summary
protected  double[] r
           
protected  boolean RPhiValid
           
 
Fields inherited from class vec_math.VectorG
a
 
Constructor Summary
protected polar2D()
           
  polar2D(double x, double y)
          Constructor chain.
 
Method Summary
protected  void calcRPhi()
          Calculates radius and azimuth of this vector.
static polar2D getFromRPhi(double r, double phi)
          Returns a new polar2D object.
protected static double getX(double r, double phi)
          Calculates x out of r and phi.
protected static double getY(double r, double phi)
          Calculates y out of r and phi.
static void main(String[] arg)
          Test purpose only.
 double Phi()
          Returns the azimuth.
 double R()
          Returns the radius.
 void set(int index, double val)
          Sets the specified coordinate.
 
Methods inherited from class vec_math.vector2D
setX, setY, toString, X, Y
 
Methods inherited from class vec_math.VectorG
add, clone, dimension, direct, directDivide, directMultiply, dot, doubleParse, equalData, equals, fillFrom, fillFrom, fromDoubles, fromString, get, getAsArray, getLength, hashCode, match, match, multiply, parse, search, searchMinMax, sort, sortToLength, subtract
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

RPhiValid

protected boolean RPhiValid

r

protected double[] r
Constructor Detail

polar2D

protected polar2D()

polar2D

public polar2D(double x,
               double y)
Constructor chain.

Method Detail

getFromRPhi

public static polar2D getFromRPhi(double r,
                                  double phi)
Returns a new polar2D object. Different to the normal constructor, this one works with the polar coordinates instead. The returned object has both coordinates system set.

Parameters:
r - Radius.
phi - Azimuth in radians.

R

public double R()
Returns the radius. Multiple calls are caught with RPhiValid to reduce computing time. Note that a call to this method also sets the phi-value of this vector.


Phi

public double Phi()
Returns the azimuth. Multiple calls are caught with RPhiValid to reduce computing time. Note that a call to this method also sets the r-value of this vector.


set

public void set(int index,
                double val)
Sets the specified coordinate. Must clear RPhiValid.

Overrides:
set in class VectorG
Parameters:
index - Index in coordinate array.
val - New value

calcRPhi

protected void calcRPhi()
Calculates radius and azimuth of this vector. The azimuth is always confined to the intervall 0 to PI.


getX

protected static double getX(double r,
                             double phi)
Calculates x out of r and phi. In the moment, only used if this polar vector was created using the getFromRPhi method.

Parameters:
r - Radius.
phi - Azimuth in radians.
See Also:
getFromRPhi(double, double)

getY

protected static double getY(double r,
                             double phi)
Calculates y out of r and phi. In the moment, only used if this polar vector was created using the getFromRPhi method.

Parameters:
r - Radius.
phi - Azimuth in radians.
See Also:
getFromRPhi(double, double)

main

public static void main(String[] arg)
Test purpose only.