Skip to content

Commit 8f3a0ca

Browse files
author
John Einselen VF
committed
Fixed random rotation
Random boolean was accidentally inverted
1 parent cd71dd9 commit 8f3a0ca

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

VF_pointArray.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
bl_info = {
22
"name": "VF Point Array",
33
"author": "John Einselen - Vectorform LLC",
4-
"version": (1, 3),
4+
"version": (1, 3, 1),
55
"blender": (2, 90, 0),
66
"location": "Scene (edit mode) > VF Tools > Point Array",
77
"description": "Creates point arrays in cubic array, golden angle, and poisson disc sampling patterns",
@@ -82,7 +82,7 @@ def execute(self, context):
8282
v[pi] = 0.0 if i == 0.0 else i / count
8383
i += 1.0
8484
v[ps] = space*0.5
85-
v[pr] = Vector([0.0, 0.0, 0.0]) if rand_rot else Vector([uniform(-math.pi, math.pi), uniform(-math.pi, math.pi), uniform(-math.pi, math.pi)])
85+
v[pr] = Vector([0.0, 0.0, 0.0]) if not rand_rot else Vector([uniform(-math.pi, math.pi), uniform(-math.pi, math.pi), uniform(-math.pi, math.pi)])
8686
v[pu] = positionRelative
8787
v[pd] = positionRelative.length
8888

@@ -119,7 +119,7 @@ def execute(self, context):
119119
v = bm.verts.new((space * 0.8660254037844386467637231707529361834714026269051903140279034897, 0.0, 0.0)) # Magic value: sin(60°)
120120
v[pi] = 0
121121
v[ps] = space
122-
v[pr] = Vector([0.0, 0.0, 0.0]) if rand_rot else Vector([uniform(-math.pi, math.pi), uniform(-math.pi, math.pi), uniform(-math.pi, math.pi)])
122+
v[pr] = Vector([0.0, 0.0, 0.0]) if not rand_rot else Vector([uniform(-math.pi, math.pi), uniform(-math.pi, math.pi), uniform(-math.pi, math.pi)])
123123
count -= 1
124124

125125
for i in range(1, count+1): # The original code incorrectly set the starting vertex at 0...and while Fermat's Spiral can benefit from an extra point near the middle, the exact centre does not work
@@ -129,7 +129,7 @@ def execute(self, context):
129129
v = bm.verts.new((math.cos(theta) * r, math.sin(theta) * r, 0.0))
130130
v[pi] = i / count if bpy.context.scene.vf_point_array_settings.golden_fill else (0.0 if i == 1 else (i - 1.0) / (count - 1.0))
131131
v[ps] = space
132-
v[pr] = Vector([0.0, 0.0, 0.0]) if rand_rot else Vector([uniform(-math.pi, math.pi), uniform(-math.pi, math.pi), uniform(-math.pi, math.pi)])
132+
v[pr] = Vector([0.0, 0.0, 0.0]) if not rand_rot else Vector([uniform(-math.pi, math.pi), uniform(-math.pi, math.pi), uniform(-math.pi, math.pi)])
133133

134134
# Replace object with new mesh data
135135
bm.to_mesh(obj.data)
@@ -257,7 +257,7 @@ def execute(self, context):
257257
v[pi] = 0.0 if i == 0.0 else i / count
258258
i += 1.0
259259
v[ps] = p[3]
260-
v[pr] = Vector([0.0, 0.0, 0.0]) if rand_rot else Vector([uniform(-math.pi, math.pi), uniform(-math.pi, math.pi), uniform(-math.pi, math.pi)])
260+
v[pr] = Vector([0.0, 0.0, 0.0]) if not rand_rot else Vector([uniform(-math.pi, math.pi), uniform(-math.pi, math.pi), uniform(-math.pi, math.pi)])
261261
positionRelative = Vector([p[0] * relativeX, p[1] * relativeY, p[2] * relativeZ])
262262
v[pu] = positionRelative
263263
v[pd] = positionRelative.length

0 commit comments

Comments
 (0)