public override double GetT(Point point)
        {
            var a = -_startPoint + _endPoint;
            var b = _startPoint - point;

            EquationSolver.SolveLinear(a.X, b.X, out double tX);
            EquationSolver.SolveLinear(a.Y, b.Y, out double tY);
            return(GetClosestT(point, tX, tY));
        }
        public override double GetT(Point point)
        {
            var a = _startPoint - 2 * _controlPoint + _endPoint;
            var b = 2 * (-_startPoint + _controlPoint);
            var c = _startPoint - point;

            EquationSolver.SolveQuadratic(a.X, b.X, c.X, out double tX1, out double tX2);
            EquationSolver.SolveQuadratic(a.Y, b.Y, c.Y, out double tY1, out double tY2);
            return(GetClosestT(point, tX1, tX2, tY1, tY2));
        }
Пример #3
0
        public override double GetT(Point point)
        {
            var a = -_startPoint + 3 * _controlPoint1 - 3 * _controlPoint2 + _endPoint;
            var b = 3 * (_startPoint - 2 * _controlPoint1 + _controlPoint2);
            var c = 3 * (-_startPoint + _controlPoint1);
            var d = _startPoint - point;

            EquationSolver.SolveCubic(a.X, b.X, c.X, d.X, out double tX1, out double tX2, out double tX3);
            EquationSolver.SolveCubic(a.Y, b.Y, c.Y, d.Y, out double tY1, out double tY2, out double tY3);
            return(GetClosestT(point, tX1, tX2, tX3, tY1, tY2, tY3));
        }