/** * <code>normalize</code> returns the unit vector of this vector. * * @return unit vector of this vector. */ public Vector4f normalize() { // float length = length(); // if (length != 0) { // return divide(length); // } // // return divide(1); float length = x * x + y * y + z * z + w * w; if (length != 1f && length != 0f){ length = 1.0f / FastMath.sqrt(length); return new Vector4f(x * length, y * length, z * length, w * length); } return clone(); }
public IrVertex deepClone() { IrVertex v = new IrVertex(); v.pos = pos != null ? pos.clone() : null; v.norm = norm != null ? norm.clone() : null; v.tang4d = tang4d != null ? tang4d.clone() : null; v.tang = tang != null ? tang.clone() : null; v.bitang = bitang != null ? bitang.clone() : null; v.uv0 = uv0 != null ? uv0.clone() : null; v.uv1 = uv1 != null ? uv1.clone() : null; v.color = color != null ? color.clone() : null; v.material = material; v.smoothing = smoothing; if (boneWeightsIndices != null) { v.boneWeightsIndices = new IrBoneWeightIndex[boneWeightsIndices.length]; for (int i = 0; i < boneWeightsIndices.length; i++) { v.boneWeightsIndices[i] = (IrBoneWeightIndex) boneWeightsIndices[i].clone(); } } return v; }
/** * <code>normalize</code> returns the unit vector of this vector. * * @return unit vector of this vector. */ public Vector4f normalize() { // float length = length(); // if (length != 0) { // return divide(length); // } // // return divide(1); float length = x * x + y * y + z * z + w * w; if (length != 1f && length != 0f){ length = 1.0f / FastMath.sqrt(length); return new Vector4f(x * length, y * length, z * length, w * length); } return clone(); }
/** * <code>normalize</code> returns the unit vector of this vector. * * @return unit vector of this vector. */ public Vector4f normalize() { // float length = length(); // if (length != 0) { // return divide(length); // } // // return divide(1); float length = x * x + y * y + z * z + w * w; if (length != 1f && length != 0f){ length = 1.0f / FastMath.sqrt(length); return new Vector4f(x * length, y * length, z * length, w * length); } return clone(); }
public IrVertex deepClone() { IrVertex v = new IrVertex(); v.pos = pos != null ? pos.clone() : null; v.norm = norm != null ? norm.clone() : null; v.tang4d = tang4d != null ? tang4d.clone() : null; v.tang = tang != null ? tang.clone() : null; v.bitang = bitang != null ? bitang.clone() : null; v.uv0 = uv0 != null ? uv0.clone() : null; v.uv1 = uv1 != null ? uv1.clone() : null; v.color = color != null ? color.clone() : null; v.material = material; v.smoothing = smoothing; if (boneWeightsIndices != null) { v.boneWeightsIndices = new IrBoneWeightIndex[boneWeightsIndices.length]; for (int i = 0; i < boneWeightsIndices.length; i++) { v.boneWeightsIndices[i] = (IrBoneWeightIndex) boneWeightsIndices[i].clone(); } } return v; }