 |
HPlot3DS canvas to show parametric functions (FRP)
Source code name: "canvas3D_hplot3dp_fpr.py"
Programming language: Python
Topic: Plots/3D
DMelt Version 1. Last modified: 05/09/2015. License: Pro
https://datamelt.org/code/cache/canvas3D_hplot3dp_fpr_519.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.
from java.awt import Color
from jhplot import *
c1 = HPlot3DP("Canvas",600,600,2,1)
c1.setGTitle('3D surfaces')
c1.visible()
f1=FPR('u=2*Pi*u; x=cos(u); y=sin(u); z=v')
# set color with transparency
c=Color(0.5,0.2,0.5,0.5)
f1.setFillColor(c)
f1.setLineColor(Color.green)
f2=FPR('u=2 Pi u; v=2 Pi v; r=0.6+.2cos(u); z=.8 sin(u); x=r cos(v); y=r sin(v)')
f2.setFillColor(Color.blue)
f2.setFilled(0)
c1.setFov(10)
c1.setFog(0)
c1.setAxes(0)
c1.setNameX("X axis")
c1.setNameY("Y axis")
c1.setAxesColor(Color.white)
c1.setAxes(1,1,0)
c1.setAxesArrows(0)
c1.setRangeZ(0,20)
c1.setBackgColor(Color.yellow)
print c1.getCameraPosition()
c1.setCameraPosition(-2.0)
c1.draw(f2)
c1.draw(f1)
c1.cd(2,1)
c1.setFog(0)
f3=FPR('r=0.7; u=2 Pi u; v=Pi v; \
x=r cos(u) sin(v); y=r sin(u) sin(v); z=r cos(v)')
f3.setDivisions(30,30)
f3.setLineColor(Color.yellow)
print c1.getEyePosition()
c1.setCameraPosition(-0.2)
c1.draw(f3)
You see the box below because you did not login.