(self, args)
CIRCLE: Draw a circle, ellipse, arc or sector.
CIRCLE: Draw a circle, ellipse, arc or sector.
CIRCLE : Draw a circle ellipse arc or sector .
def circle_(self, args):
        """CIRCLE: Draw a circle, ellipse, arc or sector."""
        if self._mode.is_text_mode:
            raise error.BASICError(error.IFC)
        # determine pixel aspect ratio
        pixel_aspect = (
            self._mode.pixel_height * self._screen_aspect[0],
            self._mode.pixel_width * self._screen_aspect[1]
        )
        step = next(args)
        x, y = (values.to_single(_arg).to_value() for _arg in islice(args, 2))
        r = values.to_single(next(args)).to_value()
        error.throw_if(r < 0)
        attr_index = next(args)
        if attr_index is not None:
            attr_index = values.to_int(attr_index)
        start = next(args)
        if start is not None:
            start = values.to_single(start).to_value()
        stop = next(args)
        if stop is not None:
            stop = values.to_single(stop).to_value()
        aspect = next(args)
        if aspect is not None:
            aspect = values.to_single(aspect).to_value()
        list(args)
        x0, y0 = self._get_window_physical(x, y, step)
        if attr_index is None:
            attr_index = -1
        else:
            error.range_check(0, 255, attr_index)
        attr = self._get_attr_index(attr_index)
        if aspect is None:
            aspect = pixel_aspect[0] / float(pixel_aspect[1])
        if aspect == 1.:
            rx, _ = self._get_window_scale(r, 0.)
            ry = rx
        elif aspect > 1.:
            _, ry = self._get_window_scale(0., r)
            rx = int(round(r / aspect))
        else:
            rx, _ = self._get_window_scale(r, 0.)
            ry = int(round(r * aspect))
        start_octant, start_coord, start_line = -1, -1, False
        if start is not None:
            start_octant, start_coord, start_line = _get_octant(start, rx, ry)
        stop_octant, stop_coord, stop_line = -1, -1, False
        if stop is not None:
            stop_octant, stop_coord, stop_line = _get_octant(stop, rx, ry)
        if aspect == 1.:
            self._draw_circle(
                x0, y0, rx, attr,
                start_octant, start_coord, start_line,
                stop_octant, stop_coord, stop_line
            )
        else:
            startx, starty, stopx, stopy = -1, -1, -1, -1
            if start is not None:
                startx = abs(int(round(rx * math.cos(start))))
                starty = abs(int(round(ry * math.sin(start))))
            if stop is not None:
                stopx = abs(int(round(rx * math.cos(stop))))
                stopy = abs(int(round(ry * math.sin(stop))))
            self._draw_ellipse(
                x0, y0, rx, ry, attr,
                start_octant//2, startx, starty, start_line,
                stop_octant//2, stopx, stopy, stop_line
            )
        self._last_attr = attr
        self._last_point = x0, y0
def circle_ ( self , args ) : if self . _mode . is_text_mode : raise error . BASICError ( error . IFC ) # determine pixel aspect ratio pixel_aspect = ( self . _mode . pixel_height * self . _screen_aspect [ 0 ] , self . _mode . pixel_width * self . _screen_aspect [ 1 ] ) step = next ( args ) x , y = ( values . to_single ( _arg ) . to_value ( ) for _arg in islice ( args , 2 ) ) r = values . to_single ( next ( args ) ) . to_value ( ) error . throw_if ( r < 0 ) attr_index = next ( args ) if attr_index is not None : attr_index = values . to_int ( attr_index ) start = next ( args ) if start is not None : start = values . to_single ( start ) . to_value ( ) stop = next ( args ) if stop is not None : stop = values . to_single ( stop ) . to_value ( ) aspect = next ( args ) if aspect is not None : aspect = values . to_single ( aspect ) . to_value ( ) list ( args ) x0 , y0 = self . _get_window_physical ( x , y , step ) if attr_index is None : attr_index = - 1 else : error . range_check ( 0 , 255 , attr_index ) attr = self . _get_attr_index ( attr_index ) if aspect is None : aspect = pixel_aspect [ 0 ] / float ( pixel_aspect [ 1 ] ) if aspect == 1. : rx , _ = self . _get_window_scale ( r , 0. ) ry = rx elif aspect > 1. : _ , ry = self . _get_window_scale ( 0. , r ) rx = int ( round ( r / aspect ) ) else : rx , _ = self . _get_window_scale ( r , 0. ) ry = int ( round ( r * aspect ) ) start_octant , start_coord , start_line = - 1 , - 1 , False if start is not None : start_octant , start_coord , start_line = _get_octant ( start , rx , ry ) stop_octant , stop_coord , stop_line = - 1 , - 1 , False if stop is not None : stop_octant , stop_coord , stop_line = _get_octant ( stop , rx , ry ) if aspect == 1. : self . _draw_circle ( x0 , y0 , rx , attr , start_octant , start_coord , start_line , stop_octant , stop_coord , stop_line ) else : startx , starty , stopx , stopy = - 1 , - 1 , - 1 , - 1 if start is not None : startx = abs ( int ( round ( rx * math . cos ( start ) ) ) ) starty = abs ( int ( round ( ry * math . sin ( start ) ) ) ) if stop is not None : stopx = abs ( int ( round ( rx * math . cos ( stop ) ) ) ) stopy = abs ( int ( round ( ry * math . sin ( stop ) ) ) ) self . _draw_ellipse ( x0 , y0 , rx , ry , attr , start_octant // 2 , startx , starty , start_line , stop_octant // 2 , stopx , stopy , stop_line ) self . _last_attr = attr self . _last_point = x0 , y0