<commit_before>package pony.geom;

typedef Point_<T> = { x:T, y:T }

/**
 * Point / IntPoint
 * @author AxGord
 */
abstract Point<T:Float>(Point_<T>) from Point_<T> to Point_<T> {
	public var x(get, set):T;
	public var y(get, set):T;
	public inline function new(x:T, y:T) this = { x:x, y:y };
	private inline function get_x():T return this.x;
	private inline function get_y():T return this.y;
	private inline function set_x(v:T):T return this.x = v;
	private inline function set_y(v:T):T return this.y = v;
	public inline function toString():String return '(${this.x}, ${this.y})';
	
	@:to public inline function toFloat():Point_<Float> return cast this;

	@:to public static inline function toInt(p:Point<Float>):Point<Int> return new Point(Std.int(p.x), Std.int(p.y));

	@:op(A / B) public static inline function div2<T:Float>(lhs:Point<T>, rhs:Point<T>):Point<Float>
		return { x:lhs.x / rhs.x, y:lhs.y / rhs.y };

	@:op(A / B) public static inline function div1<T:Float>(lhs:Point<T>, rhs:T):Point<Float>
		return { x:lhs.x / rhs, y:lhs.y / rhs };

	@:op(A / B) public static inline function div2i<T:Int>(lhs:Point<T>, rhs:Point<T>):Point<Float>
		return { x:lhs.x / rhs.x, y:lhs.y / rhs.y };

	@:op(A / B) public static inline function div1i<T:Int>(lhs:Point<T>, rhs:T):Point<Float>
		return { x:lhs.x / rhs, y:lhs.y / rhs };

	@:op(A / B) public static inline function div2if<T:Int>(lhs:Point<T>, rhs:Point<Float>):Point<Float>
		return { x:lhs.x / rhs.x, y:lhs.y / rhs.y };

	@:op(A / B) public static inline function div1if<T:Int>(lhs:Point<T>, rhs:Float):Point<Float>
		return { x:lhs.x / rhs, y:lhs.y / rhs };

	@:op(A * B) public static inline function mul2<T:Float>(lhs:Point<T>, rhs:Point<T>):Point<T>
		return { x:lhs.x * rhs.x, y:lhs.y * rhs.y };

	@:op(A * B) public static inline function mul1<T:Float>(lhs:Point<T>, rhs:T):Point<T>
		return { x:lhs.x * rhs, y:lhs.y * rhs };

	@:op(A + B) public static inline function add2<T:Float>(lhs:Point<T>, rhs:Point<T>):Point<T>
		return { x:lhs.x + rhs.x, y:lhs.y + rhs.y };

	@:op(A + B) public static inline function add1<T:Float>(lhs:Point<T>, rhs:T):Point<T>
		return { x:lhs.x + rhs, y:lhs.y + rhs };

	@:op(A - B) public static inline function sub2<T:Float>(lhs:Point<T>, rhs:Point<T>):Point<T>
		return { x:lhs.x - rhs.x, y:lhs.y - rhs.y };

	@:op(A - B) public static inline function sub1<T:Float>(lhs:Point<T>, rhs:T):Point<T>
		return { x:lhs.x - rhs, y:lhs.y - rhs };

	public static inline function random():Point<Float> return new Point<Float>(Math.random(), Math.random());

	#if flash<commit_msg>point compare<commit_after>package pony.geom;

typedef Point_<T> = { x:T, y:T }

/**
 * Point / IntPoint
 * @author AxGord
 */
abstract Point<T:Float>(Point_<T>) from Point_<T> to Point_<T> {
	public var x(get, set):T;
	public var y(get, set):T;
	public inline function new(x:T, y:T) this = { x:x, y:y };
	private inline function get_x():T return this.x;
	private inline function get_y():T return this.y;
	private inline function set_x(v:T):T return this.x = v;
	private inline function set_y(v:T):T return this.y = v;
	public inline function toString():String return '(${this.x}, ${this.y})';
	
	@:to public inline function toFloat():Point_<Float> return cast this;

	@:to public static inline function toInt(p:Point<Float>):Point<Int> return new Point(Std.int(p.x), Std.int(p.y));

	@:op(A / B) public static inline function div2<T:Float>(lhs:Point<T>, rhs:Point<T>):Point<Float>
		return { x:lhs.x / rhs.x, y:lhs.y / rhs.y };

	@:op(A / B) public static inline function div1<T:Float>(lhs:Point<T>, rhs:T):Point<Float>
		return { x:lhs.x / rhs, y:lhs.y / rhs };

	@:op(A / B) public static inline function div2i<T:Int>(lhs:Point<T>, rhs:Point<T>):Point<Float>
		return { x:lhs.x / rhs.x, y:lhs.y / rhs.y };

	@:op(A / B) public static inline function div1i<T:Int>(lhs:Point<T>, rhs:T):Point<Float>
		return { x:lhs.x / rhs, y:lhs.y / rhs };

	@:op(A / B) public static inline function div2if<T:Int>(lhs:Point<T>, rhs:Point<Float>):Point<Float>
		return { x:lhs.x / rhs.x, y:lhs.y / rhs.y };

	@:op(A / B) public static inline function div1if<T:Int>(lhs:Point<T>, rhs:Float):Point<Float>
		return { x:lhs.x / rhs, y:lhs.y / rhs };

	@:op(A * B) public static inline function mul2<T:Float>(lhs:Point<T>, rhs:Point<T>):Point<T>
		return { x:lhs.x * rhs.x, y:lhs.y * rhs.y };

	@:op(A * B) public static inline function mul1<T:Float>(lhs:Point<T>, rhs:T):Point<T>
		return { x:lhs.x * rhs, y:lhs.y * rhs };

	@:op(A + B) public static inline function add2<T:Float>(lhs:Point<T>, rhs:Point<T>):Point<T>
		return { x:lhs.x + rhs.x, y:lhs.y + rhs.y };

	@:op(A + B) public static inline function add1<T:Float>(lhs:Point<T>, rhs:T):Point<T>
		return { x:lhs.x + rhs, y:lhs.y + rhs };

	@:op(A - B) public static inline function sub2<T:Float>(lhs:Point<T>, rhs:Point<T>):Point<T>
		return { x:lhs.x - rhs.x, y:lhs.y - rhs.y };

	@:op(A - B) public static inline function sub1<T:Float>(lhs:Point<T>, rhs:T):Point<T>
		return { x:lhs.x - rhs, y:lhs.y - rhs };

	@:op(A == B) public inline function compare(b:Point<T>):Bool return x == b.x && y == b.y;

	public static inline function random():Point<Float> return new Point<Float>(Math.random(), Math.random());

	#if flash
{'fraction_non_alphanumeric': 0.1969812762705388, 'fraction_numerical': 0.0045854031333588076, 'mean_word_length': 4.45881126173097, 'pattern_counts': {'":': 0, '<': 108, '<?xml version=': 0, '>': 108, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4899281', 'n_tokens_mistral': 2217, 'n_tokens_neox': 2153, 'n_words': 511}