# Changeset 7864:25a5e79d10a7

Ignore:
Timestamp:
12/18/07 22:30:51 (5 years ago)
Branch:
default
Message:

3d plotting -- some work: (1) fast_float_function started; (2) improved documentation; (3) make line(...) 3d-aware.

Location:
sage
Files:
7 edited

Unmodified
Removed
• ## sage/calculus/calculus.py

 r7525 param = A[0] f = lambda x: self(x) #f = self.fast_float_function() else: A = self.variables() return self.parent()(self._maxima_().partfrac(var)) ################################################################### # Fast Evaluation ################################################################### def fast_float_function(self): return self._fast_float_() def _fast_float_(self): return   lambda x: float(self(x)) class Symbolic_object(SymbolicExpression): if isinstance(self._obj, int): return True def _fast_float_(self): z = float(self) return lambda x: z def _recursive_sub(self, kwds): return hash(self._name) def _fast_float_(self): return lambda x: x def _recursive_sub(self, kwds): # do the replacement if needed return float(f._approx_(float(g))) def _fast_float_(self): f = self._operands[0]._fast_float_() g = self._operands[1]._fast_float_() return lambda x: f(g(x)) def __complex__(self): """ return SymbolicComposition(self, SR(x)) def _fast_float_(self): return math.sin sin = Function_sin() _syms['sin'] = sin return math.cos(x) return SymbolicComposition(self, SR(x)) def _fast_float_(self): return math.cos
• ## sage/plot/all.py

 r7861 from animate import Animation as animate from plot3dmatplotlib import (Graphics3d, point3d, line3d, plot3d) # This needs to be deprecated.  It's crap and pointless. #from plot3dmatplotlib import (Graphics3d, point3d, line3d, plot3d) from plot3dsoya_wrap import plot3dsoya
• ## sage/plot/plot.py

 r7394 return to_float_list(xdata), to_float_list(ydata) def _graphic3d(self, *args, **kwds): """ Return 3d version of this graphics primitive. We call this if the user tries to create a graphic but gives points (etc) in 3-space instead of in the plane. """ raise NotImplementedError, "3d plotting of this primitive not yet implemented" class GraphicPrimitiveFactory_arrow(GraphicPrimitiveFactory): def __call__(self, minpoint, maxpoint, **kwds): done = False if not isinstance(points, (list,tuple)) or \ (isinstance(points,(list,tuple)) and len(points) == 2): (isinstance(points,(list,tuple)) and len(points) <= 3 and not isinstance(points[0], (list,tuple))): try: xdata = [float(points[0])] ydata = [float(points[1])] done = True points = [[float(z) for z in points]] except TypeError: pass ydata = [] for z in points: if len(z) == 3: return self._graphic3d()(points, coerce=coerce, **kwds) xdata.append(float(z[0])) ydata.append(float(z[1])) else: xdata = [z[0] for z in points] ydata = [z[1] for z in points] for z in points: if len(z) == 3: return self._graphic3d()(points, coerce=coerce, **kwds) xdata.append(z[0]) ydata.append(z[1]) return self._from_xdata_ydata(xdata, ydata, True, options=options) pass return g def _graphic3d(self): from sage.plot.plot3d.shapes2 import line3d return line3d # unique line instance
• ## sage/plot/plot3d/all.py

 r7732 from shapes import Box, ColorCube, Cone, Cylinder, Line, Arrow, Sphere, Torus, Text as Text3D from shapes import Box, ColorCube, Cone, Cylinder, Arrow, Sphere, Torus, Text as Text3D from parametric_surface import ParametricSurface, MobiusStrip from plot3d import plot3d, axes as axes3d
• ## sage/plot/plot3d/base.pyx

 r7863 """ INPUT: viewer -- string (default: 'jmol') which viewing system to use. 'jmol': an embedded non-OpenGL 3d java applet 'tachyon': an embedded ray tracer 'java3d': a popup OpenGL 3d java applet filename -- string (default: 'shape'); file to save the image to verbosity -- display information about rendering the figure figsize -- (default: 4); x or pair [x,y] for numbers, e.g., [4,4]; controls the size of the output figure the size of the output figure.  E.g., with jmol the number of pixels in each direction is 100 times figsize[0]. **kwds -- other options, which make sense for particular rendering engines """ if not isinstance(figsize, (list,tuple)):
• ## sage/plot/plot3d/plot3d.py

 r7861 """ # Check if f has a fast float evaluation try: f = f.fast_float_function() except AttributeError: # Nope -- no prob. pass #try: #    f = f.fast_float_function() #except AttributeError: #    # Nope -- no prob. #    pass if texture is None: