Esempio n. 1
0
 /// <summary>
 /// Sets up Dendritic Point class's static variables using <see cref="GenerateRules"/>.
 /// </summary>
 /// <param name="rules">Rules to set up with.</param>
 public static void Setup(GenerateRules rules)
 {
     _stepCount = rules.xHalfSize > rules.ySize
         ? _stepMultiplier * 2 * rules.xHalfSize
         : _stepMultiplier * 2 * rules.ySize;
     _stepSize      = _stepMultiplier * Math.PI / _stepCount;
     _pointCount    = rules.DendritePointCount;
     _stepThreshold = rules.DendriticStepThreshold;
     DendriticShape.MapSetup(rules.xHalfSize, rules.ySize, rules.DendriteDirectionCount);
 }
Esempio n. 2
0
        /// <summary>
        /// Constructor for new Dendritic Point.
        /// </summary>
        /// <param name="inDendriticShape"></param>
        /// <param name="inPosition"></param>
        /// <param name="randomNumber">Random Number used for generating direction.</param>
        public DendriticPoint(DendriticShape inDendriticShape, KeyPoint inPosition, double randomNumber)
        {
            dendriticShape = inDendriticShape;
            position       = inPosition;
            var directionIndex = (int)(DendriticShape.DirectionCount * randomNumber);

            if (directionIndex >= DendriticShape.DirectionCount)
            {
                directionIndex = DendriticShape.DirectionCount - 1;
            }
            dendriticAngle = dendriticShape.Direction[directionIndex];
        }