Exemplo n.º 1
0
        /// <summary>
        /// Multiply the model's strength dropoff by the given factor
        /// </summary>
        public static MagnitudeDropoffModel operator *(float strengthFactor, MagnitudeDropoffModel model)
        {
            ModelPointList multipliedList = new ModelPointList(strengthFactor * model.InitialStrength, model.Lifetime);

            for (int i = 1; i < model.Points.Length - 1; i++)
            {
                multipliedList.Add(strengthFactor * model.Points[i]);
            }

            MagnitudeDropoffModel multipliedModel = new MagnitudeDropoffModel(multipliedList);

            return(multipliedModel);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Based on given points, construct dictionary relating lines to their domains
        /// </summary>
        public MagnitudeDropoffModel(ModelPointList pointList)
        {
            //_modelPoints = pointList;

            _points = pointList.ToArray();
            _lines  = new Dictionary <ModelTimeDomain, ModelLine>();

            // calculate model's lines and their corresponding time domains
            for (int i = 0; i < _points.Length - 1; i++)
            {
                ModelPoint p1 = _points[i];
                ModelPoint p2 = _points[i + 1];

                ModelLine       line   = new ModelLine(p1, p2);
                ModelTimeDomain domain = new ModelTimeDomain(p1.Time, p2.Time);
                _lines.Add(domain, line);
            }
        }