@Test public void mNormalized() { Vector a = new Vector(4, 2); Vector b = a.mNormalized(); Assert.assertEquals(1, b.magnitude(), 0.0001f); Assert.assertEquals(1, a.normalized().scalar(b.normalized()), 0.0001f); Assert.assertEquals(new Vector(0, 0), new Vector(0, 0).normalized()); }
public Vector mNormalized() { double len = magnitude(); if (len == 0) { x = 0.0; y = 0.0; return this; } x /= len; y /= len; check(); return this; }
Vector implements Serializable { public Vector mNormalized() { double len = magnitude(); if (len == 0) { x = 0.0; y = 0.0; return this; } x /= len; y /= len; check(); return this; } }
Vector implements Serializable { public Vector mNormalized() { double len = magnitude(); if (len == 0) { x = 0.0; y = 0.0; return this; } x /= len; y /= len; check(); return this; } Vector(double x, double y);  Vector(); }
Vector implements Serializable { public Vector mNormalized() { double len = magnitude(); if (len == 0) { x = 0.0; y = 0.0; return this; } x /= len; y /= len; check(); return this; } Vector(double x, double y);  Vector(); static Vector fromVertexPosition(EPGMVertex v); void setVertexPosition(EPGMVertex v); Vector sub(Vector other); Vector add(Vector other); Vector mul(double factor); Vector div(double factor); double distance(Vector other); double scalar(Vector other); Vector clamped(double maxLen); Vector normalized(); double magnitude(); Vector confined(double minX, double maxX, double minY, double maxY); double angle(Vector other); Vector rotate(double angle); @Override boolean equals(Object other); @Override int hashCode(); @Override String toString(); double getX(); void setX(double x); double getY(); void setY(double y); Vector set(double x, double y); Vector set(Vector other); Vector reset(); Vector copy(); Vector mSub(Vector other); Vector mAdd(Vector other); Vector mMul(double factor); Vector mDiv(double factor); Vector mClamped(double maxLen); Vector mNormalized(); Vector mConfined(double minX, double maxX, double minY, double maxY); Vector mRotate(double angle); }
Vector implements Serializable { public Vector mNormalized() { double len = magnitude(); if (len == 0) { x = 0.0; y = 0.0; return this; } x /= len; y /= len; check(); return this; } Vector(double x, double y);  Vector(); static Vector fromVertexPosition(EPGMVertex v); void setVertexPosition(EPGMVertex v); Vector sub(Vector other); Vector add(Vector other); Vector mul(double factor); Vector div(double factor); double distance(Vector other); double scalar(Vector other); Vector clamped(double maxLen); Vector normalized(); double magnitude(); Vector confined(double minX, double maxX, double minY, double maxY); double angle(Vector other); Vector rotate(double angle); @Override boolean equals(Object other); @Override int hashCode(); @Override String toString(); double getX(); void setX(double x); double getY(); void setY(double y); Vector set(double x, double y); Vector set(Vector other); Vector reset(); Vector copy(); Vector mSub(Vector other); Vector mAdd(Vector other); Vector mMul(double factor); Vector mDiv(double factor); Vector mClamped(double maxLen); Vector mNormalized(); Vector mConfined(double minX, double maxX, double minY, double maxY); Vector mRotate(double angle);  }