|
@@ -13,14 +13,43 @@ using Emgu.CV.Structure;
|
|
|
|
|
|
namespace bbiwarg.Utility
|
|
|
{
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
public class Quadrangle
|
|
|
{
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
public Vector2D TopLeft { get; private set; }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
public Vector2D TopRight { get; private set; }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
public Vector2D BottomRight { get; private set; }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
public Vector2D BottomLeft { get; private set; }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
public Vector2D[] Corners { get { return new Vector2D[4] { TopLeft, TopRight, BottomRight, BottomLeft }; } }
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
public Quadrangle(Vector2D topLeft, Vector2D topRight, Vector2D bottomRight, Vector2D bottomLeft)
|
|
|
{
|
|
|
TopLeft = topLeft;
|
|
@@ -29,7 +58,11 @@ namespace bbiwarg.Utility
|
|
|
BottomLeft = bottomLeft;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
public Vector2D getRelativePosition(Vector2D p)
|
|
|
{
|
|
|
Vector2D a, b, c, d;
|
|
@@ -56,6 +89,12 @@ namespace bbiwarg.Utility
|
|
|
return new Vector2D(u, v);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
public bool isInside(Vector2D point, float tolerance=0.0f)
|
|
|
{
|
|
|
Vector2D relativePos = getRelativePosition(point);
|