Skip to content

Latest commit

 

History

History
57 lines (42 loc) · 2.16 KB

sphere.rst

File metadata and controls

57 lines (42 loc) · 2.16 KB

sphere

images/sphere.jpg

.. py:function:: sphere(pos=vec(0,0,0), radius=2, color=color.cyan)

   :param pos: Position of center. Default <0,0,0>.
   :type pos: vector
   :param radius:  Default 1.
   :type radius: scalar
   :param color: Default *color.white*
   :type color: vector
   :param size: Dimensions of a box surrounding the sphere. Default <2,2,2>.
   :type size: vector
   :param axis: Default <1,0,0>
   :type axis: vector

A sphere can be made into an ellipsoid by assigning an asymmetrical size.

Attributes used less often:

.. py:function:: sphere( opacity=0.5, shininess=0.2, texture=textures.wood, make_trail=True, canvas=mycanvas, emissive=False )
   :noindex:

   :param opacity:  Default 1.0; Range 0-1.
   :type opacity: scalar
   :param shininess: Default 0.6; Range 0-1.
   :type shininess: scalar
   :param emissive: Default False. Object glows, losing all shading, if True.
   :type emissive: boolean
   :param texture: Default None.
   :type texture: class element or path
   :param visible: If False, object is not displayed.  Default: True
   :type visible: boolean
   :param canvas:  Default is *scene*.
   :type canvas: object
   :param make_trail: If True, object leaves a trail when moved. See Attaching a Trail for more options.
   :type make_trail: boolean
   :param up: A vector perpendicular to the axis.
   :type up: vector
   :param group: The group to which this object belongs.
   :type group: object


Although a sphere does have :py:attr:`axis` and :py:attr:`up` attributes, these are not typically useful unless a texture has been applied to the sphere.

simple_sphere

In order to look smooth, a sphere is made of a very large number of triangles. Sometimes speed is more important than ultimate beauty. The simple_sphere object has many fewer triangles than a sphere. It can be used just like a sphere, but a large number of simple_sphere objects is displayed very much faster than the same number of regular spheres. For speed, the simple_sphere object is used in the points object and in trails that use points.