2023年8月18日金曜日

20230818 ミンコフスキー時空図









BLENDER PYTHON


トーラスを作る

メジャー半径1

マイナー半径 0.01

中心 0,0,ー1

中心 0,0,0

中心 0,0,1



名前は 位置を使って 小数点2桁まで


import bpy

import math


# トーラスのパラメータ

major_radius = 1.0

minor_radius = 0.01

positions = [(0, 0, -1), (0, 0, 0), (0, 0, 1)]


# トーラスを生成する関数

def create_torus(name, major_radius, minor_radius, position):

    bpy.ops.mesh.primitive_torus_add(

        align='WORLD',

        location=position,

        rotation=(0, 0, 0),

        major_radius=major_radius,

        minor_radius=minor_radius

    )

    torus = bpy.context.active_object

    torus.name = name


# 位置情報から名前を生成する関数

def generate_name(position):

    return f"Torus_{position[0]:.2f}_{position[1]:.2f}_{position[2]:.2f}"


# トーラスを生成

for pos in positions:

    torus_name = generate_name(pos)

    create_torus(torus_name, major_radius, minor_radius, pos)




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 





2023年8月12日土曜日

20230813 トーラス円周 細いの 名前付き 小数点 2桁









import bpy

import math


# zion_radius の値

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

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



# 初期設定

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 





20230813 正方形




import bpy


# 正方形の1辺の長さ

side_length = 2.0


# 正方形の中心座標

center = (0, 0, 0)


# 正方形を作成

bpy.ops.mesh.primitive_plane_add(

    size=side_length,

    enter_editmode=False,

    align='WORLD',

    location=center,

    scale=(1, 1, 1)

)










 

基本系 配布 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 





20230813 トーラス円周



blender python


トーラスを作る

中心 000

torus_major_radius = 1.0

torus_minor_radius = 0.01


半径 1と

半径 √3/2




import bpy

import math


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


# 初期設定

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


# ゴール時間を設定

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





import bpy

import math


zion_radius = 1


# 初期設定

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


# ゴール時間を設定

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



 

 

#  コレクションを作る 重複の場合 作らない

 

import bpy

 

# List of collection names

collection_names = [ 

"(√3)/2 rail",

 "(√2)/2 rail",

"(1)rail",

"(0)rail",

"細い Torus 円周",

"abcdefg",

"abcdefg"

 

]

 

# Function to create a new collection if it doesn't exist

def create_collection_if_not_exists(name):

    if name not in bpy.data.collections:

        collection = bpy.data.collections.new(name)

        bpy.context.scene.collection.children.link(collection)

 

# Create collections

for name in collection_names:

    create_collection_if_not_exists(name)

 

 

 


















 







 

 




 

基本系 配布 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 





20230812   立方体 11個を作る rail 用






blender python 



立方体 11個を 作る

立方体 大きさ 1辺 0.04



立方体 中心を

(-1,1,0)から

(1,1,0)に 等間隔に配置



import bpy

import math


# 立方体の数と大きさ

cube_count = 11

cube_size = 0.04


# 立方体の中心の配置範囲

start_x, start_y, start_z = -1, 1, 0

end_x, end_y, end_z = 1, 1, 0


# 間隔の計算

spacing = (end_x - start_x) / (cube_count - 1)


# 立方体を作成する関数

def create_cube_at_position(position):

    bpy.ops.mesh.primitive_cube_add(size=cube_size, location=position)

    cube = bpy.context.active_object

    return cube


# 立方体を等間隔に配置

for i in range(cube_count):

    x = start_x + i * spacing

    y = start_y

    z = start_z

    

    position = (x, y, z)

    create_cube_at_position(position)







import bpy

import math


# 立方体の数と大きさ

cube_count = 11

cube_size = 0.04


# 立方体の中心の配置範囲

start_x, start_z = -1, 0

end_x, end_z = 1, 0


# y成分を固定

y = math.sqrt(2) / 2


# 間隔の計算

spacing = (end_x - start_x) / (cube_count - 1)


# 立方体を作成する関数

def create_cube_at_position(position):

    bpy.ops.mesh.primitive_cube_add(size=cube_size, location=position)

    cube = bpy.context.active_object

    return cube


# 立方体を等間隔に配置

for i in range(cube_count):

    x = start_x + i * spacing

    z = start_z

    

    position = (x, y, z)

    create_cube_at_position(position)




import bpy

import math


# 立方体の数と大きさ

cube_count = 11

cube_size = 0.04


# 立方体の中心の配置範囲

start_x, start_z = -1, 0

end_x, end_z = 1, 0


# y成分を固定

y = math.sqrt(3) / 2


# 間隔の計算

spacing = (end_x - start_x) / (cube_count - 1)


# 立方体を作成する関数

def create_cube_at_position(position):

    bpy.ops.mesh.primitive_cube_add(size=cube_size, location=position)

    cube = bpy.context.active_object

    return cube


# 立方体を等間隔に配置

for i in range(cube_count):

    x = start_x + i * spacing

    z = start_z

    

    position = (x, y, z)

    create_cube_at_position(position)







import bpy

import math


# 立方体の数と大きさ

cube_count = 11

cube_size = 0.04


# 立方体の中心の配置範囲

start_x, start_z = -1, 0

end_x, end_z = 1, 0


# y成分を固定

y = 0


# 間隔の計算

spacing = (end_x - start_x) / (cube_count - 1)


# 立方体を作成する関数

def create_cube_at_position(position):

    bpy.ops.mesh.primitive_cube_add(size=cube_size, location=position)

    cube = bpy.context.active_object

    return cube


# 立方体を等間隔に配置

for i in range(cube_count):

    x = start_x + i * spacing

    z = start_z

    

    position = (x, y, z)

    create_cube_at_position(position)











 

基本系 配布 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 





2023年8月10日木曜日

20230811 円周中心の球体







blender python


球体を作る

半径0.1

中心000


名前 球体(x,y,z)





bing


import bpy


# Set the radius and location of the sphere

radius = 0.1

location = (0, 0, 0)


# Create a new mesh with the given radius

mesh = bpy.data.meshes.new("Sphere")

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

bpy.ops.mesh.primitive_uv_sphere_add(radius=radius, location=location)


# Set the name of the sphere object

sphere = bpy.context.active_object

sphere.name = "Sphere({},{},{})".format(*location)




import bpy


# 球体の半径と中心座標を設定

radius = 0.1

center = (0, 0, 0)


# 球体を作成

bpy.ops.mesh.primitive_uv_sphere_add(radius=radius, location=center)


# 球体のオブジェクトを取得

sphere = bpy.context.active_object


# 名前を設定

sphere.name = "球体({}, {}, {})".format(center[0], center[1], center[2])






 

基本系 配布 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