Box
# ---- box object --------------------------------------
##@dataclass
class Box:
# ---- init
def __init__(self,upper_left_x,upper_left_y,
lower_right_x,lower_right_y):
self.top = upper_left_y
self.right = lower_right_x
self.bottom = lower_right_y
self.left = upper_left_x
# ---- display string
def __str__(self):
return 'Box : ' +\
f'top={self.top}, ' +\
f'right={self.right}, ' +\
f'bottom={self.bottom}, ' +\
f'left={self.left}'
Example Problem and Considerations
Give the following problem:
Simulate the physics of a ball dropped from 20 feet onto a floor and
bouncing up and down vertically. The ball looses 0.05 percent of its
speed/energy every time it bounces. There is no loss from air
resistance. The ball has a radius of 1 foot.
what are some of the things you must consider?
-
The simulation takes place on the surface of the Earth?
- Show the floor. Show the ball. Fit them nicely within the
graphics window (height and width) along with any text.
- Scale the vertical drop in the graphics window.
(20 feet equals ? pixels.)
- Speed ? is ? pixels per second.
- Scale the speed? Slow the simulation so the user can see what is happening.
- User Interaction
- Does the user initiate the ball drop?
- Can the user reset the simulation?
- Can the user change the drop distance?
- Can the user change the gravity field?
Normal Vector and Other Math