from mass3d import Mass3D
from link3d import Link3D
from circle import Circle

class MouseStructure:
    """
    Class which represents a fixed mass linked to a floating mass.  The idea is the floating mass
    will be moved around by some kind of pointer and interact with the other masses.
    """

    def __init__(self):
        self.mass = 0.0
        self.mass_size = 0.0
        self.link_rigidity = 0.0
        self.link_damping = 0.0
        self.collision_link_rigidity = 0.05
        self.collision_link_damping = 0.0
        self.mass_messages = []
        self.link_messages = []
    
    def get_mass_setup_messages(self):
        """Returns a list of all msd creation messages for masses"""
        
        return self.mass_messages

    def get_link_setup_messages(self):
        """Returns a list of all msd creation messages for links"""
        
        return self.link_messages

    def create_mouse_structure(self):
    	# Set up fixed mass
        fixed_mass = Mass3D()
        fixed_mass.id = "mouse-fixed-mass"
        fixed_mass.fixed = True
        fixed_mass.position = (0, 0, 0)
        self.mass_messages.append(fixed_mass.get_msd_setup_message())

		# Set up floating mass
#         floating_mass = Mass3D()
#         floating_mass.id = "mouse-floating-mass"
#         floating_mass.fixed = False
#         floating_mass.position = (0, self.mass_size, 0)
#         floating_mass.mass = self.mass
#         self.mass_messages.append(floating_mass.get_msd_setup_message())
        
        # Link masses together
#         link = Link3D()
#         link.id = "mouse-link"
#         link.mass1_id = fixed_mass.id
#         link.mass2_id = floating_mass.id
#         link.rigidity = self.link_rigidity
#         link.damping = self.link_damping
#         self.mass_messages.append(link.get_msd_setup_message())

        # Set up collision links so that mouse masses will collide with floating masses
        collision_link = Link3D()
        collision_link.id = "mouse-collision-link"
#         collision_link.mass1_id = "mouse-floating-mass" 
#         collision_link.mass2_id = "floating-mass"
        collision_link.rigidity = self.collision_link_rigidity
        collision_link.damping = self.collision_link_damping
        collision_link.distance_exponent = 1
        collision_link.min_length = 0
        collision_link.max_length = self.mass_size
        
#         self.mass_messages.append(collision_link.get_msd_setup_message())
        
        # Set up collision link for mouse fixed mass also...
        collision_link.mass1_id = "mouse-fixed-mass" 
        collision_link.mass2_id = "floating-mass"
        self.mass_messages.append(collision_link.get_msd_setup_message())