# File: spline_squares.py # Author: Petr Sorfa # Desc: Creates a grid of splines # and then creates several square # patches by attaching the relevant # spline points. import am am.begin() # Create the horizontal splines for y in range(4): name = "mysplineh_" + str(y) am.spline_begin(name) # create a spline for x in range(4): am.spline_add_point(x, y, 0.0) am.spline_set_peaked(); am.spline_end() # Create the vertical splines for x in range(4): name = "mysplinev_" + str(x) am.spline_begin(name) # create a spline for y in range(4): am.spline_add_point(x, y, 0.0) am.spline_set_peaked(); am.spline_end() # Attach points to create squares am.spline_attach_points ("mysplineh_0", "mysplinev_0", 0, 0) am.spline_attach_points ("mysplineh_0", "mysplinev_1", 1, 0) am.spline_attach_points ("mysplineh_1", "mysplinev_0", 0, 1) am.spline_attach_points ("mysplineh_1", "mysplinev_1", 1, 1) # No need to attach points that already are am.spline_attach_points ("mysplineh_1", "mysplinev_2", 2, 1) am.spline_attach_points ("mysplineh_2", "mysplinev_1", 1, 2) am.spline_attach_points ("mysplineh_2", "mysplinev_2", 2, 2) am.spline_attach_points ("mysplineh_2", "mysplinev_3", 3, 2) am.spline_attach_points ("mysplineh_3", "mysplinev_2", 2, 3) am.spline_attach_points ("mysplineh_3", "mysplinev_3", 3, 3) am.end()