# 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")

