1. The soultion to the cie diagram problem: cie.cpp.

3.


  1. Original: 1,2,3,4
    Clip T: 2,d,e,4,1
    Clip L: d,e,4,1,2
    Clip B: h,a,2,d,e,4
    Clip R: f,g,h,a,b,c,d,e
    Note: any permutation of the above vertices is considered a valid answer. where:
    a = [107.1, 100]
    b = [200, 132.5]
    c = [200, 167.5]
    d = [107.1, 200]
    e = [95.7, 200]
    f = [200, 154.4]
    g = [200, 145.6]
    h = [95.7, 100]

  2. The clipped polygon is actually two polygons, but the Sutherland-Hodgman algorithm treats it as a single polygon. There is a "degenerate" edge (edge f-g) which should not be drawn.

    To avoid this problem, we need to keep track of polygon fragments. An algorithm that does this is the Weiler-Atherton clipper, which switches between following the polygon and following the clipping window at each intersection.