Пример #1
0
        public IList <Point> Intersection(FullLine2D line)
        {
            IList <Point> list = new List <Point>();

            double denominator = (this.Vector.Y * line.Vector.X - this.Vector.X * line.Vector.Y);

            if (!denominator.IsEqual(0))
            {
                double c1 = this.Vector.Y * this.Point.Y + this.Vector.X * this.Point.X;
                double c2 = line.Vector.Y * line.Point.Y + line.Vector.X * line.Vector.X;

                //double t1 = ((this.Point.X - line.Point.X) * line.Vector.Y + (line.Point.Y - this.Point.Y) * line.Vector.Y) / denominator;

                Point p = new Point((line.Vector.X * c1 - this.Vector.X * c2) / denominator,
                                    (this.Vector.Y * c2 - line.Vector.Y * c1) / denominator);
                list.Add(p);
            }

            return(list);
        }
Пример #2
0
        public IList<Point> Intersection(FullLine2D line)
        {
            IList<Point> list = new List<Point>();

            double denominator = (this.Vector.Y * line.Vector.X - this.Vector.X * line.Vector.Y);

            if (!denominator.IsEqual(0))
            {
                double c1 = this.Vector.Y * this.Point.Y + this.Vector.X * this.Point.X;
                double c2 = line.Vector.Y * line.Point.Y + line.Vector.X * line.Vector.X;

                //double t1 = ((this.Point.X - line.Point.X) * line.Vector.Y + (line.Point.Y - this.Point.Y) * line.Vector.Y) / denominator;

                Point p = new Point((line.Vector.X * c1 - this.Vector.X * c2) / denominator,
                    (this.Vector.Y * c2 - line.Vector.Y * c1) / denominator);
                list.Add(p);

            }

            return list;
        }