vector2 java

Solutions on MaxInterview for vector2 java by the best coders in the world

showing results for - "vector2 java"
Jakob
09 Jan 2020
1public class Vector2 
2{               
3    // Members
4    public float x;
5    public float y;
6        
7    // Constructors
8    public Vector2() {
9        this.x = 0.0f;
10        this.y = 0.0f;
11    }
12        
13    public Vector2(float x, float y) {
14        this.x = x;
15        this.y = y;
16    }
17        
18    // Compare two vectors
19    public boolean equals(Vector2 other) {
20        return (this.x == other.x && this.y == other.y);
21    }
22}