예제 #1
0
        public float DistanceTo(SpacePoint <T> otherPoint, IDimensionSelector dimSelector)
        {
            var hasSelector = dimSelector != null;

            var sum = 0f;

            for (var d = 0; d < Dimensions.Length; ++d)
            {
                if (hasSelector && !dimSelector.IncludesDimension(d))
                {
                    continue;
                }

                var valOther = otherPoint.Dimensions[d].Position;
                var valCurrD = Dimensions[d].Position;

                var n = valCurrD - valOther;
                n    = n * n;
                sum += n;
            }
            return((float)Math.Sqrt(sum));
        }
예제 #2
0
 public bool RemovePoint(SpacePoint <T> sp)
 {
     return(_points.Remove(sp));
 }
예제 #3
0
 public float DistanceTo(SpacePoint <T> otherPoint)
 {
     return(DistanceTo(otherPoint, null));
 }
예제 #4
0
 public bool AddPoint(SpacePoint <T> sp)
 {
     sp.Dimensions[Dimension.Index] = this;
     return(_points.Add(sp));
 }