├── .cdtproject ├── .cproject ├── .gitignore ├── .gitmodules ├── .project ├── Boost_OSX_Makefile.mak ├── Doxyfile ├── HACKING.txt ├── INSTALL.txt ├── LIBSIGC_COPYING.txt ├── MAC-OSX.txt ├── MSWINDOWS.txt ├── MakeVPython2.6.iss ├── MakeVPython2.7.iss ├── MakeVPython3.1.iss ├── MakeVPython3.2.iss ├── Makefile.am ├── NEWS.txt ├── README ├── VCBuild ├── VCBuild.txt ├── cvisual.sln ├── cvisual.vcproj ├── cvisual26.sln ├── cvisual26.vcproj ├── cvisual27.sln ├── cvisual27.vcproj ├── cvisual3.sln ├── cvisual3.vcproj ├── cvisual32.sln └── cvisual32.vcproj ├── acinclude.m4 ├── authors.txt ├── autogen.sh ├── compilevisual.py ├── configure.ac ├── dependencies ├── Readme.txt └── threadpool │ ├── CHANGE_LOG │ ├── COPYING │ ├── LICENSE_1_0.txt │ ├── README │ ├── TODO │ └── include │ ├── threadpool.hpp │ └── threadpool │ ├── detail │ ├── future.hpp │ ├── locking_ptr.hpp │ ├── pool_core.hpp │ ├── scope_guard.hpp │ └── worker_thread.hpp │ ├── future.hpp │ ├── pool.hpp │ ├── pool_adaptors.hpp │ ├── scheduling_policies.hpp │ ├── shutdown_policies.hpp │ ├── size_policies.hpp │ └── task_adaptors.hpp ├── examples ├── Makefile.am ├── bounce.py ├── bounce2.py ├── boxlighttest.py ├── colorsliders.py ├── conch.py ├── controlstest.py ├── convex.py ├── crossproduct.py ├── crystal.py ├── differential_gear.py ├── dipole.py ├── doublependulum.py ├── drape.py ├── electric_motor.py ├── extruded_columns.py ├── extrusion_examples.py ├── extrusion_overview.py ├── faces_cone.py ├── faces_heightfield.py ├── flower128.tga ├── gas.py ├── glinfo.py ├── graphtest.py ├── gyro.py ├── gyro2.py ├── hanoi.py ├── labels.py ├── lathe.py ├── lorenz.py ├── mandelbrot.py ├── material_test.py ├── medusa.py ├── orbit.py ├── planar.py ├── randombox.py ├── stars.py ├── stonehenge.py ├── text3D.py ├── texttest.py ├── texture_and_lighting.py ├── texturetest.py ├── tictac.py ├── tictacdat.py ├── toroid.py ├── toroid_drag.py └── wave.py ├── include ├── .gitignore ├── GL │ └── glext.h ├── arrow.hpp ├── axial.hpp ├── box.hpp ├── cone.hpp ├── config.h.in ├── cylinder.hpp ├── display_kernel.hpp ├── ellipsoid.hpp ├── frame.hpp ├── gtk2 │ ├── display.hpp │ ├── font_renderer.hpp │ ├── render_surface.hpp │ ├── text_adjust.hpp │ └── util │ │ └── timer.hpp ├── label.hpp ├── light.hpp ├── mac │ ├── display.hpp │ ├── font_renderer.hpp │ └── text_adjust.hpp ├── material.hpp ├── mouse_manager.hpp ├── mouseobject.hpp ├── primitive.hpp ├── pyramid.hpp ├── python │ ├── arrayprim.hpp │ ├── convex.hpp │ ├── curve.hpp │ ├── extrusion.hpp │ ├── faces.hpp │ ├── gil.hpp │ ├── num_util.hpp │ ├── numeric_texture.hpp │ ├── points.hpp │ ├── scalar_array.hpp │ ├── slice.hpp │ ├── vector_array.hpp │ └── wrap_vector.hpp ├── rectangular.hpp ├── renderable.hpp ├── ring.hpp ├── sphere.hpp ├── text.hpp ├── util │ ├── atomic_queue.hpp │ ├── displaylist.hpp │ ├── errors.hpp │ ├── extent.hpp │ ├── gl_enable.hpp │ ├── gl_extensions.hpp │ ├── gl_free.hpp │ ├── icososphere.hpp │ ├── quadric.hpp │ ├── rate.hpp │ ├── render_manager.hpp │ ├── rgba.hpp │ ├── shader_program.hpp │ ├── sorted_model.hpp │ ├── texture.hpp │ ├── thread.hpp │ ├── timer.hpp │ ├── tmatrix.hpp │ └── vector.hpp ├── vpython-config.h ├── win32 │ ├── display.hpp │ ├── font_renderer.hpp │ └── text_adjust.hpp └── wrap_gl.hpp ├── lib └── pkgconfig │ └── vpython-3.0.pc ├── license.txt ├── mkdist_osx.sh ├── run ├── site-packages ├── vidle2 │ ├── AutoComplete.py │ ├── AutoCompleteWindow.py │ ├── AutoExpand.py │ ├── Bindings.py │ ├── CREDITS.txt │ ├── CallTipWindow.py │ ├── CallTips.py │ ├── ChangeLog │ ├── ClassBrowser.py │ ├── CodeContext.py │ ├── ColorDelegator.py │ ├── Debugger.py │ ├── Delegator.py │ ├── EditorWindow.py │ ├── FileList.py │ ├── FileRevert.py │ ├── FormatParagraph.py │ ├── GrepDialog.py │ ├── HISTORY.txt │ ├── HyperParser.py │ ├── IOBinding.py │ ├── Icons │ │ ├── folder.gif │ │ ├── idle.icns │ │ ├── minusnode.gif │ │ ├── openfolder.gif │ │ ├── plusnode.gif │ │ ├── python.gif │ │ └── tk.gif │ ├── IdleHistory.py │ ├── MacBuildApp.py │ ├── Makefile.am │ ├── MultiCall.py │ ├── MultiStatusBar.py │ ├── NEWS.txt │ ├── ObjectBrowser.py │ ├── OutputWindow.py │ ├── ParenMatch.py │ ├── PathBrowser.py │ ├── Percolator.py │ ├── PyParse.py │ ├── PyShell.py │ ├── README.txt │ ├── RemoteDebugger.py │ ├── RemoteObjectBrowser.py │ ├── ReplaceDialog.py │ ├── RstripExtension.py │ ├── ScriptBinding.py │ ├── ScrolledList.py │ ├── SearchDialog.py │ ├── SearchDialogBase.py │ ├── SearchEngine.py │ ├── StackViewer.py │ ├── TODO.txt │ ├── ToolTip.py │ ├── TreeWidget.py │ ├── UndoDelegator.py │ ├── WidgetRedirector.py │ ├── WindowList.py │ ├── ZoomHeight.py │ ├── __init__.py │ ├── aboutDialog.py │ ├── config-extensions.def │ ├── config-highlight.def │ ├── config-keys.def │ ├── config-main.def │ ├── configDialog.py │ ├── configHandler.py │ ├── configHelpSourceEdit.py │ ├── configSectionNameDialog.py │ ├── dynOptionMenuWidget.py │ ├── extend.txt │ ├── help.txt │ ├── idle.bat │ ├── idle.py │ ├── idle.pyw │ ├── idlever.py │ ├── keybindingDialog.py │ ├── macosxSupport.py │ ├── pyclbr.py │ ├── rpc.py │ ├── run.py │ ├── tabbedpages.py │ ├── testcode.py │ ├── textView.py │ └── utils.py ├── vidle3 │ ├── AutoComplete.py │ ├── AutoCompleteWindow.py │ ├── AutoExpand.py │ ├── Bindings.py │ ├── CREDITS.txt │ ├── CallTipWindow.py │ ├── CallTips.py │ ├── ChangeLog │ ├── ClassBrowser.py │ ├── CodeContext.py │ ├── ColorDelegator.py │ ├── Debugger.py │ ├── Delegator.py │ ├── EditorWindow.py │ ├── FileList.py │ ├── FileRevert.py │ ├── FormatParagraph.py │ ├── GrepDialog.py │ ├── HISTORY.txt │ ├── HyperParser.py │ ├── IOBinding.py │ ├── Icons │ │ ├── folder.gif │ │ ├── idle.icns │ │ ├── minusnode.gif │ │ ├── openfolder.gif │ │ ├── plusnode.gif │ │ ├── python.gif │ │ └── tk.gif │ ├── IdleHistory.py │ ├── Makefile.am │ ├── MultiCall.py │ ├── MultiStatusBar.py │ ├── NEWS.txt │ ├── ObjectBrowser.py │ ├── OutputWindow.py │ ├── ParenMatch.py │ ├── PathBrowser.py │ ├── Percolator.py │ ├── PyParse.py │ ├── PyShell.py │ ├── README.txt │ ├── RemoteDebugger.py │ ├── RemoteObjectBrowser.py │ ├── ReplaceDialog.py │ ├── RstripExtension.py │ ├── ScriptBinding.py │ ├── ScrolledList.py │ ├── SearchDialog.py │ ├── SearchDialogBase.py │ ├── SearchEngine.py │ ├── StackViewer.py │ ├── TODO.txt │ ├── ToolTip.py │ ├── TreeWidget.py │ ├── UndoDelegator.py │ ├── WidgetRedirector.py │ ├── WindowList.py │ ├── ZoomHeight.py │ ├── __init__.py │ ├── aboutDialog.py │ ├── config-extensions.def │ ├── config-highlight.def │ ├── config-keys.def │ ├── config-main.def │ ├── configDialog.py │ ├── configHandler.py │ ├── configHelpSourceEdit.py │ ├── configSectionNameDialog.py │ ├── dynOptionMenuWidget.py │ ├── extend.txt │ ├── help.txt │ ├── idle.bat │ ├── idle.py │ ├── idle.pyw │ ├── idlever.py │ ├── keybindingDialog.py │ ├── macosxSupport.py │ ├── rpc.py │ ├── run.py │ ├── tabbedpages.py │ ├── testcode.py │ ├── textView.py │ └── utils.py ├── vis │ ├── BlueMarble.tga │ ├── Makefile.am │ ├── __init__.py │ ├── brickbump.tga │ ├── controls.py │ ├── crayola.py │ ├── earth.tga │ ├── factorial.py │ ├── filedialog.py │ ├── graph.py │ ├── license.txt │ ├── logo_t.gif │ ├── materials.py │ ├── pan.png │ ├── paths.py │ ├── primitives.py │ ├── random.tga │ ├── shapes.py │ ├── site_settings.py │ ├── turbulence3.tga │ ├── ui.py │ ├── vpython.glade │ ├── vpython_notoolbar.glade │ └── wood.tga └── visual │ ├── Makefile.am │ ├── __init__.py │ ├── controls.py │ ├── factorial.py │ ├── filedialog.py │ ├── graph.py │ ├── license.txt │ ├── text.py │ └── visual_all.py ├── src ├── Makefile.in ├── core │ ├── arrow.cpp │ ├── axial.cpp │ ├── box.cpp │ ├── cone.cpp │ ├── cylinder.cpp │ ├── display_kernel.cpp │ ├── ellipsoid.cpp │ ├── frame.cpp │ ├── label.cpp │ ├── light.cpp │ ├── material.cpp │ ├── mouse_manager.cpp │ ├── mouseobject.cpp │ ├── primitive.cpp │ ├── pyramid.cpp │ ├── rectangular.cpp │ ├── renderable.cpp │ ├── ring.cpp │ ├── sphere.cpp │ ├── text.cpp │ └── util │ │ ├── atomic_queue.cpp │ │ ├── displaylist.cpp │ │ ├── errors.cpp │ │ ├── extent.cpp │ │ ├── gl_extensions.cpp │ │ ├── gl_free.cpp │ │ ├── icososphere.cpp │ │ ├── quadric.cpp │ │ ├── render_manager.cpp │ │ ├── rgba.cpp │ │ ├── shader_program.cpp │ │ ├── texture.cpp │ │ ├── tmatrix.cpp │ │ └── vector.cpp ├── gtk2 │ ├── display.cpp │ ├── font_renderer.cpp │ ├── makefile │ ├── rate.cpp │ ├── render_surface.cpp │ ├── site-packages.pth │ └── timer.cpp ├── linux-symbols.map ├── mac │ ├── PackageMaker │ │ ├── VIDLE_launcher.zip │ │ ├── VPython-Python2.6.pmdoc.zip │ │ ├── VPython-Python2.6.pmdoc │ │ │ ├── 01visual-contents.xml │ │ │ ├── 01visual.xml │ │ │ ├── 02vidle-contents.xml │ │ │ ├── 02vidle.xml │ │ │ ├── 03vpython-contents.xml │ │ │ ├── 03vpython.xml │ │ │ ├── 04numpy-contents.xml │ │ │ ├── 04numpy.xml │ │ │ ├── 05numpy-contents.xml │ │ │ ├── 05numpy.xml │ │ │ ├── 06ttfquery-contents.xml │ │ │ ├── 06ttfquery.xml │ │ │ ├── 07fonttools-contents.xml │ │ │ ├── 07fonttools.xml │ │ │ ├── 08polygon-contents.xml │ │ │ ├── 08polygon.xml │ │ │ ├── 09polygon-contents.xml │ │ │ ├── 09polygon.xml │ │ │ ├── 10fonttools-contents.xml │ │ │ ├── 10fonttools.xml │ │ │ ├── 11fonttools-contents.xml │ │ │ ├── 11fonttools.xml │ │ │ ├── 12ttfquery-contents.xml │ │ │ ├── 12ttfquery.xml │ │ │ └── index.xml │ │ ├── VPython-Python2.7.pmdoc.zip │ │ ├── VPython-Python2.7.pmdoc │ │ │ ├── 01visual-contents.xml │ │ │ ├── 01visual.xml │ │ │ ├── 02vidle-contents.xml │ │ │ ├── 02vidle.xml │ │ │ ├── 03vpython-contents.xml │ │ │ ├── 03vpython.xml │ │ │ ├── 04numpy-contents.xml │ │ │ ├── 04numpy.xml │ │ │ ├── 05numpy-contents.xml │ │ │ ├── 05numpy.xml │ │ │ ├── 06ttfquery-contents.xml │ │ │ ├── 06ttfquery.xml │ │ │ ├── 07fonttools-contents.xml │ │ │ ├── 07fonttools.xml │ │ │ ├── 08polygon-contents.xml │ │ │ ├── 08polygon.xml │ │ │ ├── 09polygon-contents.xml │ │ │ ├── 09polygon.xml │ │ │ ├── 10fonttools-contents.xml │ │ │ ├── 10fonttools.xml │ │ │ ├── 11fonttools-contents.xml │ │ │ ├── 11fonttools.xml │ │ │ ├── 12ttfquery-contents.xml │ │ │ ├── 12ttfquery.xml │ │ │ ├── 13vis-contents.xml │ │ │ ├── 13vis.xml │ │ │ └── index.xml │ │ ├── VPython-Python3.1 2.pmdoc.zip │ │ ├── VPython-Python3.1.pmdoc.zip │ │ ├── VPython-Python3.1.pmdoc │ │ │ ├── 01visual-contents.xml │ │ │ ├── 01visual.xml │ │ │ ├── 02vidle-contents.xml │ │ │ ├── 02vidle.xml │ │ │ ├── 03vpython-contents.xml │ │ │ ├── 03vpython.xml │ │ │ ├── 04numpy-contents.xml │ │ │ ├── 04numpy.xml │ │ │ ├── 05numpy-contents.xml │ │ │ ├── 05numpy.xml │ │ │ ├── 06ttfquery-contents.xml │ │ │ ├── 06ttfquery.xml │ │ │ ├── 07fonttools-contents.xml │ │ │ ├── 07fonttools.xml │ │ │ ├── 08polygon-contents.xml │ │ │ ├── 08polygon.xml │ │ │ ├── 09polygon-contents.xml │ │ │ ├── 09polygon.xml │ │ │ ├── 10fonttools-contents.xml │ │ │ ├── 10fonttools.xml │ │ │ ├── 11fonttools-contents.xml │ │ │ ├── 11fonttools.xml │ │ │ ├── 12ttfquery-contents.xml │ │ │ ├── 12ttfquery.xml │ │ │ ├── 13vis-contents.xml │ │ │ ├── 13vis.xml │ │ │ └── index.xml │ │ ├── VPython-Python3.2.pmdoc.zip │ │ ├── Visual5_Python2.6_welcome.rtf │ │ ├── Visual5_Python2.7_welcome.rtf │ │ ├── Visual5_Python3.1_welcome.rtf │ │ ├── Visual5_Python3.2_welcome.rtf │ │ ├── Visual5_welcome.rtf │ │ └── packaging.txt │ ├── mac_display.cpp │ ├── mac_font_renderer.cpp │ ├── mac_rate.cpp │ ├── mac_timer.cpp │ └── makefile ├── osx-symbols.txt ├── python │ ├── arrayprim.cpp │ ├── convex.cpp │ ├── curve.cpp │ ├── cvisualmodule.cpp │ ├── extrusion.cpp │ ├── faces.cpp │ ├── num_util.cpp │ ├── numeric_texture.cpp │ ├── points.cpp │ ├── scalar_array.cpp │ ├── slice.cpp │ ├── vector_array.cpp │ ├── wrap_arrayobjects.cpp │ ├── wrap_display_kernel.cpp │ ├── wrap_primitive.cpp │ ├── wrap_rgba.cpp │ └── wrap_vector.cpp └── win32 │ ├── font_renderer.cpp │ ├── windisplay.cpp │ ├── winrate.cpp │ └── wintimer.cpp ├── valgrind-python.supp └── vpython_config_helpers.py /.cdtproject: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /.cproject: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.pyo 3 | *.pyd 4 | *.swp 5 | *.so 6 | *.os 7 | *.xml 8 | *.pmdoc 9 | *.xml 10 | *.DS_Store 11 | .sconf_temp 12 | .sconsign 13 | autom4te.cache 14 | config.log 15 | aclocal.m4 16 | compile 17 | config.guess 18 | config.status 19 | config.sub 20 | configure 21 | docs 22 | install-sh 23 | libtool 24 | ltmain.sh 25 | Makefile 26 | Makefile.in 27 | missing 28 | mkinstalldirs 29 | py-compile 30 | scripts 31 | VCbuild/*.ncb 32 | VCbuild/*.suo 33 | VCbuild/*.user 34 | VCbuild/codeanalyst 35 | VCbuild/cvisual 36 | VCbuild/dlls 37 | VCbuild/libs 38 | dependencies/boost_files 39 | dependencies/boost_files2.5 40 | site-packages/vidle2/build 41 | site-packages/visual/*.in 42 | src/mac/PackageMaker/*.pmdoc 43 | src/mac/PackageMaker/*.pmdoc/*.xml 44 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "docs"] 2 | path = docs 3 | url = git://github.com/vpython/vpython.docs.git 4 | -------------------------------------------------------------------------------- /Boost_OSX_Makefile.mak: -------------------------------------------------------------------------------- 1 | SHELL = /bin/sh 2 | CXX = /usr/local/bin/g++-3.3.4 3 | 4 | VPATH = $(srcdir) $(srcdir)/converter $(srcdir)/detail $(srcdir)/object 5 | 6 | .DEFAULT = all 7 | 8 | boostroot = ../boost_1_31_0 9 | srcdir = $(boostroot)/libs/python/src 10 | boostincdir = $(boostroot) 11 | 12 | WARNINGFLAGS = 13 | OPTIMIZEFLAGS = -DNDEBUG -fpic -O3 14 | BOOSTFLAGS = -DBOOST_PYTHON_MAX_BASES=2 -DBOOST_PYTHON_SOURCE \ 15 | -DBOOST_PYTHON_DYNAMIC_LIB 16 | 17 | OBJS = aix_init_module.lo dict.lo errors.lo list.lo long.lo module.lo \ 18 | numeric.lo object_operators.lo object_protocol.lo str.lo tuple.lo \ 19 | arg_to_python_base.lo from_python.lo registry.lo \ 20 | type_id.lo class.lo enum.lo function.lo inheritance.lo iterator.lo \ 21 | life_support.lo pickle_support.lo builtin_converters.lo 22 | 23 | pythonroot = /sw 24 | pythonincdir = $(pythonroot)/include/python2.3 25 | 26 | DEPS = $(subst .lo,.d, $(OBJS)) 27 | 28 | %.lo: %.cpp 29 | $(CXX) -ftemplate-depth-120 $(WARNINGFLAGS) $(OPTIMIZEFLAGS) $(BOOSTFLAGS) -I$(pythonincdir) -I$(boostincdir) -c -o $@ $< 30 | 31 | %.d: %.cpp 32 | $(CXX) $(BOOSTFLAGS) -I$(pythonincdir) -I$(boostincdir) -MM -MF $@ -MT "$*.lo $@" $< 33 | 34 | DYLIB_FLAGS = -v -dynamiclib -undefined suppress -flat_namespace -compatibility_version 1.31.0 \ 35 | -current_version 1.31.0 36 | libboost_python.dylib: $(OBJS) 37 | ld -dynamic -m -r -d -o libboost_python.lo $^ 38 | $(CXX) $(DYLIB_FLAGS) -o $@ libboost_python.lo 39 | rm -f libboost_python.lo 40 | 41 | libboost_python.a: $(OBJS) 42 | ar rs $@ $^ 43 | 44 | 45 | all: libboost_python.dylib libboost_python.a 46 | -include $(DEPS) 47 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to produce Makefile.in 2 | # Makefile for the top-level source directory 3 | 4 | AUTOMAKE_OPTIONS = foreign dist-bzip2 5 | 6 | SUBDIRS = site-packages/visual site-packages/vis src 7 | 8 | # Logic to distribute the header files and miscellaneous files. 9 | EXTRA_DIST = include HACKING.txt INSTALL.txt \ 10 | authors.txt license.txt NEWS.txt \ 11 | dependencies/Readme.txt dependencies/threadpool 12 | dist-hook: 13 | rm -rf `find $(distdir)/include -name CVS` $(distdir)/include/config.h 14 | 15 | # Logic to install the "vpython" script 16 | bin_SCRIPTS = bin/vpython 17 | 18 | if BUILD_EXAMPLES 19 | SUBDIRS += examples 20 | endif 21 | 22 | ##if BUILD_VIDLE 23 | ##SUBDIRS += site-packages/vidle 24 | ##endif 25 | 26 | if BUILD_DOCS 27 | SUBDIRS += docs 28 | endif 29 | 30 | -------------------------------------------------------------------------------- /VCBuild/cvisual.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 10.00 2 | # Visual C++ Express 2008 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cvisual", "cvisual.vcproj", "{6B195417-DC9C-499D-A16E-31FB23D526DF}" 4 | EndProject 5 | Global 6 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 7 | Debug|Win32 = Debug|Win32 8 | Release|Win32 = Release|Win32 9 | EndGlobalSection 10 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 11 | {6B195417-DC9C-499D-A16E-31FB23D526DF}.Debug|Win32.ActiveCfg = Debug|Win32 12 | {6B195417-DC9C-499D-A16E-31FB23D526DF}.Debug|Win32.Build.0 = Debug|Win32 13 | {6B195417-DC9C-499D-A16E-31FB23D526DF}.Release|Win32.ActiveCfg = Release|Win32 14 | {6B195417-DC9C-499D-A16E-31FB23D526DF}.Release|Win32.Build.0 = Release|Win32 15 | EndGlobalSection 16 | GlobalSection(SolutionProperties) = preSolution 17 | HideSolutionNode = FALSE 18 | EndGlobalSection 19 | EndGlobal 20 | -------------------------------------------------------------------------------- /VCBuild/cvisual26.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 10.00 3 | # Visual C++ Express 2008 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cvisual", "cvisual26.vcproj", "{6B195417-DC9C-499D-A16E-31FB23D526DF}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {6B195417-DC9C-499D-A16E-31FB23D526DF}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {6B195417-DC9C-499D-A16E-31FB23D526DF}.Debug|Win32.Build.0 = Debug|Win32 14 | {6B195417-DC9C-499D-A16E-31FB23D526DF}.Release|Win32.ActiveCfg = Release|Win32 15 | {6B195417-DC9C-499D-A16E-31FB23D526DF}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /VCBuild/cvisual27.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 10.00 3 | # Visual C++ Express 2008 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cvisual", "cvisual27.vcproj", "{6B195417-DC9C-499D-A16E-31FB23D526DF}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {6B195417-DC9C-499D-A16E-31FB23D526DF}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {6B195417-DC9C-499D-A16E-31FB23D526DF}.Debug|Win32.Build.0 = Debug|Win32 14 | {6B195417-DC9C-499D-A16E-31FB23D526DF}.Release|Win32.ActiveCfg = Release|Win32 15 | {6B195417-DC9C-499D-A16E-31FB23D526DF}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /VCBuild/cvisual3.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 10.00 3 | # Visual C++ Express 2008 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cvisual", "cvisual3.vcproj", "{6B195417-DC9C-499D-A16E-31FB23D526DF}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {6B195417-DC9C-499D-A16E-31FB23D526DF}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {6B195417-DC9C-499D-A16E-31FB23D526DF}.Debug|Win32.Build.0 = Debug|Win32 14 | {6B195417-DC9C-499D-A16E-31FB23D526DF}.Release|Win32.ActiveCfg = Release|Win32 15 | {6B195417-DC9C-499D-A16E-31FB23D526DF}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /VCBuild/cvisual32.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 10.00 3 | # Visual C++ Express 2008 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cvisual", "cvisual32.vcproj", "{6B195417-DC9C-499D-A16E-31FB23D526DF}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {6B195417-DC9C-499D-A16E-31FB23D526DF}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {6B195417-DC9C-499D-A16E-31FB23D526DF}.Debug|Win32.Build.0 = Debug|Win32 14 | {6B195417-DC9C-499D-A16E-31FB23D526DF}.Release|Win32.ActiveCfg = Release|Win32 15 | {6B195417-DC9C-499D-A16E-31FB23D526DF}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /authors.txt: -------------------------------------------------------------------------------- 1 | Original author of the Visual module: 2 | David Scherer 3 | 4 | Other members of the original design team at Carnegie Mellon: 5 | David Andersen 6 | Ruth Chabay 7 | Ari Heitner 8 | Ian Peters 9 | Bruce Sherwood 10 | 11 | Current maintainers: 12 | Jonathan Brandmeyer 13 | Bruce Sherwood 14 | 15 | Other contributors to the Visual module: 16 | Hugh Fisher (stereo code) 17 | Shaun Press (the pyramid and ellipsoid objects) 18 | John Zelle (stereo code) 19 | -------------------------------------------------------------------------------- /compilevisual.py: -------------------------------------------------------------------------------- 1 | from visual.graph import * 2 | from visual.controls import * 3 | from visual.filedialog import * 4 | from visual.factorial import * 5 | text(text="3D", color=color.red, material=materials.wood) 6 | print(factorial(4)) 7 | print('version', version) 8 | get_file() 9 | 10 | # Run this little program to compile all the visual modules. 11 | # This is part of the production of a VPython installer for Windows. 12 | -------------------------------------------------------------------------------- /dependencies/Readme.txt: -------------------------------------------------------------------------------- 1 | Files in this directory are not part of the VPython project, are not maintained by us, 2 | but are included in CVS for the convenience of developers. 3 | 4 | ---------- 5 | threadpool 6 | ---------- 7 | 8 | From threadpool.sf.net. A very simple thread pooling library based on Boost.Thread (no 9 | platform dependent code). Might become part of boost someday. 10 | 11 | The version of threadpool must match the version of Boost. 12 | Go to http://sourceforge.net/projects/threadpool and choose Download, 13 | then click the threadpool link in the Package column. 14 | Click on the "clipboard" icon for each package to see what Boost version is required. 15 | As of March 2009, here is what one finds: 16 | 0.2.5 boost::thread 1.37 17 | 0.2.4 boost::thread 1.35 18 | 19 | -------------------------------------------------------------------------------- /dependencies/threadpool/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2005-2007 Philipp Henkel 2 | 3 | Use, modification, and distribution are subject to the 4 | Boost Software License, Version 1.0. (See accompanying file 5 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -------------------------------------------------------------------------------- /dependencies/threadpool/LICENSE_1_0.txt: -------------------------------------------------------------------------------- 1 | Boost Software License - Version 1.0 - August 17th, 2003 2 | 3 | Permission is hereby granted, free of charge, to any person or organization 4 | obtaining a copy of the software and accompanying documentation covered by 5 | this license (the "Software") to use, reproduce, display, distribute, 6 | execute, and transmit the Software, and to prepare derivative works of the 7 | Software, and to permit third-parties to whom the Software is furnished to 8 | do so, all subject to the following: 9 | 10 | The copyright notices in the Software and this entire statement, including 11 | the above license grant, this restriction and the following disclaimer, 12 | must be included in all copies of the Software, in whole or in part, and 13 | all derivative works of the Software, unless such copies or derivative 14 | works are solely in the form of machine-executable object code generated by 15 | a source language processor. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 20 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 21 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 22 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /dependencies/threadpool/README: -------------------------------------------------------------------------------- 1 | threadpool 2 | 3 | Copyright (c) 2005-2007 Philipp Henkel 4 | 5 | threadpool is a cross-platform C++ thread pool library and released under the Boost Software License. 6 | 7 | See doc/index.html for information on: 8 | - API documentation and a tutorial 9 | - External dependencies 10 | - Using threadpool 11 | -------------------------------------------------------------------------------- /dependencies/threadpool/TODO: -------------------------------------------------------------------------------- 1 | threadpool to-do items 2 | ====================== 3 | 4 | Documentation 5 | -------------------------------------------- 6 | - Source code documentation 7 | - Design rationale 8 | - Tutorial 9 | - Finish Quickstart Tutorial/Example 10 | 11 | Functionality 12 | -------------------------------------------- 13 | - Implement a size policy which dynamically 14 | increase/decrease the pool's size: 15 | - init with min/max threads 16 | - auto increase 17 | - auto decrease (using timed cleanup tasks) 18 | - Add some kind of deadline scheduler 19 | - Add futures to pool 20 | 21 | 22 | Examples 23 | -------------------------------------------- 24 | - Buffering Client Requests: Handle 'bursty' client traffic 25 | Some applications need more buffering than is provided by OS I/O subsystem 26 | 27 | Working on 'active' buffer for boost::iostreams 28 | buffer_filter which provides a dynamic amount of buffer objects. 29 | buffer_filter uses a threadpool with one thread which provides the buffers to 30 | consumer. (TODO Philipp) 31 | 32 | 2nd implemention step: 33 | Flexbile configuration: Buffer capacities can be configured according to 34 | - maximum number of requests 35 | - maximum number of bytes 36 | 37 | -------------------------------------------------------------------------------- /dependencies/threadpool/include/threadpool.hpp: -------------------------------------------------------------------------------- 1 | /*! \file 2 | * \brief Main include. 3 | * 4 | * This is the only file you have to include in order to use the 5 | * complete threadpool library. 6 | * 7 | * Copyright (c) 2005-2007 Philipp Henkel 8 | * 9 | * Use, modification, and distribution are subject to the 10 | * Boost Software License, Version 1.0. (See accompanying file 11 | * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 12 | * 13 | * http://threadpool.sourceforge.net 14 | * 15 | */ 16 | 17 | #ifndef THREADPOOL_HPP_INCLUDED 18 | #define THREADPOOL_HPP_INCLUDED 19 | 20 | #include "threadpool/future.hpp" 21 | #include "threadpool/pool.hpp" 22 | 23 | #include "threadpool/pool_adaptors.hpp" 24 | #include "threadpool/task_adaptors.hpp" 25 | 26 | 27 | #endif // THREADPOOL_HPP_INCLUDED 28 | 29 | -------------------------------------------------------------------------------- /dependencies/threadpool/include/threadpool/detail/scope_guard.hpp: -------------------------------------------------------------------------------- 1 | /*! \file 2 | * \brief TODO. 3 | * 4 | * TODO. 5 | * 6 | * Copyright (c) 2005-2007 Philipp Henkel 7 | * 8 | * Use, modification, and distribution are subject to the 9 | * Boost Software License, Version 1.0. (See accompanying file 10 | * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 11 | * 12 | * http://threadpool.sourceforge.net 13 | * 14 | */ 15 | 16 | 17 | #ifndef THREADPOOL_DETAIL_SCOPE_GUARD_HPP_INCLUDED 18 | #define THREADPOOL_DETAIL_SCOPE_GUARD_HPP_INCLUDED 19 | 20 | 21 | 22 | #include 23 | 24 | 25 | namespace boost { namespace threadpool { namespace detail 26 | { 27 | 28 | // TODO documentation 29 | class scope_guard 30 | : private boost::noncopyable 31 | { 32 | function0 const m_function; 33 | bool m_is_active; 34 | 35 | public: 36 | scope_guard(function0 const & call_on_exit) 37 | : m_function(call_on_exit) 38 | , m_is_active(true) 39 | { 40 | } 41 | 42 | ~scope_guard() 43 | { 44 | if(m_is_active && m_function) 45 | { 46 | m_function(); 47 | } 48 | } 49 | 50 | void disable() 51 | { 52 | m_is_active = false; 53 | } 54 | }; 55 | 56 | 57 | 58 | 59 | 60 | 61 | } } } // namespace boost::threadpool::detail 62 | 63 | #endif // THREADPOOL_DETAIL_SCOPE_GUARD_HPP_INCLUDED 64 | 65 | 66 | -------------------------------------------------------------------------------- /examples/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to produce Makefile.in 2 | # Makefile to distribute the example programs 3 | 4 | AUTOMAKE_OPTIONS = foreign 5 | srcdir = @srcdir@ 6 | VPATH = @srcdir@ 7 | 8 | if BUILD_EXAMPLES 9 | examplefiles = bounce.py bounce2.py boxlighttest.py colorsliders.py \ 10 | conch.py controlstest.py \ 11 | convex.py crossproduct.py crystal.py differential_gear.py \ 12 | dipole.py doublependulum.py drape.py \ 13 | electric_motor.py extruded_columns.py extrusion_overview.py extrusion_examples.py \ 14 | faces_cone.py faces_heightfield.py flower128.tga gas.py glinfo.py \ 15 | graphtest.py gyro.py gyro2.py hanoi.py labels.py lathe.py \ 16 | lorenz.py mandelbrot.py material_test.py medusa.py \ 17 | orbit.py planar.py randombox.py stars.py \ 18 | stonehenge.py text3D.py texttest.py texture_and_lighting.py \ 19 | texturetest.py tictac.py tictacdat.py \ 20 | toroid_drag.py toroid.py wave.py 21 | else 22 | examplefiles = 23 | endif 24 | 25 | pkgdatadir = @visualexampledir@ 26 | 27 | dist_pkgdata_DATA = $(examplefiles) 28 | -------------------------------------------------------------------------------- /examples/bounce.py: -------------------------------------------------------------------------------- 1 | from visual import * 2 | 3 | floor = box(length=4, height=0.5, width=4, color=color.blue) 4 | 5 | ball = sphere(pos=(0,4,0), color=color.red) 6 | ball.velocity = vector(0,-1,0) 7 | 8 | dt = 0.01 9 | while 1: 10 | rate(100) 11 | ball.pos = ball.pos + ball.velocity*dt 12 | if ball.y < 1: 13 | ball.velocity.y = -ball.velocity.y 14 | else: 15 | ball.velocity.y = ball.velocity.y - 9.8*dt 16 | -------------------------------------------------------------------------------- /examples/bounce2.py: -------------------------------------------------------------------------------- 1 | from visual import * 2 | 3 | print(""" 4 | Right button drag to rotate "camera" to view scene. 5 | On a one-button mouse, right is Command + mouse. 6 | Middle button to drag up or down to zoom in or out. 7 | On a two-button mouse, middle is left + right. 8 | On a one-button mouse, middle is Option + mouse. 9 | """) 10 | 11 | side = 4.0 12 | thk = 0.3 13 | s2 = 2*side - thk 14 | s3 = 2*side + thk 15 | wallR = box (pos=( side, 0, 0), length=thk, height=s2, width=s3, color = color.red) 16 | wallL = box (pos=(-side, 0, 0), length=thk, height=s2, width=s3, color = color.red) 17 | wallB = box (pos=(0, -side, 0), length=s3, height=thk, width=s3, color = color.blue) 18 | wallT = box (pos=(0, side, 0), length=s3, height=thk, width=s3, color = color.blue) 19 | wallBK = box(pos=(0, 0, -side), length=s2, height=s2, width=thk, color = (0.7,0.7,0.7)) 20 | 21 | ball = sphere (color = color.green, radius = 0.4) 22 | ball.mass = 1.0 23 | ball.p = vector (-0.15, -0.23, +0.27) 24 | 25 | side = side - thk*0.5 - ball.radius 26 | 27 | dt = 0.5 28 | t=0.0 29 | while True: 30 | rate(100) 31 | t = t + dt 32 | ball.pos = ball.pos + (ball.p/ball.mass)*dt 33 | if not (side > ball.x > -side): 34 | ball.p.x = -ball.p.x 35 | if not (side > ball.y > -side): 36 | ball.p.y = -ball.p.y 37 | if not (side > ball.z > -side): 38 | ball.p.z = -ball.p.z 39 | -------------------------------------------------------------------------------- /examples/boxlighttest.py: -------------------------------------------------------------------------------- 1 | from visual import * 2 | 3 | # Mikhail Temkine, University of Toronto, April 2007 4 | 5 | print(""" 6 | Box lighting test 7 | """) 8 | 9 | r = 3 10 | a1 = a2 = a3 = 0.0 11 | 12 | arrow(pos=(0, 4, 0), axis=(0, 1, 0), color=color.red) 13 | boxy = box(size=(3,3,3), color=(0.5, 0.5, 0.5), material=materials.rough) 14 | b1 = sphere(radius=0.3, pos=(r, 0, 0), 15 | color=color.magenta, material=materials.emissive) 16 | b2 = sphere(radius=0.3, pos=(0, 0, r), 17 | color=color.yellow, material=materials.emissive) 18 | b3 = arrow(radius=0.3, pos=(0, 0, r), 19 | color=color.green, material=materials.emissive) 20 | l1 = local_light(pos=b1.pos, color=b1.color) 21 | l2 = local_light(pos=b2.pos, color=b2.color) 22 | l3 = distant_light(direction=b3.pos, color=b3.color) 23 | 24 | while True: 25 | rate(100) 26 | l1.pos = b1.pos = r*vector(cos(a1), sin(a1), b1.z) 27 | a1 += 0.02 28 | l2.pos = b2.pos = (r+0.4)*vector(b2.x, sin(a2), cos(a2)) 29 | a2 += 0.055 30 | l3.direction = b3.pos = (r+3)*vector(sin(a3), b3.y, cos(a3)) 31 | b3.axis = b3.pos * -0.3 32 | a3 += 0.033 33 | 34 | -------------------------------------------------------------------------------- /examples/conch.py: -------------------------------------------------------------------------------- 1 | from visual import * 2 | # Kadir Haldenbilen, Feb. 2011 3 | 4 | scene.height = scene.width = 800 5 | scene.center = (0.3,-2.4,0) 6 | 7 | def spiral(nloop=1, tightness=1.0, dir=1.0, scale=1.0): 8 | 9 | spr = [] 10 | scale = [] 11 | clrs = [] 12 | zd = 0.01 13 | for t in range(1, 1024*nloop, 16): 14 | t *= 0.01 15 | x = tightness/10.0 * t * math.cos(t)*dir 16 | y = tightness/10.0 * t * math.sin(t) 17 | sc = sqrt(x*x+y*y) 18 | z = t/7.0 19 | spr.append((x,y,z)) 20 | clr = vector((z*cos(t), abs(sin(t)),abs(cos(t*2)))).norm() 21 | clrs.append(clr) 22 | scale.append((sc,sc)) 23 | return spr, scale, clrs 24 | 25 | path, scale, clrs = spiral(nloop=2, tightness=0.8) 26 | elps = shapes.circle(radius=0.69, thickness=0.01) 27 | 28 | ee = extrusion(frame=frame(), shape=elps, pos=path, scale=scale, color=clrs, material=materials.marble) 29 | ee.frame.rotate(angle=pi/2) 30 | 31 | -------------------------------------------------------------------------------- /examples/convex.py: -------------------------------------------------------------------------------- 1 | from visual import * 2 | from random import uniform 3 | 4 | # David Scherer 5 | 6 | scene.range = 3 7 | 8 | a = convex(color=(0.5,0,0)) 9 | b = convex(color=(0,0.5,0)) 10 | c = convex(color=(0,0,0.5)) 11 | d = convex(color=(0.5,0,0.5)) 12 | e = convex(color=(0.5,0.5,0)) 13 | f = convex(color=(0,0.5,0.5)) 14 | 15 | # circle 16 | t = arange(0,2*pi,0.1) 17 | e.pos = transpose( (sin(t), cos(t)+2, 0*t) ) 18 | 19 | # triangle 20 | t = arange(0,2*pi,2*pi/3) 21 | f.pos = transpose( (sin(t)-2, cos(t)+2, 0*t) ) 22 | 23 | # disk 24 | for t in arange(0,2*pi,0.1): 25 | a.append(pos = (cos(t),0,sin(t))) 26 | a.append(pos = (cos(t),0.2,sin(t))) 27 | 28 | # box 29 | for i in range(8): 30 | p = vector((i/4)%2 - 2.5, (i/2)%2 - 0.5, (i)%2 - 0.5) 31 | b.append(pos=p) 32 | 33 | # random sphere 34 | L = [] 35 | for i in range(1000): 36 | L.append(vector(2,0) + norm(vector(uniform(-1,1),uniform(-1,1),uniform(-1,1)))) 37 | c.pos = L 38 | 39 | # lat/long sphere 40 | L = [] 41 | for t in arange(0,2*pi,0.2): 42 | for s in arange(0,pi,0.1): 43 | L.append((cos(t)*sin(s)+2, sin(t)*sin(s)+2, cos(s))) 44 | d.pos = L 45 | 46 | # modify the disk 47 | p = a 48 | p.color = (p.color[0]*2, p.color[1]*2, p.color[2]*2) 49 | while 1: 50 | rate(10) 51 | if scene.mouse.clicked: 52 | c = scene.mouse.getclick() 53 | p.append(pos=c.pos) 54 | p.pos[-1] = scene.mouse.pos 55 | -------------------------------------------------------------------------------- /examples/dipole.py: -------------------------------------------------------------------------------- 1 | from visual import * 2 | 3 | print(""" 4 | Click to plot a normalized electric field vector. 5 | Vectors are blue if low magnitude, red if high. 6 | Right button drag to rotate camera to view scene. 7 | On a one-button mouse, right is Command + mouse. 8 | Middle button drag up or down to zoom in or out. 9 | On a two-button mouse, middle is left + right. 10 | On a one-button mouse, middle is Option + mouse. 11 | """) 12 | 13 | ec = 1.6e-19 # electron charge 14 | 15 | scene.title="Electric Field Vectors" 16 | scene.range = 2e-13 17 | 18 | charges = [ sphere( pos = (-1e-13,0,0), Q = ec, color=color.red, radius = 6e-15 ), 19 | sphere( pos = ( 1e-13,0,0), Q = -ec, color=color.blue, radius = 6e-15 ), 20 | ] 21 | 22 | def getfield(p): 23 | f = vector(0,0,0) 24 | for c in charges: 25 | f = f + (p-c.pos) * 8.988e9 * c.Q / mag(p-c.pos)**3 26 | return f 27 | 28 | while True: 29 | p = scene.mouse.getclick().pos 30 | f = getfield(p) 31 | m = mag(f) 32 | red = maximum( 1-1e17/m, 0 ) 33 | blue = minimum( 1e17/m, 1 ) 34 | if red >= blue: 35 | blue = blue/red 36 | red = 1.0 37 | else: 38 | red = red/blue 39 | blue = 1.0 40 | arrow( pos=p, axis=f * (4e-14/1e17), 41 | shaftwidth = 6e-15, 42 | color=(red,0,blue)) 43 | -------------------------------------------------------------------------------- /examples/faces_cone.py: -------------------------------------------------------------------------------- 1 | from visual import * 2 | # Example of use of faces object for building arbitrary shapes (here, a cone) 3 | # David Scherer July 2001 4 | 5 | f = frame() 6 | 7 | box( size=(0.5,0.5,0.5) ) 8 | 9 | # Make a cone (smooth shading, no bottom, normals are not quite physical) 10 | 11 | N = 20 12 | 13 | try: # numpy 14 | model = faces( pos = zeros( (N*3,3), float ), frame = f ) 15 | except: # older Numeric 16 | model = faces( pos = zeros( (N*3,3), Float ), frame = f ) 17 | 18 | t = arange(0,2*pi+2*pi/N,2*pi/N) 19 | 20 | # Vertex 0 of triangles 21 | model.pos[0::3, 0] = sin(t[:-1]) 22 | model.pos[0::3, 2] = cos(t[:-1]) 23 | 24 | # Vertex 1 of triangles 25 | model.pos[1::3, 0] = sin(t[1:]) 26 | model.pos[1::3, 2] = cos(t[1:]) 27 | 28 | # Vertex 2 of triangles (point of cone) 29 | model.pos[2::3, 1] = 2 30 | 31 | # Construct normals to the edges of the triangles 32 | model.normal = model.pos 33 | model.normal[2::3,0] = sin(t[1:]) 34 | model.normal[0::1,1] = 0.5 35 | model.normal[2::3,2] = cos(t[1:]) 36 | 37 | # Give each face a hue running from 0 to 1 38 | model.color = model.pos 39 | for vertex in range(3*N): 40 | hue = float(vertex // 3)/N 41 | model.color[vertex] = color.hsv_to_rgb((hue,1,1)) 42 | 43 | ##model.color = model.pos/2 + (0.5,0,0.5) # alternative coloring 44 | 45 | while True: 46 | rate(100) 47 | f.rotate(angle=0.01) 48 | -------------------------------------------------------------------------------- /examples/flower128.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vpython/visual/e856d1b89d8ab0484409f4be7931326ed546e9a2/examples/flower128.tga -------------------------------------------------------------------------------- /examples/glinfo.py: -------------------------------------------------------------------------------- 1 | from visual import * 2 | import sys, os, time 3 | 4 | print("This test of OpenGL options is useful mainly on Windows.") 5 | print() 6 | 7 | def print_mtime(f): 8 | try: 9 | print(" %-30s %s" % (f, time.ctime(os.path.getmtime(f)))) 10 | except: 11 | pass 12 | 13 | tried = {} 14 | paths = sys.path 15 | try: 16 | windir = os.environ['windir'] 17 | paths = paths + [os.path.join(windir,'system'), 18 | os.path.join(windir,'system32')] 19 | except: 20 | print('Windows directory not found.') 21 | 22 | for dir in paths: 23 | for file in ['cvisual.dll', 'visual\\__init__.py', 'visual\\graph.py', 'opengl32.dll']: 24 | f = os.path.normcase(os.path.normpath(os.path.join(dir, file))) 25 | if f not in tried: 26 | tried[f] = print_mtime(f) 27 | 28 | scene.title = "Renderer test" 29 | scene.height = 2 30 | scene.visible = 1 31 | print(scene.info()) 32 | scene.visible = 0 33 | -------------------------------------------------------------------------------- /examples/graphtest.py: -------------------------------------------------------------------------------- 1 | from visual.graph import * 2 | 3 | # Using a graph-plotting module 4 | 5 | # If xmax, xmin, ymax, or ymin specified, the related axis is not autoscaled 6 | # Can turn off autoscaling with 7 | # oscillation.autoscale[0]=0 for x or oscillation.autoscale[1]=0 for y 8 | oscillation = gdisplay(xtitle='Time', ytitle='Response (click and drag mouse to see coordinates)') 9 | funct1 = gcurve(color=color.cyan) 10 | funct2 = gvbars(delta=0.5, color=color.red) 11 | funct3 = gdots(color=color.yellow) 12 | 13 | for t in arange(-30, 74, 1): 14 | funct1.plot( pos=(t, 5.0+5.0*cos(-0.2*t)*exp(0.015*t)) ) 15 | funct2.plot( pos=(t, 2.0+5.0*cos(-0.1*t)*exp(0.015*t)) ) 16 | funct3.plot( pos=(t, 5.0*cos(-0.03*t)*exp(0.015*t)) ) 17 | 18 | histo = gdisplay(title='Histogram', x=0, y=400, width=800,height=400) 19 | datalist1 = [5, 37, 12, 21, 25, 28, 8, 63, 52, 75, 7] 20 | data = ghistogram(bins=arange(-20, 80, 10), color=color.red) 21 | data.plot(data=datalist1) 22 | datalist2 = [7, 23, 25, 72, -15] 23 | data.plot(data=datalist2, accumulate=1) 24 | 25 | -------------------------------------------------------------------------------- /examples/labels.py: -------------------------------------------------------------------------------- 1 | from visual import * 2 | 3 | x = arrow( color=color.red) 4 | 5 | tip = label( text="tip", space=0.2, pos=(1,0), opacity=0.5) 6 | tail = label( text="tail", xoffset=20, yoffset=10, opacity=0.5) 7 | midp = label( text="a\nmidpoint", xoffset=10, yoffset=20, pos=(.5,0), opacity=0.5) 8 | 9 | print("""You should see a single arrow with three labels attached to it. 10 | Each label is translucent. The one at the tip should be centered at 11 | the tip. The head and tail labels have a single line of text. 12 | The midpoint label has two.""") 13 | -------------------------------------------------------------------------------- /examples/lathe.py: -------------------------------------------------------------------------------- 1 | from visual import * 2 | 3 | # Create a surface of revolution out of slices that are convex objects 4 | # By David Scherer 5 | 6 | def draw_slice(sweep, r, axis, frame, color): 7 | # comment in this line to see where the slices are: 8 | #color=(uniform(0,1),uniform(0,1),uniform(0,1)) 9 | 10 | ls = len(sweep) 11 | pos = zeros( (len(r)*ls, 3), float64 ) 12 | for j in range(len(r)): 13 | pos[j*ls:j*ls+ls] = sweep*r[j] + (axis[j],0,0) 14 | return convex(pos=pos, 15 | frame = frame, 16 | color = color, 17 | ) 18 | 19 | def revolution(radius, length, slices=32, color = (1,1,1), pos = (0,0,0)): 20 | r = absolute(radius) # radius is a list of radii for all the slices 21 | 22 | # sweep = unit circle in the yz plane 23 | t = arange(0,2*pi,2*pi/slices) 24 | sweep = zeros( (slices,3), float64) # Numeric array (rows=slices)*(columns=3) 25 | sweep[:,1] = cos(t) # set middle column to cos(t) 26 | sweep[:,2] = sin(t) # set final column to sin(t) 27 | 28 | # axis[i] = center of the ith slice of the surface 29 | axis = arange(0,length,float(length)/len(r)) 30 | 31 | group = frame(pos = pos) 32 | 33 | start = 0 34 | for i in range(1,len(r)-1): 35 | # if concave, show all convex slices up this point 36 | if (r[i+1] + r[i-1] - 2*r[i]) >= 0: # have encountered concave region 37 | draw_slice(sweep,r[start:i],axis[start:i], group, color) 38 | start = i-1 39 | draw_slice(sweep,r[start:],axis[start:], group, color) 40 | 41 | return group 42 | 43 | if __name__ == '__main__': 44 | scene.autocenter = True 45 | t = arange(0,1,0.02) 46 | s = revolution(sin(t*12.)*0.5 + 1.0, 5.0, pos=(3,0,0), color=color.red) 47 | s.axis = (0,1,0) 48 | 49 | glass = revolution( [0.5, 0.1, 0.1, 0.1, 0.1, 0.2, 0.3, 0.4, 0.5], 50 | length=5.0, 51 | color=color.yellow) 52 | glass.axis = (0,1,0) 53 | -------------------------------------------------------------------------------- /examples/lorenz.py: -------------------------------------------------------------------------------- 1 | from visual import * 2 | 3 | print(""" 4 | Right button drag to rotate "camera" to view scene. 5 | On a one-button mouse, right is Command + mouse. 6 | Middle button to drag up or down to zoom in or out. 7 | On a two-button mouse, middle is left + right. 8 | On a one-button mouse, middle is Option + mouse. 9 | """) 10 | scene.title = "Lorenz differential equation" 11 | scene.center = vector(25,0,0) 12 | 13 | lorenz = curve( color = color.black, radius=0.3 ) 14 | 15 | # Draw grid 16 | for x in arange(0,51,10): 17 | box(pos=(x,0,0), axis=(0,0,50), height=0.4, width=0.4, color=(0.6,0.6,0.6) ) 18 | for z in arange(-25,26,10): 19 | box(pos=(25,0,z), axis=(50,0,0), height=0.4, width=0., color=(0.6,0.6,0.6) ) 20 | 21 | dt = 0.01 22 | y = vector(35, -10, -7) 23 | 24 | for t in arange(0,10,dt): 25 | # Integrate a funny differential equation 26 | dydt = vector( - 8.0/3*y[0] + y[1]*y[2], 27 | - 10*y[1] + 10*y[2], 28 | - y[1]*y[0] + 28*y[1] - y[2] ); 29 | y = y + dydt*dt 30 | 31 | # Draw lines colored by speed 32 | c = clip( [mag(dydt) * 0.005], 0, 1 )[0] 33 | 34 | lorenz.append( pos=y, color=(c,0, 1-c) ) 35 | 36 | rate( 500 ) 37 | -------------------------------------------------------------------------------- /examples/mandelbrot.py: -------------------------------------------------------------------------------- 1 | from __future__ import division 2 | from visual.graph import * 3 | 4 | # Bruce Sherwood, Jan. 1, 2008 5 | # Use points object to make a pixel-like plot of a fractal 6 | 7 | XMIN = -2 8 | XMAX = 0.5 9 | YMIN = -1 10 | YMAX = 1 11 | g = gdisplay(width=750, height=600, xmin=XMIN, xmax=XMAX, ymin=YMIN, ymax=YMAX) 12 | pixels = gdots(shape='square', size=2) 13 | # Scale factor: 2 units (YMAX-YMIN) equals 600 screen pixels 14 | # Plot 2 by 2 gdots points 2*(2units/600pixels) apart: 15 | r = 2*2/600 16 | 17 | # Mandelbrot set (see Wikipedia, for example): 18 | max_iteration = 100 19 | for y0 in arange(YMIN, YMAX, r): # range over all pixel positions 20 | for x0 in arange(XMIN, XMAX, r): 21 | z = z0 = complex(x0,y0) 22 | iteration = 0 23 | while ( abs(z) < 2 and iteration < max_iteration): 24 | z = z*z+z0 25 | iteration += 1 26 | # Leave points black if the iteration quickly escapes: 27 | if (.1 < iteration/max_iteration < 1): 28 | c = color.hsv_to_rgb((iteration/max_iteration-.1,1,1)) 29 | pixels.plot(pos=(x0,y0), color=c) 30 | 31 | -------------------------------------------------------------------------------- /examples/orbit.py: -------------------------------------------------------------------------------- 1 | from visual import * 2 | 3 | G = 6.7e-11 4 | 5 | giant = sphere(pos=(-1e11,0,0), radius=2e10, color=color.red, 6 | make_trail=True, interval=10) 7 | giant.mass = 2e30 8 | giant.p = vector(0, 0, -1e4) * giant.mass 9 | 10 | dwarf = sphere(pos=(1.5e11,0,0), radius=1e10, color=color.yellow, 11 | make_trail=True, interval=10) 12 | dwarf.mass = 1e30 13 | dwarf.p = -giant.p 14 | 15 | dt = 1e5 16 | 17 | while True: 18 | rate(200) 19 | 20 | dist = dwarf.pos - giant.pos 21 | force = G * giant.mass * dwarf.mass * dist / mag(dist)**3 22 | giant.p = giant.p + force*dt 23 | dwarf.p = dwarf.p - force*dt 24 | 25 | for star in [giant, dwarf]: 26 | star.pos = star.pos + star.p/star.mass * dt 27 | 28 | -------------------------------------------------------------------------------- /examples/planar.py: -------------------------------------------------------------------------------- 1 | from visual import * 2 | from random import uniform, randint 3 | 4 | scene.forward = (-0.25,-0.25,-1) 5 | 6 | nboxes = 8 7 | nlinks = 16 8 | maxgrid = 10 9 | 10 | # Create some random cylinders: 11 | nodes = [] 12 | for t in arange(-pi,pi,2*pi/nboxes): 13 | b = cylinder( pos=(10*sin(t),0,10*cos(t)) ) 14 | b.color = b.icolor = (0.5,0.5,1) 15 | height = uniform(0.5,4) 16 | b.axis = (0,height,0) 17 | nodes.append( b ) 18 | 19 | # Create some random links: 20 | links = [] 21 | for l in range(nlinks): 22 | i = randint(0,nboxes-1) 23 | j = randint(0,nboxes-1) 24 | c = curve( ends=[nodes[i].pos,nodes[j].pos], radius=0.2 ) 25 | c.red = 0 26 | c.green = uniform(0.3,1) 27 | c.blue = 0 28 | c.pos = c.ends 29 | links.append(c) 30 | 31 | # Draw a grid: 32 | for i in range(maxgrid+1): 33 | curve(pos=[(2*i-maxgrid,0,-maxgrid),(2*i-maxgrid,0,maxgrid)], color=color.cyan) 34 | curve(pos=[(-maxgrid,0,2*i-maxgrid),(maxgrid,0,2*i-maxgrid)], color=color.cyan) 35 | box(pos=(0,-0.6,0),width=2*maxgrid,length=2*maxgrid,height=1,color=(0,0,0.1)) 36 | 37 | # Drag and drop loop 38 | drag = None 39 | while True: 40 | rate(100) 41 | if scene.mouse.events: 42 | c = scene.mouse.getevent() 43 | if drag and (c.drop or c.click): # drop the selected object 44 | newpos = c.project(normal=scene.up, d=yoffset)+offset 45 | if abs(newpos.x)<=maxgrid and abs(newpos.z)<=maxgrid: 46 | drag.pos = newpos 47 | drag.color = drag.icolor 48 | drag = None 49 | elif c.pick and hasattr(c.pick,"icolor"): # pick up the object 50 | drag = c.pick 51 | drag.color = color.white 52 | yoffset = c.pickpos.y 53 | offset = drag.pos-c.project(normal=scene.up, d=yoffset) 54 | if drag: 55 | newpos = scene.mouse.project(normal=scene.up, d=yoffset)+offset 56 | if abs(newpos.x)<=maxgrid and abs(newpos.z)<=maxgrid: 57 | drag.pos = newpos 58 | 59 | for lnk in links: lnk.pos = lnk.ends 60 | -------------------------------------------------------------------------------- /examples/randombox.py: -------------------------------------------------------------------------------- 1 | from visual import * 2 | from random import random, randrange 3 | 4 | ## this is mostly for experimenting with zooming and rotating 5 | 6 | print(""" 7 | Right button drag to rotate "camera" to view scene. 8 | On a one-button mouse, right is Command + mouse. 9 | Middle button to drag up or down to zoom in or out. 10 | On a two-button mouse, middle is left + right. 11 | On a one-button mouse, middle is Option + mouse. 12 | """) 13 | 14 | def random_box (): 15 | xx = randrange (-55,54) 16 | yy = randrange (-55,54) 17 | zz = randrange (-55,54) 18 | x = randrange (1,11) 19 | y = randrange (1,11) 20 | z = randrange (1,11) 21 | red = random() 22 | green = random() 23 | blue = random() 24 | box (pos = vector(xx,yy,zz), length=x, height=y, width=z, 25 | color=(red,green,blue)) 26 | 27 | def wirecube (s): 28 | c=curve (color=color.white, radius=1) 29 | pts = [(-s, -s, -s),(-s, -s, s), (-s, s, s), 30 | (-s, s, -s), (-s, -s, -s), (s, -s, -s), 31 | (s, s, -s), (-s, s, -s), (s, s, -s), 32 | (s, s, s), (-s, s, s), (s, s, s), 33 | (s, -s, s), (-s, -s, s), (s, -s, s),(s, -s, -s)] 34 | for pt in pts: 35 | c.append(pos=pt) 36 | 37 | scene.title = "Random Boxes" 38 | side=60. 39 | wirecube (side) 40 | i = 0 41 | while i < 100: 42 | random_box() 43 | i = i + 1 44 | 45 | arrow(axis = (0,12,0), shaftwidth = 3.5, color=color.red ) 46 | 47 | ball=sphere(pos=(-side/2.,-side/2.,-side/2.), color=(1,1,0), radius=3) 48 | disk=cylinder(pos=(side/2., side/2., -side/2.), color=(.3,.3,1), axis=(1,1,0), 49 | radius=5) 50 | xx=arange(0,4*pi,pi/10.) 51 | spring=curve(color=(1,.7,.1), radius=0.4) 52 | for y in xx: 53 | spring.append(pos=(20+cos(2*y), y/2.-30, -20+sin(2*y)+30)) 54 | -------------------------------------------------------------------------------- /examples/text3D.py: -------------------------------------------------------------------------------- 1 | from visual import * 2 | 3 | scene.height = 500 4 | scene.width = 800 5 | scene.range = 4 6 | scene.autocenter = True 7 | title = text(text="My text is\ngreen", align='center', depth=-0.3, color=color.green) 8 | vertical = (title.upper_left-title.start).norm() 9 | height = curve(color=color.yellow, radius=0.02, 10 | pos=[title.start-.2*title.axis, 11 | title.start-.2*title.axis+title.height*vertical]) 12 | lheight = label(pos=.5*(height.pos[0]+height.pos[1]), 13 | xoffset=-30, yoffset=+10, text='height') 14 | descent = curve(color=color.yellow, radius=0.02, 15 | pos=[title.start+0.2*title.axis, 16 | title.start+0.2*title.axis-title.descent*vertical]) 17 | ldescent = label(pos=.5*(descent.pos[0]+descent.pos[1]), 18 | xoffset=-20, yoffset=-40, text='descent') 19 | width = curve(color=color.yellow, radius=0.02, 20 | pos=[title.upper_left+0.1*vertical, title.upper_right+0.1*vertical]) 21 | lwidth = label(pos=.5*(width.pos[0]+width.pos[1]), 22 | xoffset=10, yoffset=40, text='width') 23 | verticalspacing = curve(color=color.yellow, radius=0.02, 24 | pos=[title.start+title.widths[0]*title.axis, 25 | title.start+title.widths[0]*title.axis-vector(0,title.vertical_spacing,0)]) 26 | lverticalspacing = label(pos=.5*(verticalspacing.pos[0]+verticalspacing.pos[1]), 27 | xoffset=-25, yoffset=20, text='vertical_spacing') 28 | ul = label(pos=title.upper_left, text='upper_left', 29 | xoffset=-30, yoffset=30) 30 | ur = label(pos=title.upper_right, text='upper_right', 31 | xoffset=30, yoffset=30) 32 | lr = label(pos=title.lower_right, text='lower_right', 33 | xoffset=30, yoffset=-30) 34 | ll = label(pos=title.lower_left, text='lower_left', 35 | xoffset=-30, yoffset=-30) 36 | lc = label(pos=title.pos, text="pos (align='"+title.align+"')", 37 | xoffset=-20, yoffset=-20) 38 | ls = label(pos=title.start, text='start', 39 | xoffset=-60, yoffset=-30) 40 | for s in [ul, ur, lr, ll, lc, ls]: 41 | sphere(pos=s.pos, radius=0.05, color=color.red) 42 | -------------------------------------------------------------------------------- /examples/texttest.py: -------------------------------------------------------------------------------- 1 | from visual.text import * 2 | 3 | print(""" 4 | This early 3D text machinery is limited to rather crude uppercase letters. 5 | It has been superceded by the text object introduced in Visual 5.3. 6 | """) 7 | 8 | # Display extruded text (uppercase only at present) 9 | # By default, display text along x axis, with letters pointing up parallel to y axis 10 | # Bruce Sherwood, Carnegie Mellon University, begun March 2000 11 | 12 | # Example with default values: 13 | # text(pos=(0,0,0), axis=(1,0,0), string='ABC', 14 | # height=1, depth=0, width=1, 15 | # color=currentdisplay.foreground, up=(0,1,0.3)) 16 | # axis is direction along which text advances 17 | # if width not specified, it is the same as height 18 | # depth is measured forward from pos 19 | # Only numbers and uppercase letters at present: others display as '*' 20 | 21 | scene.title = "3D Text" 22 | scene.fov = 0.001 23 | scene.range = 7 24 | text(pos=(0,3,0), string='ABC', color=color.red, depth=0.3, justify='center') 25 | text(pos=(0,-3,0), string='DEF', color=color.blue, depth=0.3, justify='center') 26 | message = text(pos=(0,0,0), string='CLICK TO CHANGE THIS', justify='center', 27 | color=color.yellow, axis=(1,0,1), 28 | depth=0.3, up=(0,1,-0.3)) 29 | scene.mouse.getclick() 30 | message.reshape(color=color.cyan, height=2) 31 | -------------------------------------------------------------------------------- /examples/texturetest.py: -------------------------------------------------------------------------------- 1 | from visual import * 2 | 3 | # Jonathan Brandmeyer 4 | scene.background = color.gray(0.8) 5 | 6 | checkerboard = array([[0,0,1,1], 7 | [0,0,1,1], 8 | [1,1,0,0], 9 | [1,1,0,0]], float) 10 | lum = materials.texture( data=checkerboard, 11 | mapping="rectangular", 12 | interpolate=False) 13 | op = materials.texture( data=checkerboard, 14 | channels=["luminance"], 15 | mapping="rectangular", 16 | interpolate=False) 17 | balp1 = box( axis=(0,0,1), color=color.orange, material=op) 18 | blum1 = box( axis=(0,0,1), color=color.orange, material=lum, pos=(-2, 0)) 19 | box( pos=(0, 2), color=color.orange, opacity=0.5) 20 | box( pos=(0,-2), color=color.orange) 21 | blum2 = box( pos=(0, 0, -2), axis=(0,0,1), color=color.orange, material=lum) 22 | z = arrow(color=color.green) 23 | z.axis *= 2 24 | 25 | scene.mouse.getclick() 26 | # Change the texture 27 | save = array(checkerboard[:,1]) 28 | checkerboard[:,1] = checkerboard[:,2] 29 | checkerboard[:,2] = save 30 | save = array(checkerboard[1,:]) 31 | checkerboard[1,:] = checkerboard[2,:] 32 | checkerboard[2,:] = save 33 | # Recreate and reassign the textures; Visual doesn't check for texture changes 34 | lum = materials.texture( data=checkerboard, 35 | mapping="rectangular", 36 | interpolate=False) 37 | op = materials.texture( mipmap=False, data=checkerboard, 38 | channels=["luminance"], 39 | mapping="rectangular", 40 | interpolate=False) 41 | balp1.material = op 42 | blum1.material = lum 43 | blum2.material = lum 44 | 45 | 46 | -------------------------------------------------------------------------------- /examples/toroid_drag.py: -------------------------------------------------------------------------------- 1 | from visual import * 2 | 3 | print(""" 4 | Drag or click to show the magnetic field interactively. 5 | Mark the magnetic field vector at the end of the drag. 6 | """) 7 | 8 | scene.width = 600 9 | scene.height = 600 10 | Rbig = 0.6 11 | L = 2*pi*Rbig 12 | Rsmall = 0.2 13 | k = 1E-7 # mu-zero/4pi 14 | I = 1.0 15 | Ncoils = 20 16 | Bscale = (2.*Rsmall)/(4*pi*1E-7*Ncoils*I/L) 17 | 18 | dphi = 2.*pi/Ncoils/50. 19 | phi = arange(0,2*pi+dphi,dphi) 20 | toroid=curve(x = Rbig*cos(phi)+Rsmall*cos(Ncoils*phi)*cos(phi), 21 | y = Rbig*sin(phi)+Rsmall*cos(Ncoils*phi)*sin(phi), 22 | z = -Rsmall*sin(Ncoils*phi)) 23 | toroid.color = (1,0.7,0.2) 24 | toroid.radius = 0.01 25 | 26 | delta = toroid.pos[1:] - toroid.pos[:-1] 27 | center = (toroid.pos[:-1] + toroid.pos[1:])/2. 28 | scene.range = 1.3*(Rbig+Rsmall) 29 | vwidth = L/100 30 | 31 | def BField(obs): 32 | r = obs-center 33 | rmag = mag(r) 34 | rmag.shape = (-1,1) 35 | try: # numpy 36 | return (k*I*cross(delta, r)/rmag**3).sum(axis=0) 37 | except: # old Numeric 38 | return sum(k*I*cross(delta, r)/rmag**3) 39 | 40 | Bvector = arrow(axis=(0,0,0), shaftwidth=vwidth, color=(0,1,1)) 41 | drag = False 42 | 43 | while True: 44 | rate(100) 45 | if drag: 46 | newobs = scene.mouse.pos 47 | if newobs != obs: 48 | obs = newobs 49 | Bvector.axis = Bscale*BField(obs) 50 | Bvector.pos = obs 51 | if scene.mouse.events: 52 | m = scene.mouse.getevent() 53 | if m.button == 'left': 54 | if m.press: 55 | obs = scene.mouse.pos 56 | Bvector.axis = Bscale*BField(obs) 57 | Bvector.pos = obs 58 | elif m.drag: 59 | drag = True 60 | obs = None # force update of position 61 | ## scene.cursor.visible = 0 # not yet implemented 62 | elif m.release or m.drop: 63 | drag = False 64 | ## scene.cursor.visible = 1 # not yet implemented 65 | arrow(pos=obs, axis=Bscale*BField(obs), shaftwidth=vwidth, color=(0,1,1)) 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /examples/wave.py: -------------------------------------------------------------------------------- 1 | from visual import * 2 | 3 | # David Scherer 4 | 5 | dt = 0.1 6 | 7 | g = [] 8 | for i in range(3): 9 | g.append(display(x = 0, y = 30 + 200*i, width=600, height=170)) 10 | 11 | g[0].title="k=6N/m mass=2.0kg" 12 | g[1].title="k=6N/m mass=1.0kg" 13 | g[2].title="k=6N/m mass=0.5kg" 14 | 15 | bands = [ curve( x = arange(-50,50), display=g[0], color=color.red, k = 6., mass = 2.0), 16 | curve( x = arange(-50,50), display=g[1], color=color.yellow, k = 6., mass = 1.0), 17 | curve( x = arange(-50,50), display=g[2], color=color.green, k = 6., mass = 0.5), 18 | ] 19 | 20 | for band in bands: 21 | band.radius = 0.5 22 | band.momentum = zeros((100,3),float) 23 | 24 | ### Uncomment exactly one of the following lines: ### 25 | 26 | band.momentum[:25,1] = sin(band.x[:25]*pi / 25.0)*3 # half-wave pulse 27 | ## band.momentum[:25,1] = sin(band.x[:25]*2*pi / 25.0)*5 # full-wave pulse 28 | ## band.momentum[:25,0] = sin(band.x[:25]*pi / 25.0)*5 # compression wave 29 | ## band.momentum[:,1] = sin(band.x * 4 * pi / 100.0)*2 # standing wave 30 | ## band.momentum[25,1] = 20 # single point impulse (messy) 31 | 32 | while True: 33 | rate(100) 34 | for band in bands: 35 | # Keep endpoints fixed: 36 | band.momentum[0] = band.momentum[-1] = vector(0,0,0) 37 | 38 | # Integrate velocity: 39 | band.pos = band.pos + (band.momentum/band.mass*dt) 40 | 41 | # force[n] is the force on point n from point n+1 (to the right): 42 | force = band.k * (band.pos[1:] - band.pos[:-1]) 43 | 44 | # all points but the last experience forces to the right: 45 | band.momentum[:-1] = band.momentum[:-1] + force * dt 46 | 47 | # all points but the first experience forces to the left: 48 | band.momentum[1:] = band.momentum[1:] - force * dt 49 | -------------------------------------------------------------------------------- /include/.gitignore: -------------------------------------------------------------------------------- 1 | config.h 2 | stamp-h1 3 | -------------------------------------------------------------------------------- /include/axial.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VPYTHON_AXIAL_HPP 2 | #define VPYTHON_AXIAL_HPP 3 | 4 | #include "primitive.hpp" 5 | 6 | namespace cvisual { 7 | 8 | /** A subbase class used to only export 'radius' as a property once to Python. */ 9 | class axial : public primitive 10 | { 11 | protected: 12 | /// The radius of whatever body inherits from this class. 13 | double radius; 14 | axial(); 15 | axial( const axial& other); 16 | 17 | public: 18 | virtual ~axial(); 19 | void set_radius(double r); 20 | double get_radius(); 21 | virtual void get_material_matrix( const view&, tmatrix& out ); 22 | }; 23 | 24 | } // !namespace cvisual 25 | 26 | #endif // !defined VPYTHON_AXIAL_HPP 27 | -------------------------------------------------------------------------------- /include/box.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VPYTHON_BOX_HPP 2 | #define VPYTHON_BOX_HPP 3 | 4 | // Copyright (c) 2000, 2001, 2002, 2003 by David Scherer and others. 5 | // Copyright (c) 2004 by Jonathan Brandmeyer and others. 6 | // See the file license.txt for complete license terms. 7 | // See the file authors.txt for a complete list of contributors. 8 | 9 | #include "rectangular.hpp" 10 | #include "util/displaylist.hpp" 11 | 12 | namespace cvisual { 13 | 14 | class box : public rectangular 15 | { 16 | private: 17 | // True if the box should not be rendered. 18 | bool degenerate(); 19 | static displaylist model; 20 | static void init_model(displaylist& model, bool skip_right_face); 21 | friend class arrow; 22 | 23 | protected: 24 | virtual void gl_pick_render( const view&); 25 | virtual void gl_render( const view&); 26 | virtual void grow_extent( extent& ); 27 | virtual void get_material_matrix( const view&, tmatrix& out ); 28 | 29 | PRIMITIVE_TYPEINFO_DECL; 30 | }; 31 | 32 | } // !namespace cvisual 33 | 34 | #endif // !defined VPYTHON_BOX_HPP 35 | -------------------------------------------------------------------------------- /include/cone.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VPYTHON_CONE_HPP 2 | #define VPYTHON_CONE_HPP 3 | 4 | // Copyright (c) 2000, 2001, 2002, 2003 by David Scherer and others. 5 | // Copyright (c) 2004 by Jonathan Brandmeyer and others. 6 | // See the file license.txt for complete license terms. 7 | // See the file authors.txt for a complete list of contributors. 8 | 9 | #include "axial.hpp" 10 | 11 | namespace cvisual { 12 | 13 | class cone : public axial 14 | { 15 | private: 16 | static void init_model(); 17 | bool degenerate(); 18 | 19 | public: 20 | cone(); 21 | 22 | void set_length( double l); 23 | double get_length(); 24 | 25 | protected: 26 | virtual void gl_pick_render( const view&); 27 | virtual void gl_render( const view&); 28 | virtual void grow_extent( extent&); 29 | virtual vector get_center() const; 30 | PRIMITIVE_TYPEINFO_DECL; 31 | }; 32 | 33 | } // !namespace cvisual 34 | 35 | #endif // !defined VPYTHON_CONE_HPP 36 | -------------------------------------------------------------------------------- /include/config.h.in: -------------------------------------------------------------------------------- 1 | #ifndef VISUAL_CONFIG_H 2 | #define VISUAL_CONFIG_H 3 | // Copyright (c) 2000, 2001, 2002, 2003 by David Scherrer and others. 4 | // See the file liscence.txt for complete liscence terms. 5 | // See the file authors.txt for a complete list of contributors. 6 | /* 7 | * Configuration header file. This file is automatically generated by configure. 8 | * You should change config.h.in and configure.ac rather than this file 9 | * See also platform.h 10 | */ 11 | 12 | /* 13 | * Set this to 1 if we are building on some Win32 platform 14 | */ 15 | #undef HAVE_WIN32_API 16 | 17 | /* 18 | * Set this to 1 if your platform supports GtkGLarea. 19 | */ 20 | #undef HAVE_GTK_GL_AREA 21 | 22 | /* 23 | * Set this to 1 if your platform supports GtkGLExtmm. 24 | * This support is experimental 25 | */ 26 | #undef HAVE_GTK_GL_EXT_MM 27 | 28 | /* 29 | * Set this to 1 if you want to build Visual with support for Numeric 30 | */ 31 | #undef VISUAL_HAVE_NUMERIC 32 | 33 | /* 34 | * Set this to 1 if you want to build Visual with support for Numarray 35 | */ 36 | #undef VISUAL_HAVE_NUMARRAY 37 | 38 | #endif // !VISUAL_CONFIG_H 39 | -------------------------------------------------------------------------------- /include/cylinder.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VPYTHON_CYLINDER_HPP 2 | #define VPYTHON_CYLINDER_HPP 3 | 4 | // Copyright (c) 2000, 2001, 2002, 2003 by David Scherer and others. 5 | // Copyright (c) 2003, 2004 by Jonathan Brandmeyer and others. 6 | // See the file license.txt for complete license terms. 7 | // See the file authors.txt for a complete list of contributors. 8 | 9 | #include "axial.hpp" 10 | 11 | namespace cvisual { 12 | 13 | class cylinder : public axial 14 | { 15 | private: 16 | static void init_model(); 17 | bool degenerate(); 18 | 19 | public: 20 | cylinder(); 21 | cylinder( const cylinder&); 22 | virtual ~cylinder(); 23 | 24 | void set_length( double l); 25 | double get_length(); 26 | 27 | protected: 28 | virtual void gl_pick_render( const view&); 29 | virtual void gl_render( const view&); 30 | virtual void grow_extent( extent&); 31 | virtual vector get_center() const; 32 | PRIMITIVE_TYPEINFO_DECL; 33 | }; 34 | 35 | } // !namespace cvisual 36 | 37 | #endif // !defined VPYTHON_CONE_HPP 38 | -------------------------------------------------------------------------------- /include/ellipsoid.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VPYTHON_ELLIPSOID_HPP 2 | #define VPYTHON_ELLIPSOID_HPP 3 | 4 | // Copyright (c) 2000, 2001, 2002, 2003 by David Scherer and others. 5 | // Copyright (c) 2003, 2004 by Jonathan Brandmeyer and others. 6 | // See the file license.txt for complete license terms. 7 | // See the file authors.txt for a complete list of contributors. 8 | 9 | #include "sphere.hpp" 10 | 11 | namespace cvisual { 12 | 13 | class ellipsoid : public sphere 14 | { 15 | private: 16 | double height; 17 | double width; 18 | 19 | public: 20 | ellipsoid(); 21 | 22 | void set_length( double l); 23 | double get_length(); 24 | 25 | void set_height( double h); 26 | double get_height(); 27 | 28 | void set_width( double w); 29 | double get_width(); 30 | 31 | vector get_size(); 32 | void set_size( const vector&); 33 | 34 | protected: 35 | // Return radius for sphere, max dimension for ellipsoid: 36 | virtual double get_max_dimension(); 37 | 38 | virtual vector get_scale(); 39 | virtual void grow_extent( extent&); 40 | virtual bool degenerate(); 41 | PRIMITIVE_TYPEINFO_DECL; 42 | }; 43 | 44 | } // !namespace cvisual 45 | 46 | #endif // !defined VPYTHON_ELLIPSOID_HPp 47 | -------------------------------------------------------------------------------- /include/gtk2/font_renderer.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VPYTHON_GTK2_FONT_RENDERER_HPP 2 | #define VPYTHON_GTK2_FONT_RENDERER_HPP 3 | 4 | // See text.hpp for public interface 5 | 6 | #include "text.hpp" 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | namespace cvisual { 13 | 14 | class font_renderer { 15 | public: 16 | // Create a font_renderer for the requested font. 17 | // Must support 'verdana' or 'sans-serif' 18 | // Should support 'times new roman' or 'serif', and 'courier new' or 'monospace' 19 | font_renderer( const std::wstring& description, int height ); 20 | 21 | // Returns true if the requested font was available. 22 | bool ok(); 23 | 24 | // Render text and call tx.set_image() 25 | void gl_render_to_texture( const struct view&, const std::wstring& text, layout_texture& tx ); 26 | 27 | private: 28 | Glib::RefPtr ft2_context; 29 | }; 30 | 31 | extern Glib::ustring w2u( const std::wstring& ); 32 | 33 | } // namespace cvisual 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /include/gtk2/render_surface.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VPYTHON_GTK2_RENDER_SURFACE_HPP 2 | #define VPYTHON_GTK2_RENDER_SURFACE_HPP 3 | 4 | // Copyright (c) 2000, 2001, 2002, 2003 by David Scherer and others. 5 | // Copyright (c) 2004 by Jonathan Brandmeyer and others. 6 | // See the file license.txt for complete license terms. 7 | // See the file authors.txt for a complete list of contributors. 8 | 9 | #include "display_kernel.hpp" 10 | #include "mouseobject.hpp" 11 | 12 | // Part of the gtkglextmm package: 13 | #include 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | namespace cvisual { 22 | 23 | class render_surface : public Gtk::GL::DrawingArea 24 | { 25 | private: 26 | mouse_manager& mouse; 27 | 28 | public: 29 | render_surface( display_kernel& _core, mouse_manager& mouse, bool activestereo = false); 30 | display_kernel& core; 31 | 32 | void paint(Gtk::Window* window, bool change, bool vis); // if change, install appropriate cursor 33 | void swap() { gl_swap_buffers(); } 34 | 35 | protected: 36 | // Low-level signal handlers 37 | // Called when the user moves the mouse across the screen. 38 | virtual bool on_motion_notify_event( GdkEventMotion* event); 39 | // Called when the window is resized. 40 | virtual bool on_configure_event( GdkEventConfigure* event); 41 | // Called when the mouse enters the scene. 42 | virtual bool on_enter_notify_event( GdkEventCrossing* event); 43 | // Called when the window is established for the first time. 44 | virtual void on_realize(); 45 | virtual bool on_expose_event( GdkEventExpose*); 46 | virtual bool on_button_press_event( GdkEventButton*); 47 | virtual bool on_button_release_event( GdkEventButton*); 48 | 49 | private: 50 | // Timer function for rendering 51 | bool forward_render_scene(); 52 | 53 | template 54 | void mouse_event( E* event, int buttons_toggled = 0 ); 55 | 56 | // Manage the current OpenGL context 57 | void gl_begin(); 58 | void gl_end(); 59 | void gl_swap_buffers(); 60 | }; 61 | 62 | } // !namespace cvisual 63 | 64 | #endif // !defined VPYTHON_GTK2_RENDER_SURFACE_HPP 65 | -------------------------------------------------------------------------------- /include/gtk2/text_adjust.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VPYTHON_GTK2_TEXT_ADJUST_HPP 2 | #define VPYTHON_GTK2_TEXT_ADJUST_HPP 3 | 4 | float text_adjust = 10.0/13.0; // multiply by this factor to get good label font size on Linux 5 | 6 | #endif // !defined VPYTHON_GTK2_RENDER_SURFACE_HPP -------------------------------------------------------------------------------- /include/gtk2/util/timer.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VPYTHON_UTIL_TIMER_HPP 2 | #define VPYTHON_UTIL_TIMER_HPP 3 | 4 | // Copyright (c) 2004 by Jonathan Brandmeyer and others. 5 | // See the file license.txt for complete license terms. 6 | // See the file authors.txt for a complete list of contributors. 7 | 8 | namespace cvisual { 9 | 10 | // On this platform we just use Glib::Timer, which has the same interface 11 | // as timer. This file should override vpython-core2/include/util/timer.hpp. 12 | 13 | #include 14 | 15 | typedef Glib::Timer render_timer; 16 | 17 | } // !namespace cvisual 18 | 19 | #endif // !defined VPYTHON_UTIL_TIMER_HPP 20 | -------------------------------------------------------------------------------- /include/light.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VPYTHON_LIGHT_HPP 2 | #define VPYTHON_LIGHT_HPP 3 | #pragma once 4 | 5 | // Copyright (c) 2004 by Jonathan Brandmeyer and others. 6 | // See the file license.txt for complete license terms. 7 | // See the file authors.txt for a complete list of contributors. 8 | 9 | #include "util/tmatrix.hpp" 10 | #include "util/rgba.hpp" 11 | #include "renderable.hpp" 12 | 13 | namespace cvisual { 14 | 15 | class light : public renderable 16 | { 17 | protected: 18 | rgb color; 19 | 20 | virtual vertex get_vertex(double gcf) = 0; 21 | 22 | public: 23 | virtual rgb get_color() { return color; } 24 | virtual void set_color( const rgb& r ) { color = r; } 25 | 26 | // renderable protocol 27 | virtual void outer_render( const view& ) {} 28 | virtual vector get_center() const { return vector(); } 29 | virtual void set_material( shared_ptr ) { throw std::invalid_argument("light object does not have a material."); } 30 | virtual shared_ptr get_material() { throw std::invalid_argument("light object does not have a material."); } 31 | virtual bool is_light() { return true; } 32 | virtual void render_lights( view& ); 33 | }; 34 | 35 | class local_light : public light { 36 | protected: 37 | vector position; 38 | virtual vertex get_vertex(double gcf) { return vertex( position*gcf, 1.0 ); } 39 | public: 40 | virtual const vector& get_pos() { return position; } 41 | virtual void set_pos(const vector& v) { position = v; } 42 | }; 43 | 44 | class distant_light : public light { 45 | protected: 46 | vector direction; 47 | virtual vertex get_vertex(double gcf) { return vertex( direction, 0.0 ); } 48 | public: 49 | virtual const vector& get_direction() { return direction; } 50 | virtual void set_direction(const vector& v) { direction = v.norm(); } 51 | }; 52 | 53 | } // !namespace cvisual 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /include/mac/font_renderer.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VPYTHON_WIN32_FONT_RENDERER_HPP 2 | #define VPYTHON_WIN32_FONT_RENDERER_HPP 3 | #pragma once 4 | 5 | // See text.hpp for public interface 6 | 7 | #include "text.hpp" 8 | 9 | namespace cvisual { 10 | 11 | class font_renderer { 12 | public: 13 | // Create a font_renderer for the requested font. 14 | // Must support 'verdana' or 'sans-serif' 15 | // Should support 'times new roman' or 'serif', and 'courier new' or 'monospace' 16 | font_renderer( const std::wstring& description, int height ); 17 | 18 | // Returns true if the requested font was available. 19 | bool ok(); 20 | 21 | // Render text and call tx.set_image() 22 | void gl_render_to_texture( const struct view&, const std::wstring& text, layout_texture& tx ); 23 | 24 | ~font_renderer(); 25 | 26 | private: 27 | int fontID, height; 28 | }; 29 | 30 | } // namespace cvisual 31 | 32 | #endif -------------------------------------------------------------------------------- /include/mac/text_adjust.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VPYTHON_MAC_TEXT_ADJUST_HPP 2 | #define VPYTHON_MAC_TEXT_ADJUST_HPP 3 | 4 | float text_adjust = 14.0/13.0; // multiply by this factor to get good label font size on Mac 5 | 6 | #endif // !defined VPYTHON_MAC_RENDER_SURFACE_HPP 7 | -------------------------------------------------------------------------------- /include/material.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VPYTHON_MATERIAL_HPP 2 | #define VPYTHON_MATERIAL_HPP 3 | #pragma once 4 | 5 | #include "util/texture.hpp" 6 | #include "util/shader_program.hpp" 7 | 8 | namespace cvisual { 9 | 10 | class material { 11 | public: 12 | material(); 13 | 14 | void set_textures( std::vector< boost::shared_ptr< texture > > ); 15 | std::vector< boost::shared_ptr< texture > > get_textures(); 16 | 17 | void set_shader( const std::string& ); 18 | std::string get_shader(); 19 | 20 | void set_translucent( bool ); 21 | bool get_translucent(); 22 | 23 | shader_program* get_shader_program() { return shader.get(); } 24 | 25 | private: 26 | friend class apply_material; 27 | 28 | std::vector< boost::shared_ptr< texture > > textures; 29 | boost::scoped_ptr< shader_program > shader; 30 | bool translucent; 31 | }; 32 | 33 | class apply_material { 34 | public: 35 | apply_material( const view& v, material* m, tmatrix& material_matrix ); 36 | ~apply_material(); 37 | 38 | private: 39 | const view& v; 40 | use_shader_program sp; 41 | }; 42 | 43 | } // namespace cvisual 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /include/mouse_manager.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VPYTHON_MOUSE_MANAGER_HPP 2 | #define VPYTHON_MOUSE_MANAGER_HPP 3 | #pragma once 4 | 5 | #include "mouseobject.hpp" 6 | 7 | namespace cvisual { 8 | 9 | // mouse_manager is reponsible for translating physical mouse movements into VPython 10 | // mouse events and camera actions. 11 | 12 | class mouse_manager { 13 | public: 14 | mouse_manager( class display_kernel& display ); 15 | 16 | // Called by the display driver to report mouse movement 17 | // Ideally this should be called in event handlers so that each successive change in mouse state 18 | // is captured in order, but a driver might just call this periodically with the current state. 19 | // If the mouse is locked, but has "moved" by (dx,dy), the driver should pass get_x()+dx, get_y()+dy 20 | void report_mouse_state(int physical_button_count, bool is_button_down[], 21 | int cursor_client_x, int cursor_client_y, 22 | int shift_state_count, bool shift_state[], 23 | bool driver_can_lock_mouse ); 24 | 25 | bool is_mouse_locked(); //< If this is true, the display driver should hide the mouse cursor and prevent it from moving 26 | 27 | // Get the current position of the mouse cursor relative to the window client area 28 | int get_x(); 29 | int get_y(); 30 | 31 | mouse_t& get_mouse(); 32 | 33 | void report_setcursor( int, int ); 34 | 35 | private: 36 | void update( bool new_buttons[], int new_px, int new_py, bool new_shift[], bool can_lock ); 37 | 38 | mouse_t mouse; 39 | display_kernel& display; 40 | 41 | bool buttons[2]; 42 | int px, py; 43 | bool locked; 44 | int locked_px, locked_py; 45 | bool left_down, left_dragging, left_semidrag; 46 | bool middle_down, middle_dragging, middle_semidrag; 47 | bool right_down, right_dragging, right_semidrag; 48 | }; 49 | 50 | } // namespace cvisual 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /include/pyramid.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VPYTHON_PYRAMID_HPP 2 | #define VPYTHON_PYRAMID_HPP 3 | 4 | // Copyright (c) 2000, 2001, 2002, 2003 by David Scherer and others. 5 | // Copyright (c) 2003, 2004 by Jonathan Brandmeyer and others. 6 | // See the file license.txt for complete license terms. 7 | // See the file authors.txt for a complete list of contributors. 8 | 9 | #include "rectangular.hpp" 10 | #include "util/displaylist.hpp" 11 | 12 | #include 13 | 14 | namespace cvisual { 15 | 16 | using boost::scoped_ptr; 17 | 18 | class pyramid : public rectangular 19 | { 20 | private: 21 | static displaylist model; 22 | static void init_model(); 23 | friend class arrow; 24 | 25 | protected: 26 | virtual void gl_pick_render( const view&); 27 | virtual void gl_render( const view&); 28 | virtual void grow_extent( extent&); 29 | virtual vector get_center() const; 30 | virtual void get_material_matrix( const view&, tmatrix& out ); 31 | 32 | PRIMITIVE_TYPEINFO_DECL; 33 | }; 34 | 35 | } // !namespace cvisual 36 | 37 | #endif // !defined VPYTHON_PYRAMID_HPP 38 | -------------------------------------------------------------------------------- /include/python/faces.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VPYTHON_PYTHON_FACES_HPP 2 | #define VPYTHON_PYTHON_FACES_HPP 3 | 4 | // Copyright (c) 2000, 2001, 2002, 2003 by David Scherer and others. 5 | // See the file license.txt for complete license terms. 6 | // See the file authors.txt for a complete list of contributors. 7 | 8 | #include "renderable.hpp" 9 | #include "python/arrayprim.hpp" 10 | 11 | #include 12 | 13 | namespace cvisual { namespace python { 14 | 15 | class faces : public arrayprim_color 16 | { 17 | protected: 18 | arrayprim_array normal; // An array of normal vectors for the faces. 19 | 20 | virtual void set_length(size_t); 21 | 22 | bool degenerate() const; 23 | virtual void gl_render( const view&); 24 | virtual void gl_pick_render( const view&); 25 | virtual vector get_center() const; 26 | virtual void grow_extent( extent&); 27 | virtual void get_material_matrix( const view&, tmatrix& ); 28 | 29 | public: 30 | faces(); 31 | 32 | // Add another vertex, normal, and color to the faces. 33 | void append_rgb( const vector&, const vector&, float red=-1, float green=-1, float blue=-1); 34 | void append( const vector&, const vector&, const rgb& ); 35 | void append( const vector&, const vector& ); 36 | void append( const vector& ); 37 | 38 | // This routine was adapted from faces_heightfield.py. It averages the normal 39 | // vectors at coincident vertices to smooth out boundaries between facets, 40 | // for normals that are within about 15 degrees of each other (cos > .95). 41 | // The intent is to smooth what should be smooth but preserve sharp corners. 42 | void smooth(); 43 | void smooth_d(const float); 44 | 45 | void make_normals(); 46 | void make_twosided(); 47 | 48 | boost::python::object get_normal(); 49 | void set_normal( const double_array& normal); 50 | void set_normal_v( const vector); 51 | }; 52 | 53 | } } // !namespace cvisual::python 54 | 55 | #endif // !defined VPYTHON_PYTHON_FACES_HPP 56 | -------------------------------------------------------------------------------- /include/python/gil.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VPYTHON_PYTHON_GIL_HPP 2 | #define VPYTHON_PYTHON_GIL_HPP 3 | 4 | #include 5 | 6 | namespace cvisual { namespace python { 7 | 8 | class gil_release 9 | { 10 | PyThreadState *state; 11 | public: 12 | inline gil_release() : state( PyEval_SaveThread()) {} 13 | inline ~gil_release() { PyEval_RestoreThread(state); } 14 | }; 15 | 16 | class gil_lock 17 | { 18 | PyGILState_STATE state; 19 | public: 20 | inline gil_lock() : state( PyGILState_Ensure()) {} 21 | inline ~gil_lock() { PyGILState_Release( state); } 22 | }; 23 | 24 | } } // !namespace cvisual::python 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /include/python/points.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VPYTHON_PYTYHON_POINTS_HPP 2 | #define VPYTHON_PYTYHON_POINTS_HPP 3 | 4 | #include "renderable.hpp" 5 | #include "python/num_util.hpp" 6 | #include "python/arrayprim.hpp" 7 | 8 | namespace cvisual { namespace python { 9 | 10 | class points : public arrayprim_color 11 | { 12 | private: 13 | // Specifies whether or not the size of the points should scale with the 14 | // world or with the screen. 15 | enum { WORLD, PIXELS } size_units; 16 | 17 | // Specifies the shape of the point. Future candidates are triangles, 18 | // diamonds, etc. 19 | enum { ROUND, SQUARE } points_shape; 20 | 21 | // The size of the points 22 | float size; 23 | 24 | bool degenerate() const; 25 | 26 | virtual void outer_render( const view&); 27 | virtual void gl_render( const view&); 28 | virtual vector get_center() const; 29 | virtual void gl_pick_render( const view&); 30 | virtual void grow_extent( extent&); 31 | 32 | public: 33 | points(); 34 | 35 | void set_points_shape( const std::string& n_type); 36 | std::string get_points_shape( void); 37 | 38 | void set_size( float r); 39 | inline float get_size( void) { return size; } 40 | 41 | void set_size_units( const std::string& n_type); 42 | std::string get_size_units( void); 43 | }; 44 | 45 | } } // !namespace cvisual::python 46 | 47 | #endif /*VPYTHON_PYTYHON_POINTS_HPP*/ 48 | -------------------------------------------------------------------------------- /include/python/wrap_vector.hpp: -------------------------------------------------------------------------------- 1 | #ifndef CVISUAL_PYTHON_WRAP_VECTOR_HPP 2 | #define CVISUAL_PYTHON_WRAP_VECTOR_HPP 3 | 4 | #include "util/vector.hpp" 5 | #include 6 | 7 | namespace cvisual { 8 | 9 | // Convert a general Python object to a Visual vector. This function may 10 | // throw. 11 | cvisual::vector tovector( boost::python::object); 12 | 13 | } // !namespace cvisual::python 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /include/rectangular.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VPYTHON_RECTANGULAR_HPP 2 | #define VPYTHON_RECTANGULAR_HPP 3 | 4 | #include "primitive.hpp" 5 | 6 | namespace cvisual { 7 | 8 | class rectangular : public primitive 9 | { 10 | protected: 11 | double width; 12 | double height; 13 | rectangular(); 14 | rectangular( const rectangular& other); 15 | 16 | void apply_transform( const view& ); 17 | 18 | public: 19 | virtual ~rectangular(); 20 | 21 | void set_length( double l); 22 | double get_length(); 23 | 24 | void set_height( double h); 25 | double get_height(); 26 | 27 | void set_width( double w); 28 | double get_width(); 29 | 30 | vector get_size(); 31 | void set_size( const vector&); 32 | }; 33 | 34 | } // !namespace cvisual 35 | 36 | #endif // !defined VPYTHON_RECTANGULAR_HPP 37 | -------------------------------------------------------------------------------- /include/ring.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VPYTHON_RING_HPP 2 | #define VPYTHON_RING_HPP 3 | 4 | // Copyright (c) 2000, 2001, 2002, 2003 by David Scherer and others. 5 | // Copyright (c) 2003, 2004 by Jonathan Brandmeyer and others. 6 | // See the file license.txt for complete license terms. 7 | // See the file authors.txt for a complete list of contributors. 8 | 9 | #include "axial.hpp" 10 | 11 | #ifdef __GNUC__ 12 | # define NONNULL __attribute__((nonnull)) 13 | #else 14 | # define NONNULL 15 | #endif 16 | 17 | namespace cvisual { 18 | 19 | // This model representation is intended to be "sort of like" what a next generation 20 | // two phase renderer would use. Eventually, therefore, it should be replaced with 21 | // the real thing. 22 | struct fvertex { 23 | union { 24 | float v[3]; 25 | struct { float x, y, z; }; 26 | }; 27 | fvertex() {} // uninitialized! 28 | fvertex( const vector& v ) : x(v.x), y(v.y), z(v.z) {} 29 | }; 30 | 31 | class model { 32 | public: 33 | std::vector< unsigned short > indices; 34 | std::vector< fvertex > vertex_pos; 35 | std::vector< fvertex > vertex_normal; 36 | }; 37 | 38 | class ring : public axial 39 | { 40 | private: 41 | // The radius of the ring's body. If not specified, it is set to 1/10 of 42 | // the radius of the body. 43 | double thickness; 44 | PRIMITIVE_TYPEINFO_DECL; 45 | bool degenerate(); 46 | 47 | cvisual::model model; 48 | int model_rings, model_bands; 49 | double model_radius, model_thickness; 50 | 51 | public: 52 | ring(); 53 | virtual ~ring(); 54 | void set_thickness( double t); 55 | double get_thickness(); 56 | 57 | protected: 58 | virtual void gl_pick_render( const view&); 59 | virtual void gl_render( const view&); 60 | virtual void grow_extent( extent&); 61 | void get_material_matrix(const view&, tmatrix& out); 62 | 63 | void create_model( int rings, int bands, class model& m ); 64 | }; 65 | 66 | } // !namespace cvisual 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /include/util/atomic_queue.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VPYTHON_UTIL_ATOMIC_QUEUE_HPP 2 | #define VPYTHON_UTIL_ATOMIC_QUEUE_HPP 3 | 4 | #include "util/thread.hpp" 5 | #include 6 | 7 | namespace cvisual { 8 | 9 | // This class exists to separate out code that is not templated (and therefore 10 | // doesn't need to be in a header file) from code that is. This prevents 11 | // picking up the whole Python runtine throughout all of cvisual, thus making 12 | // compilation faster. 13 | class atomic_queue_impl 14 | { 15 | protected: 16 | volatile bool waiting; 17 | volatile bool empty; 18 | condition ready; 19 | mutable mutex barrier; 20 | 21 | atomic_queue_impl() 22 | : waiting(false), empty(true) 23 | {} 24 | 25 | void push_notify(); 26 | void py_pop_wait( lock& L); 27 | }; 28 | 29 | template 30 | class atomic_queue : private atomic_queue_impl 31 | { 32 | private: 33 | std::queue data; 34 | 35 | /** 36 | * Precondition - the buggar is locked, at least one item is in data 37 | */ 38 | T pop_impl() 39 | { 40 | T ret = data.front(); 41 | data.pop(); 42 | if (data.empty()) 43 | empty = true; 44 | return ret; 45 | } 46 | 47 | public: 48 | atomic_queue() {} 49 | 50 | void push( const T& item) 51 | { 52 | lock L(barrier); 53 | data.push( item); 54 | push_notify(); 55 | } 56 | 57 | // It's assumed that the caller of py_pop() holds the Python GIL 58 | T py_pop() 59 | { 60 | lock L(barrier); 61 | py_pop_wait( L); 62 | return pop_impl(); 63 | } 64 | 65 | size_t size() const 66 | { 67 | lock L(barrier); 68 | return data.size(); 69 | } 70 | 71 | void clear() 72 | { 73 | lock L(barrier); 74 | while (!data.empty()) 75 | data.pop(); 76 | empty = true; 77 | } 78 | }; 79 | 80 | } // !namespace cvisual 81 | 82 | #endif // !defined VPYTHON_UTIL_ATOMIC_QUEUE_HPP 83 | -------------------------------------------------------------------------------- /include/util/displaylist.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VPYTHON_UTIL_DISPLAYLIST_HPP 2 | #define VPYTHON_UTIL_DISPLAYLIST_HPP 3 | 4 | // Copyright (c) 2004 by Jonathan Brandmeyer and others. 5 | // See the file license.txt for complete license terms. 6 | // See the file authors.txt for a complete list of contributors. 7 | 8 | #include 9 | 10 | namespace cvisual { 11 | 12 | using boost::shared_ptr; 13 | 14 | /** A manager for OpenGL displaylists */ 15 | class displaylist 16 | { 17 | private: 18 | shared_ptr impl; 19 | 20 | public: 21 | /** Begin compiling a new displaylist. Nothing is drawn to the screen 22 | when rendering commands into the displaylist. Be sure to call 23 | gl_compile_end() when you are done. 24 | */ 25 | void gl_compile_begin(); 26 | 27 | /** Completes compiling the displaylist. */ 28 | void gl_compile_end(); 29 | 30 | /** Perform the OpenGL commands cached with gl_compile_begin() and 31 | gl_compile_end(). */ 32 | void gl_render() const; 33 | 34 | /** @return true iff this object contains a compiled OpenGL program. */ 35 | operator bool() const; 36 | }; 37 | 38 | } // !namespace cvisual 39 | 40 | #endif // !defined VPYTHON_UTIL_DISPLAYLIST_HPP 41 | -------------------------------------------------------------------------------- /include/util/gl_enable.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VPYTHON_UTIL_GL_ENABLE_HPP 2 | #define VPYTHON_UTIL_GL_ENABLE_HPP 3 | 4 | #include "wrap_gl.hpp" 5 | 6 | namespace cvisual { 7 | 8 | // Stack-unwind safe versions of gl{Enable,Disable}{ClientState,}() 9 | class gl_enable 10 | { 11 | private: 12 | GLenum value; 13 | public: 14 | inline gl_enable( GLenum v) : value(v) 15 | { glEnable( value); } 16 | 17 | inline ~gl_enable() 18 | { glDisable( value); } 19 | }; 20 | 21 | class gl_enable_client 22 | { 23 | private: 24 | GLenum value; 25 | public: 26 | inline gl_enable_client( GLenum v) : value(v) 27 | { glEnableClientState( value); } 28 | 29 | inline ~gl_enable_client() 30 | { glDisableClientState( value); } 31 | }; 32 | 33 | class gl_disable 34 | { 35 | private: 36 | GLenum value; 37 | public: 38 | inline gl_disable( GLenum v) : value(v) 39 | { glDisable( value); } 40 | 41 | inline ~gl_disable() 42 | { glEnable( value); } 43 | }; 44 | 45 | } // !namespace cvisual 46 | 47 | #endif /*VPYTHON_UTIL_GL_ENABLE_HPP*/ 48 | -------------------------------------------------------------------------------- /include/util/gl_extensions.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VPYTHON_UTIL_GL_EXTENSIONS_HPP 2 | #define VPYTHON_UTIL_GL_EXTENSIONS_HPP 3 | #pragma once 4 | 5 | #include "wrap_gl.hpp" 6 | 7 | namespace cvisual { 8 | 9 | // GL extension functions wrapper - just the functions we currently need 10 | // This could be replaced by a library like GLEW, if it becomes a hassle to maintain. 11 | 12 | class gl_extensions { 13 | public: 14 | // All extensions will be unavailable until init() is called. 15 | gl_extensions(); 16 | 17 | // Must be initialized and used with the same OpenGL context current 18 | void init( class display_kernel& d ); 19 | 20 | // Extension: ARB_shader_objects 21 | bool ARB_shader_objects; 22 | PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB; 23 | PFNGLLINKPROGRAMARBPROC glLinkProgramARB; 24 | PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB; 25 | PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB; 26 | PFNGLSHADERSOURCEARBPROC glShaderSourceARB; 27 | PFNGLCOMPILESHADERARBPROC glCompileShaderARB; 28 | PFNGLATTACHOBJECTARBPROC glAttachObjectARB; 29 | PFNGLDELETEOBJECTARBPROC glDeleteObjectARB; 30 | PFNGLGETHANDLEARBPROC glGetHandleARB; 31 | PFNGLUNIFORM1IARBPROC glUniform1iARB; 32 | PFNGLUNIFORMMATRIX4FVARBPROC glUniformMatrix4fvARB; 33 | PFNGLUNIFORM4FVARBPROC glUniform4fvARB; 34 | PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB; 35 | PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameterivARB; 36 | PFNGLGETINFOLOGARBPROC glGetInfoLogARB; 37 | 38 | // Extension: EXT_texture3D 39 | bool EXT_texture3D; 40 | PFNGLTEXIMAGE3DEXTPROC glTexImage3D; 41 | PFNGLTEXSUBIMAGE3DEXTPROC glTexSubImage3D; 42 | 43 | // Extension: ARB_multitexture 44 | bool ARB_multitexture; 45 | PFNGLACTIVETEXTUREARBPROC glActiveTexture; 46 | 47 | // Extension: ARB_point_parameters 48 | bool ARB_point_parameters; 49 | PFNGLPOINTPARAMETERFVARBPROC glPointParameterfvARB; 50 | }; 51 | 52 | } 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /include/util/gl_free.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VPYTHON_UTIL_GL_FREE_HPP 2 | #define VPYTHON_UTIL_GL_FREE_HPP 3 | 4 | #include 5 | #include "thread.hpp" 6 | 7 | namespace cvisual { 8 | 9 | class gl_free_manager { 10 | public: 11 | // The callback will be called if the OpenGL context(s) are destroyed 12 | template 13 | void connect( T callback ) { on_shutdown().connect( callback ); } 14 | 15 | // The callback will be called the next time OpenGL objects may be freed, and 16 | // will no longer be called on shutdown(). 17 | template 18 | void free( T callback ) { on_next_frame().connect( callback ); on_shutdown().disconnect( callback ); } 19 | 20 | // Call with OpenGL context active 21 | void frame(); 22 | 23 | // Call when the context(s) are destroyed. The gl_free_manager can be reused. 24 | void shutdown(); 25 | 26 | private: 27 | boost::signal< void() > &on_shutdown(); 28 | boost::signal< void() > &on_next_frame(); 29 | }; 30 | 31 | // At present, there is just one of these, because all OpenGL contexts share server 32 | // objects through wglShareLists or equivalent. It is shutdown when all contexts are 33 | // shut down. If this design is changed in the 34 | // future, there will need to be an instance for each context. 35 | extern gl_free_manager on_gl_free; 36 | 37 | } // !namespace cvisual 38 | 39 | #endif // !defined VPYTHON_UTIL_GL_FREE_HPP 40 | -------------------------------------------------------------------------------- /include/util/icososphere.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VPYTHON_UTIL_ICOSOSPHERE_HPP 2 | #define VPYTHON_UTIL_ICOSOSPHERE_HPP 3 | 4 | #include 5 | 6 | namespace cvisual { 7 | 8 | class icososphere 9 | { 10 | boost::shared_array verts; 11 | boost::shared_array indices; 12 | int nverts; 13 | int ni; 14 | 15 | inline float* 16 | newe( int span) 17 | { 18 | float* e = verts.get() + 3*(nverts - 1); // one before the beginning 19 | nverts += span-1; 20 | return e; 21 | } 22 | 23 | void subdivide( int span, float* v1, float* v2, float *v3, 24 | float* s1, float* s2, float* s3, 25 | float* e1, float* e2, float* e3 ); 26 | public: 27 | icososphere( int depth); 28 | void gl_render(); 29 | }; 30 | 31 | } // !namespace cvisual 32 | #endif // !defined VPYTHON_UTIL_ICOSOSPHERE_HPP 33 | -------------------------------------------------------------------------------- /include/util/rate.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VPYTHON_UTIL_RATE_HPP 2 | #define VPYTHON_UTIL_RATE_HPP 3 | 4 | namespace cvisual { 5 | 6 | // This function is stateful and allows an application to control its loop 7 | // execution rate. When calling rate() once per iteration, rate inserts a small 8 | // delay that is calibrated such that the loop will execute at about 'freq' 9 | // iterations per second. 10 | void rate( const double& freq); 11 | 12 | } // !namespace cvisual 13 | 14 | #endif // !defined VPYTHON_UTIL_RATE_HPP 15 | -------------------------------------------------------------------------------- /include/util/render_manager.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VPYTHON_UTIL_RENDER_MANAGER_HPP 2 | #define VPYTHON_UTIL_RENDER_MANAGER_HPP 3 | #pragma once 4 | 5 | #include 6 | 7 | namespace cvisual { 8 | struct render_manager { 9 | // Called by the platform drivers to paint and swaps all of the given displays, 10 | // returning the number of seconds to wait before calling this function again. 11 | // Takes care of a lot of platform-independent policy and implementation, including 12 | // the tradeoff between frame rate and Python program performance, vertical retrace 13 | // synchronization, etc. 14 | static double paint_displays( const std::vector< class display* >&, bool swap_single_threaded = false ); 15 | }; 16 | }; 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /include/util/shader_program.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VPYTHON_UTIL_SHADER_PROGRAM_HPP 2 | #define VPYTHON_UTIL_SHADER_PROGRAM_HPP 3 | #pragma once 4 | 5 | #include "display_kernel.hpp" 6 | 7 | #ifdef __APPLE__ 8 | // The following are needed in order to be able to query the rendering properties 9 | #include 10 | #include 11 | #include 12 | #endif 13 | 14 | namespace cvisual { 15 | 16 | class shader_program { 17 | public: 18 | shader_program( const std::string& source ); 19 | ~shader_program(); 20 | 21 | const std::string& get_source() const { return source; } 22 | int get_uniform_location( const view& v, const char* name ); 23 | void set_uniform_matrix( const view& v, int loc, const tmatrix& in ); 24 | 25 | private: 26 | friend class use_shader_program; 27 | void realize( const view& ); 28 | 29 | void compile( const view&, int type, const std::string& source ); 30 | std::string getSection( const std::string& name ); 31 | 32 | static void gl_free( PFNGLDELETEOBJECTARBPROC, int ); 33 | 34 | std::string source; 35 | std::map uniforms; 36 | int program; 37 | PFNGLDELETEOBJECTARBPROC glDeleteObjectARB; 38 | }; 39 | 40 | class use_shader_program { 41 | public: 42 | // use_shader_program(NULL) does nothing, rather than enabling the fixed function 43 | // pipeline explicitly. This is convenient, but maybe we need a way to do the other thing? 44 | use_shader_program( const view& v, shader_program* program ); 45 | use_shader_program( const view& v, shader_program& program ); 46 | ~use_shader_program(); 47 | 48 | bool ok() { return m_ok; } // true if the shader program was successfully invoked 49 | 50 | private: 51 | const view& v; 52 | int oldProgram; 53 | bool m_ok; 54 | void init( shader_program* program ); 55 | }; 56 | 57 | } 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /include/util/thread.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VPYTHON_UTIL_THREAD_HPP 2 | #define VPYTHON_UTIL_THREAD_HPP 3 | 4 | // Copyright (c) 2000, 2001, 2002, 2003 by David Scherer and others. 5 | // Copyright (c) 2004 by Jonathan Brandmeyer and others. 6 | // See the file license.txt for complete license terms. 7 | // See the file authors.txt for a complete list of contributors. 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include "python/gil.hpp" 14 | 15 | namespace cvisual { 16 | 17 | #ifdef NDEBUG 18 | using boost::mutex; 19 | typedef mutex::scoped_lock lock; 20 | 21 | inline void 22 | assert_locked( const mutex&) 23 | { 24 | // Empty. 25 | } 26 | 27 | inline void 28 | assert_unlocked( const mutex&) 29 | { 30 | // Empty. 31 | } 32 | 33 | #else 34 | typedef boost::try_mutex mutex; 35 | typedef mutex::scoped_lock lock; 36 | 37 | inline void 38 | assert_locked( mutex& m) 39 | { 40 | try { 41 | mutex::scoped_try_lock L(m); 42 | } 43 | catch (boost::lock_error&) { 44 | return; 45 | } 46 | bool mutex_locked = false; 47 | assert( mutex_locked == true); 48 | } 49 | 50 | inline void 51 | assert_unlocked( mutex& m) 52 | { 53 | try { 54 | mutex::scoped_try_lock L(m); 55 | } 56 | catch (boost::lock_error&) { 57 | bool mutex_locked = true; 58 | assert( mutex_locked == false); 59 | } 60 | return; 61 | } 62 | #endif 63 | 64 | // using boost::condition; 65 | 66 | class condition : public boost::condition 67 | { 68 | public: 69 | template 70 | void py_wait( Lock& L) 71 | { 72 | python::gil_release R; 73 | boost::condition::wait(L); 74 | } 75 | }; 76 | 77 | } // !namesapce cvisual 78 | 79 | #endif // !defined VPYTHON_UTIL_THREAD_HPP 80 | -------------------------------------------------------------------------------- /include/util/timer.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VPYTHON_UTIL_TIMER_HPP 2 | #define VPYTHON_UTIL_TIMER_HPP 3 | 4 | // Copyright (c) 2004 by Jonathan Brandmeyer and others. 5 | // See the file license.txt for complete license terms. 6 | // See the file authors.txt for a complete list of contributors. 7 | 8 | namespace cvisual { 9 | 10 | class timer 11 | { 12 | private: 13 | double start; ///< The system time at the last lap_start() call. 14 | double inv_tick_count; 15 | 16 | public: 17 | /** Construct a new timer. */ 18 | timer(); 19 | 20 | /** Time elapsed since timer was created. */ 21 | double elapsed(); 22 | }; 23 | 24 | } // !namespace cvisual 25 | 26 | #endif // !defined VPYTHON_UTIL_TIMER_HPP 27 | -------------------------------------------------------------------------------- /include/vpython-config.h: -------------------------------------------------------------------------------- 1 | #ifndef VPYTHON_CONFIG_H 2 | #define VPYTHON_CONFIG_H 3 | 4 | #include 5 | 6 | #ifndef M_PI 7 | # define M_PI 3.14159265359 8 | #endif 9 | 10 | #if defined _MSC_VER 11 | # pragma warning(disable: 4996) 12 | # pragma warning(disable: 4005) 13 | # pragma warning(disable: 4715) 14 | # pragma warning(disable: 4244) 15 | #define isnan _isnan 16 | #endif 17 | 18 | #define BOOST_DATE_TIME_NO_LIB 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /include/win32/font_renderer.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VPYTHON_WIN32_FONT_RENDERER_HPP 2 | #define VPYTHON_WIN32_FONT_RENDERER_HPP 3 | #pragma once 4 | 5 | // See text.hpp for public interface 6 | 7 | #include "text.hpp" 8 | 9 | namespace cvisual { 10 | 11 | class font_renderer { 12 | public: 13 | // Create a font_renderer for the requested font. 14 | // Must support 'verdana' or 'sans-serif' 15 | // Should support 'times new roman' or 'serif', and 'courier new' or 'monospace' 16 | font_renderer( const std::wstring& description, int height ); 17 | 18 | // Returns true if the requested font was available. 19 | bool ok(); 20 | 21 | // Render text and call tx.set_image() 22 | void gl_render_to_texture( const struct view&, const std::wstring& text, layout_texture& tx ); 23 | 24 | ~font_renderer(); 25 | 26 | private: 27 | void* font_handle; 28 | bool isClearType; 29 | }; 30 | 31 | } // namespace cvisual 32 | 33 | #endif -------------------------------------------------------------------------------- /include/win32/text_adjust.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VPYTHON_MAC_TEXT_ADJUST_HPP 2 | #define VPYTHON_MAC_TEXT_ADJUST_HPP 3 | 4 | float text_adjust = 1.0; // multiply by this factor to get good label font size on Windows 5 | 6 | #endif // !defined VPYTHON_MAC_RENDER_SURFACE_HPP 7 | -------------------------------------------------------------------------------- /include/wrap_gl.hpp: -------------------------------------------------------------------------------- 1 | 2 | #ifndef VPYTHON_WRAP_GL_HPP 3 | #define VPYTHON_WRAP_GL_HPP 4 | 5 | // Copyright (c) 2004 by Jonathan Brandmeyer and others. 6 | // See the file license.txt for complete license terms. 7 | // See the file authors.txt for a complete list of contributors. 8 | 9 | //A header file to wrap around GL/gl.h on *nix and Windows. 10 | 11 | #if defined(_WIN32) 12 | #define WIN32_LEAN_AND_MEAN 1 13 | #define NOMINMAX 14 | #include 15 | #endif 16 | 17 | #if defined(__APPLE__) 18 | #define GL_GLEXT_LEGACY 19 | #include 20 | #include 21 | #include "GL/glext.h" 22 | #else 23 | #include 24 | #include 25 | #include 26 | #endif 27 | 28 | #endif // !defined VPYTHON_WRAP_GL_HPP 29 | -------------------------------------------------------------------------------- /lib/pkgconfig/vpython-3.0.pc: -------------------------------------------------------------------------------- 1 | prefix=/home/jonathan/Projects/vpython_basic_gtkmm 2 | 3 | exec_prefix=${prefix} 4 | libdir=${exec_prefix}/lib 5 | includedir=${prefix}/include 6 | 7 | Name: vpython 8 | Description: C++ engine for VPython. 9 | Requires: gtkglextmm-1.0 10 | Version: 3.0 11 | Libs: -L${libdir} -lvpython-gtk2 -lvpython-core 12 | Cflags: -I${includedir} 13 | -------------------------------------------------------------------------------- /mkdist_osx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Run in a little sandbox alongside the source package 3 | cd .. 4 | mkdir -p buildvpython3.0.3 5 | cd buildvpython3.0.3 6 | 7 | # Untar and build GCC 8 | if test ! -e /usr/local/bin/g++-3.3.4 ; then 9 | echo "Downloading GCC from the web." 10 | wget http://mirrors.rcn.net/pub/sourceware/gcc/releases/gcc-3.3.4/gcc-3.3.4.tar.bz2 11 | echo "Building GCC 3.3.4 from source." 12 | tar -xjf gcc-3.3.4.tar.bz2 13 | mkdir buildgcc 14 | cd buildgcc 15 | ../gcc-3.3.4/configure --enable-version-specific-runtime-libs --enable-threads=posix \ 16 | --disable-shared --enable-static --program-suffix=-3.3.4 --enable-languages=c,c++ 17 | make bootstrap 18 | echo "Installing GCC 3.3.4 into /usr/local with sudo, you will need your password here." 19 | sudo make install 20 | cd .. 21 | fi 22 | 23 | # Untar and build Boost 24 | if test ! -e /usr/local/lib/libboost_python.dylib ; then 25 | echo "Downloading Boost from the web." 26 | wget http://aleron.dl.sourceforge.net/sourceforge/boost/boost_1_31_0.tar.bz2 27 | echo "Building Boost.Python from source." 28 | tar -xjf boost_1_31_0.tar.bz2 29 | mkdir buildboost1.31.0 30 | cp ../visual-3.0.2/Boost_OSX_Makefile.mak buildboost1.31.0/Makefile 31 | cd buildboost1.31.0 32 | make all 33 | echo "Copying libboost_python.dylib into /usr/local/lib with sudo, you may need your password here." 34 | sudo cp libboost_python.dylib /usr/local/lib 35 | cd .. 36 | fi 37 | 38 | # configure and build VPython 39 | echo "Building VPython from source." 40 | rm -rf buildvisual 41 | mkdir buildvisual 42 | cd buildvisual 43 | export CPPFLAGS="-I/sw/include -I../../boost_1_31_0" 44 | export CXXFLAGS="-02 -finline-functions" 45 | export CXX="/usr/local/bin/g++-3.3.4 -pipe" 46 | export CC="/usr/local/bin/gcc-3.3.4 -pipe" 47 | export PYTHON=/sw/bin/python2.3 48 | ../../visual-3.0.3/configure --prefix=/sw 49 | make 50 | echo "Installing VPython into /sw with sudo, you may need your password here." 51 | sudo make install 52 | cd .. 53 | 54 | # Build a redistributable package 55 | tar -czf vpython-osx-3.0.3.tar.gz /sw/lib/python2.3/site-packages/cvisualmodule.so \ 56 | /sw/lib/python2.3/site-packages/visual/ /usr/local/lib/libboost_python.dylib 57 | 58 | # Done. 59 | -------------------------------------------------------------------------------- /run: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | export LD_LIBRARY_PATH=./lib:$LD_LIBRARY_PATH 3 | export PYTHONPATH=./site-packages:$PYTHONPATH 4 | $@ 5 | 6 | -------------------------------------------------------------------------------- /site-packages/vidle2/CREDITS.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vpython/visual/e856d1b89d8ab0484409f4be7931326ed546e9a2/site-packages/vidle2/CREDITS.txt -------------------------------------------------------------------------------- /site-packages/vidle2/Delegator.py: -------------------------------------------------------------------------------- 1 | class Delegator: 2 | 3 | # The cache is only used to be able to change delegates! 4 | 5 | def __init__(self, delegate=None): 6 | self.delegate = delegate 7 | self.__cache = {} 8 | 9 | def __getattr__(self, name): 10 | attr = getattr(self.delegate, name) # May raise AttributeError 11 | setattr(self, name, attr) 12 | self.__cache[name] = attr 13 | return attr 14 | 15 | def resetcache(self): 16 | for key in self.__cache.keys(): 17 | try: 18 | delattr(self, key) 19 | except AttributeError: 20 | pass 21 | self.__cache.clear() 22 | 23 | def cachereport(self): 24 | keys = self.__cache.keys() 25 | keys.sort() 26 | print keys 27 | 28 | def setdelegate(self, delegate): 29 | self.resetcache() 30 | self.delegate = delegate 31 | 32 | def getdelegate(self): 33 | return self.delegate 34 | -------------------------------------------------------------------------------- /site-packages/vidle2/FileRevert.py: -------------------------------------------------------------------------------- 1 | """ 2 | FileRevert is an extension that re-reads the currently open file and 3 | displays the possibly updated content. 4 | """ 5 | from Tkinter import * 6 | import tkMessageBox 7 | 8 | class FileRevert: 9 | 10 | menudefs = [('file', [('Revert', '<>')])] 11 | 12 | def __init__(self, editwin): 13 | self.text = editwin.text 14 | self.io = editwin.io 15 | 16 | def revert_file_event(self, event): 17 | fname = self.io.filename 18 | if fname is None: 19 | # No file associated. 20 | return 21 | 22 | if not self.io.get_saved(): 23 | msg = "Do you want to save a copy of %s before reverting?" % fname 24 | res = tkMessageBox.askyesnocancel( 25 | master=self.text, 26 | title="Save a copy", 27 | message=msg) 28 | if res is None: 29 | # Canceled. 30 | return 31 | elif res: 32 | self.io.save_a_copy(event) 33 | # XXX Maybe it would be better to not revert the file when 34 | # user cancels the dialog that saves a copy of the current 35 | # file. 36 | 37 | self.io.loadfile(fname) 38 | -------------------------------------------------------------------------------- /site-packages/vidle2/Icons/folder.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vpython/visual/e856d1b89d8ab0484409f4be7931326ed546e9a2/site-packages/vidle2/Icons/folder.gif -------------------------------------------------------------------------------- /site-packages/vidle2/Icons/idle.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vpython/visual/e856d1b89d8ab0484409f4be7931326ed546e9a2/site-packages/vidle2/Icons/idle.icns -------------------------------------------------------------------------------- /site-packages/vidle2/Icons/minusnode.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vpython/visual/e856d1b89d8ab0484409f4be7931326ed546e9a2/site-packages/vidle2/Icons/minusnode.gif -------------------------------------------------------------------------------- /site-packages/vidle2/Icons/openfolder.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vpython/visual/e856d1b89d8ab0484409f4be7931326ed546e9a2/site-packages/vidle2/Icons/openfolder.gif -------------------------------------------------------------------------------- /site-packages/vidle2/Icons/plusnode.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vpython/visual/e856d1b89d8ab0484409f4be7931326ed546e9a2/site-packages/vidle2/Icons/plusnode.gif -------------------------------------------------------------------------------- /site-packages/vidle2/Icons/python.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vpython/visual/e856d1b89d8ab0484409f4be7931326ed546e9a2/site-packages/vidle2/Icons/python.gif -------------------------------------------------------------------------------- /site-packages/vidle2/Icons/tk.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vpython/visual/e856d1b89d8ab0484409f4be7931326ed546e9a2/site-packages/vidle2/Icons/tk.gif -------------------------------------------------------------------------------- /site-packages/vidle2/MacBuildApp.py: -------------------------------------------------------------------------------- 1 | from bundlebuilder import AppBuilder, main 2 | 3 | a = AppBuilder( 4 | name='VIDLE.app', 5 | mainprogram='idle.py', 6 | argv_emulation=0, 7 | #iconfile= 8 | standalone=0, 9 | ) 10 | 11 | a.plist['CFBundleDocumentTypes'] = [ 12 | { "CFBundleTypeOSTypes" : [ 13 | "****" ], 14 | "CFBundleTypeRole" : "Viewer" }] 15 | 16 | main(a) 17 | -------------------------------------------------------------------------------- /site-packages/vidle2/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to produce Makefile.in 2 | # Makefile to distribute VIDLE 3 | 4 | AUTOMAKE_OPTIONS = foreign 5 | srcdir = @srcdir@ 6 | VPATH = @srcdir@ 7 | 8 | if BUILD_VIDLE 9 | vidlefiles = __init__.py \ 10 | aboutDialog.py AutoComplete.py AutoCompleteWindow.py AutoExpand.py Bindings.py \ 11 | CallTips.py CallTipWindow.py ChangeLog ClassBrowser.py CodeContext.py \ 12 | ColorDelegator.py configDialog.py \ 13 | config-extensions.def configHandler.py configHelpSourceEdit.py \ 14 | config-highlight.def config-keys.def config-main.def \ 15 | configSectionNameDialog.py CREDITS.txt \ 16 | Debugger.py Delegator.py dynOptionMenuWidget.py \ 17 | EditorWindow.py extend.txt FileList.py \ 18 | FileRevert.py FormatParagraph.py GrepDialog.py \ 19 | help.txt HISTORY.txt HyperParser.py Icons idle.bat \ 20 | idle.py idle.pyw IdleHistory.py idlever.py IOBinding.py \ 21 | keybindingDialog.py macosxSupport.py \ 22 | MultiCall.py MultiStatusBar.py NEWS.txt ObjectBrowser.py OutputWindow.py \ 23 | ParenMatch.py PathBrowser.py Percolator.py pyclbr.py PyParse.py PyShell.py \ 24 | README.txt RemoteDebugger.py RemoteObjectBrowser.py ReplaceDialog.py rpc.py \ 25 | RstripExtension.py run.py ScriptBinding.py ScrolledList.py SearchDialog.py SearchDialogBase.py \ 26 | SearchEngine.py StackViewer.py tabbedpages.py testcode.py textView.py \ 27 | TODO.txt ToolTip.py TreeWidget.py UndoDelegator.py utils.py WidgetRedirector.py \ 28 | WindowList.py ZoomHeight.py \ 29 | Icons/folder.gif Icons/idle.icns Icons/minusnode.gif Icons/openfolder.gif \ 30 | Icons/plusnode.gif Icons/python.gif Icons/tk.gif 31 | else 32 | vidlefiles = 33 | endif 34 | 35 | pkgdatadir = @visualvidledir@ 36 | 37 | dist_pkgdata_DATA = $(vidlefiles) 38 | 39 | -------------------------------------------------------------------------------- /site-packages/vidle2/MultiStatusBar.py: -------------------------------------------------------------------------------- 1 | from Tkinter import * 2 | 3 | class MultiStatusBar(Frame): 4 | 5 | def __init__(self, master=None, **kw): 6 | if master is None: 7 | master = Tk() 8 | Frame.__init__(self, master, **kw) 9 | self.labels = {} 10 | 11 | def set_label(self, name, text='', side=LEFT): 12 | if not self.labels.has_key(name): 13 | label = Label(self, bd=1, relief=SUNKEN, anchor=W) 14 | label.pack(side=side) 15 | self.labels[name] = label 16 | else: 17 | label = self.labels[name] 18 | label.config(text=text) 19 | 20 | def _test(): 21 | b = Frame() 22 | c = Text(b) 23 | c.pack(side=TOP) 24 | a = MultiStatusBar(b) 25 | a.set_label("one", "hello") 26 | a.set_label("two", "world") 27 | a.pack(side=BOTTOM, fill=X) 28 | b.pack() 29 | b.mainloop() 30 | 31 | if __name__ == '__main__': 32 | _test() 33 | -------------------------------------------------------------------------------- /site-packages/vidle2/RemoteObjectBrowser.py: -------------------------------------------------------------------------------- 1 | import rpc 2 | 3 | def remote_object_tree_item(item): 4 | wrapper = WrappedObjectTreeItem(item) 5 | oid = id(wrapper) 6 | rpc.objecttable[oid] = wrapper 7 | return oid 8 | 9 | class WrappedObjectTreeItem: 10 | # Lives in PYTHON subprocess 11 | 12 | def __init__(self, item): 13 | self.__item = item 14 | 15 | def __getattr__(self, name): 16 | value = getattr(self.__item, name) 17 | return value 18 | 19 | def _GetSubList(self): 20 | list = self.__item._GetSubList() 21 | return map(remote_object_tree_item, list) 22 | 23 | class StubObjectTreeItem: 24 | # Lives in IDLE process 25 | 26 | def __init__(self, sockio, oid): 27 | self.sockio = sockio 28 | self.oid = oid 29 | 30 | def __getattr__(self, name): 31 | value = rpc.MethodProxy(self.sockio, self.oid, name) 32 | return value 33 | 34 | def _GetSubList(self): 35 | list = self.sockio.remotecall(self.oid, "_GetSubList", (), {}) 36 | return [StubObjectTreeItem(self.sockio, oid) for oid in list] 37 | -------------------------------------------------------------------------------- /site-packages/vidle2/RstripExtension.py: -------------------------------------------------------------------------------- 1 | 'Provides "Strip trailing whitespace" under the "Format" menu.' 2 | 3 | __author__ = "Roger D. Serwy " 4 | 5 | class RstripExtension: 6 | 7 | menudefs = [ 8 | ('format', [None, 9 | ('Strip trailing whitespace', '<>'), 10 | ]),] 11 | 12 | def __init__(self, editwin): 13 | self.editwin = editwin 14 | self.editwin.text.bind("<>", self.do_rstrip) 15 | 16 | def do_rstrip(self, event=None): 17 | 18 | text = self.editwin.text 19 | undo = self.editwin.undo 20 | 21 | undo.undo_block_start() 22 | 23 | end_line = int(float(text.index('end'))) + 1 24 | for cur in range(1, end_line): 25 | txt = text.get('%i.0' % cur, '%i.0 lineend' % cur) 26 | cut = len(txt.rstrip()) 27 | text.delete('%i.%i' % (cur, cut), '%i.0 lineend' % cur) 28 | 29 | undo.undo_block_stop() 30 | -------------------------------------------------------------------------------- /site-packages/vidle2/ZoomHeight.py: -------------------------------------------------------------------------------- 1 | # Sample extension: zoom a window to maximum height 2 | 3 | import re 4 | import sys 5 | import macosxSupport 6 | 7 | class ZoomHeight: 8 | 9 | menudefs = [ 10 | ('windows', [ 11 | ('_Zoom Height', '<>'), 12 | ]) 13 | ] 14 | 15 | def __init__(self, editwin): 16 | self.editwin = editwin 17 | 18 | def zoom_height_event(self, event): 19 | top = self.editwin.top 20 | zoom_height(top) 21 | 22 | def zoom_height(top): 23 | geom = top.wm_geometry() 24 | m = re.match(r"(\d+)x(\d+)\+(-?\d+)\+(-?\d+)", geom) 25 | if not m: 26 | top.bell() 27 | return 28 | width, height, x, y = map(int, m.groups()) 29 | newheight = top.winfo_screenheight() 30 | if sys.platform == 'win32': 31 | newy = 0 32 | newheight = newheight - 72 33 | 34 | elif macosxSupport.runningAsOSXApp(): 35 | # The '88' below is a magic number that avoids placing the bottom 36 | # of the window below the panel on my machine. I don't know how 37 | # to calculate the correct value for this with tkinter. 38 | newy = 22 39 | newheight = newheight - newy - 88 40 | 41 | else: 42 | #newy = 24 43 | newy = 0 44 | #newheight = newheight - 96 45 | newheight = newheight - 88 46 | if height >= newheight: 47 | newgeom = "" 48 | else: 49 | newgeom = "%dx%d+%d+%d" % (width, newheight, x, newy) 50 | top.wm_geometry(newgeom) 51 | -------------------------------------------------------------------------------- /site-packages/vidle2/__init__.py: -------------------------------------------------------------------------------- 1 | # Dummy file to make this a package. 2 | -------------------------------------------------------------------------------- /site-packages/vidle2/config-highlight.def: -------------------------------------------------------------------------------- 1 | # IDLE reads several config files to determine user preferences. This 2 | # file is the default config file for idle highlight theme settings. 3 | 4 | [IDLE Classic] 5 | normal-foreground= #000000 6 | normal-background= #ffffff 7 | keyword-foreground= #ff7700 8 | keyword-background= #ffffff 9 | builtin-foreground= #900090 10 | builtin-background= #ffffff 11 | comment-foreground= #dd0000 12 | comment-background= #ffffff 13 | string-foreground= #00aa00 14 | string-background= #ffffff 15 | definition-foreground= #0000ff 16 | definition-background= #ffffff 17 | hilite-foreground= #000000 18 | hilite-background= gray 19 | break-foreground= black 20 | break-background= #ffff55 21 | hit-foreground= #ffffff 22 | hit-background= #000000 23 | error-foreground= #000000 24 | error-background= #ff7777 25 | #cursor (only foreground can be set, restart IDLE) 26 | cursor-foreground= black 27 | #shell window 28 | stdout-foreground= blue 29 | stdout-background= #ffffff 30 | stderr-foreground= red 31 | stderr-background= #ffffff 32 | console-foreground= #770000 33 | console-background= #ffffff 34 | 35 | [IDLE New] 36 | normal-foreground= #000000 37 | normal-background= #ffffff 38 | keyword-foreground= #ff7700 39 | keyword-background= #ffffff 40 | builtin-foreground= #900090 41 | builtin-background= #ffffff 42 | comment-foreground= #dd0000 43 | comment-background= #ffffff 44 | string-foreground= #00aa00 45 | string-background= #ffffff 46 | definition-foreground= #0000ff 47 | definition-background= #ffffff 48 | hilite-foreground= #000000 49 | hilite-background= gray 50 | break-foreground= black 51 | break-background= #ffff55 52 | hit-foreground= #ffffff 53 | hit-background= #000000 54 | error-foreground= #000000 55 | error-background= #ff7777 56 | #cursor (only foreground can be set, restart IDLE) 57 | cursor-foreground= black 58 | #shell window 59 | stdout-foreground= blue 60 | stdout-background= #ffffff 61 | stderr-foreground= red 62 | stderr-background= #ffffff 63 | console-foreground= #770000 64 | console-background= #ffffff 65 | -------------------------------------------------------------------------------- /site-packages/vidle2/dynOptionMenuWidget.py: -------------------------------------------------------------------------------- 1 | """ 2 | OptionMenu widget modified to allow dynamic menu reconfiguration 3 | and setting of highlightthickness 4 | """ 5 | from Tkinter import OptionMenu 6 | from Tkinter import _setit 7 | import copy 8 | 9 | class DynOptionMenu(OptionMenu): 10 | """ 11 | unlike OptionMenu, our kwargs can include highlightthickness 12 | """ 13 | def __init__(self, master, variable, value, *values, **kwargs): 14 | #get a copy of kwargs before OptionMenu.__init__ munges them 15 | kwargsCopy=copy.copy(kwargs) 16 | if 'highlightthickness' in kwargs.keys(): 17 | del(kwargs['highlightthickness']) 18 | OptionMenu.__init__(self, master, variable, value, *values, **kwargs) 19 | self.config(highlightthickness=kwargsCopy.get('highlightthickness')) 20 | #self.menu=self['menu'] 21 | self.variable=variable 22 | self.command=kwargs.get('command') 23 | 24 | def SetMenu(self,valueList,value=None): 25 | """ 26 | clear and reload the menu with a new set of options. 27 | valueList - list of new options 28 | value - initial value to set the optionmenu's menubutton to 29 | """ 30 | self['menu'].delete(0,'end') 31 | for item in valueList: 32 | self['menu'].add_command(label=item, 33 | command=_setit(self.variable,item,self.command)) 34 | if value: 35 | self.variable.set(value) 36 | -------------------------------------------------------------------------------- /site-packages/vidle2/idle.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem Working IDLE bat for Windows - uses start instead of absolute pathname 3 | start idle.pyw %1 %2 %3 %4 %5 %6 %7 %8 %9 4 | -------------------------------------------------------------------------------- /site-packages/vidle2/idle.py: -------------------------------------------------------------------------------- 1 | import os.path 2 | import sys 3 | 4 | # If we are working on a development version of IDLE, we need to prepend the 5 | # parent of this idlelib dir to sys.path. Otherwise, importing idlelib gets 6 | # the version installed with the Python used to call this module: 7 | idlelib_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 8 | sys.path.insert(0, idlelib_dir) 9 | 10 | import vidle.PyShell 11 | vidle.PyShell.main() 12 | -------------------------------------------------------------------------------- /site-packages/vidle2/idle.pyw: -------------------------------------------------------------------------------- 1 | try: 2 | import vidle.PyShell 3 | except ImportError: 4 | # IDLE is not installed, but maybe PyShell is on sys.path: 5 | try: 6 | import PyShell 7 | except ImportError: 8 | raise 9 | else: 10 | import os 11 | idledir = os.path.dirname(os.path.abspath(PyShell.__file__)) 12 | if idledir != os.getcwd(): 13 | # We're not in the IDLE directory, help the subprocess find run.py 14 | pypath = os.environ.get('PYTHONPATH', '') 15 | if pypath: 16 | os.environ['PYTHONPATH'] = pypath + ':' + idledir 17 | else: 18 | os.environ['PYTHONPATH'] = idledir 19 | PyShell.main() 20 | else: 21 | vidle.PyShell.main() 22 | -------------------------------------------------------------------------------- /site-packages/vidle2/idlever.py: -------------------------------------------------------------------------------- 1 | IDLE_VERSION = "2.7a0" 2 | -------------------------------------------------------------------------------- /site-packages/vidle2/testcode.py: -------------------------------------------------------------------------------- 1 | import string 2 | 3 | def f(): 4 | a = 0 5 | b = 1 6 | c = 2 7 | d = 3 8 | e = 4 9 | g() 10 | 11 | def g(): 12 | h() 13 | 14 | def h(): 15 | i() 16 | 17 | def i(): 18 | j() 19 | 20 | def j(): 21 | k() 22 | 23 | def k(): 24 | l() 25 | 26 | l = lambda: test() 27 | 28 | def test(): 29 | string.capwords(1) 30 | 31 | f() 32 | -------------------------------------------------------------------------------- /site-packages/vidle2/utils.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | def tb_print_list(extracted_list, filename, normal=sys.stdout, 4 | highlight=sys.stderr): 5 | """An extended version of traceback.print_list which exclude 6 | "in " when printing traceback and highlight the entries 7 | that occur on the given filename.""" 8 | for fname, lineno, name, line in extracted_list: 9 | f = highlight if fname == filename else normal 10 | if name == '': 11 | f.write(' File "%s", line %d\n' % (fname, lineno)) 12 | else: 13 | f.write(' File "%s", line %d, in %s\n' % (fname, lineno, name)) 14 | if line: 15 | f.write(' %s\n' % line.strip()) 16 | -------------------------------------------------------------------------------- /site-packages/vidle3/CREDITS.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vpython/visual/e856d1b89d8ab0484409f4be7931326ed546e9a2/site-packages/vidle3/CREDITS.txt -------------------------------------------------------------------------------- /site-packages/vidle3/Delegator.py: -------------------------------------------------------------------------------- 1 | class Delegator: 2 | 3 | # The cache is only used to be able to change delegates! 4 | 5 | def __init__(self, delegate=None): 6 | self.delegate = delegate 7 | self.__cache = {} 8 | 9 | def __getattr__(self, name): 10 | attr = getattr(self.delegate, name) # May raise AttributeError 11 | setattr(self, name, attr) 12 | self.__cache[name] = attr 13 | return attr 14 | 15 | def resetcache(self): 16 | for key in self.__cache: 17 | try: 18 | delattr(self, key) 19 | except AttributeError: 20 | pass 21 | self.__cache.clear() 22 | 23 | def cachereport(self): 24 | keys = list(self.__cache.keys()) 25 | keys.sort() 26 | print(keys) 27 | 28 | def setdelegate(self, delegate): 29 | self.resetcache() 30 | self.delegate = delegate 31 | 32 | def getdelegate(self): 33 | return self.delegate 34 | -------------------------------------------------------------------------------- /site-packages/vidle3/FileRevert.py: -------------------------------------------------------------------------------- 1 | """ 2 | FileRevert is an extension that re-reads the currently open file and 3 | displays the possibly updated content. 4 | """ 5 | from tkinter import * 6 | import tkinter.messagebox as tkMessageBox 7 | 8 | class FileRevert: 9 | 10 | menudefs = [('file', [('Revert', '<>')])] 11 | 12 | def __init__(self, editwin): 13 | self.text = editwin.text 14 | self.io = editwin.io 15 | 16 | def revert_file_event(self, event): 17 | fname = self.io.filename 18 | if fname is None: 19 | # No file associated. 20 | return 21 | 22 | if not self.io.get_saved(): 23 | msg = "Do you want to save a copy of %s before reverting?" % fname 24 | res = tkMessageBox.askyesnocancel( 25 | master=self.text, 26 | title="Save a copy", 27 | message=msg) 28 | if res is None: 29 | # Canceled. 30 | return 31 | elif res: 32 | self.io.save_a_copy(event) 33 | # XXX Maybe it would be better to not revert the file when 34 | # user cancels the dialog that saves a copy of the current 35 | # file. 36 | 37 | self.io.loadfile(fname) 38 | -------------------------------------------------------------------------------- /site-packages/vidle3/Icons/folder.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vpython/visual/e856d1b89d8ab0484409f4be7931326ed546e9a2/site-packages/vidle3/Icons/folder.gif -------------------------------------------------------------------------------- /site-packages/vidle3/Icons/idle.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vpython/visual/e856d1b89d8ab0484409f4be7931326ed546e9a2/site-packages/vidle3/Icons/idle.icns -------------------------------------------------------------------------------- /site-packages/vidle3/Icons/minusnode.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vpython/visual/e856d1b89d8ab0484409f4be7931326ed546e9a2/site-packages/vidle3/Icons/minusnode.gif -------------------------------------------------------------------------------- /site-packages/vidle3/Icons/openfolder.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vpython/visual/e856d1b89d8ab0484409f4be7931326ed546e9a2/site-packages/vidle3/Icons/openfolder.gif -------------------------------------------------------------------------------- /site-packages/vidle3/Icons/plusnode.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vpython/visual/e856d1b89d8ab0484409f4be7931326ed546e9a2/site-packages/vidle3/Icons/plusnode.gif -------------------------------------------------------------------------------- /site-packages/vidle3/Icons/python.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vpython/visual/e856d1b89d8ab0484409f4be7931326ed546e9a2/site-packages/vidle3/Icons/python.gif -------------------------------------------------------------------------------- /site-packages/vidle3/Icons/tk.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vpython/visual/e856d1b89d8ab0484409f4be7931326ed546e9a2/site-packages/vidle3/Icons/tk.gif -------------------------------------------------------------------------------- /site-packages/vidle3/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to produce Makefile.in 2 | # Makefile to distribute VIDLE 3 | 4 | AUTOMAKE_OPTIONS = foreign 5 | srcdir = @srcdir@ 6 | VPATH = @srcdir@ 7 | 8 | if BUILD_VIDLE 9 | vidlefiles = __init__.py \ 10 | aboutDialog.py AutoComplete.py AutoCompleteWindow.py AutoExpand.py Bindings.py \ 11 | CallTips.py CallTipWindow.py ChangeLog ClassBrowser.py CodeContext.py \ 12 | ColorDelegator.py configDialog.py \ 13 | config-extensions.def configHandler.py configHelpSourceEdit.py \ 14 | config-highlight.def config-keys.def config-main.def \ 15 | configSectionNameDialog.py CREDITS.txt \ 16 | Debugger.py Delegator.py dynOptionMenuWidget.py \ 17 | EditorWindow.py extend.txt FileList.py \ 18 | FileRevert.py FormatParagraph.py GrepDialog.py \ 19 | help.txt HISTORY.txt HyperParser.py Icons idle.bat \ 20 | idle.py idle.pyw IdleHistory.py idlever.py IOBinding.py \ 21 | keybindingDialog.py macosxSupport.py \ 22 | MultiCall.py MultiStatusBar.py NEWS.txt ObjectBrowser.py OutputWindow.py \ 23 | ParenMatch.py PathBrowser.py Percolator.py PyParse.py PyShell.py \ 24 | README.txt RemoteDebugger.py RemoteObjectBrowser.py ReplaceDialog.py rpc.py \ 25 | RstripExtension.py run.py ScriptBinding.py ScrolledList.py SearchDialog.py SearchDialogBase.py \ 26 | SearchEngine.py StackViewer.py tabbedpages.py testcode.py textView.py \ 27 | TODO.txt ToolTip.py TreeWidget.py UndoDelegator.py utils.py WidgetRedirector.py \ 28 | WindowList.py ZoomHeight.py \ 29 | Icons/folder.gif Icons/idle.icns Icons/minusnode.gif Icons/openfolder.gif \ 30 | Icons/plusnode.gif Icons/python.gif Icons/tk.gif 31 | else 32 | vidlefiles = 33 | endif 34 | 35 | pkgdatadir = @visualvidledir@ 36 | 37 | dist_pkgdata_DATA = $(vidlefiles) 38 | 39 | -------------------------------------------------------------------------------- /site-packages/vidle3/MultiStatusBar.py: -------------------------------------------------------------------------------- 1 | from tkinter import * 2 | 3 | class MultiStatusBar(Frame): 4 | 5 | def __init__(self, master=None, **kw): 6 | if master is None: 7 | master = Tk() 8 | Frame.__init__(self, master, **kw) 9 | self.labels = {} 10 | 11 | def set_label(self, name, text='', side=LEFT): 12 | if name not in self.labels: 13 | label = Label(self, bd=1, relief=SUNKEN, anchor=W) 14 | label.pack(side=side) 15 | self.labels[name] = label 16 | else: 17 | label = self.labels[name] 18 | label.config(text=text) 19 | 20 | def _test(): 21 | b = Frame() 22 | c = Text(b) 23 | c.pack(side=TOP) 24 | a = MultiStatusBar(b) 25 | a.set_label("one", "hello") 26 | a.set_label("two", "world") 27 | a.pack(side=BOTTOM, fill=X) 28 | b.pack() 29 | b.mainloop() 30 | 31 | if __name__ == '__main__': 32 | _test() 33 | -------------------------------------------------------------------------------- /site-packages/vidle3/RemoteObjectBrowser.py: -------------------------------------------------------------------------------- 1 | from . import rpc 2 | 3 | def remote_object_tree_item(item): 4 | wrapper = WrappedObjectTreeItem(item) 5 | oid = id(wrapper) 6 | rpc.objecttable[oid] = wrapper 7 | return oid 8 | 9 | class WrappedObjectTreeItem: 10 | # Lives in PYTHON subprocess 11 | 12 | def __init__(self, item): 13 | self.__item = item 14 | 15 | def __getattr__(self, name): 16 | value = getattr(self.__item, name) 17 | return value 18 | 19 | def _GetSubList(self): 20 | list = self.__item._GetSubList() 21 | return list(map(remote_object_tree_item, list)) 22 | 23 | class StubObjectTreeItem: 24 | # Lives in IDLE process 25 | 26 | def __init__(self, sockio, oid): 27 | self.sockio = sockio 28 | self.oid = oid 29 | 30 | def __getattr__(self, name): 31 | value = rpc.MethodProxy(self.sockio, self.oid, name) 32 | return value 33 | 34 | def _GetSubList(self): 35 | list = self.sockio.remotecall(self.oid, "_GetSubList", (), {}) 36 | return [StubObjectTreeItem(self.sockio, oid) for oid in list] 37 | -------------------------------------------------------------------------------- /site-packages/vidle3/RstripExtension.py: -------------------------------------------------------------------------------- 1 | 'Provides "Strip trailing whitespace" under the "Format" menu.' 2 | 3 | __author__ = "Roger D. Serwy " 4 | 5 | class RstripExtension: 6 | 7 | menudefs = [ 8 | ('format', [None, 9 | ('Strip trailing whitespace', '<>'), 10 | ]),] 11 | 12 | def __init__(self, editwin): 13 | self.editwin = editwin 14 | self.editwin.text.bind("<>", self.do_rstrip) 15 | 16 | def do_rstrip(self, event=None): 17 | 18 | text = self.editwin.text 19 | undo = self.editwin.undo 20 | 21 | undo.undo_block_start() 22 | 23 | end_line = int(float(text.index('end'))) + 1 24 | for cur in range(1, end_line): 25 | txt = text.get('%i.0' % cur, '%i.0 lineend' % cur) 26 | cut = len(txt.rstrip()) 27 | text.delete('%i.%i' % (cur, cut), '%i.0 lineend' % cur) 28 | 29 | undo.undo_block_stop() 30 | -------------------------------------------------------------------------------- /site-packages/vidle3/ZoomHeight.py: -------------------------------------------------------------------------------- 1 | # Sample extension: zoom a window to maximum height 2 | 3 | import re 4 | import sys 5 | 6 | from . import macosxSupport 7 | 8 | class ZoomHeight: 9 | 10 | menudefs = [ 11 | ('windows', [ 12 | ('_Zoom Height', '<>'), 13 | ]) 14 | ] 15 | 16 | def __init__(self, editwin): 17 | self.editwin = editwin 18 | 19 | def zoom_height_event(self, event): 20 | top = self.editwin.top 21 | zoom_height(top) 22 | 23 | def zoom_height(top): 24 | geom = top.wm_geometry() 25 | m = re.match(r"(\d+)x(\d+)\+(-?\d+)\+(-?\d+)", geom) 26 | if not m: 27 | top.bell() 28 | return 29 | width, height, x, y = map(int, m.groups()) 30 | newheight = top.winfo_screenheight() 31 | if sys.platform == 'win32': 32 | newy = 0 33 | newheight = newheight - 72 34 | 35 | elif macosxSupport.runningAsOSXApp(): 36 | # The '88' below is a magic number that avoids placing the bottom 37 | # of the window below the panel on my machine. I don't know how 38 | # to calculate the correct value for this with tkinter. 39 | newy = 22 40 | newheight = newheight - newy - 88 41 | 42 | else: 43 | #newy = 24 44 | newy = 0 45 | #newheight = newheight - 96 46 | newheight = newheight - 88 47 | if height >= newheight: 48 | newgeom = "" 49 | else: 50 | newgeom = "%dx%d+%d+%d" % (width, newheight, x, newy) 51 | top.wm_geometry(newgeom) 52 | -------------------------------------------------------------------------------- /site-packages/vidle3/__init__.py: -------------------------------------------------------------------------------- 1 | # Dummy file to make this a package. 2 | # Imports are relative (e.g. from . import PyShell), but 3 | # in PyShell.py there is a specific reference to idlelib (or vidle) 4 | # in connection with using __import__ (constructed import). 5 | -------------------------------------------------------------------------------- /site-packages/vidle3/config-highlight.def: -------------------------------------------------------------------------------- 1 | # IDLE reads several config files to determine user preferences. This 2 | # file is the default config file for idle highlight theme settings. 3 | 4 | [IDLE Classic] 5 | normal-foreground= #000000 6 | normal-background= #ffffff 7 | keyword-foreground= #ff7700 8 | keyword-background= #ffffff 9 | builtin-foreground= #900090 10 | builtin-background= #ffffff 11 | comment-foreground= #dd0000 12 | comment-background= #ffffff 13 | string-foreground= #00aa00 14 | string-background= #ffffff 15 | definition-foreground= #0000ff 16 | definition-background= #ffffff 17 | hilite-foreground= #000000 18 | hilite-background= gray 19 | break-foreground= black 20 | break-background= #ffff55 21 | hit-foreground= #ffffff 22 | hit-background= #000000 23 | error-foreground= #000000 24 | error-background= #ff7777 25 | #cursor (only foreground can be set, restart IDLE) 26 | cursor-foreground= black 27 | #shell window 28 | stdout-foreground= blue 29 | stdout-background= #ffffff 30 | stderr-foreground= red 31 | stderr-background= #ffffff 32 | console-foreground= #770000 33 | console-background= #ffffff 34 | 35 | [IDLE New] 36 | normal-foreground= #000000 37 | normal-background= #ffffff 38 | keyword-foreground= #ff7700 39 | keyword-background= #ffffff 40 | builtin-foreground= #900090 41 | builtin-background= #ffffff 42 | comment-foreground= #dd0000 43 | comment-background= #ffffff 44 | string-foreground= #00aa00 45 | string-background= #ffffff 46 | definition-foreground= #0000ff 47 | definition-background= #ffffff 48 | hilite-foreground= #000000 49 | hilite-background= gray 50 | break-foreground= black 51 | break-background= #ffff55 52 | hit-foreground= #ffffff 53 | hit-background= #000000 54 | error-foreground= #000000 55 | error-background= #ff7777 56 | #cursor (only foreground can be set, restart IDLE) 57 | cursor-foreground= black 58 | #shell window 59 | stdout-foreground= blue 60 | stdout-background= #ffffff 61 | stderr-foreground= red 62 | stderr-background= #ffffff 63 | console-foreground= #770000 64 | console-background= #ffffff 65 | -------------------------------------------------------------------------------- /site-packages/vidle3/dynOptionMenuWidget.py: -------------------------------------------------------------------------------- 1 | """ 2 | OptionMenu widget modified to allow dynamic menu reconfiguration 3 | and setting of highlightthickness 4 | """ 5 | from tkinter import OptionMenu 6 | from tkinter import _setit 7 | import copy 8 | 9 | class DynOptionMenu(OptionMenu): 10 | """ 11 | unlike OptionMenu, our kwargs can include highlightthickness 12 | """ 13 | def __init__(self, master, variable, value, *values, **kwargs): 14 | #get a copy of kwargs before OptionMenu.__init__ munges them 15 | kwargsCopy=copy.copy(kwargs) 16 | if 'highlightthickness' in list(kwargs.keys()): 17 | del(kwargs['highlightthickness']) 18 | OptionMenu.__init__(self, master, variable, value, *values, **kwargs) 19 | self.config(highlightthickness=kwargsCopy.get('highlightthickness')) 20 | #self.menu=self['menu'] 21 | self.variable=variable 22 | self.command=kwargs.get('command') 23 | 24 | def SetMenu(self,valueList,value=None): 25 | """ 26 | clear and reload the menu with a new set of options. 27 | valueList - list of new options 28 | value - initial value to set the optionmenu's menubutton to 29 | """ 30 | self['menu'].delete(0,'end') 31 | for item in valueList: 32 | self['menu'].add_command(label=item, 33 | command=_setit(self.variable,item,self.command)) 34 | if value: 35 | self.variable.set(value) 36 | -------------------------------------------------------------------------------- /site-packages/vidle3/idle.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem Working IDLE bat for Windows - uses start instead of absolute pathname 3 | start idle.pyw %1 %2 %3 %4 %5 %6 %7 %8 %9 4 | -------------------------------------------------------------------------------- /site-packages/vidle3/idle.py: -------------------------------------------------------------------------------- 1 | import os.path 2 | import sys 3 | 4 | # If we are working on a development version of IDLE, we need to prepend the 5 | # parent of this dir to sys.path. Otherwise, importing this module gets 6 | # the version installed with the Python used to call this module: 7 | idlelib_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 8 | sys.path.insert(0, idlelib_dir) 9 | 10 | from vidle import PyShell 11 | PyShell.main() 12 | -------------------------------------------------------------------------------- /site-packages/vidle3/idle.pyw: -------------------------------------------------------------------------------- 1 | try: 2 | from vidle import PyShell 3 | except ImportError: 4 | # IDLE is not installed, but maybe PyShell is on sys.path: 5 | try: 6 | import PyShell 7 | except ImportError: 8 | raise 9 | else: 10 | import os 11 | idledir = os.path.dirname(os.path.abspath(PyShell.__file__)) 12 | if idledir != os.getcwd(): 13 | # We're not in the IDLE directory, help the subprocess find run.py 14 | pypath = os.environ.get('PYTHONPATH', '') 15 | if pypath: 16 | os.environ['PYTHONPATH'] = pypath + ':' + idledir 17 | else: 18 | os.environ['PYTHONPATH'] = idledir 19 | PyShell.main() 20 | else: 21 | PyShell.main() 22 | -------------------------------------------------------------------------------- /site-packages/vidle3/idlever.py: -------------------------------------------------------------------------------- 1 | IDLE_VERSION = "3.1.2" 2 | -------------------------------------------------------------------------------- /site-packages/vidle3/testcode.py: -------------------------------------------------------------------------------- 1 | import string 2 | 3 | def f(): 4 | a = 0 5 | b = 1 6 | c = 2 7 | d = 3 8 | e = 4 9 | g() 10 | 11 | def g(): 12 | h() 13 | 14 | def h(): 15 | i() 16 | 17 | def i(): 18 | j() 19 | 20 | def j(): 21 | k() 22 | 23 | def k(): 24 | l() 25 | 26 | l = lambda: test() 27 | 28 | def test(): 29 | string.capwords(1) 30 | 31 | f() 32 | -------------------------------------------------------------------------------- /site-packages/vidle3/utils.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | def tb_print_list(extracted_list, filename, normal=sys.stdout, 4 | highlight=sys.stderr): 5 | """An extended version of traceback.print_list which exclude 6 | "in " when printing traceback and highlight the entries 7 | that occur on the given filename.""" 8 | for fname, lineno, name, line in extracted_list: 9 | f = highlight if fname == filename else normal 10 | if name == '': 11 | f.write(' File "%s", line %d\n' % (fname, lineno)) 12 | else: 13 | f.write(' File "%s", line %d, in %s\n' % (fname, lineno, name)) 14 | if line: 15 | f.write(' %s\n' % line.strip()) 16 | -------------------------------------------------------------------------------- /site-packages/vis/BlueMarble.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vpython/visual/e856d1b89d8ab0484409f4be7931326ed546e9a2/site-packages/vis/BlueMarble.tga -------------------------------------------------------------------------------- /site-packages/vis/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to produce vis/Makefile.in 2 | 3 | srcdir = @srcdir@ 4 | VPATH = @srcdir@ 5 | 6 | visfiles = __init__.py BlueMarble.tga brickbump.tga controls.py \ 7 | crayola.py earth.tga factorial.py filedialog.py \ 8 | graph.py license.txt logo_t.gif materials.py pan.png \ 9 | paths.py primitives.py random.tga shapes.py site_settings.py \ 10 | turbulence3.tga ui.py vpython_notoolbar.glade vpython.glade \ 11 | wood.tga 12 | 13 | pkgdatadir = @visualvisdir@ 14 | 15 | dist_pkgdata_DATA = $(visfiles) 16 | 17 | -------------------------------------------------------------------------------- /site-packages/vis/__init__.py: -------------------------------------------------------------------------------- 1 | version = ('5.72', 'release') 2 | 3 | from .cvisual import (vector, dot, mag, mag2, norm, cross, rotate, 4 | comp, proj, diff_angle, rate, waitclose) 5 | from .primitives import (arrow, cylinder, cone, sphere, box, ring, label, 6 | frame, pyramid, ellipsoid, curve, faces, convex, helix, 7 | points, text, distant_light, local_light, extrusion) 8 | try: 9 | from Polygon import Polygon 10 | except: 11 | pass 12 | 13 | from .ui import display 14 | scene = display() # a display needs to exist in order for an object reference to work 15 | from . import crayola 16 | color = crayola 17 | from . import materials 18 | from . import site_settings # need to study this 19 | 20 | # Allow cvisual itself to load files from the vis package - used by GTK 21 | # driver to load glade data files 22 | import os.path as _os_path 23 | from .cvisual import _set_dataroot 24 | _set_dataroot( _os_path.split( __file__ )[0] + _os_path.sep) 25 | 26 | -------------------------------------------------------------------------------- /site-packages/vis/brickbump.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vpython/visual/e856d1b89d8ab0484409f4be7931326ed546e9a2/site-packages/vis/brickbump.tga -------------------------------------------------------------------------------- /site-packages/vis/crayola.py: -------------------------------------------------------------------------------- 1 | import colorsys 2 | 3 | black = (0,0,0) 4 | white = (1,1,1) 5 | 6 | red = (1,0,0) 7 | green = (0,1,0) 8 | blue = (0,0,1) 9 | 10 | yellow = (1,1,0) 11 | cyan = (0,1,1) 12 | magenta = (1,0,1) 13 | 14 | orange = (1,0.6,0) 15 | 16 | def gray(luminance): 17 | return (luminance,luminance,luminance) 18 | 19 | def rgb_to_hsv(T): 20 | if len(T) > 3: 21 | T = T[:3] 22 | return colorsys.rgb_to_hsv(*T) 23 | 24 | def hsv_to_rgb(T): 25 | if len(T) > 3: 26 | T = T[:3] 27 | return colorsys.hsv_to_rgb(*T) 28 | 29 | -------------------------------------------------------------------------------- /site-packages/vis/earth.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vpython/visual/e856d1b89d8ab0484409f4be7931326ed546e9a2/site-packages/vis/earth.tga -------------------------------------------------------------------------------- /site-packages/vis/factorial.py: -------------------------------------------------------------------------------- 1 | # factorial and combin functions needed in statistical computations 2 | # Bruce Sherwood, Carnegie Mellon University, 2000 3 | 4 | def factorial(x): 5 | if x <= 0.: 6 | if x == 0.: return 1. 7 | else: raise ValueError('Cannot take factorial of negative number %d' % x) 8 | fact = 1. 9 | nn = 2. 10 | while nn <= x: 11 | fact = fact*nn 12 | nn = nn+1. 13 | if nn != x+1: raise ValueError('Argument of factorial must be an integer, not %0.1f' % x) 14 | return fact 15 | 16 | def combin(x, y): 17 | # combin(x,y) = factorial(x)/[factorial(y)*factorial(x-y)] 18 | z = x-y 19 | num = 1.0 20 | if y > z: 21 | y,z = z,y 22 | nn = int(z+1.) 23 | while nn <= x: 24 | num = num*nn 25 | nn = nn+1. 26 | if nn != x+1: raise ValueError('Illegal arguments (%d, %d) for combin function' % (x, y)) 27 | return num/factorial(y) 28 | 29 | if __name__ == '__main__': 30 | print('factorial(6) = 6! =', factorial(6)) 31 | print('combin(6,2) = 6!/(2!(6-2)!) =', combin(6,2)) 32 | 33 | -------------------------------------------------------------------------------- /site-packages/vis/logo_t.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vpython/visual/e856d1b89d8ab0484409f4be7931326ed546e9a2/site-packages/vis/logo_t.gif -------------------------------------------------------------------------------- /site-packages/vis/pan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vpython/visual/e856d1b89d8ab0484409f4be7931326ed546e9a2/site-packages/vis/pan.png -------------------------------------------------------------------------------- /site-packages/vis/random.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vpython/visual/e856d1b89d8ab0484409f4be7931326ed546e9a2/site-packages/vis/random.tga -------------------------------------------------------------------------------- /site-packages/vis/site_settings.py: -------------------------------------------------------------------------------- 1 | # This file may be modified by the user (or site administrator, in a 2 | # multi-user environment) to change settings or modify VPython to work 3 | # around local configuration issues. 4 | 5 | ## Disabling shaders may be necessary on some systems where Visual fails 6 | ## to detect that the video hardware or drivers are incapable of competently 7 | ## rendering the shaders used to implement certain materials. This will 8 | ## revert all objects to legacy rendering regardless of what material is 9 | ## chosen: 10 | 11 | ##from .ui import display 12 | ##display.enable_shaders = False 13 | 14 | ## Alternatively, it might be possible to fix some systems by disabling 15 | ## only some materials, remapping them to ones that work: 16 | 17 | ##from . import materials 18 | ##materials.rough = materials.diffuse\ 19 | -------------------------------------------------------------------------------- /site-packages/vis/turbulence3.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vpython/visual/e856d1b89d8ab0484409f4be7931326ed546e9a2/site-packages/vis/turbulence3.tga -------------------------------------------------------------------------------- /site-packages/vis/vpython_notoolbar.glade: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | public 8 | VPython 9 | GTK_WINDOW_TOPLEVEL 10 | GTK_WIN_POS_NONE 11 | False 12 | True 13 | False 14 | logo_t.gif 15 | True 16 | False 17 | False 18 | GDK_WINDOW_TYPE_HINT_NORMAL 19 | GDK_GRAVITY_NORTH_WEST 20 | True 21 | False 22 | 23 | 24 | 25 | public 26 | True 27 | False 28 | 0 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /site-packages/vis/wood.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vpython/visual/e856d1b89d8ab0484409f4be7931326ed546e9a2/site-packages/vis/wood.tga -------------------------------------------------------------------------------- /site-packages/visual/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to produce visual/Makefile.in 2 | 3 | srcdir = @srcdir@ 4 | VPATH = @srcdir@ 5 | 6 | # override the name of package 7 | PACKAGE = visual 8 | 9 | pkgpython_PYTHON = __init__.py controls.py factorial.py filedialog.py \ 10 | graph.py text.py visual_all.py 11 | 12 | pkgdatadir = @pythondir@/visual 13 | -------------------------------------------------------------------------------- /site-packages/visual/__init__.py: -------------------------------------------------------------------------------- 1 | from .visual_all import * 2 | -------------------------------------------------------------------------------- /site-packages/visual/controls.py: -------------------------------------------------------------------------------- 1 | from .visual_all import * 2 | from .visual_all import _fix_symbols 3 | 4 | __all__ = _fix_symbols( globals() ) + [ 5 | 'controls','button','toggle','slider','menu'] 6 | 7 | from vis.controls import * 8 | -------------------------------------------------------------------------------- /site-packages/visual/factorial.py: -------------------------------------------------------------------------------- 1 | from vis.factorial import * 2 | -------------------------------------------------------------------------------- /site-packages/visual/filedialog.py: -------------------------------------------------------------------------------- 1 | from .visual_all import * 2 | from vis.filedialog import * 3 | -------------------------------------------------------------------------------- /site-packages/visual/graph.py: -------------------------------------------------------------------------------- 1 | from .visual_all import * 2 | from .visual_all import _fix_symbols 3 | 4 | __all__ = _fix_symbols( globals() ) + [ 5 | 'gdisplay','gcurve','gdots','gvbars','ghbars','ghistogram'] 6 | 7 | from vis.graph import * 8 | -------------------------------------------------------------------------------- /src/core/axial.cpp: -------------------------------------------------------------------------------- 1 | #include "axial.hpp" 2 | 3 | namespace cvisual { 4 | 5 | axial::axial() 6 | : radius(1.0) 7 | { 8 | } 9 | 10 | axial::axial( const axial& other) 11 | : primitive( other), radius( other.radius) 12 | { 13 | } 14 | 15 | axial::~axial() 16 | { 17 | } 18 | 19 | void 20 | axial::set_radius( double r) 21 | { 22 | radius = r; 23 | } 24 | 25 | double 26 | axial::get_radius() 27 | { 28 | return radius; 29 | } 30 | 31 | void 32 | axial::get_material_matrix(const view&, tmatrix& out) { 33 | out.translate( vector(.0005,.5,.5) ); 34 | vector scale( axis.mag(), radius, radius ); 35 | out.scale( scale * (.999 / std::max(scale.x, scale.y*2)) ); 36 | 37 | // Undo the rotation inside quadric::render_cylinder() and ::render_disk(): 38 | out = out * rotation( +.5*M_PI, vector(0,1,0) ); // xxx performance 39 | } 40 | 41 | } // !namespace cvisual 42 | -------------------------------------------------------------------------------- /src/core/light.cpp: -------------------------------------------------------------------------------- 1 | #include "light.hpp" 2 | 3 | namespace cvisual { 4 | 5 | void light::render_lights( view& v ) { 6 | ++v.light_count[0]; 7 | 8 | vertex p = get_vertex( v.gcf ); 9 | for(int d=0; d<4; d++) v.light_pos.push_back(p[d]); 10 | for(int d=0; d<3; d++) v.light_color.push_back(color[d]); 11 | v.light_color.push_back( 1.0 ); 12 | } 13 | 14 | } // namespace cvisual 15 | -------------------------------------------------------------------------------- /src/core/rectangular.cpp: -------------------------------------------------------------------------------- 1 | #include "rectangular.hpp" 2 | 3 | namespace cvisual { 4 | 5 | rectangular::rectangular() 6 | : width(1.0), height(1.0) 7 | { 8 | } 9 | 10 | rectangular::rectangular( const rectangular& other) 11 | : primitive( other), width( other.width), height( other.height) 12 | { 13 | } 14 | 15 | rectangular::~rectangular() 16 | { 17 | } 18 | 19 | void 20 | rectangular::set_length( double l) 21 | { 22 | if (l < 0) 23 | throw std::runtime_error( "length cannot be negative"); 24 | axis = axis.norm() * l; 25 | } 26 | 27 | double 28 | rectangular::get_length() 29 | { 30 | return axis.mag(); 31 | } 32 | 33 | void 34 | rectangular::set_height( double h) 35 | { 36 | if (h < 0) 37 | throw std::runtime_error( "height cannot be negative"); 38 | height = h; 39 | } 40 | 41 | double 42 | rectangular::get_height() 43 | { 44 | return height; 45 | } 46 | 47 | void 48 | rectangular::set_width( double w) 49 | { 50 | if (w < 0) 51 | throw std::runtime_error( "width cannot be negative"); 52 | width = w; 53 | } 54 | 55 | double 56 | rectangular::get_width() 57 | { 58 | return width; 59 | } 60 | 61 | vector 62 | rectangular::get_size() 63 | { 64 | return vector(axis.mag(), height, width); 65 | } 66 | 67 | void 68 | rectangular::set_size( const vector& s) 69 | { 70 | if (s.x < 0) 71 | throw std::runtime_error( "length cannot be negative"); 72 | if (s.y < 0) 73 | throw std::runtime_error( "height cannot be negative"); 74 | if (s.z < 0) 75 | throw std::runtime_error( "width cannot be negative"); 76 | axis = axis.norm() * s.x; 77 | height = s.y; 78 | width = s.z; 79 | } 80 | 81 | void 82 | rectangular::apply_transform( const view& scene ) 83 | { 84 | // OpenGL needs to invert the modelview matrix to generate the normal matrix, 85 | // so try not to make it singular: 86 | double min_scale = std::max( axis.mag(), std::max(height,width) ) * 1e-6; 87 | vector size( std::max(min_scale,axis.mag()), 88 | std::max(min_scale,height), 89 | std::max(min_scale,width) ); 90 | 91 | model_world_transform( scene.gcf, size ).gl_mult(); 92 | } 93 | 94 | } // !namespace cvisual 95 | -------------------------------------------------------------------------------- /src/core/util/atomic_queue.cpp: -------------------------------------------------------------------------------- 1 | #include "util/atomic_queue.hpp" 2 | #include "python/gil.hpp" 3 | 4 | #include 5 | #include 6 | #include 7 | #include "util/errors.hpp" 8 | 9 | namespace cvisual { 10 | 11 | void 12 | atomic_queue_impl::push_notify() 13 | { 14 | empty = false; 15 | if (waiting) 16 | ready.notify_all(); 17 | } 18 | 19 | namespace { 20 | void 21 | xtime_increment( boost::xtime& time, int ms) 22 | { 23 | assert( ms < 100); 24 | time.nsec += ms * 1000000; 25 | if (time.nsec > 1000000000) { 26 | time.nsec -= 1000000000; 27 | time.sec += 1; 28 | } 29 | } 30 | } // !namespace (anon) 31 | 32 | void 33 | atomic_queue_impl::py_pop_wait( lock& L) 34 | { 35 | using python::gil_release; 36 | using python::gil_lock; 37 | 38 | // The following code is due to CL Cheung, to avoid a deadlock 39 | // between this routine waiting to regain the gil and the event 40 | // processing thread waiting to get the barrier lock L. The 41 | // symptom was Visual not responding after rapid keypresses. 42 | L.unlock(); 43 | { 44 | gil_release release; 45 | 46 | // I took the code to call Py_MakePendingCalls() out. The internet leads 47 | // me to believe that it is not necessary. For example, Python time.sleep() 48 | // doesn't do it. 49 | if (empty) { 50 | L.lock(); 51 | while (empty) { 52 | waiting = true; 53 | ready.wait(L); 54 | } 55 | L.unlock(); 56 | } 57 | waiting = false; 58 | } 59 | L.lock(); 60 | 61 | } 62 | 63 | } // !namespace cvisual 64 | -------------------------------------------------------------------------------- /src/core/util/displaylist.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2004 by Jonathan Brandmeyer and others. 2 | // See the file license.txt for complete license terms. 3 | // See the file authors.txt for a complete list of contributors. 4 | 5 | #include "util/displaylist.hpp" 6 | #include "util/gl_free.hpp" 7 | #include "util/errors.hpp" 8 | #include "wrap_gl.hpp" 9 | #include 10 | #include 11 | #include 12 | using boost::lexical_cast; 13 | 14 | namespace cvisual { 15 | 16 | class displaylist_impl : boost::noncopyable { 17 | private: 18 | unsigned int handle; 19 | bool compiled; 20 | 21 | static void gl_free(unsigned int handle) { 22 | glDeleteLists( handle, 1 ); 23 | } 24 | 25 | public: 26 | displaylist_impl() : compiled(false) { 27 | handle = glGenLists(1); 28 | on_gl_free.connect( boost::bind(&displaylist_impl::gl_free, handle) ); 29 | glNewList( handle, GL_COMPILE ); 30 | } 31 | ~displaylist_impl() { 32 | compile_end(); 33 | on_gl_free.free( boost::bind(&displaylist_impl::gl_free, handle) ); 34 | } 35 | 36 | void compile_end() { 37 | if (!compiled) { 38 | glEndList(); 39 | compiled = true; 40 | } 41 | } 42 | 43 | void call() { 44 | glCallList( handle ); 45 | } 46 | 47 | operator bool() { return handle && compiled; } 48 | }; 49 | 50 | void 51 | displaylist::gl_compile_begin() 52 | { 53 | impl.reset( new displaylist_impl ); 54 | } 55 | 56 | void 57 | displaylist::gl_compile_end() 58 | { 59 | impl->compile_end(); 60 | } 61 | 62 | void 63 | displaylist::gl_render() const 64 | { 65 | impl->call(); 66 | } 67 | 68 | displaylist::operator bool() const { 69 | return impl && *impl; 70 | } 71 | 72 | } // !namespace cvisual 73 | -------------------------------------------------------------------------------- /src/core/util/gl_extensions.cpp: -------------------------------------------------------------------------------- 1 | #include "util/gl_extensions.hpp" 2 | #include "display_kernel.hpp" 3 | 4 | namespace cvisual { 5 | 6 | template 7 | void getPFN( PFN& func, display_kernel& d, const char* name ) { 8 | func = reinterpret_cast( d.getProcAddress( name ) ); 9 | if (!func) 10 | throw std::runtime_error( 11 | ("Unable to get extension function: " + 12 | (std::string)name + " even though the extension is advertised.").c_str() ); 13 | } 14 | 15 | gl_extensions::gl_extensions() { 16 | memset( this, 0, sizeof(this) ); 17 | } 18 | 19 | void gl_extensions::init( display_kernel& d ) { 20 | #define F( name ) getPFN( name, d, #name ) 21 | 22 | //printf("t: %p\n", &glBegin); 23 | //printf("%p\n", d.getProcAddress("glBegin")); 24 | 25 | if ( ARB_shader_objects = d.hasExtension( "GL_ARB_shader_objects" ) ) { 26 | F( glCreateProgramObjectARB ); 27 | F( glLinkProgramARB ); 28 | F( glUseProgramObjectARB ); 29 | F( glCreateShaderObjectARB ); 30 | F( glShaderSourceARB ); 31 | F( glCompileShaderARB ); 32 | F( glAttachObjectARB ); 33 | F( glDeleteObjectARB ); 34 | F( glGetHandleARB ); 35 | F( glUniform1iARB ); 36 | F( glUniformMatrix4fvARB ); 37 | F( glUniform4fvARB ); 38 | F( glGetUniformLocationARB ); 39 | F( glGetObjectParameterivARB ); 40 | F( glGetInfoLogARB ); 41 | } 42 | 43 | if ( EXT_texture3D = d.hasExtension( "GL_EXT_texture3D" ) ) { 44 | F( glTexImage3D ); 45 | F( glTexSubImage3D ); 46 | } else { 47 | #ifdef __APPLE__ 48 | // Supported natively but NOT as an extension 49 | EXT_texture3D = true; 50 | glTexImage3D = ::glTexImage3D; 51 | glTexSubImage3D = ::glTexSubImage3D; 52 | #endif 53 | } 54 | 55 | if ( ARB_multitexture = d.hasExtension( "GL_ARB_multitexture" ) ) { 56 | F( glActiveTexture ); 57 | } 58 | 59 | if ( ARB_point_parameters = d.hasExtension( "GL_ARB_point_parameters" ) ) { 60 | F( glPointParameterfvARB ); 61 | } 62 | } 63 | 64 | } // namespace cvisual 65 | -------------------------------------------------------------------------------- /src/core/util/gl_free.cpp: -------------------------------------------------------------------------------- 1 | #include "util/gl_free.hpp" 2 | 3 | namespace cvisual { 4 | 5 | gl_free_manager on_gl_free; 6 | 7 | boost::signal< void() >& gl_free_manager::on_shutdown() { 8 | static boost::signal< void() >* i = new boost::signal< void() >; 9 | return *i; 10 | } 11 | 12 | boost::signal< void() >& gl_free_manager::on_next_frame() { 13 | static boost::signal< void() >* i = new boost::signal< void() >; 14 | return *i; 15 | } 16 | 17 | void 18 | gl_free_manager::frame() { 19 | on_next_frame()(); 20 | on_next_frame().disconnect_all_slots(); 21 | } 22 | 23 | void 24 | gl_free_manager::shutdown() { 25 | on_next_frame()(); 26 | on_next_frame().disconnect_all_slots(); 27 | on_shutdown()(); 28 | on_shutdown().disconnect_all_slots(); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/gtk2/site-packages.pth: -------------------------------------------------------------------------------- 1 | /usr/local/lib/python2.6/site-packages 2 | -------------------------------------------------------------------------------- /src/gtk2/timer.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2004 by Jonathan Brandmeyer. 2 | // See the file license.txt for complete license terms. 3 | // See the file authors.txt for a complete list of contributors. 4 | 5 | #include "util/timer.hpp" 6 | 7 | #include 8 | #include 9 | 10 | #include 11 | #include 12 | 13 | namespace cvisual { 14 | 15 | timer::timer() 16 | : start(0), inv_tick_count(0) 17 | { 18 | start = elapsed(); 19 | } 20 | 21 | double timer::elapsed() { 22 | timeval t; 23 | timerclear(&t); 24 | gettimeofday( &t, NULL); 25 | return static_cast(t.tv_sec) 26 | + static_cast(t.tv_usec)*1e-6 27 | - start; 28 | } 29 | 30 | } // !namespace cvisual 31 | -------------------------------------------------------------------------------- /src/linux-symbols.map: -------------------------------------------------------------------------------- 1 | CVISUAL_0_0 { 2 | global: 3 | initcvisual; 4 | PyInit_cvisual; 5 | local: 6 | *; 7 | }; 8 | -------------------------------------------------------------------------------- /src/mac/PackageMaker/VIDLE_launcher.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vpython/visual/e856d1b89d8ab0484409f4be7931326ed546e9a2/src/mac/PackageMaker/VIDLE_launcher.zip -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.6.pmdoc.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vpython/visual/e856d1b89d8ab0484409f4be7931326ed546e9a2/src/mac/PackageMaker/VPython-Python2.6.pmdoc.zip -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.6.pmdoc/01visual-contents.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.6.pmdoc/01visual.xml: -------------------------------------------------------------------------------- 1 | org.vpython.vpython514.visual.pkg1/Users/brucesherwood/Documents/workspace/stage/visual/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/visualinstallTo.isRelativeTypeinstallTopostInstallinstallTo.isAbsoluteTypeidentifierparentversioninstallTo.pathrequireAuthorizationextraFiles01visual-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.6.pmdoc/02vidle.xml: -------------------------------------------------------------------------------- 1 | org.vpython.vpython514.vidle.pkg1/Users/brucesherwood/Documents/workspace/stage/vidle/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/vidleinstallTopostInstallidentifierparentversioninstallTo.pathrequireAuthorizationextraFiles02vidle-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.6.pmdoc/03vpython.xml: -------------------------------------------------------------------------------- 1 | org.vpython.vpython532.VPython.pkg1.0/Users/brucesherwood/Documents/workspace/stage/VPython/Applications/VPythoninstallToinstallTo.pathparent03vpython-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.6.pmdoc/04numpy.xml: -------------------------------------------------------------------------------- 1 | org.vpython.vpython532.numpy.pkg1.0/Users/brucesherwood/Documents/workspace/stage/numpy/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/numpyinstallToinstallTo.pathparent04numpy-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.6.pmdoc/05numpy-contents.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.6.pmdoc/05numpy.xml: -------------------------------------------------------------------------------- 1 | org.vpython.vpython532.numpy-1.3.0-py2.6.pkg1.0/Users/brucesherwood/Documents/workspace/stage/numpy-1.3.0-py2.6.egg-info/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/installTo.pathinstallFrom.pathparentinstallTo05numpy-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.6.pmdoc/06ttfquery-contents.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.6.pmdoc/06ttfquery.xml: -------------------------------------------------------------------------------- 1 | org.vpython.vpython532.ttfquery.pkg1.0/Users/brucesherwood/Documents/workspace/stage/ttfquery/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/ttfqueryparentinstallTo.pathinstallTo06ttfquery-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.6.pmdoc/07fonttools.xml: -------------------------------------------------------------------------------- 1 | org.vpython.vpython532.FontTools-1.pkg1.0/Users/brucesherwood/Documents/workspace/stage/FontTools/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/FontToolsparentinstallTo.pathinstallTo07fonttools-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.6.pmdoc/08polygon-contents.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.6.pmdoc/08polygon.xml: -------------------------------------------------------------------------------- 1 | org.vpython.vpython532.Polygon.pkg1.0/Users/brucesherwood/Documents/workspace/stage/Polygon/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PolygonparentinstallTo.pathinstallTo08polygon-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.6.pmdoc/09polygon-contents.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.6.pmdoc/09polygon.xml: -------------------------------------------------------------------------------- 1 | org.vpython.vpython532.Polygon-2.0.1-py2.5.pkg1.0/Users/brucesherwood/Documents/workspace/stage/Polygon-2.0.1-py2.5.egg-info/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/installTo.pathlocationTypeparentinstallTo09polygon-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.6.pmdoc/10fonttools-contents.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.6.pmdoc/10fonttools.xml: -------------------------------------------------------------------------------- 1 | org.vpython.vpython532.fonttools-2.3-py2.6.pkg1.0/Users/brucesherwood/Documents/workspace/stage/fonttools-2.3-py2.6.egg-info/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/installTo.pathlocationTypeparentinstallTo10fonttools-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.6.pmdoc/11fonttools-contents.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.6.pmdoc/11fonttools.xml: -------------------------------------------------------------------------------- 1 | org.vpython.vpython532.FontTools.pkg1.0/Users/brucesherwood/Documents/workspace/stage/FontTools.pth/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/installToinstallTo.pathparent11fonttools-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.6.pmdoc/12ttfquery-contents.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.6.pmdoc/12ttfquery.xml: -------------------------------------------------------------------------------- 1 | org.vpython.vpython532.TTFQuery-1.0.4-py2.6.pkg1.0/Users/brucesherwood/Documents/workspace/stage/TTFQuery-1.0.4-py2.6.egg-info/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/installToinstallTo.pathparent12ttfquery-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.7.pmdoc.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vpython/visual/e856d1b89d8ab0484409f4be7931326ed546e9a2/src/mac/PackageMaker/VPython-Python2.7.pmdoc.zip -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.7.pmdoc/01visual-contents.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.7.pmdoc/01visual.xml: -------------------------------------------------------------------------------- 1 | org.vpython.vpython54.visual.pkg1../../../../stage2.7/visual/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/visualinstallTo.isRelativeTypeinstallTopostInstallinstallTo.isAbsoluteTypeinstallFrom.pathidentifierparentversioninstallTo.pathrequireAuthorizationextraFiles01visual-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.7.pmdoc/02vidle.xml: -------------------------------------------------------------------------------- 1 | org.vpython.vpython54.vidle.pkg1../../../../stage2.7/vidle/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/vidleinstallTopostInstallinstallFrom.pathidentifierparentversioninstallTo.pathrequireAuthorizationextraFiles02vidle-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.7.pmdoc/03vpython.xml: -------------------------------------------------------------------------------- 1 | org.vpython.vpython573.VPython-Py2.pkg1.0../../../../stage2.7/VPython-Py2.7/Applications/VPython-Py2.7installTo.pathinstallFrom.pathparentinstallTo03vpython-contents.xmlisRelocatable/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.7.pmdoc/04numpy.xml: -------------------------------------------------------------------------------- 1 | org.vpython.vpython573.numpy.pkg1.0../../../../stage2.7/numpy/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpyinstallTo.pathinstallFrom.pathparentinstallTo04numpy-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.7.pmdoc/05numpy-contents.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.7.pmdoc/05numpy.xml: -------------------------------------------------------------------------------- 1 | org.vpython.vpython573.numpy-1.5.1-py2.7.pkg1.0../../../../stage2.7/numpy-1.5.1-py2.7.egg-info/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/installTo.pathinstallFrom.pathparentinstallTo05numpy-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.7.pmdoc/06ttfquery-contents.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.7.pmdoc/06ttfquery.xml: -------------------------------------------------------------------------------- 1 | org.vpython.vpython573.ttfquery.pkg1.0../../../../stage2.7/ttfquery/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ttfqueryinstallTo.pathinstallFrom.pathparentinstallTo06ttfquery-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.7.pmdoc/07fonttools.xml: -------------------------------------------------------------------------------- 1 | org.vpython.vpython573.FontTools.pkg1.0../../../../stage2.7/FontTools/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/FontToolsinstallTo.pathinstallFrom.pathparentinstallTo07fonttools-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.7.pmdoc/08polygon-contents.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.7.pmdoc/08polygon.xml: -------------------------------------------------------------------------------- 1 | org.vpython.vpython573.Polygon.pkg1.0../../../../stage2.7/Polygon/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PolygoninstallTo.pathinstallFrom.pathparentinstallTo08polygon-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.7.pmdoc/09polygon-contents.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.7.pmdoc/09polygon.xml: -------------------------------------------------------------------------------- 1 | org.vpython.vpython54.Polygon-2.0.1-py2.7.pkg1.0../../../../stage2.7/Polygon-2.0.1-py2.5.egg-info/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/installTo.pathparentlocationTypeinstallFrom.pathinstallToidentifier09polygon-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.7.pmdoc/10fonttools-contents.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.7.pmdoc/10fonttools.xml: -------------------------------------------------------------------------------- 1 | org.vpython.vpython54.fonttools-2.3-py2.7.pkg1.0../../../../stage2.7/fonttools-2.3-py2.6.egg-info/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/installTo.pathparentlocationTypeinstallFrom.pathinstallToidentifier10fonttools-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.7.pmdoc/11fonttools-contents.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.7.pmdoc/11fonttools.xml: -------------------------------------------------------------------------------- 1 | org.vpython.vpython573.FontTools-1.pkg1.0../../../../stage2.7/FontTools.pth/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/installTo.pathinstallFrom.pathparentinstallTo11fonttools-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.7.pmdoc/12ttfquery-contents.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.7.pmdoc/12ttfquery.xml: -------------------------------------------------------------------------------- 1 | org.vpython.vpython54.TTFQuery-1.0.4-py2.7.pkg1.0../../../../stage2.7/TTFQuery-1.0.4-py2.6.egg-info/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/installTo.pathinstallFrom.pathparentinstallToidentifier12ttfquery-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.7.pmdoc/13vis-contents.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python2.7.pmdoc/13vis.xml: -------------------------------------------------------------------------------- 1 | org.vpython.vpython54.vis.pkg1.0../../../../stage2.7/vis/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/visinstallTo.pathinstallFrom.pathparentinstallToidentifier13vis-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python3.1 2.pmdoc.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vpython/visual/e856d1b89d8ab0484409f4be7931326ed546e9a2/src/mac/PackageMaker/VPython-Python3.1 2.pmdoc.zip -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python3.1.pmdoc.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vpython/visual/e856d1b89d8ab0484409f4be7931326ed546e9a2/src/mac/PackageMaker/VPython-Python3.1.pmdoc.zip -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python3.1.pmdoc/01visual-contents.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python3.1.pmdoc/01visual.xml: -------------------------------------------------------------------------------- 1 | org.vpython.vpython514.visual.pkg1../../../../stage/visual/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/site-packages/visualinstallTo.isRelativeTypeinstallTopostInstallinstallTo.isAbsoluteTypeinstallFrom.pathidentifierparentversioninstallTo.pathrequireAuthorizationextraFiles01visual-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python3.1.pmdoc/02vidle.xml: -------------------------------------------------------------------------------- 1 | org.vpython.vpython514.vidle.pkg1../../../../stage/vidle/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/site-packages/vidleinstallTopostInstallinstallFrom.pathidentifierparentversioninstallTo.pathrequireAuthorizationextraFiles02vidle-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python3.1.pmdoc/03vpython.xml: -------------------------------------------------------------------------------- 1 | org.vpython.vpython572.VPython-Py3.pkg1.0../../../../stage/VPython-Py3.1/Applications/VPython-Py3.1installTo.pathinstallFrom.pathparentinstallTo03vpython-contents.xmlisRelocatable/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python3.1.pmdoc/04numpy.xml: -------------------------------------------------------------------------------- 1 | org.vpython.vpython572.numpy.pkg1.0../../../../stage/numpy/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/site-packages/numpyinstallTo.pathinstallFrom.pathparentinstallTo04numpy-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python3.1.pmdoc/05numpy-contents.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python3.1.pmdoc/05numpy.xml: -------------------------------------------------------------------------------- 1 | org.vpython.vpython54.numpy-1.5.0-py3.1.pkg1.0../../../../stage/numpy-1.5.0-py3.1.egg-info/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/site-packages/installTo.pathinstallFrom.pathparentinstallToidentifier05numpy-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python3.1.pmdoc/06ttfquery-contents.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python3.1.pmdoc/06ttfquery.xml: -------------------------------------------------------------------------------- 1 | org.vpython.vpython572.ttfquery.pkg1.0../../../../stage/ttfquery/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/site-packages/ttfqueryinstallTo.pathinstallFrom.pathparentinstallTo06ttfquery-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python3.1.pmdoc/07fonttools.xml: -------------------------------------------------------------------------------- 1 | org.vpython.vpython572.FontTools.pkg1.0../../../../stage/FontTools/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/site-packages/FontToolsinstallTo.pathinstallFrom.pathparentinstallTo07fonttools-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python3.1.pmdoc/08polygon-contents.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python3.1.pmdoc/08polygon.xml: -------------------------------------------------------------------------------- 1 | org.vpython.vpython572.Polygon.pkg1.0../../../../stage/Polygon/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/site-packages/PolygoninstallTo.pathinstallFrom.pathparentinstallTo08polygon-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python3.1.pmdoc/09polygon-contents.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python3.1.pmdoc/09polygon.xml: -------------------------------------------------------------------------------- 1 | org.vpython.vpython54.Polygon-3.0.3-py3.1.pkg1.0../../../../stage/Polygon-3.0.3-py3.1.egg-info/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/site-packages/installTo.pathinstallTolocationTypeparentinstallFrom.pathidentifier09polygon-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python3.1.pmdoc/10fonttools-contents.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python3.1.pmdoc/10fonttools.xml: -------------------------------------------------------------------------------- 1 | org.vpython.vpython572.fonttools-2.3-py3.1.pkg1.0../../../../stage/fonttools-2.3-py3.1.egg-info/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/site-packages/installTo.pathlocationTypeparentinstallToinstallFrom.path10fonttools-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python3.1.pmdoc/11fonttools-contents.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python3.1.pmdoc/11fonttools.xml: -------------------------------------------------------------------------------- 1 | org.vpython.vpython572.FontTools-1.pkg1.0../../../../stage/FontTools.pth/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/site-packages/installTo.pathinstallFrom.pathparentinstallTo11fonttools-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python3.1.pmdoc/12ttfquery-contents.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python3.1.pmdoc/12ttfquery.xml: -------------------------------------------------------------------------------- 1 | org.vpython.vpython54.TTFQuery-1.0.4-py3.1.pkg1.0../../../../stage/TTFQuery-1.0.4-py3.1.egg-info/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/site-packages/installTo.pathinstallFrom.pathparentinstallToidentifier12ttfquery-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python3.1.pmdoc/13vis-contents.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python3.1.pmdoc/13vis.xml: -------------------------------------------------------------------------------- 1 | org.vpython.vpython572.vis.pkg1.0../../../../stage/vis/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/site-packages/visinstallTo.pathinstallFrom.pathparentinstallTo13vis-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ -------------------------------------------------------------------------------- /src/mac/PackageMaker/VPython-Python3.2.pmdoc.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vpython/visual/e856d1b89d8ab0484409f4be7931326ed546e9a2/src/mac/PackageMaker/VPython-Python3.2.pmdoc.zip -------------------------------------------------------------------------------- /src/mac/PackageMaker/Visual5_Python2.6_welcome.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf350 2 | {\fonttbl\f0\fswiss\fcharset0 Helvetica;} 3 | {\colortbl;\red255\green255\blue255;} 4 | \margl1440\margr1440\vieww9000\viewh8400\viewkind0 5 | \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural 6 | 7 | \f0\fs24 \cf0 Python 2.6 must first be installed from python.org before installing this Python module. This installer also installs numpy, the numeric array module for Python, which is required for Visual. This installer also installs the modules Polygon, ttfquery, and FontTools.} -------------------------------------------------------------------------------- /src/mac/PackageMaker/Visual5_Python2.7_welcome.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360 2 | {\fonttbl\f0\fswiss\fcharset0 Helvetica;} 3 | {\colortbl;\red255\green255\blue255;} 4 | \margl1440\margr1440\vieww9000\viewh8400\viewkind0 5 | \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural 6 | 7 | \f0\fs24 \cf0 A 32-bit version of Python 2.7 must first be installed from python.org before installing this Python module. This installer also installs numpy, the numeric array module for Python, which is required for Visual. This installer also installs the modules Polygon, ttfquery, and FontTools.} -------------------------------------------------------------------------------- /src/mac/PackageMaker/Visual5_Python3.1_welcome.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360 2 | {\fonttbl\f0\fswiss\fcharset0 Helvetica;} 3 | {\colortbl;\red255\green255\blue255;} 4 | \margl1440\margr1440\vieww9000\viewh8400\viewkind0 5 | \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural 6 | 7 | \f0\fs24 \cf0 A 32-bit version of Python 2.7 must first be installed from python.org before installing this Python module. This installer also installs numpy, the numeric array module for Python, which is required for Visual. This installer also installs the modules Polygon, ttfquery, and FontTools.} -------------------------------------------------------------------------------- /src/mac/PackageMaker/Visual5_Python3.2_welcome.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360 2 | {\fonttbl\f0\fswiss\fcharset0 Helvetica;} 3 | {\colortbl;\red255\green255\blue255;} 4 | \margl1440\margr1440\vieww9000\viewh8400\viewkind0 5 | \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural 6 | 7 | \f0\fs24 \cf0 A 32-bit version of Python 3.2 must first be installed from python.org before installing this Python module. This installer also installs numpy, the numeric array module for Python, which is required for Visual. This installer also installs the modules Polygon, ttfquery, and FontTools.} -------------------------------------------------------------------------------- /src/mac/PackageMaker/Visual5_welcome.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf320 2 | {\fonttbl\f0\fswiss\fcharset0 Helvetica;} 3 | {\colortbl;\red255\green255\blue255;} 4 | \margl1440\margr1440\vieww9000\viewh8400\viewkind0 5 | \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural 6 | 7 | \f0\fs24 \cf0 Python 2.7 must first be installed from python.org before installing this Python module. This installer also installs numpy, the numeric array module for Python, which is required for Visual. This installer also installs the modules Polygon, ttfquery, and FontTools.} -------------------------------------------------------------------------------- /src/mac/mac_timer.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2004 by Jonathan Brandmeyer. 2 | // See the file license.txt for complete license terms. 3 | // See the file authors.txt for a complete list of contributors. 4 | 5 | #include "util/timer.hpp" 6 | 7 | #include 8 | #include 9 | 10 | #include 11 | #include 12 | 13 | namespace cvisual { 14 | 15 | timer::timer() 16 | : start(0), inv_tick_count(0) 17 | { 18 | start = elapsed(); 19 | } 20 | 21 | double timer::elapsed() { 22 | timeval t; 23 | timerclear(&t); 24 | gettimeofday( &t, NULL); 25 | return static_cast(t.tv_sec) 26 | + static_cast(t.tv_usec)*1e-6 27 | - start; 28 | } 29 | 30 | } // !namespace cvisual 31 | -------------------------------------------------------------------------------- /src/osx-symbols.txt: -------------------------------------------------------------------------------- 1 | _initcvisual 2 | -------------------------------------------------------------------------------- /src/python/slice.cpp: -------------------------------------------------------------------------------- 1 | #include "python/slice.hpp" 2 | 3 | // Copyright (c) 2004 by Jonathan Brandmeyer and others. 4 | // See the file license.txt for complete license terms. 5 | // See the file authors.txt for a complete list of contributors. 6 | using namespace boost::python; 7 | 8 | namespace cvisual { namespace python { 9 | 10 | slice::slice() 11 | : object( detail::new_reference( 12 | PySlice_New( NULL, NULL, NULL))) 13 | { 14 | } 15 | 16 | object 17 | slice::start() 18 | { 19 | return object( detail::borrowed_reference( ((PySliceObject*)this->ptr())->start)); 20 | } 21 | 22 | object 23 | slice::stop() 24 | { 25 | return object( detail::borrowed_reference( ((PySliceObject*)this->ptr())->stop)); 26 | } 27 | 28 | object 29 | slice::step() 30 | { 31 | return object( detail::borrowed_reference( ((PySliceObject*)this->ptr())->step)); 32 | } 33 | 34 | } } // !namespace cvisual::python 35 | -------------------------------------------------------------------------------- /src/win32/winrate.cpp: -------------------------------------------------------------------------------- 1 | #include "util/rate.hpp" 2 | 3 | #define WIN32_LEAN_AND_MEAN 1 4 | #include 5 | #include 6 | 7 | namespace cvisual { 8 | 9 | namespace { 10 | class rate_timer 11 | { 12 | long long tics_per_second; 13 | long long origin; 14 | 15 | public: 16 | rate_timer() 17 | { 18 | QueryPerformanceFrequency( (LARGE_INTEGER*)&tics_per_second); 19 | QueryPerformanceCounter( (LARGE_INTEGER*)&origin); 20 | } 21 | 22 | void delay( double _delay) 23 | { 24 | const long long delay = (long long)( _delay * (double)tics_per_second); 25 | long long now = 0; 26 | QueryPerformanceCounter( (LARGE_INTEGER*)&now); 27 | long long wait = delay - (now - origin); 28 | if (wait < 0) { 29 | QueryPerformanceCounter( (LARGE_INTEGER*)&origin); 30 | return; 31 | } 32 | // Convert from ticks to milliseconds. 33 | DWORD ms_wait = wait * 1000 / tics_per_second; 34 | Sleep( ms_wait); 35 | // Sleep() usually under-delays by up to 16 ms, so, busy wait out the 36 | // remainder. See also src/test/sleep_test.cpp 37 | QueryPerformanceCounter( (LARGE_INTEGER*)&now); 38 | wait = delay - (now - origin); 39 | while (wait > 0) { 40 | QueryPerformanceCounter( (LARGE_INTEGER*)&now); 41 | wait = delay - (now - origin); 42 | } 43 | QueryPerformanceCounter( (LARGE_INTEGER*)&origin); 44 | } 45 | }; 46 | } // !namespace (unnamed) 47 | 48 | void 49 | rate( const double& freq) 50 | { 51 | static rate_timer* rt = 0; 52 | if (!rt) 53 | rt = new rate_timer(); 54 | 55 | if (freq <= 0.0) 56 | throw std::invalid_argument( "Rate must be positive and nonzero."); 57 | rt->delay( 1.0/freq ); 58 | } 59 | 60 | } // !namespace cvisual 61 | -------------------------------------------------------------------------------- /src/win32/wintimer.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2004 by Jonathan Brandmeyer. 2 | // See the file license.txt for complete license terms. 3 | // See the file authors.txt for a complete list of contributors. 4 | 5 | #include "util/timer.hpp" 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | namespace cvisual { 14 | 15 | timer::timer() 16 | : start(0) 17 | { 18 | LARGE_INTEGER freq; 19 | if (!QueryPerformanceFrequency(&freq)) 20 | throw std::runtime_error( "No high resolution timer." ); 21 | inv_tick_count = 1.0 / static_cast(freq.QuadPart); 22 | 23 | start = elapsed(); 24 | } 25 | 26 | double 27 | timer::elapsed() 28 | { 29 | LARGE_INTEGER count; 30 | QueryPerformanceCounter( &count ); 31 | return static_cast(count.QuadPart)*inv_tick_count - start; 32 | } 33 | 34 | } // !namespace cvisual 35 | --------------------------------------------------------------------------------