 |
CLIP Score: 24.94
from AIDL import *
def fish(
body_length: float = 6 * inches,
body_height: float = 3 * inches,
eye_radius: float = 0.2 * inches,
fin_height: float = 1 * inch,
tail_width: float = 1.5 * inches
):
"""
Model a simple fish with a body, eye, and three fins.
"""
# Define the root structure for the fish
fish = Solid()
# Body of the Fish
body = Solid()
fish.body = body
body.ellipse = Circle((0, 0), body_length / 2) # Using a circle for simplicity
# Eye of the Fish
eye = Hole(shift=(-body_length / 4, body_height / 4))
fish.eye = eye
eye.pupil = Circle((0, 0), eye_radius)
# Top fin (Dorsal)
dorsal_fin = Solid(shift=(0, body_height / 2))
fish.dorsal_fin = dorsal_fin
dorsal_fin.shape = Triangle((0, 0), body_length / 3, fin_height)
# Bottom fin (Pelvic)
pelvic_fin = Solid(shift=(0, -body_height / 2))
fish.pelvic_fin = pelvic_fin
pelvic_fin.shape = Triangle((0, 0), body_length / 3, fin_height)
# Tail fin (Caudal)
tail_fin = Solid(shift=(body_length / 2, 0))
fish.tail_fin = tail_fin
tail_fin.left_side = Triangle((-tail_width, 0), tail_width, fin_height)
tail_fin.right_side = Triangle((-tail_width, 0), tail_width, -fin_height)
# Optional Detail - Scales as small circles (Drawings)
detail = Drawing()
fish.detail = detail
number_of_scales = 10
scale_positions = [(i * body_length / number_of_scales - body_length / 2, 0) for i in range(number_of_scales)]
detail.scales = [Circle(pos, eye_radius / 2) for pos in scale_positions]
return fish
with AIDL_2D:
model = fish()
print(model.Solve())
model.Render()
|
Please write an AIDL program to generate a fish
Sure! Let's design a fish using the AIDL language. We'll start with a rough plan for the structure of our fish:
1. **Body**: The main oval shape of the fish.
2. **Eye**: A circle representing the eye.
3. **Fins**: Various fins including top fin (dorsal), bottom fin (pelvic/anal), and tail fin (caudal).
4. **Details**: Optional engravings for the fish's scales and gills.
Let's proceed step-by-step. We can refine and add more details as needed. Here's a preliminary AIDL implementation:
```python
from AIDL import *
def fish(
body_length: float = 6 * inches,
body_height: float = 3 * inches,
eye_radius: float = 0.2 * inches,
fin_height: float = 1 * inch,
tail_width: float = 1.5 * inches
):
"""
Model a simple fish with a body, eye, and three fins.
"""
# Define the root structure for the fish
fish = Solid()
# Body of the Fish
body = Solid()
fish.body = body
body.ellipse = Circle((0, 0), body_length / 2) # Using a circle for simplicity
# Eye of the Fish
eye = Hole(shift=(-body_length / 4, body_height / 4))
fish.eye = eye
eye.pupil = Circle((0, 0), eye_radius)
# Top fin (Dorsal)
dorsal_fin = Solid(shift=(0, body_height / 2))
fish.dorsal_fin = dorsal_fin
dorsal_fin.shape = Triangle((0, 0), body_length / 3, fin_height)
# Bottom fin (Pelvic)
pelvic_fin = Solid(shift=(0, -body_height / 2))
fish.pelvic_fin = pelvic_fin
pelvic_fin.shape = Triangle((0, 0), body_length / 3, fin_height)
# Tail fin (Caudal)
tail_fin = Solid(shift=(body_length / 2, 0))
fish.tail_fin = tail_fin
tail_fin.left_side = Triangle((-tail_width, 0), tail_width, fin_height)
tail_fin.right_side = Triangle((-tail_width, 0), tail_width, -fin_height)
# Optional Detail - Scales as small circles (Drawings)
detail = Drawing()
fish.detail = detail
number_of_scales = 10
scale_positions = [(i * body_length / number_of_scales - body_length / 2, 0) for i in range(number_of_scales)]
detail.scales = [Circle(pos, eye_radius / 2) for pos in scale_positions]
return fish
with AIDL_2D:
model = fish()
print(model.Solve())
model.Render()
```
This script defines a simple fish with a body, eye, three fins, and optional scales. We:
- Created a main `fish` structure and added a body.
- Defined a `Circle` for the body.
- Added an eye as a `Hole`.
- Added three fins (dorsal, pelvic, tail) using `Triangle` shapes.
- Added optional scale details using a list of `Circle` drawings.
Let me know if you want to add or modify any specific part of the fish, such as different shapes for fins or additional details!
|