Computes the position of the object on the cable taking into account the angle determined by the counterweight and the dimensions of the hanging system.
By default:
- the object is supposed to be suspended exactly in the middle of the cable
- the object is on considered the ground for all values of the angle
:angle: angle that the cable makes with the horizon
:x_origin: x coordinate of the bottom of the left pole (origin of the coordinate system)
:y_origin: y coordinate of the bottom of the left pole (origin of the coordinate system)
:distance: horizontal distance between the two poles
:height: height of the poles (same height for both)
:returns: coordinates of the point at which the object are hanged
"""
# the jean is midway between the poles
x_object=x_origin+0.5*distance
# default y value: the jean is on the ground
y_object=y_origin
# we check that the angle is comprised between horizontal (greater than 0) and vertical (smaller than pi/2)
ifangle>0andangle<(np.pi/2):
# we compute the delta between the horizon and the point given by the angle
delta=(0.5*distance*np.tan(angle))
# we check that the delta is smaller than the height of the poles (otherwise it just means the jean is on the ground)
ifdelta<=height:
y_object=y_origin+height-delta
return[x_object,y_object]
classSuspendedObjectsLab:
"""
This class embeds all the necessary code to create a virtual lab to study the static equilibrium of an object suspended on a clothesline with a counterweight.
Initiates and displays the virtual lab on suspended objects.
:m_object: mass of the suspended object
:distance: horizontal distance between the two poles
:height: height of the poles (same height for both)
:x_origin: x coordinate of the bottom of the left pole (origin of the coordinate system)
:y_origin: y coordinate of the bottom of the left pole (origin of the coordinate system)
:get_angle_from_masses: function to compute the angle that the cable makes with the horizon, as a function of the respective masses of the object and the counterweight -- angle(m_object, m_counterweight)
:get_object_coordinates: function to compute the coordinates of the point at which the object is suspended on the cable -- coord(angle, x_origin, y_origin, distance, height)
'''
###--- Parameters of the situation
self.m_object=m_object# mass of the wet object, in kg
self.distance=distance# distance between the poles, in m
self.height=height# height of the poles, in m
self.x_origin=x_origin# x coordinate of point of origin of the figure = x position of the left pole, in m
self.y_origin=y_origin# y coordinate of point of origin of the figure = y position of the lower point (ground), in m