@Assignments/hw7(week8)/hw7.rb
# *add* methods to this class -- do *not* change given code and do not
# override any methods
# Note: This is the most difficult class.  In the sample solution,
#  preprocess_prog is about 15 lines long and 
# intersectWithSegmentAsLineResult is about 40 lines long
add* methods to this class -- do *not* change given code and do not
override any methods
Note: This is the most difficult class.  In the sample solution,
preprocess_prog is about 15 lines long and
intersectWithSegmentAsLineResult is about 40 lines long
add * methods to this class -- do * not * change given code and do not override any methods Note : This is the most difficult class . In the sample solution preprocess_prog is about 15 lines long and intersectWithSegmentAsLineResult is about 40 lines long
def preprocess_prog
    if real_close(x1,x2)
      if real_close(y1,y2)
        Point.new(x1,y1)
      else
        if y1 > y2
          LineSegment.new(x2,y2,x1,y1)
        else
          self
        end
      end
    else
      if x1 > x2
        LineSegment.new(x2,y2,x1,y1)
      else
        self
      end
    end
  end
def preprocess_prog if real_close ( x1 , x2 ) if real_close ( y1 , y2 ) Point . new ( x1 , y1 ) else if y1 > y2 LineSegment . new ( x2 , y2 , x1 , y1 ) else self end end else if x1 > x2 LineSegment . new ( x2 , y2 , x1 , y1 ) else self end end end
add* methods to this class -- do *not* change given code and do not
override any methods
Note: This is the most difficult class.
add * methods to this class -- do * not * change given code and do not override any methods Note : This is the most difficult class .