コード例 #1
0
ファイル: ellipse.py プロジェクト: abhishekkumawat23/sympy
    def __hash__(self):
        return super(Ellipse, self).__hash__()

    def __contains__(self, o):
        if isinstance(o, Point):
            x = C.Dummy('x', real=True)
            y = C.Dummy('y', real=True)

            res = self.equation(x, y).subs({x: o.x, y: o.y})
            return trigsimp(simplify(res)) is S.Zero
        elif isinstance(o, Ellipse):
            return self == o
        return False
# once py2.5 support gets dropped replace this with a class decorator
Ellipse._doctest_depends_on = no_attrs_in_subclass(
    Ellipse, Ellipse._doctest_depends_on)


class Circle(Ellipse):
    """A circle in space.

    Constructed simply from a center and a radius, or from three
    non-collinear points.

    Parameters
    ==========

    center : Point
    radius : number or sympy expression
    points : sequence of three Points
コード例 #2
0
            self.axes.adjust_bounds(self._functions[f].bounds)
        self._render_lock.release()

    def wait_for_calculations(self):
        sleep(0)
        self._render_lock.acquire()
        for f in self._functions:
            a = self._functions[f]._get_calculating_verts
            b = self._functions[f]._get_calculating_cverts
            while a() or b():
                sleep(0)
        self._render_lock.release()


#python 2.5 does not support class decorators so use this workaround
PygletPlot._doctest_depends_on = no_attrs_in_subclass(
    PygletPlot, PygletPlot._doctest_depends_on)


class ScreenShot:
    def __init__(self, plot):
        self._plot = plot
        self.screenshot_requested = False
        self.outfile = None
        self.format = ''
        self.invisibleMode = False
        self.flag = 0

    def __nonzero__(self):
        if self.screenshot_requested:
            return 1
        return 0
コード例 #3
0
ファイル: plot.py プロジェクト: Maihj/sympy
        self.axes.reset_bounding_box()
        for f in self._functions:
            self.axes.adjust_bounds(self._functions[f].bounds)
        self._render_lock.release()

    def wait_for_calculations(self):
        sleep(0)
        self._render_lock.acquire()
        for f in self._functions:
            a = self._functions[f]._get_calculating_verts
            b = self._functions[f]._get_calculating_cverts
            while a() or b():
                sleep(0)
        self._render_lock.release()
#python 2.5 does not support class decorators so use this workaround
PygletPlot._doctest_depends_on = no_attrs_in_subclass(
    PygletPlot, PygletPlot._doctest_depends_on)

class ScreenShot:
    def __init__(self, plot):
        self._plot = plot
        self.screenshot_requested = False
        self.outfile = None
        self.format = ''
        self.invisibleMode = False
        self.flag = 0

    def __nonzero__(self):
        if self.screenshot_requested:
            return 1
        return 0
コード例 #4
0
        return super(Ellipse, self).__hash__()

    def __contains__(self, o):
        if isinstance(o, Point):
            x = C.Dummy('x', real=True)
            y = C.Dummy('y', real=True)

            res = self.equation(x, y).subs({x: o.x, y: o.y})
            return trigsimp(simplify(res)) is S.Zero
        elif isinstance(o, Ellipse):
            return self == o
        return False


# once py2.5 support gets dropped replace this with a class decorator
Ellipse._doctest_depends_on = no_attrs_in_subclass(Ellipse,
                                                   Ellipse._doctest_depends_on)


class Circle(Ellipse):
    """A circle in space.

    Constructed simply from a center and a radius, or from three
    non-collinear points.

    Parameters
    ==========

    center : Point
    radius : number or sympy expression
    points : sequence of three Points