(self, initial_square, length, alpha, base_angle=0)
return self._get_point_on_square_edge(t2, length, slope + base_angle)
Compute the central point of a child square.

        Parameters
        ----------
        initial_square : Square
            The parent square representation where we will be drawing from.
        length : float
            The length of the side of the new square (the one we are computing
            the center for).
        alpha : float
            The angle that defines the size of our new square (in radians).
        base_angle : float, optional
            If the square we want to find the center for is not the first child
            i.e. its edges does not touch the base square, then we need the
            initial angle that will act as the starting point for the new
            square.

        Returns
        -------
        Point
            The central point to the new square.
Compute the central point of a child square.
Compute the central point of a child square .
def _compute_center(self, initial_square, length, alpha, base_angle=0):
        """Compute the central point of a child square.

        Parameters
        ----------
        initial_square : Square
            The parent square representation where we will be drawing from.
        length : float
            The length of the side of the new square (the one we are computing
            the center for).
        alpha : float
            The angle that defines the size of our new square (in radians).
        base_angle : float, optional
            If the square we want to find the center for is not the first child
            i.e. its edges does not touch the base square, then we need the
            initial angle that will act as the starting point for the new
            square.

        Returns
        -------
        Point
            The central point to the new square.

        """
        parent_center, parent_length, parent_angle = initial_square
        # get the point on the square side that will be the rotation origin
        t0 = self._get_point_on_square_edge(
            parent_center, parent_length, parent_angle)
        # get the edge point that we will rotate around t0
        square_diagonal_length = sqrt(2 * parent_length ** 2)
        edge = self._get_point_on_square_edge(
            parent_center, square_diagonal_length, parent_angle - pi / 4)
        # if the new square is not the first child, we need to rotate the edge
        if base_angle != 0:
            edge = self._rotate_point(edge, t0, base_angle)

        # rotate the edge point to the correct spot
        t1 = self._rotate_point(edge, t0, alpha)

        # calculate the middle point between the rotated point and edge
        t2 = Point((t1.x + edge.x) / 2, (t1.y + edge.y) / 2)
        # calculate the slope of the new square
        slope = parent_angle - pi / 2 + alpha / 2
        # using this data, we can compute the square center
        return self._get_point_on_square_edge(t2, length, slope + base_angle)
def _compute_center ( self , initial_square , length , alpha , base_angle = 0 ) : parent_center , parent_length , parent_angle = initial_square # get the point on the square side that will be the rotation origin t0 = self . _get_point_on_square_edge ( parent_center , parent_length , parent_angle ) # get the edge point that we will rotate around t0 square_diagonal_length = sqrt ( 2 * parent_length ** 2 ) edge = self . _get_point_on_square_edge ( parent_center , square_diagonal_length , parent_angle - pi / 4 ) # if the new square is not the first child, we need to rotate the edge if base_angle != 0 : edge = self . _rotate_point ( edge , t0 , base_angle ) # rotate the edge point to the correct spot t1 = self . _rotate_point ( edge , t0 , alpha ) # calculate the middle point between the rotated point and edge t2 = Point ( ( t1 . x + edge . x ) / 2 , ( t1 . y + edge . y ) / 2 ) # calculate the slope of the new square slope = parent_angle - pi / 2 + alpha / 2 # using this data, we can compute the square center return self . _get_point_on_square_edge ( t2 , length , slope + base_angle )