diff --git a/optical_system.blend b/optical_system.blend index 7cf2e89..a650c89 100644 Binary files a/optical_system.blend and b/optical_system.blend differ diff --git a/optical_system.blend1 b/optical_system.blend1 index 15a6dd7..75541b4 100644 Binary files a/optical_system.blend1 and b/optical_system.blend1 differ diff --git a/optical_system.glb b/optical_system.glb index ae07fcd..7e1f5b9 100644 Binary files a/optical_system.glb and b/optical_system.glb differ diff --git a/optical_system_render.png b/optical_system_render.png index 010325e..8b801f5 100644 Binary files a/optical_system_render.png and b/optical_system_render.png differ diff --git a/toModel.py b/toModel.py index c3ab4e6..827f38d 100644 --- a/toModel.py +++ b/toModel.py @@ -95,7 +95,7 @@ nothing_mat = create_nothing_material() emissive_mat = create_emissive_material() # 创建更精确的抛物面 -def create_parabolic_surface(face_f, size=2.0, resolution=32): +def create_parabolic_surface(face_f, size=1.0, resolution=32): bm = bmesh.new() # 创建抛物面网格 @@ -135,7 +135,7 @@ def create_parabolic_surface(face_f, size=2.0, resolution=32): return obj # 创建双曲面 -def create_hyperbolic_surface(face_f, face_g, size=2.0, resolution=32): +def create_hyperbolic_surface(face_f, face_g, size=1.0, resolution=32): bm = bmesh.new() # 创建双曲面网格 @@ -197,28 +197,36 @@ def create_geometry(obj_data): try: if face_geom == "plane": - bpy.ops.mesh.primitive_plane_add(size=2) + bpy.ops.mesh.primitive_plane_add(size=1) # 减小平面尺寸 mesh = bpy.context.active_object + elif face_geom == "circle": + # 创建圆形平面 + bpy.ops.mesh.primitive_circle_add(vertices=32, radius=0.5) + mesh = bpy.context.active_object + # 填充圆形 + bpy.ops.object.mode_set(mode='EDIT') + bpy.ops.mesh.edge_face_add() + bpy.ops.object.mode_set(mode='OBJECT') elif face_geom == "parabola": if face_f < 1e9 and face_f > 0.1: # 使用精确抛物面 mesh = create_parabolic_surface(face_f) else: # 使用简化圆锥 - bpy.ops.mesh.primitive_cone_add(vertices=32, radius1=1.5, radius2=0.1, depth=2.0) + bpy.ops.mesh.primitive_cone_add(vertices=32, radius1=0.75, radius2=0.05, depth=1.0) mesh = bpy.context.active_object elif face_geom == "hyperbola": if abs(face_f) > 0.1 and abs(face_g) > 0.1: # 使用精确双曲面 mesh = create_hyperbolic_surface(face_f, face_g) else: # 使用简化环面 - bpy.ops.mesh.primitive_torus_add(major_radius=1.0, minor_radius=0.3) + bpy.ops.mesh.primitive_torus_add(major_radius=0.5, minor_radius=0.15) mesh = bpy.context.active_object else: # 默认立方体 - bpy.ops.mesh.primitive_cube_add(size=1.0) + bpy.ops.mesh.primitive_cube_add(size=0.5) mesh = bpy.context.active_object except Exception as e: print(f"创建几何体时出错: {e}") # 备用:创建简单立方体 - bpy.ops.mesh.primitive_cube_add(size=0.5) + bpy.ops.mesh.primitive_cube_add(size=0.25) mesh = bpy.context.active_object # 设置对象属性