Here you can find the source of Vector2fNormalize(float[] a, float[] dest)
public static void Vector2fNormalize(float[] a, float[] dest)
//package com.java2s; /*/* w w w. ja v a2 s . c o m*/ * leola-live * see license.txt */ public class Main { /** * Float index for the X component */ public static final int X = 0; /** * Float index for the Y component */ public static final int Y = 1; public static void Vector2fNormalize(float[] a, float[] dest) { float fLen = (float) Math.sqrt((a[X] * a[X] + a[Y] * a[Y])); if (fLen == 0) return; fLen = 1.0f / fLen; dest[X] = a[X] * fLen; dest[Y] = a[Y] * fLen; } }