Java Array Normalize NormalizeVec2D(double[] vec)

Here you can find the source of NormalizeVec2D(double[] vec)

Description

Normalize Vec D

License

Open Source License

Declaration

public static void NormalizeVec2D(double[] vec) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    private final static double EPSILON = 0.00000001;

    public static void NormalizeVec2D(double[] vec) {
        double one_over_length = 1.0 / Math.sqrt(vec[0] * vec[0] + vec[1] * vec[1] + EPSILON);
        vec[0] *= one_over_length;/*from   w ww  .  j  a v a 2  s  .c o  m*/
        vec[1] *= one_over_length;
        ;
    }
}

Related

  1. normalizeToInPlace(double[] in, double normsum)
  2. normalizeToLogProbs(double[] x)
  3. normalizeToOne(double[] doubles)
  4. normalizeToSumUpTo(double[] x, double sumUp)
  5. normalizeTrimmedText(char[] ch)
  6. normalizeVector(double[] input)
  7. normalizeVector(Double[] vector)
  8. normalizeVector(final double[] v)
  9. normalizeVector(float[] samples)