 |
Show two curves in 3D using JavaView
Source code name: "javaview_curve2.py"
Programming language: Python
Topic: Plots/3D
DMelt Version 2.5. Last modified: 06/23/1974. License: Pro
https://datamelt.org/code/cache/javaview_curve2_4336.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.
# Show 2 parametric curves in 3D using JavaView
from jv.geom import PgElementSet
from jvx.curve import PgParmCurve
from jv.function import PuFunction
from jhplot import HJavaView
# first curve
obj1 = PgParmCurve(3)
obj1.setName("curve1")
fun1 = PuFunction(1, 3)
fun1.setName("f")
fun1.setExpression(0, "u")
fun1.setExpression(1, "sin(u)")
fun1.setExpression(2, "cos(u)")
obj1.setFunction(fun1)
obj1.computeCurve();
# second curve
obj2 = PgParmCurve(3)
obj2.setName("curve2")
fun2 = PuFunction(1, 3)
fun2.setName("f")
fun2.setExpression(0, "sqrt(u)")
fun2.setExpression(1, "sin(2*u)")
fun2.setExpression(2, "2*cos(u)")
obj2.setFunction(fun2)
obj2.computeCurve();
c1= HJavaView()
c1.draw([obj1,obj2])
c1.visible()
c1.export("image.jpg")
You see the box below because you did not login.