Create a half of a sphere using JavaView
Code: "javaview_parametric.py". Programming language: Python
DMelt Version 2.5. Last modified: 06/28/1974. License: Pro
https://datamelt.org/code/cache/javaview_parametric_6833.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.
# Describes parametrized surfaces over a two dimensional domain.
# Show a half sphere
from jv.function import PuFunction
from jvx.surface import PgDomainDescr,PgParmSurface
from jhplot import HJavaView
from java.lang import Math
dimOfDomain = 2
numFunctions = 3
m_domain = PgDomainDescr(dimOfDomain)
m_domain.setName("Half Sphere")
m_domain.setMaxSize(-2., -2., 2., 2.)
m_domain.setSize(-Math.PI, Math.PI, 0, 2*Math.PI)
m_domain.setDiscr(20, 20)
m_domain.init()
m_function= PuFunction(dimOfDomain, numFunctions)
geom= PgParmSurface(numFunctions)
geom.setName("Half Sphere")
m_function.setName("Helix")
m_function.setExpression(0, "2*sin(v)*cos(u)")
m_function.setExpression(1, "2*sin(v)*sin(u)")
m_function.setExpression(2, "2*cos(v)")
geom.setFunctionExpr(m_function)
geom.setDomainDescr(m_domain)
geom.compute()
# add some colors
geom.showElementColors(True);
geom.showElementBackColor(True);
geom.setTransparency(0.5);
geom.showTransparency(True);
geom.makeElementColorsFromXYZ()
geom.showElementColors(True)
c1=HJavaView()
c1.visible()
c1.draw(geom)
You see the box below because you did not login.