Exemple #1
0
 private void SetUserXY(User user, GeoXYRect Rect, double Resolution, GeoXYLine Line)
 {
     while (true)
     {
         double x = this.RandomGen(Rect.Left, Rect.Right);
         double y = this.RandomGen(Rect.Bottom, Rect.Top);
         GeoXYPoint point = new GeoXYPoint(x, y);
         for (int i = 0; i < (Line.PointsCount - 1); i++)
         {
             GeoXYLine line = new GeoXYLine(Line.Points[i], Line.Points[i + 1]);
             if (line.DistanceAsLineSegmentToPoint(point) < Resolution)
             {
                 user.X = x;
                 user.Y = y;
                 break;
             }
         }
         if (user.X > 0.0)
         {
             return;
         }
     }
 }