def plot3d(self, ztail=0, zhead=0, **kwds): """ Takes 2D plot and places it in 3D. EXAMPLES:: sage: A = arrow((0,0),(1,1))[0].plot3d() sage: A.jmol_repr(A.testing_render_params())[0] 'draw line_1 diameter 2 arrow {0.0 0.0 0.0} {1.0 1.0 0.0} ' Note that we had to index the arrow to get the Arrow graphics primitive. We can also change the height via the plot3d method of Graphics, but only as a whole:: sage: A = arrow((0,0),(1,1)).plot3d(3) sage: A.jmol_repr(A.testing_render_params())[0][0] 'draw line_1 diameter 2 arrow {0.0 0.0 3.0} {1.0 1.0 3.0} ' Optional arguments place both the head and tail outside the `xy`-plane, but at different heights. This must be done on the graphics primitive obtained by indexing:: sage: A=arrow((0,0),(1,1))[0].plot3d(3,4) sage: A.jmol_repr(A.testing_render_params())[0] 'draw line_1 diameter 2 arrow {0.0 0.0 3.0} {1.0 1.0 4.0} ' """ from sage.plot.plot3d.shapes2 import line3d options = self._plot3d_options() options.update(kwds) return line3d([(self.xtail, self.ytail, ztail), (self.xhead, self.yhead, zhead)], arrow_head=True, **options)
def line(points, **kwds): """ Returns either a 2-dimensional or 3-dimensional line depending on value of points. INPUT: - ``points`` - either a single point (as a tuple), a list of points, a single complex number, or a list of complex numbers. For information regarding additional arguments, see either line2d? or line3d?. EXAMPLES:: sage: line([(0,0), (1,1)]) Graphics object consisting of 1 graphics primitive :: sage: line([(0,0,1), (1,1,1)]) Graphics3d Object """ try: return line2d(points, **kwds) except ValueError: from sage.plot.plot3d.shapes2 import line3d return line3d(points, **kwds)
def plot3d(self, ztail=0, zhead=0, **kwds): """ Takes 2D plot and places it in 3D. EXAMPLES:: sage: A = arrow((0,0),(1,1))[0].plot3d() sage: A.jmol_repr(A.testing_render_params())[0] 'draw line_1 diameter 2 arrow {0.0 0.0 0.0} {1.0 1.0 0.0} ' Note that we had to index the arrow to get the Arrow graphics primitive. We can also change the height via the :meth:`Graphics.plot3d` method, but only as a whole:: sage: A = arrow((0,0),(1,1)).plot3d(3) sage: A.jmol_repr(A.testing_render_params())[0][0] 'draw line_1 diameter 2 arrow {0.0 0.0 3.0} {1.0 1.0 3.0} ' Optional arguments place both the head and tail outside the `xy`-plane, but at different heights. This must be done on the graphics primitive obtained by indexing:: sage: A=arrow((0,0),(1,1))[0].plot3d(3,4) sage: A.jmol_repr(A.testing_render_params())[0] 'draw line_1 diameter 2 arrow {0.0 0.0 3.0} {1.0 1.0 4.0} ' """ from sage.plot.plot3d.shapes2 import line3d options = self._plot3d_options() options.update(kwds) return line3d([(self.xtail, self.ytail, ztail), (self.xhead, self.yhead, zhead)], arrow_head=True, **options)
def plot3d(self, z=0, **kwds): """ Plots a 2D line in 3D, with default height zero. EXAMPLES:: sage: E = EllipticCurve('37a').plot(thickness=5).plot3d() sage: F = EllipticCurve('37a').plot(thickness=5).plot3d(z=2) sage: E + F # long time (5s on sage.math, 2012) """ from sage.plot.plot3d.shapes2 import line3d options = self._plot3d_options() options.update(kwds) return line3d([(x, y, z) for x, y in zip(self.xdata, self.ydata)], **options)
def line(points, **kwds): """ Returns either a 2-dimensional or 3-dimensional line depending on value of points. For information regarding additional arguments, see either line2d? or line3d?. EXAMPLES:: sage: line([(0,0), (1,1)]) :: sage: line([(0,0,1), (1,1,1)]) """ try: return line2d(points, **kwds) except ValueError: from sage.plot.plot3d.shapes2 import line3d return line3d(points, **kwds)