Mesh: remove trailing whitespace
This commit is contained in:
@@ -29,11 +29,11 @@ def Ellipsoid (lenX, lenY, count):
|
||||
i = 0.0
|
||||
while (i < math.pi + step / 10.0):
|
||||
x = math.cos(i) * lenX
|
||||
y = math.sin(i) * lenY
|
||||
y = math.sin(i) * lenY
|
||||
polyline.append([x, y])
|
||||
i = i + step
|
||||
|
||||
return RotationBody(polyline, count)
|
||||
return RotationBody(polyline, count)
|
||||
|
||||
def Cylinder (radius, len, closed, edgelen, count):
|
||||
return Cone(radius, radius, len, closed, edgelen, count)
|
||||
@@ -51,7 +51,7 @@ def Cone (radius1, radius2, len, closed, edgelen, count):
|
||||
polyline.append([len, i])
|
||||
i = i + step
|
||||
|
||||
ct = math.ceil(len / edgelen)
|
||||
ct = math.ceil(len / edgelen)
|
||||
step = len / ct
|
||||
rstep = (radius1 - radius2) / ct
|
||||
i = len;
|
||||
@@ -73,12 +73,12 @@ def Cone (radius1, radius2, len, closed, edgelen, count):
|
||||
polyline.append([0.0, i])
|
||||
i = i - step
|
||||
polyline.append([0.0, 0.0])
|
||||
|
||||
|
||||
return RotationBody(polyline, count)
|
||||
|
||||
def Toroid (radius1, radius2, count):
|
||||
polyline = []
|
||||
|
||||
|
||||
step = math.pi * 2.0 / count
|
||||
i = -math.pi
|
||||
while (i < math.pi + step / 10.0):
|
||||
@@ -88,7 +88,7 @@ def Toroid (radius1, radius2, count):
|
||||
i = i + step
|
||||
|
||||
return RotationBody(polyline, count)
|
||||
|
||||
|
||||
|
||||
def RotationBody (polyline, count):
|
||||
"""Build a rotation body from a given (closed) polyline, rotation axis is the X-Axis.
|
||||
@@ -105,7 +105,7 @@ def RotationBody (polyline, count):
|
||||
for j in range(0, len(polyline) - 1):
|
||||
v1 = polyline[j]
|
||||
v2 = polyline[j+1]
|
||||
|
||||
|
||||
x1 = v1[0]
|
||||
y1 = v1[1] * math.cos(i)
|
||||
z1 = v1[1] * math.sin(i)
|
||||
@@ -119,7 +119,7 @@ def RotationBody (polyline, count):
|
||||
y4 = v2[1] * math.cos(li)
|
||||
z4 = v2[1] * math.sin(li)
|
||||
|
||||
if (v1[1] != 0.0):
|
||||
if (v1[1] != 0.0):
|
||||
facets.append([x1, y1, z1])
|
||||
facets.append([x2, y2, z2])
|
||||
facets.append([x3, y3, z3])
|
||||
@@ -128,18 +128,18 @@ def RotationBody (polyline, count):
|
||||
facets.append([x2, y2, z2])
|
||||
facets.append([x4, y4, z4])
|
||||
facets.append([x3, y3, z3])
|
||||
|
||||
|
||||
i = i + step
|
||||
|
||||
|
||||
return facets;
|
||||
|
||||
def Cube (lenX, lenY, lenZ):
|
||||
hx = lenX / 2.0
|
||||
hy = lenY / 2.0
|
||||
hz = lenZ / 2.0
|
||||
|
||||
|
||||
facets = []
|
||||
|
||||
|
||||
facets.append([-hx, -hy, -hz])
|
||||
facets.append([hx, -hy, -hz])
|
||||
facets.append([hx, -hy, hz])
|
||||
@@ -187,7 +187,7 @@ def Cube (lenX, lenY, lenZ):
|
||||
facets.append([-hx, -hy, hz])
|
||||
facets.append([hx, -hy, hz])
|
||||
facets.append([hx, hy, hz])
|
||||
|
||||
|
||||
return facets
|
||||
|
||||
def FineCube (lenX, lenY, lenZ, edgelen):
|
||||
@@ -200,7 +200,7 @@ def FineCube (lenX, lenY, lenZ, edgelen):
|
||||
dy = lenY / cy
|
||||
cz = int(max(lenZ / edgelen,1))
|
||||
dz = lenZ / cz
|
||||
|
||||
|
||||
facets = []
|
||||
|
||||
# z
|
||||
@@ -264,7 +264,6 @@ def FineCube (lenX, lenY, lenZ, edgelen):
|
||||
|
||||
def main ():
|
||||
Cylinder (10.0, 20.0, 1, 10, 10)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user