#7889: revolution plot
---------------------------+------------------------------------------------
Reporter: olazo | Owner: olazo
Type: enhancement | Status: needs_review
Priority: minor | Milestone: sage-4.3.2
Component: graphics | Keywords: revolution,plot
Author: olazo | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
---------------------------+------------------------------------------------
Changes (by newvalueoldvalue):
* status: new => needs_review
* milestone: => sage-4.3.2
* author: => olazo
Old description:
> As a continuation of the recent cloning of ploting methods found in
> mathematica. I've started a clone of Mathematica's
> [http://reference.wolfram.com/mathematica/ref/RevolutionPlot3D.html
> RevolutionPlot3D].
>
> My version, however, can specify the axis of rotation of the curve, given
> as a line paralel to the z axis, located in the point of coordinates
> (x;y). And also, the posibility to display the revolved curve.
>
> The code so far is:
> {{{
> def
> revolution_plot(cur,trange,phirange=None,axis=(0,0),showcurve=False,**kwds):
> def findvar(expr):
> try:
> vart=cur.args()[0]
> except:
> vart=var('t')
> return vart
>
> if phirange==None:#this if-else provides a phirange
> phi=var('phi')
> phirange=(phi,0,2*pi)
> else:
> phi=phirange[0]
> phirange=(phi,phirange[1],phirange[2])
>
> if str(type(cur)) == "<type 'tuple'>":#this if-else provides a vector
> v to be ploted
> vart=findvar(cur[0])
> R=sqrt((cur[0]-axis[0])^2+axis[1]^2)
> v=(R*cos(phi)+axis[0],R*sin(phi)+axis[1],cur[1])
> curveplot=parametric_plot3d((cur[0],0,cur[1]),trange,thickness=2,rgbcolor=(1,0,0))
> elif str(type(cur))== "<type 'list'>":
> vart=findvar(cur[0])
> R=sqrt((cur[0]-axis[0])^2+axis[1]^2)
> v=(R*cos(phi)+axis[0],R*sin(phi)+axis[1],cur[1])
> curveplot=parametric_plot3d((cur[0],0,cur[1]),trange,thickness=2,rgbcolor=(1,0,0))
> else:
> vart=findvar(cur)
> R=sqrt((vart-axis[0])^2+(axis[1])^2)
> v=(R*cos(phi)+axis[0],R*sin(phi)+axis[1],cur)
> curveplot=parametric_plot3d((vart,0,cur),trange,thickness=2,rgbcolor=(1,0,0))
>
> if showcurve:
> return parametric_plot3d(v,trange,phirange,**kwds)+curveplot
> return parametric_plot3d(v,trange,phirange,**kwds)
> }}}
>
> Examples of it are available in [http://www.sagenb.org/home/pub/1342/
> this worksheet]
New description:
As a continuation of the recent cloning of ploting methods found in
mathematica. I've started a clone of Mathematica's
[http://reference.wolfram.com/mathematica/ref/RevolutionPlot3D.html
RevolutionPlot3D].
My version, however, can specify the axis of rotation of the curve, given
as a line paralel to the z axis, located in the point of coordinates
(x;y). And also, the posibility to display the revolved curve.
Examples of it are available in [http://www.sagenb.org/home/pub/1342/ this
worksheet]
--
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/7889#comment:2>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.