コード例 #1
0
        public override double Calc()
        {
            var rad1 = SolverUtils.Hypot(arc1.Center.X.Value - arc1.StartX, arc1.Center.Y.Value - arc1.StartY);
            var temp = rad1 - circle1.Radius.Value;

            return(temp * temp);
        }
コード例 #2
0
        public override double Calc()
        {
            var temp = SolverUtils.Hypot(L1.P2.X.Value - L1.P1.X.Value, L1.P2.Y.Value - L1.P1.Y.Value) -
                       SolverUtils.Hypot(L2.P2.X.Value - L2.P1.X.Value, L2.P2.Y.Value - L2.P1.Y.Value);

            return(temp * temp);
        }
コード例 #3
0
        public override double Calc()
        {
            var dx  = L1.P2.X.Value - L1.P1.X.Value;
            var dy  = L1.P2.Y.Value - L1.P1.Y.Value;
            var hyp = SolverUtils.Hypot(dx, dy);
            //Calculate the expected tangent intersection points
            var rpx  = circle1.Center.X.Value - dy / hyp * circle1.Radius.Value;
            var rpy  = circle1.Center.Y.Value + dx / hyp * circle1.Radius.Value;
            var rpxN = circle1.Center.X.Value + dy / hyp * circle1.Radius.Value;
            var rpyN = circle1.Center.Y.Value - dx / hyp * circle1.Radius.Value;

            var error1 = (-dy * rpx + dx * rpy + (L1.P1.X.Value * L1.P2.Y.Value - L1.P2.X.Value * L1.P1.Y.Value)) / hyp;
            var error2 = (-dy * rpxN + dx * rpyN + (L1.P1.X.Value * L1.P2.Y.Value - L1.P2.X.Value * L1.P1.Y.Value)) / hyp;

            error1 = error1 * error1;
            error2 = error2 * error2;
            var error = 0.0;

            if (error1 < error2)
            {
                error += error1;
            }
            else
            {
                error += error2;
            }
            return(error);
        }
コード例 #4
0
        public override double Calc()
        {
            var rad1 = SolverUtils.Hypot(arc1.Center.X.Value - arc1.StartX, arc1.Center.Y.Value - Arc1StartY);
            var rad2 = SolverUtils.Hypot(arc1.Center.X.Value - arc1.EndX, arc1.Center.Y.Value - arc1.EndY);
            var temp = rad1 - Radius;

            return(temp * temp);
        }
コード例 #5
0
        public override double Calc()
        {
            //see what the current radius to the point is
            var rad1 = SolverUtils.Hypot(circle1.Center.X.Value - P1.X.Value, circle1.Center.Y.Value - P1.Y.Value);
            //Compare this radius to the radius of the circle, return the error squared
            var temp = rad1 - circle1.Radius.Value;

            return(temp * temp);
        }
コード例 #6
0
        public override double Calc()
        {
            var rad1 = SolverUtils.Hypot(arc1.Center.X.Value - P1.X.Value, arc1.Center.Y.Value - P1.Y.Value);
            var rad2 = SolverUtils.Hypot(arc1.Center.X.Value - arc1.StartX, arc1.Center.Y.Value - arc1.StartX);
            //Compare this radius to the radius of the circle, return the error squared
            var temp = rad1 - rad2;

            return(temp * temp);
        }
コード例 #7
0
        public override double Calc()
        {
            var dx = L1.P2.X.Value - L1.P1.X.Value;
            var dy = L1.P2.Y.Value - L1.P1.Y.Value;

            var t    = -(L1.P1.X.Value * dx - P1.X.Value * dx + L1.P1.Y.Value * dy - P1.Y.Value * dy) / (dx * dx + dy * dy);
            var xint = L1.P1.X.Value + dx * t;
            var yint = L1.P1.Y.Value + dy * t;
            var temp = SolverUtils.Hypot((P1.X.Value - xint), (P1.Y.Value - yint)) - Distance;

            return(temp * temp / 10);
        }
コード例 #8
0
        public override double Calc()
        {
            var dx  = L1.P2.X.Value - L1.P1.X.Value;
            var dy  = L1.P2.Y.Value - L1.P1.Y.Value;
            var dx2 = L2.P2.X.Value - L2.P1.X.Value;
            var dy2 = L2.P2.Y.Value - L2.P1.Y.Value;

            var hyp1 = SolverUtils.Hypot(dx, dy);
            var hyp2 = SolverUtils.Hypot(dx2, dy2);

            dx  = dx / hyp1;
            dy  = dy / hyp1;
            dx2 = dx2 / hyp2;
            dy2 = dy2 / hyp2;

            var temp = dy * dx2 - dx * dy2;

            return((temp) * (temp));
        }
コード例 #9
0
        public override double Calc()
        {
            var temp = SolverUtils.Hypot(arc1.Center.X.Value - arc2.Center.X.Value, arc1.Center.X.Value - arc2.Center.Y.Value);

            return(temp * temp);
        }
コード例 #10
0
        public override double Calc()
        {
            var temp = SolverUtils.Hypot(circle1.Center.X.Value - circle2.Center.X.Value, circle1.Center.Y.Value - circle2.Center.Y.Value);

            return(temp * temp);
        }