public int Handle(RationalInfo info) { Rational r = info.rational; float cents = (float)r.ToCents(); float distance = (float)info.distance; float harm = 1f / distance; //float harm = Utils.GetHarmonicity(distance); // harmonicity: 0..1 float x = cents; // 0..1200 // use id as a tip string id = String.Format("{0} {1} {2} {3:F2} {4}", r.ToString(), r.FormatMonzo(), distance, r.ToCents(), _temperament.FormatRational(r) ); _image.Line(Point.Points(x, 0, x, harm * 3)) .Add(id: id) .FillStroke(Color.Empty, Color.LightGray, harm * 2); string fraction = r.FormatFraction("\n"); _image.Text(new Point(x, 0), fraction, harm * 2f, lineLeading: 0.8f, align: Image.Align.Center) .Add() .FillStroke(Color.Black, Color.Empty); return(1); }
private object[] GetFormatParams(RationalInfo info) { if (info == null) { return(new[] { "", "No", "R", "Powers", "Epimorics", "Dist", "Cents", "12TET", "", "" }); } var r = info.rational; return(new object[] { _label, ++_counter, r, r.FormatMonzo(), Powers.ToString(r.GetEpimoricPowers(), "[]"), info.distance, r.ToCents(), _temperament.FormatRational(r), Library.Find(r), info.additionalData }); }