24 lines
531 B
Haxe
24 lines
531 B
Haxe
package ru.m.geom;
|
|
|
|
class Point {
|
|
public var x(default, default):Float;
|
|
public var y(default, default):Float;
|
|
|
|
public function new(x:Float, y:Float) {
|
|
this.x = x;
|
|
this.y = y;
|
|
}
|
|
|
|
public function add(point:Point):Point {
|
|
return new Point(x + point.x, y + point.y);
|
|
}
|
|
|
|
public function hashCode():Int {
|
|
return Std.int(x + 1000 * y);
|
|
}
|
|
|
|
public function toString():String {
|
|
return 'Point{x=${Math.round(x * 100) / 100},y=${Math.round(y * 100) / 100}}';
|
|
}
|
|
}
|