 |
CLIP Score: 27.32
from AIDL import *
def vintage_camera(
body_width: float = 5 * inches,
body_height: float = 3 * inches,
lens_diameter: float = 1.5 * inches,
viewfinder_size: float = 0.5 * inches,
shutter_button_diameter: float = 0.3 * inches,
film_advance_knob_diameter: float = 0.5 * inches):
"""
Model a vintage camera with a rectangular body, circular lens, viewfinder, shutter button, and film advance knob.
"""
# Create the main body structure
camera = Solid()
# Define the body geometry as a rounded rectangle with small corner radius
camera.body = RoundedRectangle((0, 0), body_width, body_height, corner_radius=0.2 * inches)
# Create the lens structure centered on the body
lens = Solid(shift=(0, -body_height / 4))
lens.circle = Circle((0, 0), lens_diameter / 2)
camera.lens = lens
# Create the viewfinder structure near the top left of the body
viewfinder = Solid(shift=(-body_width / 4, body_height / 4))
viewfinder.rect = Rectangle((0, 0), viewfinder_size, viewfinder_size)
camera.viewfinder = viewfinder
# Create the shutter button structure near the top right of the body
shutter_button = Solid(shift=(body_width / 3, body_height / 3))
shutter_button.circle = Circle((0, 0), shutter_button_diameter / 2)
camera.shutter_button = shutter_button
# Create the film advance knob structure near the top of the body, shifted slightly to the left
film_advance_knob = Solid(shift=(-body_width / 3, body_height / 3))
film_advance_knob.circle = Circle((0, 0), film_advance_knob_diameter / 2)
camera.film_advance_knob = film_advance_knob
return camera
with AIDL_2D:
model = vintage_camera()
print(model.Solve())
model.Render()
|
Please write an AIDL program to generate a vintage camera
Sure, I'll help you create a vintage camera model using AIDL. Let's break down the model into its main components and then build each component using the respective AIDL structures and geometry.
A vintage camera typically has the following main parts:
1. **Body** - The main rectangular part of the camera.
2. **Lens** - A circular shape protruding from the body.
3. **Viewfinder** - A small rectangle near the top.
4. **Shutter Button** - A small circle near the top of the body.
5. **Film Advance Knob** - A small circle near the side of the body.
Let's start by defining the `camera_body` function, which will be the root of our model. We will then add substructures for the lens, viewfinder, shutter button, and film advance knob.
Here's the complete AIDL program for generating a vintage camera:
```python
from AIDL import *
def vintage_camera(
body_width: float = 5 * inches,
body_height: float = 3 * inches,
lens_diameter: float = 1.5 * inches,
viewfinder_size: float = 0.5 * inches,
shutter_button_diameter: float = 0.3 * inches,
film_advance_knob_diameter: float = 0.5 * inches):
"""
Model a vintage camera with a rectangular body, circular lens, viewfinder, shutter button, and film advance knob.
"""
# Create the main body structure
camera = Solid()
# Define the body geometry as a rounded rectangle with small corner radius
camera.body = RoundedRectangle((0, 0), body_width, body_height, corner_radius=0.2 * inches)
# Create the lens structure centered on the body
lens = Solid(shift=(0, -body_height / 4))
lens.circle = Circle((0, 0), lens_diameter / 2)
camera.lens = lens
# Create the viewfinder structure near the top left of the body
viewfinder = Solid(shift=(-body_width / 4, body_height / 4))
viewfinder.rect = Rectangle((0, 0), viewfinder_size, viewfinder_size)
camera.viewfinder = viewfinder
# Create the shutter button structure near the top right of the body
shutter_button = Solid(shift=(body_width / 3, body_height / 3))
shutter_button.circle = Circle((0, 0), shutter_button_diameter / 2)
camera.shutter_button = shutter_button
# Create the film advance knob structure near the top of the body, shifted slightly to the left
film_advance_knob = Solid(shift=(-body_width / 3, body_height / 3))
film_advance_knob.circle = Circle((0, 0), film_advance_knob_diameter / 2)
camera.film_advance_knob = film_advance_knob
return camera
with AIDL_2D:
model = vintage_camera()
print(model.Solve())
model.Render()
```
### Explanation:
1. **Main Body**: The main body of the camera is modeled as a `RoundedRectangle` with a small corner radius to give it the vintage look.
2. **Lens**: The lens is modeled as a `Circle`, shifted downward from the center of the body.
3. **Viewfinder**: The viewfinder is modeled as a small `Rectangle` near the top left corner.
4. **Shutter Button**: The shutter button is modeled as a small `Circle` near the top right corner.
5. **Film Advance Knob**: The film advance knob is another small `Circle`, positioned near the top of the body but shifted slightly to the left of the center.
Feel free to adjust the parameters to refine the design according to your preference. Let me know if you need any modifications or further features added to the camera model!
|