Esempio n. 1
0
def polygon(points, **options):
    """
    Returns either a 2-dimensional or 3-dimensional polygon depending
    on value of points.

    For information regarding additional arguments, see either
    :func:`polygon2d` or :func:`~sage.plot.plot3d.shapes2.polygon3d`.
    Options may be found and set using the dictionaries ``polygon2d.options``
    and ``polygon3d.options``.

    EXAMPLES::

        sage: polygon([(0,0), (1,1), (0,1)])
        sage: polygon([(0,0,1), (1,1,1), (2,0,1)])

    Extra options will get passed on to show(), as long as they are valid::

        sage: polygon([(0,0), (1,1), (0,1)], axes=False)
        sage: polygon([(0,0), (1,1), (0,1)]).show(axes=False) # These are equivalent
    """
    try:
        return polygon2d(points, **options)
    except ValueError:
        from sage.plot.plot3d.shapes2 import polygon3d
        return polygon3d(points, **options)
Esempio n. 2
0
def polygon(points, **options):
    """
    Returns either a 2-dimensional or 3-dimensional polygon depending
    on value of points.

    For information regarding additional arguments, see either
    :func:`polygon2d` or :func:`~sage.plot.plot3d.shapes2.polygon3d`.
    Options may be found and set using the dictionaries ``polygon2d.options``
    and ``polygon3d.options``.

    EXAMPLES::

        sage: polygon([(0,0), (1,1), (0,1)])
        Graphics object consisting of 1 graphics primitive

    .. PLOT::

        sphinx_plot(polygon([(0,0), (1,1), (0,1)]))

    ::

        sage: polygon([(0,0,1), (1,1,1), (2,0,1)])
        Graphics3d Object

    Extra options will get passed on to show(), as long as they are valid::

        sage: polygon([(0,0), (1,1), (0,1)], axes=False)
        Graphics object consisting of 1 graphics primitive
        sage: polygon([(0,0), (1,1), (0,1)]).show(axes=False) # These are equivalent
    """
    try:
        return polygon2d(points, **options)
    except ValueError:
        from sage.plot.plot3d.shapes2 import polygon3d
        return polygon3d(points, **options)
Esempio n. 3
0
def polygon(points, **options):
    """
    Returns either a 2-dimensional or 3-dimensional polygon depending
    on value of points.

    For information regarding additional arguments, see either :func:`polygon2d`
    or :func:`~sage.plot.plot3d.shapes2.polygon3d`.

    EXAMPLES::

        sage: polygon([(0,0), (1,1), (0,1)])
        sage: polygon([(0,0,1), (1,1,1), (2,0,1)])

    Extra options will get passed on to show(), as long as they are valid::

        sage: polygon([(0,0), (1,1), (0,1)], axes=False)
        sage: polygon([(0,0), (1,1), (0,1)]).show(axes=False) # These are equivalent
    """
    try:
        return polygon2d(points, **options)
    except ValueError:
        from sage.plot.plot3d.shapes2 import polygon3d
        return polygon3d(points, **options)