Пример #1
0
        public bool Parallel(CLine line)
        {
            bool bParallel = false;

            if (this.a / this.b == line.a / line.b)
            {
                bParallel = true;
            }

            return(bParallel);
        }
Пример #2
0
        /**************************************
        *  Calculate intersection point of two lines
        *  if two lines are parallel, return null
        * ************************************/
        public CPoint2D IntersecctionWith(CLine line)
        {
            CPoint2D point = new CPoint2D();
            double   a1    = this.a;
            double   b1    = this.b;
            double   c1    = this.c;

            double a2 = line.a;
            double b2 = line.b;
            double c2 = line.c;

            if (!(this.Parallel(line)))             //not parallen
            {
                point.X = (c2 * b1 - c1 * b2) / (a1 * b2 - a2 * b1);
                point.Y = (a1 * c2 - c1 * a2) / (a2 * b2 - a1 * b2);
            }
            return(point);
        }
Пример #3
0
 public CLine(CLine copiedLine)
 {
     this.a = copiedLine.a;
     this.b = copiedLine.b;
     this.c = copiedLine.c;
 }
Пример #4
0
 public CLine(CLine copiedLine)
 {
     this.a=copiedLine.a;
     this.b=copiedLine.b;
     this.c=copiedLine.c;
 }
Пример #5
0
        public bool Parallel(CLine line)
        {
            bool bParallel=false;
            if (this.a/this.b==line.a/line.b)
                bParallel=true;

            return bParallel;
        }
Пример #6
0
        /**************************************
         Calculate intersection point of two lines
         if two lines are parallel, return null
         * ************************************/
        public CPoint2D IntersecctionWith(CLine line)
        {
            CPoint2D point=new CPoint2D();
            double a1=this.a;
            double b1=this.b;
            double c1=this.c;

            double a2=line.a;
            double b2=line.b;
            double c2=line.c;

            if (!(this.Parallel(line))) //not parallen
            {
                point.X=(c2*b1-c1*b2)/(a1*b2-a2*b1);
                point.Y=(a1*c2-c1*a2)/(a2*b2-a1*b2);
            }
            return point;
        }