Exemple #1
0
 private static void MinMaxAreaForOrhtoSepLine(PointF p1, Vector2dF ortho, LabelPolygon lp, ref float min, ref float max)
 {
     for (int j = 0; j < lp._points.Length; j++)
     {
         Vector2dF rc   = new Vector2dF(lp[j], p1);
         float     prod = ortho.DotProduct(rc);
         if (j == 0)
         {
             min = max = prod;
         }
         else
         {
             min = Math.Min(min, prod);
             max = Math.Max(max, prod);
         }
     }
 }
Exemple #2
0
            private static bool HasSeperateLine(LabelPolygon tester, LabelPolygon cand)
            {
                for (int i = 1; i <= tester._points.Length; i++)
                {
                    PointF    p1    = tester[i];
                    Vector2dF ortho = new Vector2dF(p1, tester._points[i - 1]);
                    ortho.ToOrtho();
                    ortho.Normalize();

                    float t_min = 0f, t_max = 0f, c_min = 0f, c_max = 0f;
                    MinMaxAreaForOrhtoSepLine(p1, ortho, tester, ref t_min, ref t_max);
                    MinMaxAreaForOrhtoSepLine(p1, ortho, cand, ref c_min, ref c_max);

                    if ((t_min <= c_max && t_max <= c_min) ||
                        (c_min <= t_max && c_max <= t_min))
                    {
                        return(true);
                    }
                }

                return(false);
            }
Exemple #3
0
 public float DotProduct(Vector2dF v)
 {
     return(_x * v._x + _y * v._y);
 }