3.22 3D Geometry package. HView3D class.

The HView3D class allows to draw 3D objects (cubes, shapes cylinders etc.). Look at the API of the jhplot.v3d package. This is a typical example of how to draw 3D shapes:

>>> from java.awt import Color
>>> from jhplot  import HView3D 
>>> from jhplot.v3d import Cube,Sphere,Cone,Cylinder  
>>>
>>> c1 = HView3D("Canvas",400,400) # create 3D viewer with the size 400x400   
>>> c1.visible(1)
>>> c1.setGTitle("3D objects in HView3D")
>>>
>>> o= Cube(c1.getModel(),40) # build a cube with size 40 
>>> o.setRot(45,45,45) # rotate  
>>> c1.draw(o)
>>>
>>> o = Sphere(c1.getModel(),30.,80,80) # build a sphere with the radius 30  
>>> o.setTrans(40,-20,10) # move it  
>>> c1.draw(o);
>>>
>>> o = Cone(c1.getModel(), 30, 100, 50)
>>> o.setTrans(-20, 30, 0)
>>> o.setColor(Color.red)
>>> c1.draw(o);
>>>
>>> o = Cylinder(c1.getModel(), 40, 100, 2)
>>> o.setTrans(-1, 0, 0)
>>> o.setRot(0, 60, 0)
>>> o.setColor(Color.yellow)
>>> c1.draw(o)
>>>
>>>c1.update() # upade the canvas and draw all objects
Run a complete example in geom3d.py.