2023年8月14日月曜日

20230814 半径√2の円周




import bpy

import math


# zion_radius の値

#zion_radius = (3**(0.5))/2

#zion_radius = (2**(0.5))/2

zion_radius = (2**(0.5))


# 初期設定

torus_major_radius = zion_radius  # トーラスのメジャー半径

torus_minor_radius = 0.01  # トーラスのマイナー半径

sphere_radius = 0.07  # 球体の半径

animation_duration = 20  # アニメーションの時間(秒)

frame_rate = bpy.context.scene.render.fps

clockwise = True  # 時計回り: False, 反時計回り: True


# トーラスを作成

bpy.ops.mesh.primitive_torus_add(align='WORLD', major_radius=torus_major_radius, minor_radius=torus_minor_radius, location=(0, 0, 0))  # 描画開始位置

torus = bpy.context.active_object


# 球体を作成

bpy.ops.mesh.primitive_uv_sphere_add(radius=sphere_radius, location=(0, zion_radius, 0))  # 描画開始位置

sphere = bpy.context.active_object


# 球体をトーラスにリンク設定

sphere.parent = torus


# トーラスの名前を設定

torus_name = f"Torus_{zion_radius:.2f}_radius"

torus.name = torus_name


# ゴール時間を設定

goal_frame = animation_duration * frame_rate


# アニメーションを設定

for frame in range(1, goal_frame + 1):

    bpy.context.scene.frame_set(frame)

    

    # トーラスを回転させる

    angle = 2 * math.pi * (frame / (animation_duration * frame_rate))

    if clockwise:

        angle = -angle

    torus.rotation_euler.z = angle

    torus.keyframe_insert(data_path="rotation_euler", frame=frame)


# アウトライナで全てのオブジェクトを選択解除

bpy.ops.object.select_all(action='DESELECT')


# endを530フレームに設定

bpy.context.scene.frame_end = 530






 

基本系 配布 001 単位円 torus と xyz軸 円柱

https://drive.google.com/file/d/1adh0pC0n5MUfaPnsQcab8CnTvHu_JqLg/view?usp=drive_link

 

基本系 配布 002 単位2長さ balls

https://drive.google.com/file/d/1vyg5oFWmw_TK8nwp5TmVSfLH94I6rTaY/view?usp=drive_link

 

基本系 配布 003 単位2長さ balls 光時計セット 

https://drive.google.com/file/d/1u2Rn_nVBcewe39Vokua9C5n25cdivyyL/view?usp=drive_link

 

blender 基本系 配布 カタログ 2023 - zionad_mainのブログ https://mokuji000zionad.hatenablog.com/entry/2023/07/31/095208 






以下 ChatGPT との対話 修正記録 と メモ・ノート


ああああああああああああああああああああああああああああああああああああああああああああ