public double DistanceTo(PointDbl pt) { var dx = X - pt.X; var dy = Y - pt.Y; return(Math.Sqrt(dx * dx + dy * dy)); }
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)); }
private DgSet(PointDbl dog, PointDbl gopher, List <PointDbl> holes) { Holes = holes; Gopher = gopher; Dog = dog; }