(float[] v)
| 94 | to[2] = veca[2] + scale * vecb[2]; |
| 95 | } |
| 96 | public static final float VectorNormalize(float[] v) { |
| 97 | |
| 98 | float length = VectorLength(v); |
| 99 | if (length != 0.0f) { |
| 100 | float ilength = 1.0f / length; |
| 101 | v[0] *= ilength; |
| 102 | v[1] *= ilength; |
| 103 | v[2] *= ilength; |
| 104 | } |
| 105 | return length; |
| 106 | } |
| 107 | public static final float VectorLength(float v[]) { |
| 108 | return (float) Math.sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]); |
| 109 | } |