// Don't forget that the distance in multiple dimensions of distance 1 can be greater than 1!
        public float getDistance(SpectrumPosition otherPosition)
        {
            double distanceSquared = 0.0;

            for (int i = 0; i < Tweakables.SPECTRUM_DIMENSIONS; i++)
            {
                distanceSquared += Math.Pow(positions[i] - otherPosition.positions[i], 2);
            }

            return((float)Math.Sqrt(distanceSquared));
        }
Пример #2
0
        public Voter(int index, Spectrum spectrum)
        {
            this.index = index;
            viewpoint  = new DistanceViewpoint(this);
            position   = new SpectrumPosition(spectrum);

            if (Tweakables.PRINT_POSITION)
            {
                System.Console.WriteLine(ToString() + " " + position.ToString());
            }
        }