def init(self): Model.init(self) if(hasattr(self.terrain_model, 'init')): self.terrain_model.init() for scene in self.subscene_list: if(hasattr(scene, 'init')): scene.init()
def __init__(self, data_points, num_samples_rendering = (34, 34)): ''' data_points is in row major order, namely the 16 rows of the array correspond to (s,t) values (0,0), (0,1),(0,2), (0,3), (1, 0), (1,1),... and so on. num_samples_rendering refers to the number of samples that would be used by the draw_scene() function when rendering the patch ''' Model.__init__(self) self.data_points = data_points self.num_samples_rendering = num_samples_rendering self.B = np.linalg.inv( [ [0, 1, 8, 27], [0, 1, 4, 9], [0, 1, 2, 3], [1, 1, 1, 1]]) self.MatX = np.dot( np.transpose(self.B), np.dot( np.reshape(data_points[:,0], (4,4)), self.B )) self.MatY = np.dot( np.transpose(self.B), np.dot( np.reshape(data_points[:,1], (4,4)), self.B )) self.MatZ = np.dot( np.transpose(self.B), np.dot( np.reshape(data_points[:,2], (4,4)), self.B ))
def __init__(self, data_points = None, num_samples_rendering = 101): ''' A set of data points can be optionally provided during instantiaion. The format is a list of tuples, where each tuple consists of a point and tangent at that point. Both point and tangents are represented by arrays. [(p0, m0), (p1, m1), (p2, m2)] where point p0 = [x0, y0, z0] and m0 = [mx0, my0, mz0] the tangent at p0, and so on. ''' Model.__init__(self) self.num_samples_rendering = num_samples_rendering self.B_Hermite = inv([[0, 1, 0, 3], [0, 1, 0, 2], [0, 1, 1, 1], [1, 1, 0, 0]]) self.coeff_matrix = [] # list of basis vector matrices for each segment self.point_tangent_list = [] if data_points is not None: set_data(data_points)
def __init__(self, terrain_model, subscene_list = []): Model.__init__(self) self.terrain_model = terrain_model self.subscene_list = subscene_list