GitHubDashboard/FDG/Diagram.cs
/// <summary>
/// Calculates the attraction force between two connected nodes, using the specified spring length.
/// </summary>
/// <param name="x">The node that the force is acting on.</param>
/// <param name="y">The node creating the force.</param>
/// <param name="springLength">The length of the spring, in pixels.</param>
/// <returns>A Vector representing the attraction force.</returns>
Calculates the attraction force between two connected nodes, using the specified spring length.
Calculates the attraction force between two connected nodes using the specified spring length .
private Vector CalcAttractionForce(Node x, Node y, double springLength)
		{
			double proximity = Math.Max(CalcDistance(x.Location, y.Location), 1);
			double force = ATTRACTION_CONSTANT * Math.Max(proximity - springLength, 0);
			double angle = GetBearingAngle(x.Location, y.Location);
			return new Vector(force, angle);
		}
private Vector CalcAttractionForce ( Node x , Node y , double springLength ) { double proximity = Math . Max ( CalcDistance ( x . Location , y . Location ) , 1 ) ; double force = ATTRACTION_CONSTANT * Math . Max ( proximity - springLength , 0 ) ; double angle = GetBearingAngle ( x . Location , y . Location ) ; return new Vector ( force , angle ) ; }
Calculates the attraction force between two connected nodes, using the specified spring length.
Calculates the attraction force between two connected nodes using the specified spring length .
// Hooke's Law: F = -kx
A Vector representing the attraction force.
A Vector representing the attraction force .
x
Node
The node that the force is acting on.
The node that the force is acting on .
y
Node
The node creating the force.
The node creating the force .
springLength
double
The length of the spring, in pixels.
The length of the spring in pixels .