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

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

            return(bParallel);
        }
Пример #2
0
        public LineEquation(LineEquation copiedLine)
        {
            if (copiedLine == null)
            {
                throw new ArgumentNullException("copiedLine");
            }

            this.a = copiedLine.a;
            this.b = copiedLine.b;
            this.c = copiedLine.c;
        }
Пример #3
0
        /**************************************
        *  Calculate intersection point of two lines
        *  if two lines are parallel, return null
        * ************************************/
        public Coordinate IntersecctionWith(LineEquation line)
        {
            if (line == null)
            {
                throw new ArgumentNullException("line");
            }

            Coordinate point = new Coordinate();
            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);
        }