Java examples for java.lang:Math Vector
Compute the squared norm of a vector
import javax.vecmath.Point2d; import javax.vecmath.Tuple2d; import javax.vecmath.Vector2d; public class Main{ /**//w ww . j a v a 2 s . co m * Compute the squared norm of a vector * @param v vector to compute squared norm * @return the vector squared norm */ public static double norm2(final Vector2d v) { return v.x * v.x + v.y * v.y; } }