 |
3D torus and a sphere on the same canvas using JavaView
Source code name: "javaview_torus.py"
Programming language: Python
Topic: Graphics/3D
DMelt Version 2.5. Last modified: 06/22/1974. License: Pro
https://datamelt.org/code/cache/javaview_torus_3161.py
To run this script using the DMelt IDE,
copy the above URL link to the menu [File]→[Read script from URL] of the DMelt IDE.
# shows how to draw several objects
from jv.geom import PgElementSet
from jhplot import HJavaView
obj = PgElementSet(3)
obj.setName("torus")
obj.computeTorus(20, 20, 20.0, 7)
obj.flipOrientation()
obj.makeVertexNormals()
obj.makeElementNormals()
obj.makeElementColorsFromZ()
obj.showElementColors(True)
obj.showElementBackColor(True)
obj.setTransparency(0.1)
obj.showTransparency(True)
obj.showSmoothElementColors(True)
obj.showSmoothLighting(True)
# second object
obj2 = PgElementSet(3)
obj2.setName("sphere")
obj2.computeSphere(20, 20, 10.0)
obj2.makeElementColorsFromXYZ()
obj2.showElementColors(True)
obj.setTransparency(0.5)
obj.showTransparency(True)
c1= HJavaView()
c1.draw([obj,obj2])
c1.visible()
You see the box below because you did not login.