Commits

German Larrain committed 874189f

collision.base.HeightfieldTrimesh: renamed 'num_{x, z}' to 'size_{x, z}'.

  • Participants
  • Parent commits bee0c92

Comments (0)

Files changed (1)

File ars/model/collision/base.py

 
 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)
 
 	@staticmethod
-	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
 		indices = []
 
-		for x in range(num_x):
+		for x in range(size_x):
 			indices_x = []
-			for z in range(num_z):
-				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), ...]
 		faces = []
 
-		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
 				face_type = zero
-				if num_z % 2 == 0:
+				if size_z % 2 == 0:
 					face_type += 1
 
 				# there are 2 faces per square