vector2d in java code example
Example: vector2 java
public class Vector2
{
// Members
public float x;
public float y;
// Constructors
public Vector2() {
this.x = 0.0f;
this.y = 0.0f;
}
public Vector2(float x, float y) {
this.x = x;
this.y = y;
}
// Compare two vectors
public boolean equals(Vector2 other) {
return (this.x == other.x && this.y == other.y);
}
}