Homework Solution: (scheme)(d) (on-parallels? x1 y1 x2 y2 x3 y3 x4 y4), a function of eight parameters (the x and y values…

    (scheme)(d) (on-parallels? x1 y1 x2 y2 x3 y3 x4 y4), a function of eight parameters (the x and y values of four points), returns true if the line through points (x1,y1) and (x2,y2) is parallel to the line through points (x3,y3) and (x4,y4). You may assume that points (x1, y1) and (x2, y2) are distinct, as are (x3, y3) and (x4, y4). (Note: this function can use any of the functions defined above, but should give a correct answer even in the cases where points-slope or points-intercept would fail.

    Expert Answer

     
    The idea is to find slop of lines. If two lines are parallel then there slop must be same otherwise they are not parallel.

    (scheme)(d) (on-parallels? x1 y1 x2 y2 x3 y3 x4 y4), a business of eight parameters (the x and y values of lewd points), avail gentleman if the thread through points (x1,y1) and (x2,y2) is congruous to the thread through points (x3,y3) and (x4,y4). You may exhibit that points (x1, y1) and (x2, y2) are perspicuous, as are (x3, y3) and (x4, y4). (Note: this business can reason any of the businesss defined overhead, barring should confer a amend vindication equable in the cases where points-slope or points-intercept would fall-short.

    Expert Vindication

     

    The not attributable attributableion is to ascertain slop of threads. If couple threads are congruous then there slop must be similar differently they are not attributable attributable attributable congruous.

    Bool congruous (x1,y1,x2,y2,x3,y3,x4,y4)

    {

    // Slop of principal thread

    double m1 =(y2-y1)/(x2-x1);

    //Slope of thread couple

    double m2= (y4-y3)/(x4-x3);

    If(m1==m2)

    return gentleman;

    else

    return false;

    }