All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jtransc.game.math.Point Maven / Gradle / Ivy

Go to download

JVM AOT compiler currently generating Javascript and Haxe, with initial focus on Kotlin and games.

There is a newer version: 0.5.0
Show newest version
package com.jtransc.game.math;

public class Point {
    public double x;
    public double y;

    public Point() {
        this(0, 0);
    }

    public Point(double x, double y) {
        this.x = x;
        this.y = y;
    }

    public Point setTo(double x, double y) {
        this.x = x;
        this.y = y;
        return this;
    }

    public void copyFrom(Point that) {
        this.x = that.x;
        this.y = that.y;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Point that = (Point) o;
        return this.x == that.x && this.y == that.y;

    }

    @Override
    public int hashCode() {
        return (int) (31 * Double.doubleToLongBits(x) + Double.doubleToLongBits(y));
    }

    @Override
    public String toString() {
        return "Point(" + x + ", " + y + ")";
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy