|
@@ -54,4 +54,19 @@ class Line {
|
|
|
return hxd.Math.sqrt(distanceSq(p));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * The angle between a line and the x-axis
|
|
|
+ */
|
|
|
+ public inline function angle():Float {
|
|
|
+ var dx = p2.x - p1.x;
|
|
|
+ var dy = p2.y - p1.y;
|
|
|
+ return hxd.Math.atan2(dy, dx);
|
|
|
+ }
|
|
|
+
|
|
|
+ public inline function length():Float {
|
|
|
+ var dx = p2.x - p1.x;
|
|
|
+ var dy = p2.y - p1.y;
|
|
|
+ return hxd.Math.distance(dx, dy);
|
|
|
+ }
|
|
|
+
|
|
|
}
|