Skip to content

Instantly share code, notes, and snippets.

@njlr
Created September 7, 2017 10:48
Show Gist options
  • Select an option

  • Save njlr/cf688eacf609154c004123711b94fa36 to your computer and use it in GitHub Desktop.

Select an option

Save njlr/cf688eacf609154c004123711b94fa36 to your computer and use it in GitHub Desktop.
public final class Vector2 {
 
  public final float x;
  public final float y;
 
  public Vector2(float x, float y) {
  this.x = x;
  this.y = y;
  }
 
  public Vector2 add(final Vector2 v) {
  return new Vector2(x + v.x, y + v.y);
  }
 
  // toString, hashCode, equals…
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment