示例#1
0
        public double DistanceTo(PointDbl pt)
        {
            var dx = X - pt.X;
            var dy = Y - pt.Y;

            return(Math.Sqrt(dx * dx + dy * dy));
        }
示例#2
0
                public static DgSet ReadSet(bool firstCase)
                {
                    if (!firstCase)
                    {
                        ReadLine();
                    }
                    var vals = GetDblVals();

                    if (vals == null)
                    {
                        return(null);
                    }
                    var cHoles      = (int)(vals[0] + 0.5);
                    var gopherPoint = new PointDbl(vals[1], vals[2]);
                    var dogPoint    = new PointDbl(vals[3], vals[4]);
                    var holes       = new List <PointDbl>(cHoles);

                    for (var iHole = 0; iHole < cHoles; iHole++)
                    {
                        var holeVals = GetDblVals();
                        holes.Add(new PointDbl(holeVals[0], holeVals[1]));
                    }
                    return(new DgSet(dogPoint, gopherPoint, holes));
                }
示例#3
0
 private DgSet(PointDbl dog, PointDbl gopher, List <PointDbl> holes)
 {
     Holes  = holes;
     Gopher = gopher;
     Dog    = dog;
 }