def classify_intersection5(s, curve1, curve2):
    """Image for :func:`._surface_helpers.classify_intersection` docstring."""
    if NO_IMAGES:
        return

    surface1 = bezier.Surface.from_nodes(
        np.asfortranarray(
            [
                [1.0, 1.5, 2.0, 1.25, 1.75, 1.5],
                [0.0, 1.0, 0.0, 0.9375, 0.9375, 1.875],
            ]
        )
    )
    surface2 = bezier.Surface.from_nodes(
        np.asfortranarray(
            [
                [3.0, 1.5, 0.0, 2.25, 0.75, 1.5],
                [0.0, 1.0, 0.0, -2.0, -2.0, -4.0],
            ]
        )
    )
    figure, (ax1, ax2) = plt.subplots(2, 1)
    classify_help(s, curve1, surface1, curve2, surface2, 0, ax=ax1)
    classify_help(s, curve1, surface1, curve2, surface2, 1, ax=ax2)
    # Remove the alpha from the color
    color1 = ax1.patches[0].get_facecolor()[:3]
    color2 = ax1.patches[1].get_facecolor()[:3]
    # Now add the "degenerate" intersection polygons. The first
    # comes from specializing to
    # left1(0.5, 1.0)-left2(0.0, 0.25)-right1(0.375, 0.5)
    surface3 = bezier.Surface.from_nodes(
        np.asfortranarray(
            [
                [1.5, 1.75, 2.0, 1.6875, 1.9375, 1.875],
                [0.5, 0.5, 0.0, 0.5, 0.234375, 0.46875],
            ]
        )
    )
    # NOTE: We don't require the intersection polygon be valid.
    surface3.plot(256, ax=ax1)
    # The second comes from specializing to
    # left1(0.0, 0.5)-right1(0.5, 0.625)-left3(0.75, 1.0)
    surface4 = bezier.Surface.from_nodes(
        np.asfortranarray(
            [
                [1.0, 1.25, 1.5, 1.0625, 1.3125, 1.125],
                [0.0, 0.5, 0.5, 0.234375, 0.5, 0.46875],
            ]
        )
    )
    # NOTE: We don't require the intersection polygon be valid.
    surface4.plot(256, ax=ax2)
    (int_x,), (int_y,) = curve1.evaluate(s)
    ax1.plot([int_x], [int_y], color=color1, linestyle="None", marker="o")
    ax2.plot([int_x], [int_y], color=color2, linestyle="None", marker="o")
    for ax in (ax1, ax2):
        ax.axis("scaled")
        ax.set_xlim(-0.0625, 3.0625)
        ax.set_ylim(-0.0625, 0.5625)
    plt.setp(ax1.get_xticklabels(), visible=False)
    figure.tight_layout(h_pad=-7.0)
    save_image(figure, "classify_intersection5.png")
def classify_intersection5 ( s , curve1 , curve2 ) : if NO_IMAGES : return surface1 = bezier . Surface . from_nodes ( np . asfortranarray ( [ [ 1.0 , 1.5 , 2.0 , 1.25 , 1.75 , 1.5 ] , [ 0.0 , 1.0 , 0.0 , 0.9375 , 0.9375 , 1.875 ] , ] ) ) surface2 = bezier . Surface . from_nodes ( np . asfortranarray ( [ [ 3.0 , 1.5 , 0.0 , 2.25 , 0.75 , 1.5 ] , [ 0.0 , 1.0 , 0.0 , - 2.0 , - 2.0 , - 4.0 ] , ] ) ) figure , ( ax1 , ax2 ) = plt . subplots ( 2 , 1 ) classify_help ( s , curve1 , surface1 , curve2 , surface2 , 0 , ax = ax1 ) classify_help ( s , curve1 , surface1 , curve2 , surface2 , 1 , ax = ax2 ) color1 = ax1 . patches [ 0 ] . get_facecolor ( ) [ : 3 ] color2 = ax1 . patches [ 1 ] . get_facecolor ( ) [ : 3 ] surface3 = bezier . Surface . from_nodes ( np . asfortranarray ( [ [ 1.5 , 1.75 , 2.0 , 1.6875 , 1.9375 , 1.875 ] , [ 0.5 , 0.5 , 0.0 , 0.5 , 0.234375 , 0.46875 ] , ] ) ) surface3 . plot ( 256 , ax = ax1 ) surface4 = bezier . Surface . from_nodes ( np . asfortranarray ( [ [ 1.0 , 1.25 , 1.5 , 1.0625 , 1.3125 , 1.125 ] , [ 0.0 , 0.5 , 0.5 , 0.234375 , 0.5 , 0.46875 ] , ] ) ) surface4 . plot ( 256 , ax = ax2 ) ( int_x , ) , ( int_y , ) = curve1 . evaluate ( s ) ax1 . plot ( [ int_x ] , [ int_y ] , color = color1 , linestyle = "None" , marker = "o" ) ax2 . plot ( [ int_x ] , [ int_y ] , color = color2 , linestyle = "None" , marker = "o" ) for ax in ( ax1 , ax2 ) : ax . axis ( "scaled" ) ax . set_xlim ( - 0.0625 , 3.0625 ) ax . set_ylim ( - 0.0625 , 0.5625 ) plt . setp ( ax1 . get_xticklabels ( ) , visible = False ) figure . tight_layout ( h_pad = - 7.0 ) save_image ( figure , "classify_intersection5.png" )
Image for :func:`._surface_helpers.classify_intersection` docstring.