コード例 #1
0
ファイル: viewer.py プロジェクト: jonntd/superficie
import sys
from PyQt4 import QtGui
from superficie.viewer import MinimalViewer
from superficie.util import readFile


app = QtGui.QApplication(sys.argv)
viewer = MinimalViewer()
input = readFile('sample.iv')
viewer.addChild(input)
viewer.toText(viewer.getSRoot())
viewer.resize(400, 400)
viewer.show()
viewer.viewAll()

sys.exit(app.exec_())

コード例 #2
0
import sys
from math import pi, sin, cos
from PyQt4 import QtGui
from superficie.plots import ParametricPlot3D
from superficie.viewer import MinimalViewer

app = QtGui.QApplication(sys.argv)
viewer = MinimalViewer()

a = 1
b = 0.5
c = 0.505


def torus(u, v):
    return (a + b * cos(v)) * cos(u), (a + b * cos(v)) * sin(u), b * sin(v)


plot = ParametricPlot3D(torus, (0, 2 * pi, 150), (0, 2 * pi, 100))

viewer.addChild(plot).viewAll().resize(400, 400)
viewer.show()
sys.exit(app.exec_())
コード例 #3
0
import sys
from PyQt4 import QtGui
from superficie.plots import Plot3D
from superficie.viewer import MinimalViewer

app = QtGui.QApplication(sys.argv)
viewer = MinimalViewer()

function = lambda x, y: .5 * x**3 - .5 * 3 * x * y**2 + 2.5
x_range = (-1, 1)
y_range = (-1, 1)
plot = Plot3D(function, x_range, y_range)

# add the object to the scene
viewer.addChild(plot)
# adjust the camera and rotation center
viewer.viewAll()
viewer.resize(400, 400)
viewer.show()
sys.exit(app.exec_())
コード例 #4
0
ファイル: arrows.py プロジェクト: jonntd/superficie
import sys
from PyQt4 import QtGui
from superficie.nodes import Arrow, Line
from superficie.viewer import MinimalViewer

x = [(0, 0, 0), (1, 0, 0)]
y = [(0, 0, 0), (0, 1, 0)]
z = [(0, 0, 0), (0, 0, 1)]

ob = Arrow((0, .05, 0), (1, .05, 0))
ob2 = Arrow(*y).setWidthFactor(.5)
ob3 = Arrow(*z)

app = QtGui.QApplication(sys.argv)
viewer = MinimalViewer()
viewer.addChild(ob)
viewer.addChild(ob2)
viewer.addChild(ob3)

viewer.resize(400, 400)
viewer.show()
viewer.viewAll()

sys.exit(app.exec_())

コード例 #5
0
import sys
from PyQt4 import QtGui
from superficie.viewer import MinimalViewer
from superficie.util import readFile

app = QtGui.QApplication(sys.argv)
viewer = MinimalViewer()
input = readFile('sample.iv')
viewer.addChild(input)
viewer.toText(viewer.getSRoot())
viewer.resize(400, 400)
viewer.show()
viewer.viewAll()

sys.exit(app.exec_())
コード例 #6
0
import sys
from math import exp, sin, cosh, tanh, cos, tan, pi
from PyQt4 import QtGui
from superficie.nodes import Curve3D
from superficie.viewer import MinimalViewer

app = QtGui.QApplication(sys.argv)
viewer = MinimalViewer()

r = 3
m = tan(pi / 60)
t0 = pi / 2


def sigmoid(t):
    return abs(2.0/(1+exp(-(t/15.0)))-1)


def loxodrome(t):
    t = t * sigmoid(t)
    return r * cos(-t) / cosh(m * (-t - t0)), r * sin(-t) / cosh(m * (-t - t0)), r * tanh(m * (-t - t0))

# max_distance and max_angle are hints for the refinement algorithm (optionals)
curve = Curve3D(loxodrome, (-75, 60, 10), width=1, max_distance=.3, max_angle=.2)

viewer.addChild(curve).viewAll().resize(400, 400)
viewer.show()
sys.exit(app.exec_())