using Microsoft.Msagl.Core.Geometry;
using Microsoft.Msagl.Core.Layout;
namespace Microsoft.Msagl.Layout.Incremental {
///
/// Keeps nodes within a specified distance of each other
///
public class MaxSeparationConstraint : StickConstraint {
///
///
///
///
///
///
public MaxSeparationConstraint(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;
}
}
}
}