public string CheckType(Point point) { var minDist = Double.MaxValue; var type = string.Empty; foreach (var hyperbox in _hboxes) { var dist = 0.0; //Lista de eixos for (var a = 0; a < hyperbox.GetAxisAmt(); a++) { var axis = hyperbox.Axis[a]; if (point.GetValue(a) >= axis.Min && point.GetValue(a) <= axis.Max) { continue; } var b = Math.Abs(point.GetValue(a) - axis.Middle) - axis.Lenght / 2; dist += Math.Pow(b, 2.0); } if (minDist > dist) //">": first one stays / ">=": last one stays :: customized by Mari { minDist = dist; type = hyperbox.ID; } } return(type); }
public bool Check(Point point) { for (var axis = 0; axis < Ranges.Length; axis++) { var v = point.GetValue(axis); var axisCheck = false; foreach (var range in Ranges[axis]) { if (range.Check(v)) { axisCheck = true; break; } } if (axisCheck == false) { return(false); } } return(true); }