using Microsoft.Msagl.Core.Geometry;
using Microsoft.Msagl.Core.Layout;
namespace Microsoft.Msagl.Layout.Incremental {
///
/// A MinSeparationConstraint requires a minimum distance between two nodes, i.e. if nodes are closer than
/// the minimum separation they will be projected apart, if they are further apart than the minimum
/// separation then we don't need to do anything.
///
public class MinSeparationConstraint : StickConstraint {
///
///
///
///
///
///
public MinSeparationConstraint(Node u, Node v, double separation)
: base(u, v, separation) { }
///
///
///
public override double Project() {
Point uv = v.Center - u.Center;
if (uv.Length < separation) {
return base.Project();
} else {
return 0;
}
}
}
}