class HeightfieldTrimesh(Trimesh):

- def __init__(self, space, num_x, num_z, vertices):

- faces = self.calc_faces(num_x, num_z)

+ def __init__(self, space, size_x, size_z, vertices):

+ faces = self.calc_faces(size_x, size_z)

super(HeightfieldTrimesh, self).__init__(space, vertices, faces)

- def calc_faces(num_x, num_z):

- """Create the faces corresponding to a heightfield size 'num_x' by

- 'num_z'. Faces are triangular, so each is composed by 3 vertices.

+ def calc_faces(size_x, size_z):

+ """Create the faces corresponding to a heightfield size 'size_x' by

+ 'size_z'. Faces are triangular, so each is composed by 3 vertices.

# index of each square is calculated because it is needed to define faces

+ for x in range(size_x):

- indices_x.insert(z, num_z * x + z)

+ for z in range(size_z):

+ indices_x.insert(z, size_z * x + z)

indices.insert(x, indices_x)

# faces = [(1a,1b,1c), (2a,2b,2c), ...]

- for x in range(num_x - 1):

- for z in range(num_z - 1):

+ for x in range(size_x - 1):

+ for z in range(size_z - 1):

zero = indices[x][z] # top-left corner

one = indices[x][z + 1] # bottom-left

# there are two face types for each square

# contiguous squares must have different face types

# there are 2 faces per square