public void ReCalcMe()
 {
     if (Point1 != null && Point2 != null)
     {
         if (TS_point.TS_AreDoublesEqual(Point1.Y, Point2.Y) && TS_point.TS_AreDoublesEqual(Point1.X, Point2.X))
         {
             SlopeA     = Double.NaN;
             InterceptB = Double.NaN;
             GenA       = Double.NaN;
             GenB       = Double.NaN;
             GenC       = Double.NaN;
         }
         else
         if (TS_point.TS_AreDoublesEqual(Point1.X, Point2.X))
         {
             SlopeA     = Double.PositiveInfinity;
             InterceptB = Double.NaN;
             GenA       = 1;
             GenB       = 0;
             GenC       = -Point1.X;
         }
         else
         {
             SlopeA     = (Point2.Y - Point1.Y) / (Point2.X - Point1.X);
             InterceptB = Point2.Y - (SlopeA * Point2.X);
             GenA       = SlopeA;
             GenB       = -1;
             GenC       = InterceptB;
         }
     }
 }
        public TS_point Intersection(TS_line line2)
        {
            double a1 = SlopeA;
            double b1 = InterceptB;
            double a2 = line2.SlopeA;
            double b2 = line2.InterceptB;

            if (TS_point.TS_AreDoublesEqual(a1, a2))
            {
                return(new TS_point(Double.NaN, Double.NaN));
            }

            /*
             * double x = (b1-b2)/(a2-a1);
             * double y = (a2*b1 - b2*a1)/(a2-a1);
             * return new TS_point(x,y);
             */

            double A1 = GenA;
            double A2 = line2.GenA;
            double B1 = GenB;
            double B2 = line2.GenB;
            double C1 = GenC;
            double C2 = line2.GenC;

            double D1 = (B2 - B1) / (A1 - A2);
            double D2 = (C2 - C1) / (A1 - A2);

            double y = -(A1 * D2 + C1) / (A1 * D1 + B1);
            double x = D1 * y + D2;

            return(new TS_point(x, y));
        }
 public bool IsContain(TS_point point)
 {
     if (TS_point.TS_AreDoublesEqual(GenA * point.X + GenB * point.Y + GenC, 0))
     {
         return(true);
     }
     return(false);
 }
 private double SlopeFactorA()
 {
     if (TS_point.TS_AreDoublesEqual(Point1.X, Point2.X))
     {
         return(Double.NaN);
     }
     return((Point2.Y - Point1.Y) / (Point2.X - Point1.X));
 }
 private void SetSomeMatchedPoints()
 {
     if (TS_point.TS_AreDoublesEqual(GenB, 0))
     {
         _Point1 = new TS_point(_GenC / _GenA, 0);
         _Point2 = new TS_point(_GenC / _GenA, 1);
     }
     else
     {
         _Point1 = new TS_point(0, GetValueOf_Yaxis(0));
         _Point2 = new TS_point(1, GetValueOf_Yaxis(1));
     }
 }