def mutate(self):
     """Mutate the modifiers components"""
     if model_random.is_mutating():
         self.alpha1 = model_random.jitter_constrained(self.alpha1, self.constraint_alpha)
     if model_random.is_mutating():
         self.alpha2 = model_random.jitter_constrained(self.alpha2, self.constraint_alpha)
     self.center.mutate()
     self.direction.mutate()
Exemplo n.º 2
0
 def mutate(self):
     """Make small random changes to the layers components."""
     cpool = model_constraintpool.ConstraintPool.get_pool()
     order_constraint = cpool.get(self, ORDER_CONSTRAINT)
     self.order = model_random.jitter_constrained(self.order,
                                                  order_constraint)
     radius_constraint = cpool.get(self, RADIUS_CONSTRAINT)
     self.radius = model_random.jitter_constrained(self.radius,
                                                   radius_constraint)
 def mutate(self, radian, distance):
     """Make small random changes in radian and distance.
     post: (-1.0*math.pi) <= __return__[0] <= math.pi
     post: __return__[1] >= 0.0
     """
     cpool = model_constraintpool.ConstraintPool.get_pool()
     radian_constraint = cpool.get(self, RADIAN_CONSTRAINT)
     distance_constraint = cpool.get(self, DISTANCE_CONSTRAINT)
     radian = model_random.jitter_constrained(radian, radian_constraint)
     distance = model_random.jitter_constrained(distance,
                                                distance_constraint)
     return model_random.radian_limit(radian), math.fabs(distance)
 def mutate(self):
     """Make small random changes to the layers components."""
     cpool = model_constraintpool.ConstraintPool.get_pool()
     order_constraint = cpool.get(self, ORDER_CONSTRAINT)
     self.order = model_random.jitter_constrained(self.order,
                                                  order_constraint)
     radius_constraint = cpool.get(self, RADIUS_CONSTRAINT)
     self.radius = model_random.jitter_constrained(self.radius,
                                                   radius_constraint)
     scale_constraint = cpool.get(self, SCALE_CONSTRAINT)
     self.scale = model_random.jitter_constrained(self.scale,
                                                  scale_constraint)
     dim_out_constraint = cpool.get(self, DIM_OUT_CONSTRAINT)
     self.dim_out = model_random.jitter_constrained(self.dim_out,
                                                    dim_out_constraint)
Exemplo n.º 5
0
 def mutate(self):
     """Make small random changes to the layers components."""
     super(FilledSpline, self).mutate()
     cpool = model_constraintpool.ConstraintPool.get_pool()
     line_width_constraint = cpool.get(self, 'line_width')
     roundness_constraint = cpool.get(self, 'roundness')
     self.colorgamut.mutate()
     self.colorgamut.adjust_color(self.linecolor)
     self.colorgamut.adjust_color(self.fillcolor)
     self.line_width = model_random.jitter_constrained(
         self.line_width, line_width_constraint)
     self.roundness = model_random.jitter_constrained(
         self.roundness, roundness_constraint)
     self.center.mutate()
     self.sampler.mutate()
 def mutate(self):
     """Make random changes to the layers components."""
     cpool = model_constraintpool.ConstraintPool.get_pool()
     operator_constraint = cpool.get(self, OPERATOR_CONSTRAINT)
     if model_random.is_mutating():
         self.left_operator = random.choice(operator_constraint)
     if model_random.is_mutating():
         self.right_operator = random.choice(operator_constraint)
     alphablending_constraint = cpool.get(self, ALPHABLENDING_CONSTRAINT)
     self.left_alphablending = \
                 model_random.jitter_constrained(self.left_alphablending, \
                                                 alphablending_constraint)
     self.right_alphablending = \
                 model_random.jitter_constrained(self.right_alphablending, \
                                                 alphablending_constraint)
Exemplo n.º 7
0
 def mutate(self):
     """No member variables. Nothing to do."""
     if model_random.is_mutating():
         self.border_weight = model_random.jitter_constrained(
             self.border_weight, self.constraint_weight)
     if model_random.is_mutating():
         self.border_alpha = 1.0 if random.randint(0, 1) > 0 else 0.0
 def mutate(self):
     """Make small random changes to the layers components."""
     super(CircularArc, self).mutate()
     cpool = model_constraintpool.ConstraintPool.get_pool()
     self.linecolor.mutate()
     line_width_constraint = cpool.get(self, LINE_WIDTH__CONSTRAINT)
     self.line_width = model_random.jitter_constrained(
         self.line_width, line_width_constraint)
     size_constraint = cpool.get(self, SIZE_CONSTRAINT)
     self.size = model_random.jitter_constrained(self.size, size_constraint)
     start_angle_constraint = cpool.get(self, START_ANGLE_CONSTRAINT)
     self.start_angle = model_random.jitter_constrained(
         self.start_angle, start_angle_constraint)
     angle_constraint = cpool.get(self, ANGLE_CONSTRAINT)
     self.angle = model_random.jitter_constrained(self.angle,
                                                  angle_constraint)
     self.sampler.mutate()
Exemplo n.º 9
0
 def mutate(self):
     """Make small random changes to the layers components."""
     cpool = model_constraintpool.ConstraintPool.get_pool()
     order_constraint = cpool.get(self, ORDER_CONSTRAINT)
     self.order = model_random.jitter_discret_constrained(
         self.order, order_constraint)
     radius_constraint = cpool.get(self, RADIUS_CONSTRAINT)
     self.radius = model_random.jitter_constrained(self.radius,
                                                   radius_constraint)
     scatter_constraint = cpool.get(self, SCATTER_CONSTRAINT)
     self.scatter = model_random.jitter_constrained(self.scatter,
                                                    scatter_constraint)
     start_angle_constraint = cpool.get(self, START_ANGLE_CONSTRAINT)
     self.start_angle = model_random.jitter_constrained(
         self.start_angle, start_angle_constraint)
     line_width_constraint = cpool.get(self, LINE_WIDTH_CONSTRAINT)
     self.line_width = model_random.jitter_constrained(
         self.line_width, line_width_constraint)
 def mutate(self):
     """Mutate"""
     cpool = model_constraintpool.ConstraintPool.get_pool()
     x_center_constraint = cpool.get(self, X_CENTER_CONSTRAINT)
     self.x_center = model_random.jitter_constrained(self.x_center,
                                                     x_center_constraint)
     y_center_constraint = cpool.get(self, Y_CENTER_CONSTRAINT)
     self.y_center = model_random.jitter_constrained(self.y_center,
                                                     y_center_constraint)
     if model_random.is_mutating():
         steps_constraint = cpool.get(self, STEPS_CONSTRAINT)
         self.steps = model_random.jitter_discret_constrained(self.steps,
                                                         steps_constraint)
     turns_constraint = cpool.get(self, TURNS_CONSTRAINT)
     self.turns = model_random.jitter_constrained(self.turns,
                                                     turns_constraint)
     a_constraint = cpool.get(self, A_CONSTRAINT)
     self.a = model_random.jitter_constrained(self.a, a_constraint)
     b_constraint = cpool.get(self, B_CONSTRAINT)
     self.b = model_random.jitter_constrained(self.b, b_constraint)
Exemplo n.º 11
0
    def mutate(self):
        """Make small random changes to the layers components."""
        cpool = model_constraintpool.ConstraintPool.get_pool()
        if model_random.is_mutating():
            self._randomize_mapping(cpool)

        size_constraint = cpool.get(self, GLYPHFONTSIZE_CONSTRAINT)
        self.size = model_random.jitter_constrained(self.size, size_constraint)
        if model_random.is_mutating():
            family_constraint = cpool.get(self, GLYPHFONTFAMILY_CONSTRAINT)
            self.family = random.choice(family_constraint)
Exemplo n.º 12
0
    def mutate(self):
        """Make small random changes to the layers components."""
        super(QuadTreeLayer, self).mutate()
        cpool = model_constraintpool.ConstraintPool.get_pool()
        depth_constraint = cpool.get(self, DEPTH_CONSTRAINT)
        self.depth = model_random.jitter_discret_constrained(
            self.depth, depth_constraint)
        propability_constraint = cpool.get(self, PROBABILITY_CONSTRAINT)
        self.propability = model_random.jitter_constrained(
            self.propability, propability_constraint)

        border_width_constraint = cpool.get(self, BORDER_WIDTH_CONSTRAINT)
        self.border_width = model_random.jitter_constrained(
            self.border_width, border_width_constraint)

        self.colorgamut.mutate()
        new_site_color = self.colorgamut.get_randomized_color(self.path)
        model_random.mutate_list(self.tile_colors, depth_constraint,
                                 new_site_color)
        for cix in range(len(self.tile_colors)):
            self.colorgamut.adjust_color(self.tile_colors[cix])
Exemplo n.º 13
0
 def mutate(self):
     """Mutate"""
     cpool = model_constraintpool.ConstraintPool.get_pool()
     x_center_constraint = cpool.get(self, X_CENTER_CONSTRAINT)
     self.x_center = model_random.jitter_constrained(
         self.x_center, x_center_constraint)
     y_center_constraint = cpool.get(self, Y_CENTER_CONSTRAINT)
     self.y_center = model_random.jitter_constrained(
         self.y_center, y_center_constraint)
     steps_constraint = cpool.get(self, STEPS_CONSTRAINT)
     if model_random.is_mutating():
         self.start = model_random.jitter_discret_constrained(
             self.start, steps_constraint)
     if model_random.is_mutating():
         self.end = model_random.jitter_discret_constrained(
             self.end, steps_constraint)
     angle_constraint = cpool.get(self, ANGLE_CONSTRAINT)
     self.angle = model_random.jitter_constrained(self.angle,
                                                  angle_constraint)
     c_constraint = cpool.get(self, C_CONSTRAINT)
     self.c = model_random.jitter_constrained(self.c, c_constraint)
Exemplo n.º 14
0
    def mutate(self):
        """Make small random changes to the layers components."""
        super(VoronoiDiagramLayer, self).mutate()
        cpool = model_constraintpool.ConstraintPool.get_pool()
        number_of_constraint = cpool.get(self, NUMBER_OF_SITES_CONSTRAINT)
        new_site_point = exon_position.Position(self.path, 0.0, 0.0)
        new_site_point.randomize()
        model_random.mutate_list(self.sites_point, number_of_constraint,
                                 new_site_point)

        self.colorgamut.mutate()
        new_site_color = self.colorgamut.get_randomized_color(self.path)
        model_random.mutate_list(self.sites_color, number_of_constraint,
                                 new_site_color)
        for cix in range(len(self.sites_color)):
            self.colorgamut.adjust_color(self.sites_color[cix])

        order_constraint = cpool.get(self, ORDER_CONSTRAINT)
        self.order = model_random.jitter_constrained(self.order,
                                                     order_constraint)

        self.sampler.mutate()
        self.stamp.mutate()
    def mutate(self):
        """Mutate transformations."""
        cpool = model_constraintpool.ConstraintPool.get_pool()
        #TODO self.pol_transf polar coordinaten mutieren
        if model_random.is_mutating():
            symmetry_constraint = cpool.get(self, SYMMETRY_CONSTRAINT)
            self.symmetry = model_random.jitter_discret_constrained(self.symmetry,
                                                            symmetry_constraint)
        if model_random.is_mutating():
            Dn_constraint = cpool.get(self, DN_CONSTRAINT)
            self.Dn = model_random.jitter_discret_constrained(self.Dn,
                                                              Dn_constraint)
        
        if model_random.is_mutating():
            orbit_constraint = cpool.get(self, ORBIT_CONSTRAINT)
            self.orbits = model_random.jitter_discret_constrained(self.Dn,
                                                              orbit_constraint)
        self.random_seed = random.randint(1, 65535)
        for tix in range(self.num_transformations):
            #translation -2.0, 2.0
            self.pol_transf[tix][0] = model_random.jitter_constrained(self.pol_transf[tix][0], [-2.0, 2.0])
            self.pol_transf[tix][1] = model_random.jitter_constrained(self.pol_transf[tix][1], [-2.0, 2.0])
            #rotation  -math.pi, math.pi
            radian = self.pol_transf[tix][2] + model_random.jitter(0.1)
            self.pol_transf[tix][2] = model_random.radian_limit(radian)
            radian = self.pol_transf[tix][3] + model_random.jitter(0.1)
            self.pol_transf[tix][3] = model_random.radian_limit(radian)
            #scaling 0.0, 1.0
            self.pol_transf[tix][4] = model_random.jitter_constrained(self.pol_transf[tix][4], [-1.0, 1.0])
            self.pol_transf[tix][5] = model_random.jitter_constrained(self.pol_transf[tix][5], [-1.0, 1.0])
#        self._prepare_transient_members()
        if model_random.is_mutating():
            x_stamp_size_constraint = cpool.get(self, X_STAMP_SIZE_CONSTRAINT)
            self.x_stamp_size = model_random.jitter_constrained(self.x_stamp_size,
                                                            x_stamp_size_constraint)
        if model_random.is_mutating():
            y_stamp_size_constraint = cpool.get(self, Y_STAMP_SIZE_CONSTRAINT)
            self.y_stamp_size = model_random.jitter_constrained(self.y_stamp_size,
                                                            y_stamp_size_constraint)