ini.trakem2.vector
Class Util

java.lang.Object
  extended by ini.trakem2.vector.Util

public class Util
extends java.lang.Object


Constructor Summary
Util()
           
 
Method Summary
static double[] copy(double[] a, int new_length)
          Will make a new double[] array, then fit in it as many points from the given array as possible according to the desired new length.
static double[] copy(double[] a, int first, int new_length)
           
static double getAngle(double x, double y)
          Returns the angle in radians of the given polar coordinates, correcting the Math.atan2 output.
static void reverse(double[] a)
          Reverse in place an array of doubles.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Util

public Util()
Method Detail

copy

public static final double[] copy(double[] a,
                                  int new_length)
Will make a new double[] array, then fit in it as many points from the given array as possible according to the desired new length. If the new length is shorter that a.length, it will shrink and crop from the end; if larger, the extra spaces will be set with zeros.


copy

public static final double[] copy(double[] a,
                                  int first,
                                  int new_length)

getAngle

public static final double getAngle(double x,
                                    double y)
Returns the angle in radians of the given polar coordinates, correcting the Math.atan2 output. Adjusting so that 0 is 3 o'clock, PI+PI/2 is 12 o'clock, PI is 9 o'clock, and PI/2 is 6 o'clock (why atan2 doesn't output angles this way? I remember I had the same problem for Pipe.java in the A_3D_editing plugin)


reverse

public static final void reverse(double[] a)
Reverse in place an array of doubles.