Beispiel #1
0
        public PointM GetRelativePoint(StringLine str, PointM pos)
        {
            //if (!(str == Left || str == Right))
            //    return PointM.Empty;
            var strPosRatio = PointM.Distance(pos, str.P2) / PointM.Distance(str.FretZero, str.P2);
            var dist        = PointM.Distance(P0, P2);

            return(P2 + (Direction * -1 * (dist * strPosRatio)));
        }
Beispiel #2
0
        public StringCenter(StringLine left, StringLine right)
        {
            Left  = left;
            Right = right;
            P1    = PointM.Average(left.P1, right.P1);
            P2    = PointM.Average(left.P2, right.P2);
            P0    = PointM.Average(left.FretZero, right.FretZero);
            //P1 = PointM.FromVector(Equation.GetPointForY(Math.Min(left.P1.Y.NormalizedValue, right.P1.Y.NormalizedValue)), P1.Unit);

            //P1 = PointM.Average(left.FretZero, right.FretZero);
            //P2 = PointM.Average(left.P2, right.P2);
            //var nutLine = Line.FromPoints((Vector)left.P1, (Vector)right.P1);

            //P1 = PointM.FromVector(Equation.GetIntersection(nutLine), P1.Unit ?? P2.Unit);
        }
Beispiel #3
0
        public PointM GetRelativePoint(StringLine str, PointM pos)
        {
            PointM startPt = PointM.Empty;

            if (str.Index == 0)
            {
                startPt = Side == FingerboardSide.Treble ? str.P1 : str.FretZero;
            }
            else if (str.Index == Layout.NumberOfStrings - 1)
            {
                startPt = Side == FingerboardSide.Bass ? str.P1 : str.FretZero;
            }

            var strPosRatio = PointM.Distance(pos, str.P2) / PointM.Distance(startPt, str.P2);
            var endPt       = RealEnd.IsEmpty ? P2 : RealEnd;
            var dist        = PointM.Distance(P1, endPt);

            return(endPt + (Direction * -1 * (dist * strPosRatio)));
        }