-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathPointMath.hx
62 lines (49 loc) · 1.31 KB
/
PointMath.hx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package deep.math;
import nme.geom.Point;
/**
* ...
* @author deep <system.grand@gmail.com>
*/
class PointMath
{
@op("+", true) public static function add(a:Point, b:Point):Point
{
return new Point(a.x + b.x, a.y + b.y);
}
@op("+", true) public static function addScalarFloat(a:Point, b:Float):Point
{
return new Point(a.x + b, a.y + b);
}
@op("+", true) public static function addScalarInt(a:Point, b:Int):Point
{
return new Point(a.x + b, a.y + b);
}
@op("-", true) public static function sub(a:Point, b:Point):Point
{
return new Point(a.x - b.x, a.y - b.y);
}
@op("-", false) public static function subScalarFloat(a:Point, b:Float):Point
{
return new Point(a.x - b, a.y - b);
}
@op("-", false) public static function subScalarInt(a:Point, b:Int):Point
{
return new Point(a.x - b, a.y - b);
}
@op("/", false) public static function divScalarInt(a:Point, b:Int):Point
{
return new Point(a.x / b, a.y / b);
}
@op("/", false) public static function divScalarFloat(a:Point, b:Float):Point
{
return new Point(a.x / b, a.y / b);
}
@op("*", true) public static function multScalarInt(a:Point, b:Int):Point
{
return new Point(a.x * b, a.y * b);
}
@op("*", true) public static function multScalarFloat(a:Point, b:Float):Point
{
return new Point(a.x * b, a.y * b);
}
}