 |
CLIP Score: 26.22
from AIDL import *
def vintage_camera(
body_width: float = 4 * inches,
body_height: float = 3 * inches,
lens_radius: float = 1 * inch,
viewfinder_width: float = 1 * inch,
viewfinder_height: float = 0.75 * inch
):
"""
Model a vintage camera with a rectangular body, circular lens, and a smaller rectangular viewfinder.
Optional engraving details are added as drawing elements.
"""
camera = Solid() # Root structure for the camera
# Define the camera body as a rectangle
camera.body = Rectangle((0, 0), body_width, body_height)
# Define the lens as a circle centered on the camera body
camera.lens = Solid(shift=(0, body_height / 4))
camera.lens.circle = Circle((0, 0), lens_radius)
# Define the viewfinder as a rectangle at the top of the camera body
camera.viewfinder = Solid(shift=(0, body_height / 2 - viewfinder_height / 2))
camera.viewfinder.rectangle = Rectangle((0, 0), viewfinder_width, viewfinder_height)
# Optional engraving details (e.g., horizontal lines)
camera.engravings = Drawing()
num_lines = 5
line_spacing = body_height / (num_lines + 1)
camera.engravings.horizontal_lines = [Line((-body_width / 2, body_height / 2 - (i + 1) * line_spacing),
(body_width / 2, body_height / 2 - (i + 1) * line_spacing))
for i in range(num_lines)]
return camera
with AIDL_2D:
model = vintage_camera()
print(model.Solve())
model.Render()
|
Please write an AIDL program to generate a vintage camera
A vintage camera has several distinctive features such as a body, lens, viewfinder, and possibly some engraving details. Let's start by defining the components we'll need:
1. **Body**: The main rectangular part of the camera.
2. **Lens**: A circular piece often protruding from the body.
3. **Viewfinder**: A smaller rectangle, often at the top of the body.
4. **Engraving Details**: Optional artistic engravings on the body for decoration.
Here's how we can structure the program:
1. Define the main body as a solid rectangle.
2. Define the lens as a solid circle.
3. Define the viewfinder as a solid rectangle.
4. Add optional drawing nodes for engraving details.
Next, I'll write the AIDL program to model this vintage camera.
```python
from AIDL import *
def vintage_camera(
body_width: float = 4 * inches,
body_height: float = 3 * inches,
lens_radius: float = 1 * inch,
viewfinder_width: float = 1 * inch,
viewfinder_height: float = 0.75 * inch
):
"""
Model a vintage camera with a rectangular body, circular lens, and a smaller rectangular viewfinder.
Optional engraving details are added as drawing elements.
"""
camera = Solid() # Root structure for the camera
# Define the camera body as a rectangle
camera.body = Rectangle((0, 0), body_width, body_height)
# Define the lens as a circle centered on the camera body
camera.lens = Solid(shift=(0, body_height / 4))
camera.lens.circle = Circle((0, 0), lens_radius)
# Define the viewfinder as a rectangle at the top of the camera body
camera.viewfinder = Solid(shift=(0, body_height / 2 - viewfinder_height / 2))
camera.viewfinder.rectangle = Rectangle((0, 0), viewfinder_width, viewfinder_height)
# Optional engraving details (e.g., horizontal lines)
camera.engravings = Drawing()
num_lines = 5
line_spacing = body_height / (num_lines + 1)
camera.engravings.horizontal_lines = [Line((-body_width / 2, body_height / 2 - (i + 1) * line_spacing),
(body_width / 2, body_height / 2 - (i + 1) * line_spacing))
for i in range(num_lines)]
return camera
with AIDL_2D:
model = vintage_camera()
print(model.Solve())
model.Render()
```
This program defines a vintage camera model with a rectangular body, a circular lens centered vertically on the body, and a smaller rectangular viewfinder at the top. Optional engraving details are added as horizontal lines on the body.
Feel free to adjust the dimensions and details to better match your specific vintage camera design. If you have any more specific features you'd like to include, let me know, and we can refine the model further!
|