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; }
public ForceLink(List <TLink> links = null) { this._links = links ?? new List <TLink>(); strength = defaultStrength; distance = defaultDistance; }
public ForceRadial(double radius, double x = 0, double y = 0) { this.SetRadius(radius); this.X = x; this.Y = y; strengthFunc = defaultStrength; }
public ForceBounded(double x1 = 0, double y1 = 0, double x2 = double.PositiveInfinity, double y2 = double.PositiveInfinity) { SetBound(x1, x2, y1, y2); this.strengthFunc = defaultStrength; }
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; }
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; }
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; }
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); }
public ForceX(double x) { strengthFunc = defaultStrength; this.SetX(x); }
public ForceX(ForceDelegate <TNode> xFunc = null) { strengthFunc = defaultStrength; this.xFunc = xFunc == null ? defaultX : xFunc; }
public ForceY(double y) { strengthFunc = defaultStrength; this.SetY(y); }
public ForceY(ForceDelegate <TNode> yFunc = null) { strengthFunc = defaultStrength; this.yFunc = yFunc == null ? defaultY : yFunc; }
public ForceCollide(double radius, double strength = 1, int iterations = 1) { this.radiusFunc = (_, __, ___) => radius; this.Strength = strength; this.Iterations = iterations; }
public ForceCollide(ForceDelegate <TNode> radiusFunc = null) { this.radiusFunc = radiusFunc == null ? defaultRadius : radiusFunc; }
public ForceManyBody() { strength = defaultStrength; }