Draw a sphere: Difference between revisions

From Rosetta Code
Content added Content deleted
m (comments and fix)
(openscad)
Line 9: Line 9:
in ball.s sph 0 0 0 3 # Create a sphere of radius 3 cm named ball.s with its centre at 0,0,0 </lang>
in ball.s sph 0 0 0 3 # Create a sphere of radius 3 cm named ball.s with its centre at 0,0,0 </lang>


=={{header|Openscad}}==
Drawing a sphere is easy in openscad:

<lang openscad>// This will produce a sphere of radius 5
sphere(5);</lang>


[[Category:Geometric Primitives]]
[[Category:Geometric Primitives]]

Revision as of 00:21, 25 March 2011

Task
Draw a sphere
You are encouraged to solve this task according to the task description, using any language you may know.

The task is to draw a sphere cuboid. The sohere can be represented graphically, or in ascii art, depending on the language capabilities. Either static or rotational projection is acceptable for this task.

Brlcad

<lang brlcad>opendb balls.g y # Create a database to hold our shapes units cm # Set the unit of measure in ball.s sph 0 0 0 3 # Create a sphere of radius 3 cm named ball.s with its centre at 0,0,0 </lang>

Openscad

Drawing a sphere is easy in openscad:

<lang openscad>// This will produce a sphere of radius 5 sphere(5);</lang>