Esempio n. 1
0
        public StringLine ConstructString(SIString str, Measure nutPos, Measure bridgePos)
        {
            var     opp = Measure.Abs(nutPos - bridgePos);
            Measure adj = str.ScaleLength;

            if (str.LengthCalculationMethod == LengthFunction.AlongString && opp > Measure.Zero)
            {
                var theta = MathP.Asin(opp.NormalizedValue / str.ScaleLength.NormalizedValue);
                adj = MathP.Cos(theta) * str.ScaleLength;
            }

            var p1 = new PointM(nutPos, (adj / 2d));
            var p2 = new PointM(bridgePos, (adj / 2d) * -1d);

            return(AddVisualElement(new StringLine(str, p1, p2)));
        }
Esempio n. 2
0
 public static Vector FromAngle(Angle angle)
 {
     return(new Vector(MathP.Cos(angle.Radians), MathP.Sin(angle.Radians)));
 }