private void ComputeWeight() { HTModelNode child = null; for (IEnumerator i = Children(); i.MoveNext();) { child = (HTModelNode)i.Current; globalWeight += child.GetWeight(); } if (globalWeight != 0.0) { weight += Math.Log(globalWeight); } }
override public void Layout(double angle, double width, double length) { base.Layout(angle, width, length); if (parent != null) { HTCoordE a = new HTCoordE(Math.Cos(angle), Math.Sin(angle)); HTCoordE nz = new HTCoordE(-z.X, -z.Y); a.Translate(parent.GetCoordinates()); a.Translate(nz); angle = a.Arg(); double c = Math.Cos(width); double A = 1 + length * length; double B = 2 * length; width = Math.Acos((A * c - B) / (A - B * c)); } HTModelNode child = null; HTCoordE dump = new HTCoordE(); int nbrChild = children.Count; double l1 = (0.95 - model.GetLength()); double l2 = Math.Cos((20.0 * Math.PI) / (2.0 * nbrChild + 38.0)); length = model.GetLength() + (l1 * l2); double startAngle = angle - width; for (IEnumerator i = Children(); i.MoveNext();) { child = (HTModelNode)i.Current; double percent = child.GetWeight() / globalWeight; double childWidth = width * percent; double childAngle = startAngle + childWidth; child.Layout(childAngle, childWidth, length); startAngle += 2.0 * childWidth; } }