add yapf style and apply yapf to format all Python files

This recreates pull request #2192
This commit is contained in:
Erwin Coumans
2019-04-27 07:31:15 -07:00
parent c591735042
commit ef9570c315
347 changed files with 70304 additions and 22752 deletions

View File

@@ -2,58 +2,57 @@ import math
NUM_VERTS_X = 30
NUM_VERTS_Y = 30
totalVerts = NUM_VERTS_X*NUM_VERTS_Y
totalTriangles = 2*(NUM_VERTS_X-1)*(NUM_VERTS_Y-1)
totalVerts = NUM_VERTS_X * NUM_VERTS_Y
totalTriangles = 2 * (NUM_VERTS_X - 1) * (NUM_VERTS_Y - 1)
offset = -50.0
TRIANGLE_SIZE = 1.
waveheight=0.1
gGroundVertices = [None] * totalVerts*3
gGroundIndices = [None] * totalTriangles*3
waveheight = 0.1
gGroundVertices = [None] * totalVerts * 3
gGroundIndices = [None] * totalTriangles * 3
i=0
i = 0
for i in range (NUM_VERTS_X):
for j in range (NUM_VERTS_Y):
gGroundVertices[(i+j*NUM_VERTS_X)*3+0] = (i-NUM_VERTS_X*0.5)*TRIANGLE_SIZE
gGroundVertices[(i+j*NUM_VERTS_X)*3+1] = (j-NUM_VERTS_Y*0.5)*TRIANGLE_SIZE
gGroundVertices[(i+j*NUM_VERTS_X)*3+2] = waveheight*math.sin(float(i))*math.cos(float(j)+offset)
index=0
for i in range (NUM_VERTS_X-1):
for j in range (NUM_VERTS_Y-1):
gGroundIndices[index] = 1+j*NUM_VERTS_X+i
index+=1
gGroundIndices[index] = 1+j*NUM_VERTS_X+i+1
index+=1
gGroundIndices[index] = 1+(j+1)*NUM_VERTS_X+i+1
index+=1
gGroundIndices[index] = 1+j*NUM_VERTS_X+i
index+=1
gGroundIndices[index] = 1+(j+1)*NUM_VERTS_X+i+1
index+=1
gGroundIndices[index] = 1+(j+1)*NUM_VERTS_X+i
index+=1
for i in range(NUM_VERTS_X):
for j in range(NUM_VERTS_Y):
gGroundVertices[(i + j * NUM_VERTS_X) * 3 + 0] = (i - NUM_VERTS_X * 0.5) * TRIANGLE_SIZE
gGroundVertices[(i + j * NUM_VERTS_X) * 3 + 1] = (j - NUM_VERTS_Y * 0.5) * TRIANGLE_SIZE
gGroundVertices[(i + j * NUM_VERTS_X) * 3 +
2] = waveheight * math.sin(float(i)) * math.cos(float(j) + offset)
index = 0
for i in range(NUM_VERTS_X - 1):
for j in range(NUM_VERTS_Y - 1):
gGroundIndices[index] = 1 + j * NUM_VERTS_X + i
index += 1
gGroundIndices[index] = 1 + j * NUM_VERTS_X + i + 1
index += 1
gGroundIndices[index] = 1 + (j + 1) * NUM_VERTS_X + i + 1
index += 1
gGroundIndices[index] = 1 + j * NUM_VERTS_X + i
index += 1
gGroundIndices[index] = 1 + (j + 1) * NUM_VERTS_X + i + 1
index += 1
gGroundIndices[index] = 1 + (j + 1) * NUM_VERTS_X + i
index += 1
#print(gGroundVertices)
#print(gGroundIndices)
print("o Terrain")
for i in range (totalVerts):
print("v "),
print(gGroundVertices[i*3+0]),
print(" "),
print(gGroundVertices[i*3+1]),
print(" "),
print(gGroundVertices[i*3+2])
for i in range (totalTriangles):
print("f "),
print(gGroundIndices[i*3+0]),
print(" "),
print(gGroundIndices[i*3+1]),
print(" "),
print(gGroundIndices[i*3+2]),
print(" ")
for i in range(totalVerts):
print("v "),
print(gGroundVertices[i * 3 + 0]),
print(" "),
print(gGroundVertices[i * 3 + 1]),
print(" "),
print(gGroundVertices[i * 3 + 2])
for i in range(totalTriangles):
print("f "),
print(gGroundIndices[i * 3 + 0]),
print(" "),
print(gGroundIndices[i * 3 + 1]),
print(" "),
print(gGroundIndices[i * 3 + 2]),
print(" ")