| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- !!omap
- - name: car
- - parts:
- - name: head
- shapes:
- libraries: ['from math import tan, radians, sin, cos', 'from pysketcher import *']
- - name: constants
- shapes:
- R: 1.0 # radius of wheel
- L: 4.0 # distance between wheels
- H: 2.0 # height of vehicle body
- w_1: 5.0 # position of front wheel
- - name: frame
- shapes:
- xmax: w_1 + 2*L + 3*R
- setframe:
- action: drawing_tool.set_coordinate_system(xmin=0, xmax=xmax,
- ymin=-1, ymax=2*R + 3*H,
- axis=False)
- wheel1: |
- Composition({'wheel': Circle(center=(w_1, R), radius=R),
- 'cross': Composition({'cross1': Line((w_1,0),(w_1,2*R)),
- 'cross2': Line((w_1-R,R), (w_1+R,R))})})
- wheel2:
- formula: wheel1.copy()
- transform: translate((L,0))
- under: Rectangle(lower_left_corner=(w_1-2*R, 2*R),
- width=2*R + L + 2*R, height=H)
- over: Rectangle(lower_left_corner=(w_1, 2*R + H),
- width=2.5*R, height=1.25*H)
- wheels: |
- Composition({'wheel1': wheel1, 'wheel2': wheel2})
- body: |
- Composition({'under': under, 'over': over})
- vehicle: |
- Composition({'wheels': wheels, 'body': body})
- ground: Wall(x=[R, xmax], y=[0, 0], thickness=-0.3*R)
- car: |
- Composition({'vehicle': vehicle, 'ground': ground})
|