Ejemplo n.º 1
0
            public bool IsCoincidesWith(StraightLineEquation other)
            {
                var fb = -(A / B);
                var sb = -(other.A / other.B);

                return(fb * sb > 0 && C * other.B == other.C * B);
            }
Ejemplo n.º 2
0
        private Point GetIntersectPoint(StraightLineEquation f, StraightLineEquation s)
        { // TODO HELP ME
            var x = (f.B * s.C - s.B * f.C) / (f.A * s.B - s.A * f.B);
            var y = (s.A * f.C - f.A * s.C) / (f.A * s.B - s.A * f.B);

            return(new Point(x, y));
        }
Ejemplo n.º 3
0
        private bool IsIntersect(Vector fs, Vector fe, Vector ss, Vector se)
        { // TODO HELP ME
            var firstLine  = new StraightLineEquation(fs, fe);
            var secondLine = new StraightLineEquation(ss, se);

            if (firstLine.A == 0 && secondLine.A == 0 || firstLine.B == 0 && secondLine.B == 0)
            {
                return(firstLine.IsCoincidesWith(secondLine));
            }
            var point = GetIntersectPoint(firstLine, secondLine);

            return(point.IsBetween(fs.ToPoint(), fe.ToPoint()) &&
                   point.IsBetween(ss.ToPoint(), se.ToPoint()));
        }