self.addChild(critic4) figuras = [ Plano1, Esfera1, Esfera2, Esfera3, ParaboloideHiperbolico, ParaboloideHiperbolicoReglado, ParaboloideHiperbolicoCortes, ToroMeridianos, ToroParalelos, ToroVerticalMorseConstr, ToroVerticalMorse ] class CamposVectoriales(Chapter): def __init__(self): Chapter.__init__(self, name=u"Campos vectoriales, singularidades e índice") for f in figuras: self.addPage(f()) if __name__ == "__main__": import sys from superficie.viewer.Viewer import Viewer app = QtGui.QApplication(sys.argv) visor = Viewer() visor.book.addChapter(CamposVectoriales()) visor.chapter.chapterSpecificIn() visor.whichPage = 0 visor.resize(400, 400) visor.show() visor.chaptersStack.show() sys.exit(app.exec_())
self.showAxis(False) self.addChildren(curvas) self.setupAnimations([ AnimationGroup(curvas, (5000,0,len(curva)-1)) ]) class CurvasAlabeadas(Chapter): def __init__(self): Chapter.__init__(self, name="Curvas alabeadas") figuras = [ #Exponencial, Alabeada, HeliceCircular, HeliceReflejada ] for f in figuras: self.addPage(f()) if __name__ == "__main__": import sys app = QtGui.QApplication(sys.argv) visor = Viewer() visor.book.addChapter(curvas_superficies()) visor.whichChapter = 0 visor.chapter.whichPage = 0 visor.resize(400, 400) visor.show() visor.chaptersStack.show() visor.notesStack.show() sys.exit(app.exec_())
ParaboloideHiperbolico, ParaboloideHiperbolicoReglado, ParaboloideHiperbolicoCortes, ToroMeridianos, ToroParalelos, ToroVerticalMorseConstr, ToroVerticalMorse ] class CamposVectoriales(Chapter): def __init__(self): Chapter.__init__(self, name=u"Campos vectoriales, singularidades e índice") for f in figuras: self.addPage(f()) if __name__ == "__main__": import sys from superficie.viewer.Viewer import Viewer app = QtGui.QApplication(sys.argv) visor = Viewer() visor.book.addChapter(CamposVectoriales()) visor.chapter.chapterSpecificIn() visor.whichPage = 0 visor.resize(400, 400) visor.show() visor.chaptersStack.show() sys.exit(app.exec_())
def main(chapter_cls=None): # to run interactively with ipython: # ipython -i --gui=qt script.py # in this case, QtGui.QApplication.instance() will be prebuilt from PyQt4 import QtGui from superficie.viewer.Viewer import Viewer app = QtGui.QApplication.instance() run_exec = False if not app: import sys app = QtGui.QApplication(sys.argv) run_exec = True visor = Viewer() if chapter_cls: visor.book.addChapter(chapter_cls()) ## ============================ visor.whichPage = 0 visor.resize(400, 400) visor.show() visor.trackCameraPosition(True) visor.viewAll() visor.chaptersStack.show() visor.notesStack.show() if run_exec: sys.exit(app.exec_()) return visor
def tuplize(arg): """returns arg if it is already a sequence, (arg,) otherwise""" return arg if isinstance(arg, collections.Sequence) else (arg,) if __name__ == "__main__": from PyQt4 import QtGui, QtCore import sys from superficie.Plot3D import Plot3D, RevolutionPlot3D, ParametricPlot3D, Mesh from superficie.Viewer import Viewer from math import sin app = QtGui.QApplication(sys.argv) Mesh.autoAdd = True viewer = Viewer() viewer.createChapter() class MiPlot3D(Plot3D): def __init__(self, *args, **kwargs): super(MiPlot3D, self).__init__(*args, **kwargs) def With(self, param_lst): print param_lst def setupParameter(self, param): self.addParameter(('v', 0, 1, 0)) ## ============================ d = self.getParametersValues() for quad in self.quads.values(): quad.function.updateGlobals(d)
## asymptotes self.addChild(Line([(-pi / 2, -5, 0), (-pi / 2, 5, 0)], color=(1, .5, .5))) self.addChild(Line([(pi / 2, -5, 0), (pi / 2, 5, 0)], color=(1, .5, .5))) # curve.attachField will create an arrow starting at the curve and ending in the vector given by derivative tangent_vector = curve.attachField("tangent", lambda t: Vec3(1, 1 / cos(t) ** 2, 0)) # by default the arrow doesn't have a tail tangent_vector.add_tail(radius=0.08) # set up the default animations for this page (just the animation for the tangent_vector object in this case) self.setupAnimations([tangent_vector]) class PlaneCurves(Chapter): def __init__(self): Chapter.__init__(self, name="Plane Curve") self.addPage(Tangent()) if __name__ == "__main__": import sys from superficie.viewer.Viewer import Viewer app = QtGui.QApplication(sys.argv) visor = Viewer() visor.book.addChapter(PlaneCurves()) visor.whichChapter = 0 visor.chapter.whichPage = 0 visor.resize(400, 400) visor.show() visor.chaptersStack.show() visor.notesStack.show() sys.exit(app.exec_())
def post(self): c = Viewer.Instance().camera c.position = (7, 7, 7) c.pointAt(Vec3(0, 0, 0), Vec3(0, 0, 1))
def pre(self): c = Viewer.Instance().camera c.position = (0, 0, 10) c.pointAt(Vec3(0, 0, 0))