예제 #1
0
        public bool IsRightOf(LineFr line)
        {
            if (line.Contains(this))
            {
                return(false);
            }
            if (line.IsHorizontal())
            {
                return(Y < line.YIntercept());
            }
            if (line.IsVertical())
            {
                return(X > line.XIntercept());
            }

            var linePointNullable = line.Intersection(LineFr.Vertical(Fraction.Zero));

            if (linePointNullable == null)
            {
                throw new ArgumentException("Wartość linePoint nie może wynosić null");
            }

            var linePoint = (PointFr)linePointNullable;
            var temp      = new LineFr(this, linePoint);

            if (Y < linePoint.Y)
            {
                if (line.Slope < 0) // a
                {
                    return(temp.Slope < 0 && temp.Slope > line.Slope);
                }

                return(temp.Slope < 0 || temp.Slope > line.Slope); // b
            }
            if (Y > linePoint.Y)
            {
                if (line.Slope < 0) // c
                {
                    return(temp.Slope >= 0 || temp.Slope < line.Slope);
                }

                return(temp.Slope >= 0 && temp.Slope < line.Slope); // d
            }
            return(IsRightOf(linePoint));                           // 'this' ma taką samą współrzędną y jak 'linePoint'
        }
예제 #2
0
 public bool IsLeftOf(LineFr line)
 {
     return(!line.Contains(this) && !IsRightOf(line));
 }