Пример #1
0
 public ForceRadial(ForceDelegate <TNode> radiusFunc = null, double x = 0, double y = 0)
 {
     this.radiusFunc = radiusFunc == null ? defaultRadius : radiusFunc;
     this.X          = x;
     this.Y          = y;
     strengthFunc    = defaultStrength;
 }
Пример #2
0
        public ForceLink(List <TLink> links = null)
        {
            this._links = links ?? new List <TLink>();

            strength = defaultStrength;
            distance = defaultDistance;
        }
Пример #3
0
 public ForceRadial(double radius, double x = 0, double y = 0)
 {
     this.SetRadius(radius);
     this.X       = x;
     this.Y       = y;
     strengthFunc = defaultStrength;
 }
Пример #4
0
 public ForceBounded(double x1 = 0, double y1 = 0,
                     double x2 = double.PositiveInfinity,
                     double y2 = double.PositiveInfinity)
 {
     SetBound(x1, x2, y1, y2);
     this.strengthFunc = defaultStrength;
 }
Пример #5
0
        public ForceLink(List <TLink> links, double strength, double distance, int iterations = 1)
        {
            this._links = links ?? new List <TLink>();

            this.strength = (_, __, ___) => strength;
            this.distance = (_, __, ___) => distance;

            this.Iterations = iterations;
        }
Пример #6
0
 public ForceLink(List <TLink> links, int iterations = 1,
                  ForceDelegate <TLink> strengthFunc = null,
                  ForceDelegate <TLink> distanceFunc = null)
 {
     this._links     = links ?? new List <TLink>();
     this.Iterations = iterations;
     this.strength   = strengthFunc ?? defaultStrength;
     this.distance   = distanceFunc ?? defaultDistance;
 }
Пример #7
0
 public ForceManyBody(double strength    = -30,
                      double distanceMin = 1, double distanceMax = double.NaN,
                      double theta       = 0.9)
 {
     this.strength    = (_, __, ___) => strength;
     this.DistanceMin = distanceMin;
     if (!double.IsNaN(distanceMax))
     {
         this.DistanceMax = distanceMax;
     }
     this.Theta = theta;
 }
Пример #8
0
    Vector3 normalizeNeighbors(ForceDelegate type)
    {
        Vector3 sum   = new Vector3();
        int     count = 0;

        foreach (Boid target in inVicinity)
        {
            sum += type(target);
            count++;
        }

        if (count > 0)
        {
            sum /= count;

            Vector3 steer = new Vector3(sum.x, sum.y, 0) - velocity;
            steer = Vector3.ClampMagnitude(steer, maxforce);

            return(steer);
        }
        return(Vector3.zero);
    }
Пример #9
0
 public ForceX(double x)
 {
     strengthFunc = defaultStrength;
     this.SetX(x);
 }
Пример #10
0
 public ForceX(ForceDelegate <TNode> xFunc = null)
 {
     strengthFunc = defaultStrength;
     this.xFunc   = xFunc == null ? defaultX : xFunc;
 }
Пример #11
0
 public ForceY(double y)
 {
     strengthFunc = defaultStrength;
     this.SetY(y);
 }
Пример #12
0
 public ForceY(ForceDelegate <TNode> yFunc = null)
 {
     strengthFunc = defaultStrength;
     this.yFunc   = yFunc == null ? defaultY : yFunc;
 }
Пример #13
0
 public ForceCollide(double radius, double strength = 1, int iterations = 1)
 {
     this.radiusFunc = (_, __, ___) => radius;
     this.Strength   = strength;
     this.Iterations = iterations;
 }
Пример #14
0
 public ForceCollide(ForceDelegate <TNode> radiusFunc = null)
 {
     this.radiusFunc = radiusFunc == null ? defaultRadius : radiusFunc;
 }
Пример #15
0
 public ForceManyBody()
 {
     strength = defaultStrength;
 }