just adding a circular array feature for Blender for Python addon.
I have:
- The blue circle and it's center (c1)
- a variable number of items in the array (count)
- The center for the array (CF).
- The normal of the blue circle
Are there some good ideas how to calculate c2..c4 in 3d space?
With this code it kind of works:
Almost :-) With this code, the centers of the array are not build around the CF:
def create_circle_array(self, count: int):
self._array.clear()
CF = get_face_center(self._hit_face, self._hit_obj)
# Just to test if CF is set correctly.
bpy.context.scene.cursor.location = CF
# self._center_3d is center of circle c1
v1 = (self._center_3d - CF)
r = v1.length # Radius
count = int(count + 1)
v1.normalize()
v2 = self._normal.cross(v1)
v1 = Vector(v1)
v2 = Vector(v2)
verts = []
t = 0
offset = 0 # Increase this to offset (in radians) the points along the circle perimeter
while t < 2 * pi + offset:
verts.append(CF + r * cos(t) * v1 + r * sin(t) * v2)
t += 2 * pi / count
But the new centers are not build around CF: