Fix missing segment bug.

This commit is contained in:
jmsgrogan 2017-10-24 20:35:56 +01:00
parent f5f8a6640a
commit 9035f01f2d

View file

@ -38,7 +38,6 @@ def generate_pendant_shade(shape_parameters):
summed_offset = 0.0
for jdx in range(len(shape_parameters["division_offsets"])):
summed_offset += shape_parameters["division_offsets"][jdx]
print(summed_offset)
for idx in range(num_verts):
bm.verts.ensure_lookup_table()
@ -58,14 +57,10 @@ def generate_pendant_shade(shape_parameters):
summed_offset += shape_parameters["division_offsets"][jdx]
if frac >=prev_offset and frac <= summed_offset:
division_index = jdx
if division_index==0:
print(vert.co.z, frac)
current_offset = shape_parameters["division_offsets"][division_index]
division_type = shape_parameters["division_patterns"][division_index]
if division_index==0:
print(vert.co.z, frac, division_index)
division_radius = shape_parameters["fixture_radius"]
previous_offset = 0.0
previous_radius = division_radius
@ -76,30 +71,17 @@ def generate_pendant_shade(shape_parameters):
if previous_radius< shape_parameters["fixture_radius"]:
previous_radius = shape_parameters["fixture_radius"]
if division_radius<previous_radius:
division_radius = previous_radius
#print(division_radius, vert.co.z)
if division_type == "straight":
vert.co.x = division_radius*math.sin(theta)
vert.co.y = division_radius*math.cos(theta)
elif division_type == "square":
if division_type == "square":
mapped_rad = division_radius + (frac)**2
vert.co.x = mapped_rad*math.sin(theta)
vert.co.y = mapped_rad*math.cos(theta)
# elif division_type == "inv_square":
# mapped_rad = division_radius + 1.0/(0.01+frac**2)
# vert.co.x = mapped_rad*math.sin(theta)
# vert.co.y = mapped_rad*math.cos(theta)
elif division_type == "sine":
mapped_rad = division_radius + math.sin(math.pi/2.0*frac)
vert.co.x = mapped_rad*math.sin(theta)
vert.co.y = mapped_rad*math.cos(theta)
# elif division_type == "inv_sine":
# mapped_rad = division_radius + 1.0/math.sin(math.pi/2.0*frac)
# vert.co.x = mapped_rad*math.sin(theta)
# vert.co.y = mapped_rad*math.cos(theta)
elif division_type == "ramp":
mapped_rad = division_radius + frac
vert.co.x = mapped_rad*math.sin(theta)
@ -108,6 +90,9 @@ def generate_pendant_shade(shape_parameters):
mapped_rad = division_radius + frac
vert.co.x = mapped_rad*math.sin(theta)
vert.co.y = mapped_rad*math.cos(theta)
else: #straight
vert.co.x = division_radius*math.sin(theta)
vert.co.y = division_radius*math.cos(theta)
for face in bm.faces:
if UpOrDown(face.normal):