private RbInfo GetNearest(Point3d point3d, List <RbInfo> RbInsPoints) { var sorted = RbInsPoints.OrderBy(x => x.Pos.Distance2dTo(point3d)).ToList(); RbInfo ret = sorted[0]; double dist = point3d.Distance2dTo(ret.Pos); if (dist > _MaxDist) { return(null); } return(ret); }