コード例 #1
0
        public void GetSlopeIntercept_WhenCalled_ReturnCorrectSlopeAndIntercept()
        {
            var line   = new FloatLine(1, 6, 3, -4);
            var result = LinearEquations.GetSlopeInterceptForm(line);

            Assert.Equal(-5, result.M);
            Assert.Equal(11, result.B);
        }
コード例 #2
0
        protected override void Update()
        {
            var mousePos = GetMousePosition();

            if (IntersectionMode == IntersectionMode.X)
            {
                var helper = LinearEquations.GetSlopeInterceptForm(_lineShape);
                Intersection = helper.PointOnLineX(mousePos.X);
            }
            else if (IntersectionMode == IntersectionMode.Y)
            {
                var helper = LinearEquations.GetSlopeInterceptForm(_lineShape);
                Intersection = helper.PointOnLineY(mousePos.Y);
            }
        }