--- /dev/null
+[Buildset]
+BuildItems=@Variant(\x00\x00\x00\t\x00\x00\x00\x00\x01\x00\x00\x00\x0b\x00\x00\x00\x00\x01\x00\x00\x00\x12\x00m\x00a\x00t\x00h\x00g\x00l\x00-\x002\x00x)
+
+[CMake]
+BuildDirs=/home/balakin/progr/sfnet/mathgl/mathgl-2x/build
+CMakeDir=/usr/share/cmake-2.8/Modules
+Current CMake Binary=file:///usr/bin/cmake
+CurrentBuildDir=file:///home/balakin/progr/sfnet/mathgl/mathgl-2x/build
+CurrentBuildType=Debug
+CurrentInstallDir=
+Extra Arguments=
+ProjectRootRelative=./
+
+[Launch]
+Launch Configurations=Launch Configuration 0,Launch Configuration 1
+
+[Launch][Launch Configuration 0]
+Configured Launch Modes=execute
+Configured Launchers=nativeAppLauncher
+Name=fltk_example
+Type=Native Application
+
+[Launch][Launch Configuration 0][Data]
+Arguments=-test
+Dependencies=@Variant(\x00\x00\x00\t\x00\x00\x00\x00\x01\x00\x00\x00\x0b\x00\x00\x00\x00\x03\x00\x00\x00\x12\x00m\x00a\x00t\x00h\x00g\x00l\x00-\x002\x00x\x00\x00\x00\n\x00u\x00t\x00i\x00l\x00s\x00\x00\x00\x0e\x00m\x00g\x00l\x00c\x00o\x00n\x00v)
+Dependency Action=Build
+EnvironmentGroup=default
+Executable=file:///home/balakin/progr/sfnet/mathgl/mathgl-2x/build/examples/mgl_fltk_example
+External Terminal=konsole --noclose --workdir %workdir -e %exe
+Project Target=mathgl-2x,utils,mglconv
+Use External Terminal=false
+Working Directory=
+isExecutable=true
+
+[Launch][Launch Configuration 1]
+Configured Launch Modes=execute
+Configured Launchers=nativeAppLauncher
+Name=udav
+Type=Native Application
+
+[Launch][Launch Configuration 1][Data]
+Arguments=
+Debugger Shell=
+Dependencies=@Variant(\x00\x00\x00\t\x00\x00\x00\x00\x00)
+Dependency Action=Nothing
+Display Demangle Names=true
+Display Static Members=false
+EnvironmentGroup=default
+Executable=file:///home/balakin/progr/sfnet/mathgl/mathgl-2x/build/udav/udav
+External Terminal=konsole --noclose --workdir %workdir -e %exe
+GDB Path=
+Project Target=
+Remote GDB Config Script=
+Remote GDB Run Script=
+Remote GDB Shell Script=
+Use External Terminal=false
+Working Directory=
+isExecutable=true
+
+[Project]
+VersionControlSupport=kdevsubversion
project( MathGL )
set(CMAKE_VERBOSE_MAKEFILE ON)
+set(MathGL_VERSION_MAJOR 2)
+set(MathGL_VERSION_MINOR 0)
+
option(enable-double "Enable double precision in MathGL library")
option(enable-all "Enable all features")
option(enable-langall "Enable all language interfaces")
option(enable-pthread "Enable POSIX threads support")
option(enable-gsl "Enable gsl support")
option(enable-jpeg "Enable jpeg support")
-option(enable-u3d "Enable u3d support")
+#option(enable-u3d "Enable u3d support")
option(enable-pdf "Enable pdf support")
option(enable-gif "Enable gif support")
option(enable-hdf4 "Enable hdf4 support")
set(MGL_HAVE_JPEG 0)
endif(enable-all OR enable-jpeg)
-#if((enable-all OR enable-u3d OR enable-pdf) AND (NOT enable-lgpl) )
-if((enable-u3d OR enable-pdf) AND (NOT enable-lgpl) )
- set(MGL_HAVE_U3D 1)
- find_library(U3D_LIB IDTF)
- if(NOT U3D_LIB)
- message(STATUS "Couldn't find U3D libraries.")
- endif(NOT U3D_LIB)
- find_path(U3D_INCLUDE_DIR u3d/SceneConverterLib.h)
- if(NOT U3D_INCLUDE_DIR)
- message(STATUS "Couldn't find U3D headers.")
- endif(NOT U3D_INCLUDE_DIR)
- message(STATUS "Found U3D libraries at: ${U3D_LIB}")
- message(STATUS "Found U3D headers: ${U3D_INCLUDE_DIR}")
-#else((enable-u3d OR enable-pdf) AND (NOT enable-lgpl) )
-else((enable-all OR enable-u3d OR enable-pdf) AND (NOT enable-lgpl) )
- set(MGL_HAVE_U3D 0)
-#endif((enable-u3d OR enable-pdf) AND (NOT enable-lgpl) )
-endif((enable-u3d OR enable-pdf) AND (NOT enable-lgpl) )
+# if(enable-u3d AND (NOT enable-lgpl) )
+# set(MGL_HAVE_U3D 1)
+# find_library(U3D_LIB IDTF)
+# if(NOT U3D_LIB)
+# message(SEND_ERROR "Couldn't find U3D libraries.")
+# endif(NOT U3D_LIB)
+# find_path(U3D_INCLUDE_DIR u3d/SceneConverterLib.h)
+# if(NOT U3D_INCLUDE_DIR)
+# message(SEND_ERROR "Couldn't find U3D headers.")
+# endif(NOT U3D_INCLUDE_DIR)
+# message(STATUS "Found U3D libraries at: ${U3D_LIB}")
+# message(STATUS "Found U3D headers: ${U3D_INCLUDE_DIR}")
+# else(enable-u3d AND (NOT enable-lgpl) )
+# set(MGL_HAVE_U3D 0)
+# endif(enable-u3d AND (NOT enable-lgpl) )
-#if((enable-all OR enable-pdf) AND (NOT enable-lgpl) )
-if((enable-pdf) AND (NOT enable-lgpl) )
+if((enable-all OR enable-pdf) AND (NOT enable-lgpl) )
set(MGL_HAVE_PDF 1)
find_library(HPDF_LIB hpdf)
if(NOT HPDF_LIB)
- message(STATUS "Couldn't find libHaru.")
+ message(SEND_ERROR "Couldn't find libHaru.")
endif(NOT HPDF_LIB)
find_path(HPDF_INCLUDE_DIR hpdf_u3d.h)
if(NOT HPDF_INCLUDE_DIR)
- message(STATUS "Couldn't find headers of u3d-enabled version of libHaru.")
+ message(SEND_ERROR "Couldn't find headers of 3d-enabled version of libHaru.")
endif(NOT HPDF_INCLUDE_DIR)
- message(STATUS "Found libHaru library at: ${HPDF_LIB}")
- message(STATUS "Found libHaru headers: ${HPDF_INCLUDE_DIR}")
-#else((enable-all OR enable-pdf) AND (NOT enable-lgpl) )
-else((enable-pdf) AND (NOT enable-lgpl) )
+# message(STATUS "Found libHaru library at: ${HPDF_LIB}")
+# message(STATUS "Found libHaru headers: ${HPDF_INCLUDE_DIR}")
+else((enable-all OR enable-pdf) AND (NOT enable-lgpl) )
set(MGL_HAVE_PDF 0)
-#endif((enable-all OR enable-pdf) AND (NOT enable-lgpl) )
-endif((enable-pdf) AND (NOT enable-lgpl) )
+endif((enable-all OR enable-pdf) AND (NOT enable-lgpl) )
if(enable-all OR enable-gif)
set(MGL_HAVE_GIF 1)
if((enable-langall OR enable-octave) AND (NOT enable-lgpl) )
set(MGL_HAVE_OCTAVE 1)
- find_path(OCTAVE_INCLUDE_DIR octave/oct.h)
- if(NOT OCTAVE_INCLUDE_DIR)
- message(SEND_ERROR "Couldn't find octave/oct.h needed for octave interfaces compiling.")
- endif(NOT OCTAVE_INCLUDE_DIR)
- find_program(oct_prog octave)
+ find_program(oct_prog octave-config)
if(NOT oct_prog)
- message(SEND_ERROR "Couldn't find octave needed for octave interfaces compiling.")
+ message(SEND_ERROR "Couldn't find octave-config needed for octave interfaces compiling.")
endif(NOT oct_prog)
find_program(oct_mk mkoctfile)
if(NOT oct_mk)
message(SEND_ERROR "Couldn't find mkoctfile needed for octave interfaces compiling.")
endif(NOT oct_mk)
+ find_program(oct_tar tar)
+ if(NOT oct_tar)
+ message(SEND_ERROR "Couldn't find tar needed for octave interfaces creation.")
+ endif(NOT oct_tar)
else((enable-langall OR enable-octave) AND (NOT enable-lgpl) )
set(MGL_HAVE_OCTAVE 0)
endif((enable-langall OR enable-octave) AND (NOT enable-lgpl) )
+++ /dev/null
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-
- This version of the GNU Lesser General Public License incorporates
-the terms and conditions of version 3 of the GNU General Public
-License, supplemented by the additional permissions listed below.
-
- 0. Additional Definitions.
-
- As used herein, "this License" refers to version 3 of the GNU Lesser
-General Public License, and the "GNU GPL" refers to version 3 of the GNU
-General Public License.
-
- "The Library" refers to a covered work governed by this License,
-other than an Application or a Combined Work as defined below.
-
- An "Application" is any work that makes use of an interface provided
-by the Library, but which is not otherwise based on the Library.
-Defining a subclass of a class defined by the Library is deemed a mode
-of using an interface provided by the Library.
-
- A "Combined Work" is a work produced by combining or linking an
-Application with the Library. The particular version of the Library
-with which the Combined Work was made is also called the "Linked
-Version".
-
- The "Minimal Corresponding Source" for a Combined Work means the
-Corresponding Source for the Combined Work, excluding any source code
-for portions of the Combined Work that, considered in isolation, are
-based on the Application, and not on the Linked Version.
-
- The "Corresponding Application Code" for a Combined Work means the
-object code and/or source code for the Application, including any data
-and utility programs needed for reproducing the Combined Work from the
-Application, but excluding the System Libraries of the Combined Work.
-
- 1. Exception to Section 3 of the GNU GPL.
-
- You may convey a covered work under sections 3 and 4 of this License
-without being bound by section 3 of the GNU GPL.
-
- 2. Conveying Modified Versions.
-
- If you modify a copy of the Library, and, in your modifications, a
-facility refers to a function or data to be supplied by an Application
-that uses the facility (other than as an argument passed when the
-facility is invoked), then you may convey a copy of the modified
-version:
-
- a) under this License, provided that you make a good faith effort to
- ensure that, in the event an Application does not supply the
- function or data, the facility still operates, and performs
- whatever part of its purpose remains meaningful, or
-
- b) under the GNU GPL, with none of the additional permissions of
- this License applicable to that copy.
-
- 3. Object Code Incorporating Material from Library Header Files.
-
- The object code form of an Application may incorporate material from
-a header file that is part of the Library. You may convey such object
-code under terms of your choice, provided that, if the incorporated
-material is not limited to numerical parameters, data structure
-layouts and accessors, or small macros, inline functions and templates
-(ten or fewer lines in length), you do both of the following:
-
- a) Give prominent notice with each copy of the object code that the
- Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the object code with a copy of the GNU GPL and this license
- document.
-
- 4. Combined Works.
-
- You may convey a Combined Work under terms of your choice that,
-taken together, effectively do not restrict modification of the
-portions of the Library contained in the Combined Work and reverse
-engineering for debugging such modifications, if you also do each of
-the following:
-
- a) Give prominent notice with each copy of the Combined Work that
- the Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the Combined Work with a copy of the GNU GPL and this license
- document.
-
- c) For a Combined Work that displays copyright notices during
- execution, include the copyright notice for the Library among
- these notices, as well as a reference directing the user to the
- copies of the GNU GPL and this license document.
-
- d) Do one of the following:
-
- 0) Convey the Minimal Corresponding Source under the terms of this
- License, and the Corresponding Application Code in a form
- suitable for, and under terms that permit, the user to
- recombine or relink the Application with a modified version of
- the Linked Version to produce a modified Combined Work, in the
- manner specified by section 6 of the GNU GPL for conveying
- Corresponding Source.
-
- 1) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (a) uses at run time
- a copy of the Library already present on the user's computer
- system, and (b) will operate properly with a modified version
- of the Library that is interface-compatible with the Linked
- Version.
-
- e) Provide Installation Information, but only if you would otherwise
- be required to provide such information under section 6 of the
- GNU GPL, and only to the extent that such information is
- necessary to install and execute a modified version of the
- Combined Work produced by recombining or relinking the
- Application with a modified version of the Linked Version. (If
- you use option 4d0, the Installation Information must accompany
- the Minimal Corresponding Source and Corresponding Application
- Code. If you use option 4d1, you must provide the Installation
- Information in the manner specified by section 6 of the GNU GPL
- for conveying Corresponding Source.)
-
- 5. Combined Libraries.
-
- You may place library facilities that are a work based on the
-Library side by side in a single library together with other library
-facilities that are not Applications and are not covered by this
-License, and convey such a combined library under terms of your
-choice, if you do both of the following:
-
- a) Accompany the combined library with a copy of the same work based
- on the Library, uncombined with any other library facilities,
- conveyed under the terms of this License.
-
- b) Give prominent notice with the combined library that part of it
- is a work based on the Library, and explaining where to find the
- accompanying uncombined form of the same work.
-
- 6. Revised Versions of the GNU Lesser General Public License.
-
- The Free Software Foundation may publish revised and/or new versions
-of the GNU Lesser General Public License from time to time. Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Library as you received it specifies that a certain numbered version
-of the GNU Lesser General Public License "or any later version"
-applies to it, you have the option of following the terms and
-conditions either of that published version or of any later version
-published by the Free Software Foundation. If the Library as you
-received it does not specify a version number of the GNU Lesser
-General Public License, you may choose any version of the GNU Lesser
-General Public License ever published by the Free Software Foundation.
-
- If the Library as you received it specifies that a proxy can decide
-whether future versions of the GNU Lesser General Public License shall
-apply, that proxy's public statement of acceptance of any version is
-permanent authorization for you to choose that version for the
-Library.
+++ /dev/null
-link ChangeLog.txt
\ No newline at end of file
--- /dev/null
+ChangeLog.txt
\ No newline at end of file
-2.0.b Released 23 August 2011
+2.0 Released 12 April 2012
Installation is simple. Just execute:\r
-./configure\r
+cmake .\r
+cmake .\r
make\r
make install\r
\r
Sometimes you also need to update yours library list. To do that just execute:\r
-ldconfig
\ No newline at end of file
+ldconfig\r
+\r
+See MathGL documentation for more details.\r
+++ /dev/null
-ACLOCAL_AMFLAGS = -I config
-SUBDIRS = src widgets include lang examples utils
-
-clean-local:
- find . -name '*~' -print0 | xargs -0 rm -f
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="MathGL2" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output="bin/Debug/MathGL2" prefix_auto="1" extension_auto="1" />
- <Option object_output="obj/Debug/" />
- <Option type="1" />
- <Option compiler="gcc" />
- <Option parameters="-test" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- </Target>
- <Target title="Release">
- <Option output="bin/Release/MathGL2" prefix_auto="1" extension_auto="1" />
- <Option object_output="obj/Release/" />
- <Option type="1" />
- <Option compiler="gcc" />
- <Compiler>
- <Add option="-march=core2" />
- <Add option="-O3" />
- <Add option="-O2" />
- </Compiler>
- </Target>
- <Target title="mglview">
- <Option output="bin/Release/mglview" prefix_auto="1" extension_auto="1" />
- <Option object_output="obj/Release/" />
- <Option type="1" />
- <Option compiler="gcc" />
- <Compiler>
- <Add option="-march=core2" />
- <Add option="-O3" />
- <Add option="-O2" />
- </Compiler>
- </Target>
- <Target title="GLUT">
- <Option output="bin/Debug/glut" prefix_auto="1" extension_auto="1" />
- <Option object_output="obj/Debug/" />
- <Option type="1" />
- <Option compiler="gcc" />
- <Option parameters="-test" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add option="-lglut -lXmu -lXi -lGLU -lGL -lSM -lICE -lX11 -lXext" />
- </Linker>
- </Target>
- <Target title="mglconv">
- <Option output="bin/Release/mglconv" prefix_auto="1" extension_auto="1" />
- <Option object_output="obj/Release/" />
- <Option type="1" />
- <Option compiler="gcc" />
- <Compiler>
- <Add option="-march=core2" />
- <Add option="-O3" />
- <Add option="-O2" />
- </Compiler>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wshadow" />
- <Add option="-Wunreachable-code" />
- <Add option="-Wmissing-include-dirs" />
- <Add option="-Wswitch-enum" />
- <Add option="-Wextra" />
- <Add option="-Wall" />
- <Add option="-pg" />
- <Add option="-g" />
- <Add option="-fexceptions" />
- <Add option="-DHAVE_PTHREAD" />
- <Add option="-DHAVE_JPEG" />
- <Add option="-DHAVE_GIF" />
- <Add option="-DHAVE_HDF5" />
- <Add option="-DHAVE_HDF4" />
- <Add option="-DHAVE_FLTK" />
- <Add directory="include" />
- </Compiler>
- <Linker>
- <Add option="-pg" />
- <Add option="-lgsl -lgslcblas -lpthread -lz -lpng -lGL -lfltk" />
- <Add option="-ljpeg -lgif -lhdf5 -lmfhdf -ldf" />
- </Linker>
- <Unit filename="examples/fltk_example.cpp">
- <Option target="Debug" />
- </Unit>
- <Unit filename="examples/full_test.cpp">
- <Option target="Release" />
- </Unit>
- <Unit filename="examples/glut_example.cpp">
- <Option target="GLUT" />
- </Unit>
- <Unit filename="examples/wnd_samples.cpp">
- <Option target="Debug" />
- <Option target="Release" />
- <Option target="GLUT" />
- </Unit>
- <Unit filename="include/mgl/base.h" />
- <Unit filename="include/mgl/base_cf.h" />
- <Unit filename="include/mgl/canvas.h" />
- <Unit filename="include/mgl/canvas_cf.h" />
- <Unit filename="include/mgl/cont.h" />
- <Unit filename="include/mgl/data.h" />
- <Unit filename="include/mgl/define.h" />
- <Unit filename="include/mgl/eval.h" />
- <Unit filename="include/mgl/fit.h" />
- <Unit filename="include/mgl/fltk.h" />
- <Unit filename="include/mgl/font.h" />
- <Unit filename="include/mgl/glut.h" />
- <Unit filename="include/mgl/mgl.h" />
- <Unit filename="include/mgl/mgl_cf.h" />
- <Unit filename="include/mgl/opengl.h" />
- <Unit filename="include/mgl/other.h" />
- <Unit filename="include/mgl/parser.h" />
- <Unit filename="include/mgl/plot.h" />
- <Unit filename="include/mgl/prim.h" />
- <Unit filename="include/mgl/qt.h" />
- <Unit filename="include/mgl/surf.h" />
- <Unit filename="include/mgl/type.h" />
- <Unit filename="include/mgl/vect.h" />
- <Unit filename="include/mgl/volume.h" />
- <Unit filename="include/mgl/window.h" />
- <Unit filename="include/xpm/alpha.xpm" />
- <Unit filename="include/xpm/alpha_on.xpm" />
- <Unit filename="include/xpm/copy.xpm" />
- <Unit filename="include/xpm/down_1.xpm" />
- <Unit filename="include/xpm/fileprint.xpm" />
- <Unit filename="include/xpm/first.xpm" />
- <Unit filename="include/xpm/last.xpm" />
- <Unit filename="include/xpm/left_1.xpm" />
- <Unit filename="include/xpm/light.xpm" />
- <Unit filename="include/xpm/light_on.xpm" />
- <Unit filename="include/xpm/next.xpm" />
- <Unit filename="include/xpm/next_sl.xpm" />
- <Unit filename="include/xpm/norm_1.xpm" />
- <Unit filename="include/xpm/ok.xpm" />
- <Unit filename="include/xpm/prev_sl.xpm" />
- <Unit filename="include/xpm/right_1.xpm" />
- <Unit filename="include/xpm/rotate.xpm" />
- <Unit filename="include/xpm/rotate_on.xpm" />
- <Unit filename="include/xpm/show_on.xpm" />
- <Unit filename="include/xpm/show_sl.xpm" />
- <Unit filename="include/xpm/up_1.xpm" />
- <Unit filename="include/xpm/zoom_1.xpm" />
- <Unit filename="include/xpm/zoom_in.xpm" />
- <Unit filename="include/xpm/zoom_on.xpm" />
- <Unit filename="include/xpm/zoom_out.xpm" />
- <Unit filename="src/axis.cpp" />
- <Unit filename="src/base.cpp" />
- <Unit filename="src/base_cf.cpp" />
- <Unit filename="src/canvas.cpp" />
- <Unit filename="src/canvas_cf.cpp" />
- <Unit filename="src/cont.cpp" />
- <Unit filename="src/crust.cpp" />
- <Unit filename="src/data.cpp" />
- <Unit filename="src/data_io.cpp" />
- <Unit filename="src/data_new.cpp" />
- <Unit filename="src/data_op.cpp" />
- <Unit filename="src/data_png.cpp" />
- <Unit filename="src/def_font.cpp" />
- <Unit filename="src/eval.cpp" />
- <Unit filename="src/evalp.cpp" />
- <Unit filename="src/exec.cpp" />
- <Unit filename="src/export.cpp" />
- <Unit filename="src/export_2d.cpp" />
- <Unit filename="src/export_3d.cpp" />
- <Unit filename="src/fit.cpp" />
- <Unit filename="src/font.cpp" />
- <Unit filename="src/opengl.cpp" />
- <Unit filename="src/other.cpp" />
- <Unit filename="src/parser.cpp" />
- <Unit filename="src/pde.cpp" />
- <Unit filename="src/pixel.cpp" />
- <Unit filename="src/plot.cpp" />
- <Unit filename="src/prim.cpp" />
- <Unit filename="src/surf.cpp" />
- <Unit filename="src/tex_table.cpp" />
- <Unit filename="src/vect.cpp" />
- <Unit filename="src/volume.cpp" />
- <Unit filename="todo.txt" />
- <Unit filename="utils/mglconv.cpp">
- <Option target="mglconv" />
- </Unit>
- <Unit filename="utils/mglview.cpp">
- <Option target="mglview" />
- </Unit>
- <Unit filename="widgets/fltk.cpp">
- <Option target="Debug" />
- <Option target="Release" />
- <Option target="mglview" />
- <Option target="GLUT" />
- </Unit>
- <Unit filename="widgets/glut.cpp">
- <Option target="GLUT" />
- </Unit>
- <Unit filename="widgets/window.cpp" />
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
+++ /dev/null
-#! /bin/sh
-
-set -x
-aclocal -I config
-case `uname` in
- Darwin) glibtoolize --force --copy ;;
- *) libtoolize --force --copy ;;
-esac
-autoheader
-automake --add-missing --copy
-autoconf
+++ /dev/null
-find . -name '.svn' -print0 | xargs -0 rm -rf
-find . -name '*~' -print0 | xargs -0 rm -f
-rm ./clean-svn
+++ /dev/null
-# Build Qt apps with the autotools (Autoconf/Automake).
-# M4 macros.
-# This file is part of AutoTroll.
-# Copyright (C) 2006 Benoit Sigoure <benoit.sigoure@lrde.epita.fr>
-#
-# AutoTroll is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
-# USA.
-
- # ------------- #
- # DOCUMENTATION #
- # ------------- #
-
-# Disclaimer: Never tested with anything else than Qt 4.2! Feedback welcome.
-# Simply invoke AT_WITH_QT in your configure.ac. AT_WITH_QT can take
-# arguments which are documented in depth below. The default arguments are
-# equivalent to the default .pro file generated by qmake.
-#
-# Invoking AT_WITH_QT will do the following:
-# - Add a --with-qt option to your configure
-# - Find qmake, moc and uic and save them in the make variables $(QMAKE),
-# $(MOC), $(UIC).
-# - Save the path to Qt in $(QT_PATH)
-# - Find the flags to use Qt, that is:
-# * $(QT_DEFINES): -D's defined by qmake.
-# * $(QT_CFLAGS): CFLAGS as defined by qmake (C?!)
-# * $(QT_CXXFLAGS): CXXFLAGS as defined by qmake.
-# * $(QT_INCPATH): -I's defined by qmake.
-# * $(QT_CPPFLAGS): Same as $(QT_DEFINES) + $(QT_INCPATH)
-# * $(QT_LFLAGS): LFLAGS defined by qmake.
-# * $(QT_LDFLAGS): Same thing as $(QT_LFLAGS).
-# * $(QT_LIBS): LIBS defined by qmake.
-#
-# You *MUST* invoke $(MOC) and/or $(UIC) where necessary. AutoTroll provides
-# you with Makerules to ease this, here is a sample Makefile.am to use with
-# AutoTroll which builds the code given in the chapter 7 of the Qt Tutorial:
-# http://doc.trolltech.com/4.2/tutorial-t7.html
-#
-# -------------------------------------------------------------------------
-# include $(top_srcdir)/build-aux/autotroll.mk
-#
-# ACLOCAL_AMFLAGS = -I build-aux
-#
-# bin_PROGRAMS = lcdrange
-# lcdrange_SOURCES = $(BUILT_SOURCES) lcdrange.cpp lcdrange.h main.cpp
-# lcdrange_CXXFLAGS = $(QT_CXXFLAGS) $(AM_CXXFLAGS)
-# lcdrange_CPPFLAGS = $(QT_CPPFLAGS) $(AM_CPPFLAGS)
-# lcdrange_LDFLAGS = $(QT_LDFLAGS) $(LDFLAGS)
-# lcdrange_LDADD = $(QT_LIBS) $(LDADD)
-#
-# BUILT_SOURCES = lcdrange.moc.cpp
-# -------------------------------------------------------------------------
-#
-# Note that your MOC, UIC and QRC files *MUST* be listed manually in
-# BUILT_SOURCES. If you name them properly (eg: .moc.cc, .qrc.cc, .ui.cc -- of
-# course you can use .cpp or .cxx or .C rather than .cc) AutoTroll will build
-# them automagically for you (using implicit rules defined in autotroll.mk).
-
-m4_pattern_forbid([^AT_])dnl
-m4_pattern_forbid([^_AT_])dnl
-
-# AT_WITH_QT([QT_modules], [QT_config], [QT_misc])
-# ------------------------------------------------
-# Enable Qt support and add an option --with-qt to the configure script.
-#
-# The QT_modules argument is optional and defines extra modules to enable or
-# disable (it's equivalent to the QT variable in .pro files). Modules can be
-# specified as follows:
-#
-# AT_WITH_QT => No argument -> No QT value.
-# Qmake sets it to "core gui" by default.
-# AT_WITH_QT([xml]) => QT += xml
-# AT_WITH_QT([+xml]) => QT += xml
-# AT_WITH_QT([-gui]) => QT -= gui
-# AT_WITH_QT([xml -gui +sql svg]) => QT += xml sql svg
-# QT -= gui
-#
-# The QT_config argument is also optional and follows the same convention as
-# QT_modules. Instead of changing the QT variable, it changes the CONFIG
-# variable, which is used to tweak configuration and compiler options.
-#
-# The last argument, QT_misc (also optional) will be copied as-is the .pro
-# file used to guess how to compile Qt apps. You may use it to further tweak
-# the build process of Qt apps if tweaking the QT or CONFIG variables isn't
-# enough for you.
-AC_DEFUN([AT_WITH_QT],
-[ AC_REQUIRE([AC_CANONICAL_HOST])
- AC_REQUIRE([AC_CANONICAL_BUILD])
- AC_REQUIRE([AC_PROG_CXX])
-
- test x"$TROLL" != x && echo 'ViM rox emacs.'
-
-dnl Memo: AC_ARG_WITH(package, help-string, [if-given], [if-not-given])
- AC_ARG_WITH([qt],
- [AS_HELP_STRING([--with-qt],
- [Path to Qt @<:@Look in PATH and /usr/local/Trolltech@:>@])],
- [QT_PATH=$withval], [QT_PATH=])
-
- # Find Qt.
- if test -d /usr/local/Trolltech; then
- # Try to find the latest version.
- tmp_qt_paths=`echo /usr/local/Trolltech/*/bin | tr ' ' '\n' | sort -nr \
- | xargs | sed 's/ */:/g'`
- fi
-
- # Find qmake.
- AC_PATH_PROGS([QMAKE], [qmake-qt4${EXEEXT}], [missing], [$QT_DIR:$QT_PATH:$PATH:$tmp_qt_paths])
- if test x"$QMAKE" = xmissing; then
- AC_PATH_PROGS([QMAKE], [qmake${EXEEXT}], [missing], [$QT_DIR:$QT_PATH:$PATH:$tmp_qt_paths])
- if test x"$QMAKE" = xmissing; then
- AC_MSG_ERROR([Cannot find qmake in your PATH. Try using --with-qt.])
- fi
- fi
-
- # Find moc (Meta Object Compiler).
- AC_PATH_PROGS([MOC], [moc-qt4${EXEEXT}], [missing], [$QT_PATH:$PATH:$tmp_qt_paths])
- if test x"$MOC" = xmissing; then
- AC_PATH_PROGS([MOC], [moc${EXEEXT}], [missing], [$QT_PATH:$PATH:$tmp_qt_paths])
- if test x"$MOC" = xmissing; then
- AC_MSG_ERROR([Cannot find moc (Meta Object Compiler) in your PATH. Try using --with-qt.])
- fi
- fi
-
- # Find uic (User Interface Compiler).
- AC_PATH_PROGS([UIC], [uic-qt4${EXEEXT}], [missing], [$QT_PATH:$PATH:$tmp_qt_paths])
- if test x"$UIC" = xmissing; then
- AC_PATH_PROGS([UIC], [uic${EXEEXT}], [missing], [$QT_PATH:$PATH:$tmp_qt_paths])
- if test x"$UIC" = xmissing; then
- AC_MSG_ERROR([Cannot find uic (User Interface Compiler) in your PATH. Try using --with-qt.])
- fi
- fi
-
- # Find rcc (Qt Resource Compiler).
- AC_PATH_PROGS([RCC], [rcc-qt4${EXEEXT}], [false], [$QT_PATH:$PATH:$tmp_qt_paths])
- if test x"$RCC" = xfalse; then
- AC_PATH_PROGS([RCC], [rcc${EXEEXT}], [false], [$QT_PATH:$PATH:$tmp_qt_paths])
- if test x"$RCC" = xfalse; then
- AC_MSG_WARN([Cannot find rcc (Qt Resource Compiler) in your PATH. Try using --with-qt.])
- fi
- fi
-
- # If we don't know the path to Qt, guess it from the path to qmake.
- if test x"$QT_PATH" = x; then
- QT_PATH=`dirname "$QMAKE"`
- fi
- if test x"$QT_PATH" = x; then
- AC_MSG_ERROR([Cannot find the path to your Qt install. Use --with-qt.])
- fi
- AC_SUBST([QT_PATH])
-
- # Get ready to build a test-app with Qt.
-
- # Look for a writable temporary directory.
- AC_ARG_VAR([TMPDIR], [A temporary directory with write access @<:@/tmp@:>@])
- if test x"$TMPDIR" = x || test ! -d "$TMPDIR" || test ! -w "$TMPDIR"; then
- echo "$as_me:$LINENO: no TMPDIR or bad TMPDIR ($TMPDIR)" \
- >&AS_MESSAGE_LOG_FD
- for i in /tmp /var/tmp; do
- if test -d "$i" && test -w "$i"; then
- TMPDIR=$i
- export TMPDIR
- echo "$as_me:$LINENO: setting TMPDIR=$TMPDIR" >&AS_MESSAGE_LOG_FD
- break
- fi
- done
- fi
-
- # Kludge!! QMake has a very strange behavior. For instance, if you
- # install Qt under your $HOME and run QMake somewhere else under your
- # $HOME, it will try to be clever and produce Makefiles with relative
- # include paths. In order to avoid this, we will test QMake from a
- # temporary directory (usually /tmp). Note that this problem was only
- # observed with Qt 4.
- my_configure_pwd=`pwd`
- my_tmpdir="$TMPDIR/conftest$$.dir"
- test -d "$my_tmpdir" || mkdir "$my_tmpdir"
- if test -w "$my_tmpdir" && cd "$my_tmpdir"
- then
- :
- else
- AC_MSG_ERROR([Cannot cd to or write in $my_tmpdir])
- fi
- cat >conftest.h <<_ASEOF
-#include <QObject>
-
-class Foo: public QObject
-{
- Q_OBJECT;
-public:
- Foo();
- ~Foo() {}
-public slots:
- void setValue(int value);
-signals:
- void valueChanged(int newValue);
-private:
- int value_;
-};
-_ASEOF
-
- cat >conftest.cpp <<_ASEOF
-#include "conftest.h"
-Foo::Foo()
- : value_ (42)
-{
- connect(this, SIGNAL(valueChanged(int)), this, SLOT(setValue(int)));
-}
-
-void Foo::setValue(int value)
-{
- value_ = value;
-}
-
-int main()
-{
- Foo f;
-}
-_ASEOF
- if $QMAKE -project; then :; else
- AC_MSG_ERROR([Calling $QMAKE -project failed.])
- fi
-
- # Find the .pro file generated by qmake.
- pro_file='conftest.dir.pro'
- test -f $pro_file || pro_file=`echo *.pro`
- if test -f "$pro_file"; then :; else
- AC_MSG_ERROR([Can't find the .pro file generated by Qmake.])
- fi
-
-dnl Tweak the value of QT in the .pro if have been the 1st arg.
-m4_ifval([$1], [_AT_TWEAK_PRO_FILE([QT], [$1])])
-
-dnl Tweak the value of CONFIG in the .pro if have been given a 2nd arg.
-m4_ifval([$2], [_AT_TWEAK_PRO_FILE([CONFIG], [$2])])
-
-m4_ifval([$3],
-[ # Add the extra-settings the user wants to set in the .pro
- echo "$3" >>"$pro_file"
-])
-
- echo "$as_me:$LINENO: Invoking $QMAKE on $pro_file" >&AS_MESSAGE_LOG_FD
- sed 's/^/| /' "$pro_file" >&AS_MESSAGE_LOG_FD
-
- if $QMAKE; then :; else
- AC_MSG_ERROR([Calling $QMAKE failed.])
- fi
- # Try to compile a simple Qt app.
- AC_CACHE_CHECK([whether we can build a simple Qt app], [at_cv_qt_build],
- [at_cv_qt_build=ko
- : ${MAKE=make}
-
- if $MAKE >&AS_MESSAGE_LOG_FD 2>&1; then
- at_cv_qt_build='ok, looks like Qt 4'
- else
- echo "$as_me:$LINENO: Build failed, trying to #include <qobject.h> \
-instead" >&AS_MESSAGE_LOG_FD
- sed 's/<QObject>/<qobject.h>/' conftest.h > tmp.h && mv tmp.h conftest.h
- if $MAKE >&AS_MESSAGE_LOG_FD 2>&1; then
- at_cv_qt_build='ok, looks like Qt 3'
- else
- # Sometimes (such as on Debian) build will fail because Qt hasn't been
- # installed in debug mode and qmake tries (by default) to build apps in
- # debug mode => Try again in release mode.
- echo "$as_me:$LINENO: Build failed, trying to enforce release mode" \
- >&AS_MESSAGE_LOG_FD
-
- _AT_TWEAK_PRO_FILE([CONFIG], [+release])
-
- sed 's/<qobject.h>/<QObject>/' conftest.h > tmp.h && mv tmp.h conftest.h
- if $MAKE >&AS_MESSAGE_LOG_FD 2>&1; then
- at_cv_qt_build='ok, looks like Qt 4, release mode forced'
- else
- echo "$as_me:$LINENO: Build failed, trying to #include <qobject.h> \
-instead" >&AS_MESSAGE_LOG_FD
- sed 's/<QObject>/<qobject.h>/' conftest.h > tmp.h && mv tmp.h conftest.h
- if $MAKE >&AS_MESSAGE_LOG_FD 2>&1; then
- at_cv_qt_build='ok, looks like Qt 3, release mode forced'
- else
- at_cv_qt_build=ko
- echo "$as_me:$LINENO: failed program was:" >&AS_MESSAGE_LOG_FD
- sed 's/^/| /' conftest.h >&AS_MESSAGE_LOG_FD
- echo "$as_me:$LINENO: failed program was:" >&AS_MESSAGE_LOG_FD
- sed 's/^/| /' conftest.cpp >&AS_MESSAGE_LOG_FD
- fi # if make with Qt3-style #include and release mode forced.
- fi # if make with Qt4-style #include and release mode forced.
- fi # if make with Qt3-style #include.
- fi # if make with Qt4-style #include.
- ])dnl end: AC_CACHE_CHECK(at_cv_qt_build)
-
- if test x"$at_cv_qt_build" = xko; then
- AC_MSG_ERROR([Cannot build a test Qt program])
- fi
- QT_VERSION_MAJOR=`echo "$at_cv_qt_build" | sed 's/^[^0-9]*//'`
- AC_SUBST([QT_VERSION_MAJOR])
-
- # This sed filter is applied after an expression of the form: /^FOO.*=/!d;
- # It starts by removing the beginning of the line, removing references to
- # SUBLIBS, removing unnecessary whitespaces at the beginning, and prefixes
- # all variable uses by QT_.
- qt_sed_filter='s///;
- s/$(SUBLIBS)//g;
- s/^ *//;
- s/\$(\(@<:@A-Z_@:>@@<:@A-Z_@:>@*\))/$(QT_\1)/g'
-
- # Find the Makefile (qmake happens to generate a fake Makefile which invokes
- # a Makefile.Debug or Makefile.Release). We we have both, we'll pick the
- # Makefile.Release. The reason is that the main difference is that release
- # uses -Os and debug -g. We can override -Os by passing another -O but we
- # usually don't override -g.
- if test -f Makefile.Release; then
- at_mfile='Makefile.Release'
- else
- at_mfile='Makefile'
- fi
- if test -f $at_mfile; then :; else
- cd "$my_configure_pwd"
- AC_MSG_ERROR([Cannot find the Makefile generated by qmake.])
- fi
-
- # Find the DEFINES of Qt (should have been named CPPFLAGS).
- AC_CACHE_CHECK([for the DEFINES to use with Qt], [at_cv_env_QT_DEFINES],
- [at_cv_env_QT_DEFINES=`sed "/^DEFINES@<:@ @:>@*=/!d;$qt_sed_filter" $at_mfile`])
- AC_SUBST([QT_DEFINES], [$at_cv_env_QT_DEFINES])
-
- # Find the CFLAGS of Qt (We can use Qt in C?!)
- AC_CACHE_CHECK([for the CFLAGS to use with Qt], [at_cv_env_QT_CFLAGS],
- [at_cv_env_QT_CFLAGS=`sed "/^CFLAGS@<:@ @:>@*=/!d;$qt_sed_filter" $at_mfile`])
- AC_SUBST([QT_CFLAGS], [$at_cv_env_QT_CFLAGS])
-
- # Find the CXXFLAGS of Qt.
- AC_CACHE_CHECK([for the CXXFLAGS to use with Qt], [at_cv_env_QT_CXXFLAGS],
- [at_cv_env_QT_CXXFLAGS=`sed "/^CXXFLAGS@<:@ @:>@*=/!d;$qt_sed_filter" $at_mfile`])
- AC_SUBST([QT_CXXFLAGS], [$at_cv_env_QT_CXXFLAGS])
-
- # Find the INCPATH of Qt.
- AC_CACHE_CHECK([for the INCPATH to use with Qt], [at_cv_env_QT_INCPATH],
- [at_cv_env_QT_INCPATH=`sed "/^INCPATH@<:@ @:>@*=/!d;$qt_sed_filter" $at_mfile`])
- AC_SUBST([QT_INCPATH], [$at_cv_env_QT_INCPATH])
-
- AC_SUBST([QT_CPPFLAGS], ["$at_cv_env_QT_DEFINES $at_cv_env_QT_INCPATH"])
-
- # Find the LFLAGS of Qt (Should have been named LDFLAGS)
- AC_CACHE_CHECK([for the LDFLAGS to use with Qt], [at_cv_env_QT_LDFLAGS],
- [at_cv_env_QT_LDFLAGS=`sed "/^LDFLAGS@<:@ @:>@*=/!d;$qt_sed_filter" $at_mfile`])
- AC_SUBST([QT_LFLAGS], [$at_cv_env_QT_LDFLAGS])
- AC_SUBST([QT_LDFLAGS], [$at_cv_env_QT_LDFLAGS])
-
- AC_MSG_CHECKING([whether host operating system is Darwin])
- at_darwin="no"
- case $host_os in
- darwin*)
- at_darwin="yes"
- ;;
- esac
- AC_MSG_RESULT([$at_darwin])
-
- # Find the LIBS of Qt.
- AC_CACHE_CHECK([for the LIBS to use with Qt], [at_cv_env_QT_LIBS],
- [at_cv_env_QT_LIBS=`sed "/^LIBS@<:@ @:>@*=/!d;$qt_sed_filter" $at_mfile`
- if test x$at_darwin = xyes; then
- # Fix QT_LIBS: as of today Libtool (GNU Libtool 1.5.23a) doesn't handle
- # -F properly. The "bug" has been fixed on 22 October 2006
- # by Peter O'Gorman but we provide backward compatibility here.
- at_cv_env_QT_LIBS=`echo "$at_cv_env_QT_LIBS" \
- | sed 's/^-F/-Wl,-F/;s/ -F/ -Wl,-F/g'`
- fi
- ])
- AC_SUBST([QT_LIBS], [$at_cv_env_QT_LIBS])
-
- cd "$my_configure_pwd" || echo 'WTF!'
- rm -rf "$my_tmpdir"
-])
-
-# AT_REQUIRE_QT_VERSION(QT_version)
-# ---------------------------------
-# Check (using qmake) that Qt's version "matches" QT_version.
-# Must be run AFTER AT_WITH_QT. Requires autoconf 2.60.
-AC_DEFUN([AT_REQUIRE_QT_VERSION],
-[ AC_PREREQ([2.60])
- if test x"$QMAKE" = x; then
- AC_MSG_ERROR([\$QMAKE is empty. \
-Did you invoke AT@&t@_WITH_QT before AT@&t@_REQUIRE_QT_VERSION?])
- fi
- AC_CACHE_CHECK([for Qt's version], [at_cv_QT_VERSION],
- [echo "$as_me:$LINENO: Running $QMAKE --version:" >&AS_MESSAGE_LOG_FD
- $QMAKE --version >&AS_MESSAGE_LOG_FD 2>&1
- qmake_version_sed=['/^.*\([0-9]\.[0-9]\.[0-9]\).*$/!d;s//\1/']
- at_cv_QT_VERSION=`$QMAKE --version 2>&1 | sed "$qmake_version_sed"`])
- if test x"$at_cv_QT_VERSION" = x; then
- AC_MSG_ERROR([Cannot detect Qt's version.])
- fi
- AC_SUBST([QT_VERSION], [$at_cv_QT_VERSION])
- AS_VERSION_COMPARE([$QT_VERSION], [$1],
- [AC_MSG_ERROR([This package requires Qt $1 or above.])])
-])
-
-# _AT_TWEAK_PRO_FILE(QT_VAR, VALUE)
-# ---------------------------
-# @internal. Tweak the variable QT_VAR in the .pro.
-# VALUE is an IFS-separated list of value and each value is rewritten
-# as follows:
-# +value => QT_VAR += value
-# -value => QT_VAR -= value
-# value => QT_VAR += value
-AC_DEFUN([_AT_TWEAK_PRO_FILE],
-[ # Tweak the value of $1 in the .pro file for $2.
-
- qt_conf=''
- for at_mod in $2; do
- at_mod=`echo "$at_mod" | sed 's/^-//; tough
- s/^+//; beef
- :ough
- s/^/$1 -= /;n
- :eef
- s/^/$1 += /'`
- qt_conf="$qt_conf
-$at_mod"
- done
- echo "$qt_conf" | sed 1d >>"$pro_file"
-])
+++ /dev/null
-# Makerules.
-# This file is part of AutoTroll.
-# Copyright (C) 2006 Benoit Sigoure.
-#
-# AutoTroll is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
-# USA.
-
- # ------------- #
- # DOCUMENTATION #
- # ------------- #
-
-# See autotroll.m4 :)
-
-
-SUFFIXES = .moc.cpp .moc.cc .moc.cxx .moc.C .h .hh \
- .ui .ui.h .ui.hh \
- .qrc .qrc.cpp .qrc.cc .qrc.cxx .qrc.C
-
-# --- #
-# MOC #
-# --- #
-
-.hh.moc.cpp:
- $(MOC) $(QT_CPPFLAGS) $< -o $@
-.h.moc.cpp:
- $(MOC) $(QT_CPPFLAGS) $< -o $@
-
-.hh.moc.cc:
- $(MOC) $(QT_CPPFLAGS) $< -o $@
-.h.moc.cc:
- $(MOC) $(QT_CPPFLAGS) $< -o $@
-
-.hh.moc.cxx:
- $(MOC) $(QT_CPPFLAGS) $< -o $@
-.h.moc.cxx:
- $(MOC) $(QT_CPPFLAGS) $< -o $@
-
-.hh.moc.C:
- $(MOC) $(QT_CPPFLAGS) $< -o $@
-.h.moc.C:
- $(MOC) $(QT_CPPFLAGS) $< -o $@
-
-# --- #
-# UIC #
-# --- #
-
-.ui.ui.hh:
- $(UIC) $< -o $@
-
-.ui.ui.h:
- $(UIC) $< -o $@
-
-# --- #
-# RCC #
-# --- #
-
-.qrc.qrc.cpp:
- $(RCC) -name `echo "$<" | sed 's/\.qrc$$//'` $< -o $@
-
-.qrc.qrc.cc:
- $(RCC) -name `echo "$<" | sed 's/\.qrc$$//'` $< -o $@
-
-.qrc.qrc.cxx:
- $(RCC) -name `echo "$<" | sed 's/\.qrc$$//'` $< -o $@
-
-.qrc.qrc.C:
- $(RCC) -name `echo "$<" | sed 's/\.qrc$$//'` $< -o $@
-
-DISTCLEANFILES = $(BUILT_SOURCES)
+++ /dev/null
-AC_INIT([mathgl], [2.0], [mathgl.abalakin@gmail.com])
-
-MGL_RELEASE=2.0
-AC_SUBST(MGL_RELEASE)
-
-AC_CONFIG_MACRO_DIR([config])
-AC_CONFIG_AUX_DIR(config)
-AC_CONFIG_SRCDIR(src)
-AC_CONFIG_HEADER(include/mgl/config.h)
-AC_LANG([C++])
-
-#MGL_RELEASE=1.4
-#AC_SUBST(MGL_RELEASE)
-
-# LT Version numbers, remember to change them just *before* a release.
-# (Interfaces removed: CURRENT++, AGE=0, REVISION=0)
-# (Interfaces added: CURRENT++, AGE++, REVISION=0)
-# (No interfaces changed: REVISION++)
-MGL_CURRENT=6
-MGL_REVISION=0
-MGL_AGE=0
-AC_SUBST(MGL_CURRENT)
-AC_SUBST(MGL_REVISION)
-AC_SUBST(MGL_AGE)
-
-AM_INIT_AUTOMAKE
-
-AC_PROG_CC
-AC_PROG_CXX
-AC_PROG_INSTALL
-
-AC_LIBTOOL_WIN32_DLL
-AC_LIBTOOL_DLOPEN
-AC_PROG_LIBTOOL
-
-AC_ARG_ENABLE(double,
-[ --enable-double Turn on double precision in MathGL library],
-[case "${enableval}" in
- yes) double=true ;;
- no) double=false ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-double) ;;
-esac],[double=false])
-
-if (test x$double = xtrue) ;then
- AC_DEFINE([MGL_USE_DOUBLE],1,[This define enables double precision in MathGL])
-else
- AC_DEFINE([MGL_USE_DOUBLE],0,[This define enables double precision in MathGL])
-fi
-
-AC_ARG_ENABLE(all,
-[ --enable-all Turn on all features],
-[case "${enableval}" in
- yes) all=true ;;
- no) all=false ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-all) ;;
-esac],[all=false])
-
-AC_ARG_ENABLE(langall,
-[ --enable-langall Turn on all language interfaces],
-[case "${enableval}" in
- yes) langall=true ;;
- no) langall=false ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-langall) ;;
-esac],[langall=false])
-
-AC_ARG_ENABLE(pthread,
-[ --enable-pthread Turn on pthread support in MathGL library],
-[case "${enableval}" in
- yes) pthread=true ;;
- no) pthread=false ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-pthread) ;;
-esac],[pthread=true])
-AC_CHECK_HEADER(pthread.h,[(test x$all = xtrue || test x$pthread = xtrue) && PTHREAD_FLAGS=-DHAVE_PTHREAD AC_SUBST(PTHREAD_FLAGS)],
- [(test x$all = xtrue || test x$pthread = xtrue) && echo "Please install posix threads headers" && exit])
-
-AC_CHECK_LIB([pthread], [main], [(test x$all = xtrue || test x$pthread = xtrue) && PTHREAD_LIBS=-lpthread AC_SUBST(PTHREAD_LIBS)],
- [(test x$all = xtrue || test x$pthread = xtrue) && echo "Please install posix threads library" && exit])
-AM_CONDITIONAL(USE_PTHREAD, test x$pthread = xtrue)
-
-AC_ARG_ENABLE(gsl,
-[ --enable-gsl Turn on gsl functions],
-[case "${enableval}" in
- yes) gsl=true ;;
- no) gsl=false ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-gsl) ;;
-esac],[gsl=true])
-
-if (test x$all = xtrue || test x$gsl = xtrue) ;then
- GSL_PROG=gsl-config
- AC_CHECK_PROG(GSL_FLAGS,$GSL_PROG,`$GSL_PROG --cflags`)
- AC_CHECK_PROG(GSL_LIBS,$GSL_PROG,`$GSL_PROG --libs`)
- if test "$GSL_LIBS" ;then
- test_gsl=true
- else
- echo "Please install gsl headers and libraries and make sure that \
- path to $GSL_PROG exist in your PATH"
- exit
- fi
-else
- GSL_FLAGS=-DNO_GSL
- AC_SUBST(GSL_FLAGS)
-fi
-AM_CONDITIONAL(USE_GSL, test x$test_gsl = xtrue)
-
-case "${host}" in
- *darwin*)
- GL_LIBS="-framework OpenGL"
- AC_SUBST(GL_LIBS)
- ;;
-
- *w32*)
- GL_LIBS=opengl32
- AC_CHECK_HEADER([GL/gl.h],,[echo "Please install OpenGL headers (GL/gl.h)"; exit])
- AC_CHECK_LIB([${GL_LIBS}], [main], [GL_LIBS=-l${GL_LIBS} AC_SUBST(GL_LIBS)],
- [echo "Please install OpenGL library (lib${GL_LIBS}.a)"; exit])
- ;;
-
- *)
- GL_LIBS=GL
- AC_CHECK_HEADER(GL/gl.h,,[echo "Please install OpenGL headers (GL/gl.h)"; exit])
- AC_CHECK_LIB([${GL_LIBS}], [main], [GL_LIBS=-l${GL_LIBS} AC_SUBST(GL_LIBS)],
- [echo "Please install OpenGL library (lib${GL_LIBS}.a)"; exit])
- ;;
-
-esac
-AM_CONDITIONAL(USE_GLUT, (test x$all = xtrue || test x$glut = xtrue))
-
-case "${host}" in
- *linux*)
- ADDON_FLAGS=-DNO_COLOR_ARRAY
- ;;
-
- *)
- ;;
-esac
-
-AC_ARG_ENABLE(hdf5,
-[ --enable-hdf5 Turn on hdf5],
-[case "${enableval}" in
- yes) hdf5=true ;;
- no) hdf5=false ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-hdf5) ;;
-esac],[hdf5=false])
-AC_ARG_ENABLE(hdf5_18,
-[ --enable-hdf5_18 Turn on hdf5 version 1.8],
-[case "${enableval}" in
- yes) hdf5_18=true ;;
- no) hdf5_18=false ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-hdf5_18) ;;
-esac],[hdf5_18=false])
-#AC_CHECK_HEADER(hdf5.h,[(test x$all = xtrue || test x$hdf5 = xtrue || test x$hdf5_18 = xtrue) && HDF5_FLAGS=-DHAVE_HDF5 AC_SUBST(HDF5_FLAGS)],
-AC_CHECK_HEADER(hdf5.h,[(test x$all = xtrue || test x$hdf5 = xtrue || test x$hdf5_18 = xtrue) && HDF5_FLAGS=-DHAVE_HDF5 ],
- [(test x$all = xtrue || test x$hdf5 = xtrue || test x$hdf5_18 = xtrue) && echo "Please install hdf5 headers" && exit])
-if ((test x$all = xtrue || test x$hdf5 = xtrue) && test x$hdf5_18 = xfalse) ;then
- HDF5_FLAGS="$HDF5_FLAGS -DH5_USE_16_API"
- AC_SUBST(HDF5_FLAGS)
-fi
-AC_CHECK_LIB([hdf5], [main], [(test x$all = xtrue || test x$hdf5 = xtrue || test x$hdf5_18 = xtrue) && HDF5_LIBS=-lhdf5 AC_SUBST(HDF5_LIBS)],
- [(test x$all = xtrue || test x$hdf5 = xtrue || test x$hdf5_18 = xtrue) && echo "Please install hdf5 library" && exit])
-AM_CONDITIONAL(USE_HDF5, (test x$all = xtrue || test x$hdf5 = xtrue || test x$hdf5_18 = xtrue))
-
-
-AC_ARG_ENABLE(hdf4,
-[ --enable-hdf4 Turn on hdf4],
-[case "${enableval}" in
- yes) hdf4=true ;;
- no) hdf4=false ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-hdf4) ;;
-esac],[hdf4=false])
-AC_CHECK_HEADER(hdf/mfhdf.h,[(test x$all = xtrue || test x$hdf4 = xtrue) && HDF4_FLAGS=-DHAVE_HDF4 ],
- [(test x$all = xtrue || test x$hdf4 = xtrue) && echo "Please install hdf4 headers" && exit])
- AC_SUBST(HDF4_FLAGS)
-AC_CHECK_LIB([df], [main], [(test x$all = xtrue || test x$hdf4 = xtrue) && HDF4_LIBS="-lmfhdf -ldf" AC_SUBST(HDF4_LIBS)],
- [(test x$all = xtrue || test x$hdf4 = xtrue) && echo "Please install hdf4 library" && exit])
-AM_CONDITIONAL(USE_HDF4, (test x$all = xtrue || test x$hdf4 = xtrue))
-
-AC_CHECK_HEADER(png.h,,[echo "Please install png headers" && exit])
-
-AC_CHECK_LIB([png], [main], [PNG_LIBS=-lpng AC_SUBST(PNG_LIBS)],
- [echo "Please install png library" && exit])
-
-AC_ARG_ENABLE(jpeg,
-[ --enable-jpeg Turn on jpeg],
-[case "${enableval}" in
- yes) jpeg=true ;;
- no) jpeg=false ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-jpeg) ;;
-esac],[jpeg=false])
-AC_CHECK_HEADER(jpeglib.h,[(test x$all = xtrue || test x$jpeg = xtrue) && JPEG_FLAGS=-DHAVE_JPEG AC_SUBST(JPEG_FLAGS)],
- [(test x$all = xtrue || test x$jpeg = xtrue) && echo "Please install jpeg headers" && exit])
-
-AC_CHECK_LIB([jpeg], [main], [(test x$all = xtrue || test x$jpeg = xtrue) && JPEG_LIBS=-ljpeg AC_SUBST(JPEG_LIBS)],
- [(test x$all = xtrue || test x$jpeg = xtrue) && echo "Please install jpeg library" && exit])
-AM_CONDITIONAL(USE_JPEG, (test x$all = xtrue || test x$jpeg = xtrue))
-
-AC_ARG_ENABLE(u3d,
-[ --enable-u3d Turn on u3d functions],
-[case "${enableval}" in
- yes) u3d=true ;;
- no) u3d=false ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-u3d) ;;
-esac],[u3d=false])
-AC_ARG_ENABLE(pdf,
-[ --enable-pdf Turn on u3d and pdf functions],
-[case "${enableval}" in
- yes) pdf=true; u3d=true ;;
- no) pdf=false ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-pdf) ;;
-esac],[pdf=false])
-AS_IF([test "x$pdf" == xtrue],
- [AC_CHECK_LIB([hpdf], [main],
- [],
- [AC_MSG_FAILURE(
- [--enable-pdf was given, but test for libharu failed])]
- )])
-AS_IF([test "x$pdf" == xtrue],
- [AC_CHECK_HEADERS([hpdf.h], [],
- [AC_MSG_FAILURE(
- [--enable-pdf was given, but test for headers failed])]
- )])
-AM_CONDITIONAL(USE_PDF, test x$pdf = xtrue)
-
-AS_IF([test "x$u3d" == xtrue],
- [AC_CHECK_LIB([IDTF], [main],
- [AC_SUBST([U3D_LIBS], ["-lIDTF -lm -ldl"])
- AC_DEFINE([HAVE_U3D], [1],
- [Define if you have libIDTF])
- ],
- [AC_MSG_FAILURE(
- [--enable-u3d was given, but test for libIDTF failed])],
- [-lm -ldl])])
-AS_IF([test "x$u3d" == xtrue],
- [AC_CHECK_HEADERS([u3d/SceneConverterLib.h], [],
- [AC_MSG_FAILURE(
- [--enable-u3d was given, but test for headers failed])]
- )])
-AM_CONDITIONAL(USE_U3D, test x$u3d = xtrue)
-
-AC_ARG_ENABLE(fltk,
-[ --enable-fltk Turn on fltk],
-[case "${enableval}" in
- yes) fltk=true ;;
- no) fltk=false ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-fltk) ;;
-esac],[fltk=false])
-if (test x$all = xtrue || test x$fltk = xtrue) ;then
- FLTK_PROG=fltk-config
- AC_CHECK_PROG(FLTK_FLAGS,$FLTK_PROG,`$FLTK_PROG --cxxflags`)
- AC_CHECK_PROG(FLTK_LIBS,$FLTK_PROG,`$FLTK_PROG --ldflags`)
- if test "$FLTK_FLAGS" && test "$FLTK_LIBS" ;then
- test_fltk=true
- else
- echo "Please install FLTK headers and libraries and make sure that \
- path to $FLTK_PROG exist in your PATH"
- exit
- fi
-fi
-AM_CONDITIONAL(USE_FLTK, test x$test_fltk = xtrue)
-
-AC_ARG_ENABLE(qt,
-[ --enable-qt Turn on Qt],
-[case "${enableval}" in
- yes) qt=true ;;
- no) qt=false ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-qt) ;;
-esac],[qt=false])
-if (test x$all = xtrue || test x$qt = xtrue) ;then
- AT_WITH_QT
- AT_REQUIRE_QT_VERSION(4.3)
- test_qt=true
-fi
-AM_CONDITIONAL(USE_QT, test x$test_qt = xtrue)
-
-AC_ARG_ENABLE(python,
-[ --enable-python Turn on interface to python],
-[case "${enableval}" in
- yes) python=true ;;
- no) python=false ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-python) ;;
-esac],[python=false])
-if (test x$langall = xtrue || test x$python = xtrue) ;then
- AC_CHECK_PROG(PYTHON_HEADERS,python-config,`python-config --cflags`)
- AC_CHECK_PROG(HAVE_SWIG,swig$EXEEXT,true)
- if (test "$PYTHON_HEADERS" && test "$HAVE_SWIG") ;then
- test_python=true
- AM_PATH_PYTHON()
- else
- echo Please install python-dev and swig packages
- exit
- fi
-fi
-AM_CONDITIONAL(USE_PYTHON, test x$test_python = xtrue )
-
-AC_ARG_ENABLE(octave,
-[ --enable-octave Turn on interface to octave],
-[case "${enableval}" in
- yes) octave=true ;;
- no) octave=false ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-octave) ;;
-esac],[octave=false])
-if (test x$langall = xtrue || test x$octave = xtrue) ;then
- AC_CHECK_PROG([OCTAVE],[octave-config],[octave-config])
-# find Octave arch
- AC_MSG_CHECKING([for Octave arch])
- OCTAVE_ARCH=`$OCTAVE -p CANONICAL_HOST_TYPE`-`$OCTAVE -p API_VERSION`
- OCTAVE_INCFLAGS="-I`$OCTAVE -p OCTINCLUDEDIR`"
- AC_MSG_RESULT([$OCTAVE_ARCH])
- AC_SUBST(OCTAVE_ARCH,[$OCTAVE_ARCH])
- AC_SUBST(OCTAVE_INCFLAGS,[$OCTAVE_INCFLAGS])
- test_octave=true
-fi
-AM_CONDITIONAL(USE_OCTAVE, test x$test_octave = xtrue )
-
-AM_CXXFLAGS="$AM_CXXFLAGS -Wall $GSL_FLAGS"
-AC_SUBST(AM_CXXFLAGS)
-
-AC_CONFIG_FILES([
-Makefile
-src/Makefile
-include/Makefile
-widgets/Makefile
-lang/Makefile
-utils/Makefile
-examples/Makefile
-])
-AC_OUTPUT
-
if(MGL_HAVE_QT)
include(${QT_USE_FILE})
- qt_wrap_cpp(mgl_qt_example MGL_MOC_EX_FILES ../include/mgl/qt.h)
+ qt_wrap_cpp(mgl_qt_example MGL_MOC_EX_FILES ../include/mgl2/qt.h)
add_executable(mgl_qt_example wnd_samples.cpp qt_example.cpp ${MGL_MOC_EX_FILES})
target_link_libraries(mgl_qt_example mgl-wnd ${QT_LIBRARIES})
install(
+++ /dev/null
-AM_CXXFLAGS += -I$(top_srcdir)/include -I$(top_builddir)/include
-
-check_PROGRAMS =
-bin_PROGRAMS = mgl_example
-mgl_example_SOURCES = wnd_samples.cpp full_test.cpp
-mgl_example_LDADD = $(top_builddir)/src/libmgl.la
-
-if USE_FLTK
-bin_PROGRAMS += mgl_fltk_example
-mgl_fltk_example_SOURCES = wnd_samples.cpp fltk_example.cpp
-mgl_fltk_example_LDADD = $(FLTK_LIBS) $(top_builddir)/widgets/libmgl-wnd.la $(top_builddir)/src/libmgl.la
-mgl_fltk_example_CXXFLAGS = $(FLTK_FLAGS) $(AM_CXXFLAGS)
-
-check_PROGRAMS += test
-test_SOURCES = wnd_samples.cpp main.cpp
-test_LDADD = $(FLTK_LIBS) $(top_builddir)/widgets/libmgl-wnd.la $(top_builddir)/src/libmgl.la
-test_CXXFLAGS = $(FLTK_FLAGS) $(AM_CXXFLAGS)
-endif
-
-#if USE_GLUT
-#bin_PROGRAMS += mgl_glut_example
-#mgl_glut_example_SOURCES = wnd_samples.cpp glut_example.cpp
-#mgl_glut_example_LDADD = $(top_builddir)/widgets/libmgl-wnd.la $(top_builddir)/src/libmgl.la
-#endif
-
-#if USE_WX
-#bin_PROGRAMS += mgl_wx_example
-#mgl_wx_example_LDADD = $(WX_LIBS) $(top_builddir)/widgets/libmgl-wnd.la $(top_builddir)/src/libmgl.la
-#mgl_wx_example_CXXFLAGS = $(WX_FLAGS) $(AM_CXXFLAGS)
-#mgl_wx_example_SOURCES = wnd_samples.cpp wx_example.cpp
-#endif
-
-if USE_QT
-include $(top_srcdir)/config/autotroll.mk
-ACLOCAL_AMFLAGS = -I $(top_srcdir)/config/
-
-bin_PROGRAMS += mgl_qt_example
-mgl_qt_example_SOURCES = wnd_samples.cpp $(top_builddir)/include/mgl/qt.moc.cpp $(top_srcdir)/include/mgl/qt.h qt_example.cpp
-mgl_qt_example_LDADD = $(QT_LIBS) $(top_builddir)/widgets/libmgl-wnd.la $(top_builddir)/src/libmgl.la
-mgl_qt_example_LDFLAGS = $(QT_LDFLAGS)
-mgl_qt_example_CPPFLAGS = $(QT_CPPFLAGS) $(AM_CPPFLAGS)
-mgl_qt_example_CXXFLAGS = $(QT_CXXFLAGS) $(AM_CXXFLAGS)
-
-BUILT_SOURCES = $(top_builddir)/include/mgl/qt.moc.cpp
-CLEANFILES = $(BUILT_SOURCES)
-endif
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
***************************************************************************/\r
#include <stdio.h>\r
-#include "mgl/mgl.h"\r
-#include "mgl/fltk.h"\r
+#include "mgl2/mgl.h"\r
+#include "mgl2/fltk.h"\r
//-----------------------------------------------------------------------------\r
int test_wnd(mglGraph *gr);\r
int sample(mglGraph *gr);\r
#include <stdlib.h>\r
#include <getopt.h>\r
#include <vector>\r
-#include "mgl/mgl.h"\r
-#include "mgl/eval.h"\r
-//#include <mgl/mgl_idtf.h>\r
-//#include "mgl/parser.h"\r
+#include "mgl2/mgl.h"\r
+#include "mgl2/eval.h"\r
//-----------------------------------------------------------------------------\r
void mgls_prepare1d(mglData *y, mglData *y1=0, mglData *y2=0, mglData *x1=0, mglData *x2=0);\r
void mgls_prepare2d(mglData *a, mglData *b=0, mglData *v=0);\r
int main(int argc,char **argv)\r
{\r
const char *suf = "";\r
- char name[256]="";\r
+ char name[256]="", *tmp;\r
int ch;\r
// mglGraphIDTF u3d;\r
mglGraph *gr = NULL;\r
case 0: break;\r
case 'w': width =atoi(optarg); break;\r
case 'h': height=atoi(optarg); break;\r
- case 'k': strcpy(name, optarg); break;\r
+ case 'k': strcpy(name, optarg); tmp=strchr(name,'.');\r
+ if(tmp) *tmp=0; break;\r
case 't': mglNumThr=atoi(optarg); break;\r
case 'l':\r
while(s->name[0]) { printf("%s ",s->name); s++; }\r
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
***************************************************************************/\r
#include <stdio.h>\r
-#include "mgl/glut.h"\r
+#include "mgl2/glut.h"\r
//-----------------------------------------------------------------------------\r
int test_wnd(mglGraph *gr);\r
int sample(mglGraph *gr);\r
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
***************************************************************************/\r
#include <stdio.h>\r
-#include "mgl/window.h"\r
+#include "mgl2/window.h"\r
//-----------------------------------------------------------------------------\r
int test_wnd(mglGraph *gr);\r
int sample(mglGraph *gr);\r
#include <stdlib.h>\r
#include <math.h>\r
//-----------------------------------------------------------------------------\r
-#include "mgl/mgl.h"\r
-#include "mgl/parser.h"\r
+#include "mgl2/mgl.h"\r
+#include "mgl2/parser.h"\r
//-----------------------------------------------------------------------------\r
void mgls_prepare1d(mglData *y, mglData *y1=0, mglData *y2=0, mglData *x1=0, mglData *x2=0);\r
void mgls_prepare2d(mglData *a, mglData *b=0, mglData *v=0);\r
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
***************************************************************************/\r
#include <stdio.h>\r
-#include "mgl/wx.h"\r
+#include "mgl2/wx.h"\r
//-----------------------------------------------------------------------------\r
#ifdef ENABLE_MGLGRAPHWX\r
int test(mglGraph *gr, void *);\r
-configure_file(${MathGL_SOURCE_DIR}/include/config.h.in ${MathGL_BINARY_DIR}/include/mgl/config.h)
+configure_file(${MathGL_SOURCE_DIR}/include/config.h.in ${MathGL_BINARY_DIR}/include/mgl2/config.h)
-set(MGL_INCLUDE_PATH "${CMAKE_INSTALL_PREFIX}/include/mgl")
-install(DIRECTORY mgl/ DESTINATION ${MGL_INCLUDE_PATH}
+set(MGL_INCLUDE_PATH "${CMAKE_INSTALL_PREFIX}/include/mgl2")
+install(DIRECTORY mgl2/ DESTINATION ${MGL_INCLUDE_PATH}
PATTERN ".svn" EXCLUDE
PATTERN "fltk.h" EXCLUDE
PATTERN "glut.h" EXCLUDE
PATTERN "*.pas"
PATTERN "*.h")
-install(FILES ${MathGL_BINARY_DIR}/include/mgl/config.h DESTINATION ${MGL_INCLUDE_PATH})
+install(FILES ${MathGL_BINARY_DIR}/include/mgl2/config.h DESTINATION ${MGL_INCLUDE_PATH})
if(MGL_HAVE_FLTK)
- install(FILES mgl/fltk.h DESTINATION ${MGL_INCLUDE_PATH})
+ install(FILES mgl2/fltk.h DESTINATION ${MGL_INCLUDE_PATH})
endif(MGL_HAVE_FLTK)
if(MGL_HAVE_GLUT)
- install(FILES mgl/glut.h DESTINATION ${MGL_INCLUDE_PATH})
+ install(FILES mgl2/glut.h DESTINATION ${MGL_INCLUDE_PATH})
endif(MGL_HAVE_GLUT)
if(MGL_HAVE_WX)
- install(FILES mgl/wx.h DESTINATION ${MGL_INCLUDE_PATH})
+ install(FILES mgl2/wx.h DESTINATION ${MGL_INCLUDE_PATH})
endif(MGL_HAVE_WX)
if(MGL_HAVE_QT)
- install(FILES mgl/qt.h DESTINATION ${MGL_INCLUDE_PATH})
+ install(FILES mgl2/qt.h DESTINATION ${MGL_INCLUDE_PATH})
endif(MGL_HAVE_QT)
+++ /dev/null
-if USE_FLTK
-FLTK_INC = mgl/fltk.h
-endif
-if USE_QT
-QT_INC = mgl/qt.h
-endif
-
-nobase_include_HEADERS = $(FLTK_INC) $(QT_INC) \
-mgl/base_cf.h mgl/opengl.h mgl/config.h mgl/data.h \
-mgl/fit.h mgl/plot.h mgl/vect.h \
-mgl/base.h mgl/canvas.h mgl/define.h mgl/font.h mgl/mgl.h \
-mgl/other.h mgl/prim.h mgl/volume.h \
-mgl/canvas_cf.h mgl/cont.h mgl/eval.h mgl/mgl_cf.h \
-mgl/parser.h mgl/surf.h mgl/window.h
+++ /dev/null
-/***************************************************************************
- * addon.h is part of Math Graphic Library
- * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU Library General Public License as *
- * published by the Free Software Foundation; either version 3 of the *
- * License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU Library General Public *
- * License along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
- ***************************************************************************/
-#ifndef _MGL_ADDON_H_
-#define _MGL_ADDON_H_
-/***************************************************************************/
-#include <stdio.h>
-#ifdef __cplusplus
-/***************************************************************************/
-#include <complex>
-#ifndef dual
-#define dual std::complex<double>
-#endif
-//---------------------------------------------------------------------------
-dual mgl_ipowc(dual x,int n);
-dual expi(dual a);
-dual expi(double a);
-//---------------------------------------------------------------------------
-/// Explicit scheme for 1 step of axial diffraction
-bool mgl_difr_axial(dual *a, int n, dual q, int Border,dual *b, dual *d, int kk, double di);
-/// Explicit scheme for 1 step of plane diffraction
-bool mgl_difr_grid(dual *a,int n,dual q,int Border,dual *b,dual *d,int kk);
-/***************************************************************************/
-extern "C" {
-#endif
-/***************************************************************************/
-double mgl_gauss_rnd();
-void mgl_fft_freq(double *freq,unsigned nn);
-/***************************************************************************/
-/** Remove double spaces from the string */
-void mgl_strcls(char *str);
-/** Get position of substring or return -1 if not found */
-int mgl_strpos(const char *str,char *fnd);
-/** Get position of symbol or return -1 if not found */
-int mgl_chrpos(const char *str,char fnd);
-/***************************************************************************/
-/** Get uncommented string from file (NOTE: it is not thread safe!!!) */
-char *mgl_fgetstr(FILE *fp);
-/** Check if symbol denote true */
-bool mgl_istrue(char ch);
-/** Print test message */
-void mgl_test(const char *str, ...);
-/** Print info message */
-void mgl_info(const char *str, ...);
-/** Locate next data block (block started by -----) */
-FILE *mgl_next_data(const char *fname,int p);
-/***************************************************************************/
-#ifdef __cplusplus
-};
-#endif
-#endif
+++ /dev/null
-/***************************************************************************\r
- * base.h is part of Math Graphic Library\r
- * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
- * *\r
- * This program is free software; you can redistribute it and/or modify *\r
- * it under the terms of the GNU Library General Public License as *\r
- * published by the Free Software Foundation; either version 3 of the *\r
- * License, or (at your option) any later version. *\r
- * *\r
- * This program is distributed in the hope that it will be useful, *\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
- * GNU General Public License for more details. *\r
- * *\r
- * You should have received a copy of the GNU Library General Public *\r
- * License along with this program; if not, write to the *\r
- * Free Software Foundation, Inc., *\r
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
- ***************************************************************************/\r
-#ifndef _MGL_BASE_H_\r
-#define _MGL_BASE_H_\r
-#include <string.h>\r
-#include <stdlib.h>\r
-#include <stdio.h>\r
-#include <math.h>\r
-#ifndef _MSC_VER\r
-#include <stdint.h>\r
-#endif\r
-#include "mgl/define.h"\r
-/*****************************************************************************/\r
-#ifdef __cplusplus\r
-#include <vector>\r
-#include <string>\r
-#include "mgl/type.h"\r
-#include "mgl/eval.h"\r
-#include "mgl/font.h"\r
-//-----------------------------------------------------------------------------\r
-/// Abstract class for data array\r
-class mglDataA\r
-{\r
-public:\r
- virtual mreal v(long i,long j=0,long k=0) const = 0;\r
- virtual mreal vthr(long i) const = 0;\r
- virtual long GetNx() const = 0;\r
- virtual long GetNy() const = 0;\r
- virtual long GetNz() const = 0;\r
- inline long GetNN() const { return GetNx()*GetNy()*GetNz(); }\r
- virtual float Maximal() const = 0;\r
- virtual float Minimal() const = 0;\r
- virtual mreal dvx(long i,long j=0,long k=0) const = 0;\r
-// { return i>0 ? (i<GetNx()-1 ? (v(i+1,j,k)-v(i-1,j,k))/2 : v(i,j,k)-v(i-1,j,k)) : v(1,j,k)-v(0,j,k); }\r
- virtual mreal dvy(long i,long j=0,long k=0) const = 0;\r
-// { return j>0 ? (j<GetNy()-1 ? (v(i,j+1,k)-v(i,j-1,k))/2 : v(i,j,k)-v(i,j-1,k)) : v(i,1,k)-v(i,0,k); }\r
- virtual mreal dvz(long i,long j=0,long k=0) const = 0;\r
-// { return k>0 ? (k<GetNz()-1 ? (v(i,j,k+1)-v(i,j,k-1))/2 : v(i,j,k)-v(i,j,k-1)) : v(i,j,1)-v(i,j,0); }\r
-};\r
-//-----------------------------------------------------------------------------\r
-inline float mgl_d(float v,float v1,float v2) { return v2!=v1?(v-v1)/(v2-v1):NAN; }\r
-//-----------------------------------------------------------------------------\r
-mglPoint GetX(const mglDataA *x, int i, int j, int k=0);\r
-mglPoint GetY(const mglDataA *y, int i, int j, int k=0);\r
-mglPoint GetZ(const mglDataA *z, int i, int j, int k=0);\r
-inline mglPoint GetX(const mglDataA &x, int i, int j, int k=0)\r
-{ return GetX(&x,i,j,k); }\r
-inline mglPoint GetY(const mglDataA &y, int i, int j, int k=0)\r
-{ return GetY(&y,i,j,k); }\r
-inline mglPoint GetZ(const mglDataA &z, int i, int j, int k=0)\r
-{ return GetZ(&z,i,j,k); }\r
-//-----------------------------------------------------------------------------\r
-/// Structure for simplest primitives\r
-struct mglPrim\r
-{\r
- // NOTE: n4 is used as mark; n3 -- as pen style for type=0,1,4\r
- // NOTE: n3 is used as position of txt,font in Ptxt for type=6\r
- long n1,n2,n3,n4; ///< coordinates of corners\r
- int type; ///< primitive type (0-point, 1-line, 2-trig, 3-quad, 4-glyph, 6-text)\r
- int id; ///< object id\r
- float z; ///< z-position\r
- float s; ///< size (if applicable) or fscl\r
- float w; ///< width (if applicable) or ftet\r
- float p;\r
-\r
- mglPrim(int t=0) { n1=n2=n3=n4=id=0; z=s=w=p=0; type = t; }\r
-};\r
-bool operator<(const mglPrim &a,const mglPrim &b);\r
-bool operator>(const mglPrim &a,const mglPrim &b);\r
-//-----------------------------------------------------------------------------\r
-/// Structure for group of primitives\r
-struct mglGroup\r
-{\r
- std::vector<long> p;///< list of primitives (not filled!!!)\r
- int Id; ///< Current list of primitives\r
- std::string Lbl; ///< Group label\r
- mglGroup(const char *lbl="", int id=0) { Lbl=lbl; Id=id; }\r
-};\r
-//-----------------------------------------------------------------------------\r
-/// Structure for text label\r
-struct mglText\r
-{\r
- std::wstring text;\r
- std::string stl;\r
- float val;\r
- mglText(const wchar_t *txt=0, const char *fnt=0, float v=0) { text=txt; stl=fnt; val=v; }\r
- mglText(const std::wstring &txt, float v=0) { text=txt; val=v; }\r
-};\r
-//-----------------------------------------------------------------------------\r
-/// Structure for internal point represenatation\r
-struct mglPnt\r
-{\r
- float xx,yy,zz; // original coordinates\r
- float x,y,z; // coordinates\r
- float c,t,ta; // index in color scheme\r
- float u,v,w; // normales\r
- float r,g,b,a; // RGBA color\r
- mglPnt() { xx=yy=zz=x=y=z=c=t=ta=u=v=w=r=g=b=a=0; }\r
-};\r
-inline mglPnt operator+(const mglPnt &a, const mglPnt &b)\r
-{ mglPnt c=a;\r
- c.x+=b.x; c.y+=b.y; c.z+=b.z; c.u+=b.u; c.v+=b.v; c.w+=b.w;\r
- c.r+=b.r; c.g+=b.g; c.b+=b.b; c.a+=b.a; return c; }\r
-inline mglPnt operator-(const mglPnt &a, const mglPnt &b)\r
-{ mglPnt c=a;\r
- c.x-=b.x; c.y-=b.y; c.z-=b.z; c.u-=b.u; c.v-=b.v; c.w-=b.w;\r
- c.r-=b.r; c.g-=b.g; c.b-=b.b; c.a-=b.a; return c; }\r
-inline mglPnt operator*(const mglPnt &a, float b)\r
-{ mglPnt c=a;\r
- c.x*=b; c.y*=b; c.z*=b; c.u*=b; c.v*=b; c.w*=b;\r
- c.r*=b; c.g*=b; c.b*=b; c.a*=b; return c; }\r
-inline mglPnt operator*(float b, const mglPnt &a)\r
-{ mglPnt c=a;\r
- c.x*=b; c.y*=b; c.z*=b; c.u*=b; c.v*=b; c.w*=b;\r
- c.r*=b; c.g*=b; c.b*=b; c.a*=b; return c; }\r
-//-----------------------------------------------------------------------------\r
-struct mglTexture\r
-{\r
- mglColor col[512]; ///< Colors itself\r
- long n; ///< Number of initial colors along u\r
-\r
- char Sch[260]; ///< Color scheme used\r
- int Smooth; ///< Type of texture (smoothing and so on)\r
- float Alpha; ///< Transparency\r
- \r
- mglTexture() { n=0; }\r
- mglTexture(const char *cols, int smooth=0,float alpha=1)\r
- { n=0; Set(cols,smooth,alpha); }\r
- void Clear() { n=0; }\r
- void Set(const char *cols, int smooth=0,float alpha=1);\r
- void GetC(float u,float v,mglPnt &p) const;\r
- bool IsSame(const mglTexture &t) const;\r
- void GetRGBA(unsigned char *f) const; // Write as BGRA for fastest export to TGA\r
-};\r
-//-----------------------------------------------------------------------------\r
-const mglColor NC(-1,-1,-1);\r
-const mglColor BC( 0, 0, 0);\r
-const mglColor WC( 1, 1, 1);\r
-const mglColor RC( 1, 0, 0);\r
-long mgl_have_color(const char *stl);\r
-//-----------------------------------------------------------------------------\r
-/// Structure for color ID\r
-struct mglColorID\r
-{\r
- char id;\r
- mglColor col;\r
-};\r
-extern mglColorID mglColorIds[];\r
-//-----------------------------------------------------------------------------\r
-/// Base class for canvas which handle all basic drawing\r
-class mglBase\r
-{\r
-public:\r
- mglBase();\r
- virtual ~mglBase();\r
-\r
- bool Stop; ///< Flag that execution should be terminated.\r
- mglPoint Min; ///< Lower edge of bounding box for graphics.\r
- mglPoint Max; ///< Upper edge of bounding box for graphics.\r
- std::string Mess; ///< Buffer for receiving messages\r
- int ObjId; ///< object id for mglPrim\r
- int HighId; ///< object id to be highlited\r
- std::vector<mglGroup> Grp; ///< List of groups with names -- need for export\r
- std::string PlotId; ///< Id of plot for saving filename (in GLUT window for example)\r
-\r
- float CDef; ///< Default (current) color in texture\r
- float AlphaDef; ///< Default value of alpha channel (transparency)\r
- float BarWidth; ///< Relative width of rectangles in Bars().\r
- int MeshNum; ///< Set approximate number of lines in Mesh and Grid. By default (=0) it draw all lines.\r
- char Arrow1, Arrow2;///< Style of arrows at end and at start of curve\r
- long InUse; ///< Smart pointer (number of users)\r
- long Flag; ///< Flags for controlling drawing\r
-\r
- inline bool get(long fl) const { return Flag&fl; }\r
- inline void set(long fl) { Flag |= fl; }\r
- inline void clr(long fl) { Flag &=~fl; }\r
- inline void set(bool v,long fl) { Flag = v ? Flag|fl : Flag&(~fl); }\r
-\r
- /// Set values of mglGraph::Min and mglGraph::Max\r
- inline void SetRanges(float x1, float x2, float y1, float y2, float z1=0, float z2=0, float c1=0, float c2=0)\r
- { SetRanges(mglPoint(x1,y1,z1,c1),mglPoint(x2,y2,z2,c2)); }\r
- void SetRanges(mglPoint v1, mglPoint v2);\r
- /// Set values of mglGraph::Cmin and mglGraph::Cmax as minimal and maximal values of data a\r
- void CRange(const mglDataA &a, bool add = false, float fact=0);\r
- inline void CRange(float v1,float v2) { if(v1!=v2) {Min.c=v1; Max.c=v2; RecalcCRange();} }\r
- /// Set values of mglGraph::Min.x and mglGraph::Max.x as minimal and maximal values of data a\r
- void XRange(const mglDataA &a, bool add = false, float fact=0);\r
- inline void XRange(float v1,float v2) { if(v1!=v2) {Min.x=v1; Max.x=v2; RecalcBorder();} }\r
- /// Set values of mglGraph::Min.x and mglGraph::Max.x as minimal and maximal values of data a\r
- void YRange(const mglDataA &a, bool add = false, float fact=0);\r
- inline void YRange(float v1,float v2) { if(v1!=v2) {Min.y=v1; Max.y=v2; RecalcBorder();} }\r
- /// Set values of mglGraph::Min.x and mglGraph::Max.x as minimal and maximal values of data a\r
- void ZRange(const mglDataA &a, bool add = false, float fact=0);\r
- inline void ZRange(float v1,float v2) { if(v1!=v2) {Min.z=v1; Max.z=v2; RecalcBorder();} }\r
- /// Set ranges for automatic variables\r
- void SetAutoRanges(float x1, float x2, float y1=0, float y2=0, float z1=0, float z2=0, float c1=0, float c2=0);\r
- /// Set axis origin\r
- inline void SetOrigin(float x0, float y0, float z0=NAN, float c0=NAN)\r
- { Org=mglPoint(x0,y0,z0,c0); }\r
- /// Save ranges into internal variable and put parsed\r
- float SaveState(const char *opt);\r
- /// Load ranges from internal variable\r
- void LoadState();\r
-\r
- /// Safetly set the transformation formulas for coordinate.\r
- void SetFunc(const char *EqX, const char *EqY, const char *EqZ=0, const char *EqA=0);\r
- /// Set one of predefined transformation rule\r
- void SetCoor(int how);\r
- /// Safetly set the cutting off condition (formula).\r
- void CutOff(const char *EqCut);\r
- /// Set to draw Ternary axis (triangle like axis, grid and so on)\r
- void Ternary(int tern);\r
-\r
- /// Set cutting for points outside of bounding box\r
- inline void SetCut(bool val) { set(val, MGL_ENABLE_CUT); }\r
- /// Set additional cutting box\r
- inline void SetCutBox(float x1, float y1, float z1, float x2, float y2, float z2)\r
- { CutMin=mglPoint(x1,y1,z1); CutMax=mglPoint(x2,y2,z2); }\r
- inline void SetCutBox(mglPoint v1, mglPoint v2) { CutMin=v1; CutMax=v2; }\r
-\r
- /// Set the using of light on/off.\r
- virtual bool Light(bool enable)\r
- { bool t=get(MGL_ENABLE_LIGHT); set(enable,MGL_ENABLE_LIGHT); return t; }\r
- /// Set ambient light brightness\r
- virtual void SetAmbient(float bright=0.5);\r
- /// Use diffusive light (only for local light sources)\r
- inline void SetDifLight(bool dif) { set(dif,MGL_DIFFUSIVE); }\r
- /// Set the transparency on/off.\r
- virtual bool Alpha(bool enable)\r
- { bool t=get(MGL_ENABLE_ALPHA); set(enable,MGL_ENABLE_ALPHA); return t; }\r
- /// Set default value of alpha-channel\r
- inline void SetAlphaDef(float val) { AlphaDef=val; };\r
- /// Set default palette\r
- inline void SetPalette(const char *colors)\r
- { Txt[0].Set(mgl_have_color(colors)?colors:MGL_DEF_PAL,-1); }\r
- inline long GetNumPal(long id) const { return Txt[abs(id)/256].n; }\r
- /// Set default color scheme\r
- inline void SetDefScheme(const char *colors)\r
- { Txt[1].Set(mgl_have_color(colors)?colors:"BbcyrR"); }\r
-\r
- /// Set number of mesh lines\r
- inline void SetMeshNum(int val) { MeshNum=val; };\r
- /// Set relative width of rectangles in Bars, Barh, BoxPlot\r
- inline void SetBarWidth(float val) { BarWidth=val; };\r
- /// Set size of marks\r
- inline void SetMarkSize(float val) { MarkSize=0.02*val; }\r
- /// Set size of arrows\r
- inline void SetArrowSize(float val) { ArrowSize=0.03*val; }\r
-\r
- /// Set warning code ant fill Message\r
- void SetWarn(int code, const char *who="");\r
- int inline GetWarn() const { return WarnCode; }\r
-\r
- virtual void StartAutoGroup (const char *)=0;\r
- void StartGroup(const char *name, int id);\r
- virtual void EndGroup()=0; // { LoadState(); }\r
- /// Highlight group\r
- inline void Highlight(int id) { HighId=id; }\r
-\r
- /// Set FontSize by size in pt and picture DPI (default is 16 pt for dpi=72)\r
- virtual void SetFontSizePT(float pt, int dpi=72){ FontSize = pt*27.f/dpi; }\r
- /// Set FontSize by size in centimeters and picture DPI (default is 0.56 cm = 16 pt)\r
- inline void SetFontSizeCM(float cm, int dpi=72) { SetFontSizePT(cm*28.45f,dpi); };\r
- /// Set FontSize by size in inch and picture DPI (default is 0.22 in = 16 pt)\r
- inline void SetFontSizeIN(float in, int dpi=72) { SetFontSizePT(in*72.27f,dpi); };\r
- /// Set font typeface. Note that each mglFont instance can be used with ONLY ONE mglGraph instance at a moment of time!\r
- void SetFont(mglFont *f);\r
- /// Get current typeface. Note that this variable can be deleted at next SetFont() call!\r
- inline mglFont *GetFont() { return fnt; }\r
- /// Restore font\r
- inline void RestoreFont() { fnt->Restore(); }\r
- /// Load font from file\r
- inline void LoadFont (const char *name, const char *path=NULL)\r
- { fnt->Load(name,path); };\r
- /// Copy font from another mglGraph instance\r
- inline void CopyFont(mglBase *gr) { fnt->Copy(gr->GetFont()); }\r
- /// Set default font size\r
- inline void SetFontSize(float val) { FontSize=val>0 ? val:FontSize*val; }\r
- inline float GetFontSize() const { return FontSize; };\r
- inline float TextWidth(const wchar_t *text, const char *font, float size) const\r
- { return (size<0?-size*FontSize:size)*font_factor*fnt->Width(text,(font&&*font)?font:FontDef)/8; }\r
- inline float TextHeight(const char *font, float size) const\r
- { return (size<0?-size*FontSize:size)*font_factor*fnt->Height(font?font:FontDef)/8; }\r
- inline float FontFactor() const { return font_factor; }\r
- virtual float GetRatio() const;\r
- /// Set to use or not text rotation\r
- inline void SetRotatedText(bool val) { set(val,MGL_ENABLE_RTEXT); }\r
- /// Set default font style and color\r
- inline void SetFontDef(const char *font) { strncpy(FontDef, font, 31); }\r
- /// Set to use or not text rotation\r
- inline void SetTickRotate(bool val) { set(val,MGL_TICKS_ROTATE); }\r
- /// Set to use or not text rotation\r
- inline void SetTickSkip(bool val) { set(val,MGL_TICKS_SKIP); }\r
-\r
- /// Add string to legend\r
- void AddLegend(const char *text,const char *style);\r
- void AddLegend(const wchar_t *text,const char *style);\r
- /// Clear saved legend string\r
- inline void ClearLegend() { Leg.clear(); }\r
-\r
- /// Set plot quality\r
- virtual void SetQuality(int qual=MGL_DRAW_NORM) { Quality=qual; }\r
- inline int GetQuality() const { return Quality; }\r
-\r
- // ~~~~~~~~~~~~~~~~~~~~~~ Developer functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r
- /// Add point to the pntN and return its position\r
- long AddPnt(mglPoint p, float c=-1, mglPoint n=mglPoint(NAN), float a=-1, int scl=1);\r
- long CopyNtoC(long k, float c);\r
- long CopyProj(long from, mglPoint p, mglPoint n);\r
- virtual void Reserve(long n); ///< Allocate n-cells for pntC and return current position\r
- /// Set to reduce accuracy of points (to reduc size of output files)\r
- inline void SetReduceAcc(bool val) { set(val, MGL_REDUCEACC); }\r
-\r
-// inline long GetPos() { return Pnt.size()-1; }\r
- inline mglPoint GetPntP(long i) const\r
- { const mglPnt &p=Pnt[i]; return mglPoint(p.x,p.y,p.z); }\r
- inline float GetClrC(long i) const { return Pnt[i].c; }\r
- inline const mglPnt &GetPnt(long i) const { return Pnt[i]; }\r
- inline long GetPntNum() const { return Pnt.size(); }\r
- inline mglPrim &GetPrm(long i) { return Prm[i]; }\r
- inline long GetPrmNum() const { return Prm.size(); }\r
- inline const mglText &GetPtx(long i) const { return Ptx[i]; }\r
- inline long GetPtxNum() const { return Ptx.size(); }\r
- inline const mglTexture &GetTxt(long i) const { return Txt[i]; }\r
- inline long GetTxtNum() const { return Txt.size(); }\r
- /// Scale coordinates and cut off some points\r
- virtual bool ScalePoint(mglPoint &p, mglPoint &n, bool use_nan=true) const;\r
-\r
- virtual float GetOrgX(char dir) const=0; ///< Get Org.x (parse NAN value)\r
- virtual float GetOrgY(char dir) const=0; ///< Get Org.y (parse NAN value)\r
- virtual float GetOrgZ(char dir) const=0; ///< Get Org.z (parse NAN value)\r
-\r
- /// Get color depending on single variable z, which should be scaled if scale=true\r
- inline float GetC(long s,float z,bool scale = true) const\r
- { return s+(scale?GetA(z):(z>0?z/MGL_FLT_EPS:0)); }\r
- /// Get alpha value depending on single variable \a a\r
- float GetA(float a) const;\r
- /// Set pen/palette\r
- char SetPenPal(const char *stl, long *id=0);\r
- /// Add texture (like color scheme) and return the position of first color\r
- long AddTexture(const char *cols, int smooth=0);\r
-// inline float AddTexture(char col) { return AddTexture(mglColor(col)); };\r
- float AddTexture(mglColor col);\r
- inline void DefColor(mglColor col) { CDef = AddTexture(col); }\r
- /// Set next color from palette\r
- float NextColor(long &id);\r
-\r
- virtual void mark_plot(long p, char type, float size=1)=0;\r
- virtual void arrow_plot(long p1, long p2, char st)=0;\r
- virtual void line_plot(long p1, long p2)=0;\r
- virtual void trig_plot(long p1, long p2, long p3)=0;\r
- virtual void quad_plot(long p1, long p2, long p3, long p4)=0;\r
- virtual void Glyph(float x, float y, float f, int style, long icode, float col)=0;\r
- virtual float text_plot(long p,const wchar_t *text,const char *fnt,float size=-1,float sh=0,float col=-('k'),bool rot=true)=0;\r
- void vect_plot(long p1, long p2, float s=1);\r
- inline float mark_size() { return MarkSize*font_factor; }\r
-// inline char last_color() { return last_style[1]; }\r
- inline const char *last_line() { return last_style; }\r
-\r
-protected:\r
- mglPoint FMin; ///< Actual lower edge after transformation formulas.\r
- mglPoint FMax; ///< Actual upper edge after transformation formulas.\r
- mglPoint Org; ///< Center of axis cross section.\r
- int WarnCode; ///< Warning code\r
- std::vector<mglPnt> Pnt; ///< Internal points\r
- std::vector<mglPrim> Prm; ///< Primitives (lines, triangles and so on) -- need for export\r
- std::vector<mglPrim> Sub; ///< InPlot regions {n1=x1,n2=x2,n3=y1,n4=y2,id}\r
- std::vector<mglText> Ptx; ///< Text labels for mglPrim\r
- std::vector<mglText> Leg; ///< Text labels for legend\r
- std::vector<mglTexture> Txt;///< Pointer to textures\r
-#if MGL_HAVE_PTHREAD\r
- pthread_mutex_t mutexPnt, mutexTxt, mutexLeg;\r
-#endif\r
-\r
- int TernAxis; ///< Flag that Ternary axis is used\r
- unsigned PDef; ///< Pen bit mask\r
- float pPos; ///< Current position in pen mask\r
- float PenWidth; ///< Pen width for further line plotting (must be >0 !!!)\r
-// long numT; ///< Number of textures\r
- float AmbBr; ///< Default ambient light brightness\r
-\r
- mglFont *fnt; ///< Class for printing vector text\r
- float FontSize; ///< The size of font for tick and axis labels\r
- char FontDef[32]; ///< Font specification (see mglGraph::Puts). Default is Roman with align at center.\r
- int Quality; ///< Quality of plot (0x0-pure, 0x1-fast; 0x2-fine; 0x4 - low memory)\r
-\r
- mglFormula *fx; ///< Transformation formula for x direction.\r
- mglFormula *fy; ///< Transformation formula for y direction.\r
- mglFormula *fz; ///< Transformation formula for z direction.\r
- mglFormula *fa; ///< Transformation formula for coloring.\r
- mglFormula *fc; ///< Cutting off condition (formula).\r
-\r
- long CurrPal; ///< Current palette index\r
- float MarkSize; ///< The size of marks for 1D plots.\r
- float ArrowSize; ///< The size of arrows.\r
- char last_style[64];///< Last pen style\r
- float font_factor; ///< Font scaling factor\r
-\r
- virtual void LightScale()=0; ///< Scale positions of light sources\r
-\r
-private:\r
- mglPoint MinS; ///< Saved lower edge of bounding box for graphics.\r
- mglPoint MaxS; ///< Saved upper edge of bounding box for graphics.\r
- float MSS, ASS, FSS, ADS, MNS, LSS; ///< Saved state\r
- long CSS; ///< Saved flags\r
- bool saved; ///< State is saved\r
- std::string leg_str;///< text to be save in legend\r
-\r
- mglPoint CutMin; ///< Lower edge of bounding box for cut off.\r
- mglPoint CutMax; ///< Upper edge of bounding box for cut off.\r
-\r
- void RecalcCRange(); ///< Recalculate internal parameter for correct coloring.\r
- void RecalcBorder(); ///< Recalculate internal parameter for correct transformation rules.\r
- void SetFBord(float x,float y,float z); ///< Set internal boundng box depending on transformation formula\r
- void ClearEq(); ///< Clear the used variables for axis transformation\r
-};\r
-//-----------------------------------------------------------------------------\r
-#define _Da_(d) (*((const mglDataA *)(d)))\r
-#define _DA_(a) ((const mglDataA *)*(a))\r
-#define _GR_ ((mglBase *)(*gr))\r
-//-----------------------------------------------------------------------------\r
-//#define _D_(d) *((mglData *)*(d))\r
-#define _DM_(a) ((mglData *)*(a))\r
-#define _DT_ ((mglData *)*d)\r
-//-----------------------------------------------------------------------------\r
-class mglData;\r
-class mglParser;\r
-class mglFormula;\r
-typedef mglBase* HMGL;\r
-typedef mglData* HMDT;\r
-typedef mglParser* HMPR;\r
-typedef mglFormula* HMEX;\r
-typedef const mglDataA* HCDT;\r
-#else\r
-typedef void *HMGL;\r
-typedef void *HMDT;\r
-typedef void *HMEX;\r
-typedef void *HMPR;\r
-typedef const void *HCDT;\r
-#endif\r
-/*****************************************************************************/\r
-#endif\r
+++ /dev/null
-/***************************************************************************\r
- * base_cf.h is part of Math Graphic Library\r
- * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
- * *\r
- * This program is free software; you can redistribute it and/or modify *\r
- * it under the terms of the GNU Library General Public License as *\r
- * published by the Free Software Foundation; either version 3 of the *\r
- * License, or (at your option) any later version. *\r
- * *\r
- * This program is distributed in the hope that it will be useful, *\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
- * GNU General Public License for more details. *\r
- * *\r
- * You should have received a copy of the GNU Library General Public *\r
- * License along with this program; if not, write to the *\r
- * Free Software Foundation, Inc., *\r
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
- ***************************************************************************/\r
-#ifndef _MGL_BASE_CF_H_\r
-#define _MGL_BASE_CF_H_\r
-#include "mgl/base.h"\r
-/*****************************************************************************/\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-/*****************************************************************************/\r
-int mgl_get_warn(HMGL gr);\r
-void mgl_set_warn(HMGL gr, int code, const char *text);\r
-const char *mgl_get_mess(HMGL gr);\r
-long mgl_use_graph(HMGL gr, int inc);\r
-void mgl_start_group(HMGL gr, const char *);\r
-void mgl_end_group(HMGL gr);\r
-void mgl_highlight(HMGL gr, int id);\r
-\r
-void mgl_set_palette(HMGL gr, const char *colors);\r
-void mgl_set_alpha_default(HMGL graph, float alpha);\r
-void mgl_set_bar_width(HMGL graph, float width);\r
-void mgl_set_meshnum(HMGL graph, int num);\r
-void mgl_set_ambbr(HMGL gr, float i);\r
-void mgl_set_light_dif(HMGL gr, int enable);\r
-\r
-void mgl_set_rdc_acc(HMGL graph, int reduce);\r
-void mgl_set_cut(HMGL graph, int cut);\r
-void mgl_set_cut_box(HMGL gr, float x1,float y1,float z1,float x2,float y2,float z2);\r
-void mgl_set_ranges(HMGL graph, float x1, float x2, float y1, float y2, float z1, float z2);\r
-void mgl_set_range_val(HMGL gr, char dir, float v1,float v2);\r
-void mgl_set_range_dat(HMGL gr, char dir, HCDT a, int add);\r
-\r
-void mgl_set_origin(HMGL graph, float x0, float y0, float z0);\r
-void mgl_set_func(HMGL graph, const char *EqX,const char *EqY,const char *EqZ,const char *EqA);\r
-void mgl_set_coor(HMGL gr, int how);\r
-void mgl_set_ternary(HMGL gr, int enable);\r
-void mgl_set_cutoff(HMGL graph, const char *EqC);\r
-\r
-void mgl_set_tick_rotate(HMGL graph, int enable);\r
-void mgl_set_tick_skip(HMGL graph, int enable);\r
-\r
-float mgl_data_get_value(HCDT d, long i, long j, long k);\r
-long mgl_data_get_nx(HCDT d);\r
-long mgl_data_get_ny(HCDT d);\r
-long mgl_data_get_nz(HCDT d);\r
-\r
-void mgl_set_mark_size(HMGL graph, float size);\r
-void mgl_set_arrow_size(HMGL graph, float size);\r
-void mgl_set_font_size(HMGL graph, float size);\r
-void mgl_set_font_def(HMGL graph, const char *fnt);\r
-void mgl_set_rotated_text(HMGL graph, int enable);\r
-void mgl_load_font(HMGL gr, const char *name, const char *path);\r
-void mgl_copy_font(HMGL gr, HMGL gr_from);\r
-void mgl_restore_font(HMGL gr);\r
-/*****************************************************************************/\r
-int mgl_get_warn_(uintptr_t *gr);\r
-void mgl_set_warn_(uintptr_t *gr, int *code, const char *text,int);\r
-long mgl_use_graph_(uintptr_t *gr, int *inc);\r
-void mgl_start_group_(uintptr_t *gr, const char *,int);\r
-void mgl_end_group_(uintptr_t *gr);\r
-void mgl_highlight_(uintptr_t *gr, int *id);\r
-\r
-void mgl_set_palette_(uintptr_t *gr, const char *colors, int);\r
-void mgl_set_pal_color_(uintptr_t *graph, int *n, float *r, float *g, float *b);\r
-void mgl_set_pal_num_(uintptr_t *graph, int *num);\r
-void mgl_set_alpha_default_(uintptr_t *graph, float *alpha);\r
-void mgl_set_bar_width_(uintptr_t *graph, float *width);\r
-void mgl_set_meshnum_(uintptr_t *graph, int *num);\r
-void mgl_set_ambbr_(uintptr_t *gr, float *i);\r
-void mgl_set_light_dif_(uintptr_t *graph, int *enable);\r
-\r
-void mgl_set_rdc_acc_(uintptr_t *graph, int *reduce);\r
-void mgl_set_cut_(uintptr_t *graph, int *cut);\r
-void mgl_set_cut_box_(uintptr_t *gr, float *x1,float *y1,float *z1,float *x2,float *y2,float *z2);\r
-void mgl_set_ranges_(uintptr_t *graph, float *x1, float *x2, float *y1, float *y2, float *z1, float *z2);\r
-void mgl_set_range_val_(uintptr_t *gr, const char *dir, float *v1,float *v2,int);\r
-void mgl_set_range_dat_(uintptr_t *gr, const char *dir, uintptr_t *a, int *add,int);\r
-\r
-void mgl_set_origin_(uintptr_t *gr, float *x0, float *y0, float *z0);\r
-void mgl_set_func_(uintptr_t *graph, const char *EqX, const char *EqY, const char *EqZ, const char *EqA, int, int, int, int);\r
-void mgl_set_coor_(uintptr_t *gr, int *how);\r
-void mgl_set_ternary_(uintptr_t *graph, int *enable);\r
-void mgl_set_cutoff_(uintptr_t *graph, const char *EqC, int);\r
-\r
-void mgl_set_tick_rotate_(uintptr_t *graph, int *enable);\r
-void mgl_set_tick_skip_(uintptr_t *graph, int *enable);\r
-\r
-float mgl_data_get_value_(uintptr_t *d, int *i, int *j, int *k);\r
-long mgl_data_get_nx_(uintptr_t *d);\r
-long mgl_data_get_ny_(uintptr_t *d);\r
-long mgl_data_get_nz_(uintptr_t *d);\r
-\r
-void mgl_set_mark_size_(uintptr_t *graph, float *size);\r
-void mgl_set_arrow_size_(uintptr_t *graph, float *size);\r
-void mgl_set_font_size_(uintptr_t *graph, float *size);\r
-void mgl_set_font_def_(uintptr_t *graph, const char *fnt, int);\r
-void mgl_set_rotated_text_(uintptr_t *graph, int *enable);\r
-void mgl_load_font_(uintptr_t *gr, char *name, char *path, int l, int n);\r
-void mgl_copy_font_(uintptr_t *gr, uintptr_t *gr_from);\r
-void mgl_restore_font_(uintptr_t *gr);\r
-/*****************************************************************************/\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-/*****************************************************************************/\r
-#endif\r
+++ /dev/null
-/***************************************************************************\r
- * canvas.h is part of Math Graphic Library\r
- * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
- * *\r
- * This program is free software; you can redistribute it and/or modify *\r
- * it under the terms of the GNU Library General Public License as *\r
- * published by the Free Software Foundation; either version 3 of the *\r
- * License, or (at your option) any later version. *\r
- * *\r
- * This program is distributed in the hope that it will be useful, *\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
- * GNU General Public License for more details. *\r
- * *\r
- * You should have received a copy of the GNU Library General Public *\r
- * License along with this program; if not, write to the *\r
- * Free Software Foundation, Inc., *\r
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
- ***************************************************************************/\r
-#ifndef MGL_CANVAS_H\r
-#define MGL_CANVAS_H\r
-#include "mgl/base.h"\r
-//-----------------------------------------------------------------------------\r
-#ifndef MGL_STACK_ENTRY\r
-#define MGL_STACK_ENTRY 10\r
-#endif\r
-//-----------------------------------------------------------------------------\r
-#if MGL_HAVE_GIF\r
-#include <gif_lib.h>\r
-#else\r
-struct GifFileType;\r
-#endif\r
-//-----------------------------------------------------------------------------\r
-/// Structure for transformation matrix\r
-struct mglMatrix\r
-{\r
- float b[9];\r
- float x,y,z,pf;\r
- mglMatrix() { clear(); }\r
- inline void clear() { x=y=z=0; memset(b,0,9*sizeof(float)); b[0]=b[4]=b[8]=1; }\r
- inline mglMatrix &operator=(mglMatrix &a)\r
- { x=a.x; y=a.y; z=a.z; pf=a.pf; memcpy(b,a.b,9*sizeof(float)); return *this; }\r
-};\r
-//-----------------------------------------------------------------------------\r
-/// Structure for drawing axis and ticks\r
-struct mglAxis\r
-{\r
- mglAxis() { dv=ds=d=v0=v1=v2=o=0; ns=f=ch=*t=0; }\r
- mglAxis(const mglAxis &aa)\r
- { dv=aa.dv; ds=aa.ds; d=aa.d; dir=aa.dir;\r
- v0=aa.v0; v1=aa.v1; v2=aa.v2; o=aa.o;\r
- a = aa.a; b = aa.b; org=aa.org; txt=aa.txt;\r
- ns=aa.ns; f=aa.f; ch=aa.ch; wcscpy(t,aa.t); }\r
- inline void AddLabel(const wchar_t *lbl, float v)\r
- { txt.push_back(mglText(lbl,"",v)); }\r
- inline void AddLabel(const std::wstring &lbl, float v)\r
- { txt.push_back(mglText(lbl,v)); }\r
-\r
- float dv,ds; ///< Actual step for ticks and subticks.\r
- float d; ///< Step for axis ticks (if positive) or its number (if negative).\r
- int ns; ///< Number of axis subticks.\r
- wchar_t t[256]; ///< Tick template (set NULL to use default one ("%.2g" in simplest case))\r
- mglPoint dir; ///< Axis direction\r
- mglPoint a,b; ///< Directions of over axis\r
- mglPoint org;\r
- float v0; ///< Center of axis cross section\r
- float v1; ///< Minimal axis range.\r
- float v2; ///< Maximal axis range.\r
- float o; ///< Point of starting ticks numbering (if NAN then Org is used).\r
- int f; ///< Flag 0x1 - time, 0x2 - manual, 0x4 - fixed dv\r
- std::vector<mglText> txt; ///< Axis labels\r
- char ch; ///< Character of axis (like 'x','y','z','c')\r
-};\r
-//-----------------------------------------------------------------------------\r
-/// Structure for light source\r
-struct mglLight\r
-{\r
- mglLight() { n=false; a=b=0; }\r
- bool n; ///< Availability of light sources\r
- mglPoint d; ///< Direction of light sources\r
- mglPoint r; ///< Position of light sources (NAN for infinity)\r
- mglPoint q; ///< Actual position of light sources (filled by LightScale() function)\r
- mglPoint p; ///< Actual direction of light sources (filled by LightScale() function)\r
- float a; ///< Aperture of light sources\r
- float b; ///< Brightness of light sources\r
- mglColor c; ///< Color of light sources\r
-};\r
-//-----------------------------------------------------------------------------\r
-class mglCanvas;\r
-/// Structure for light source\r
-struct mglDrawReg\r
-{\r
- int x1,x2,y1,y2;\r
- void set(mglCanvas *gr, int nx, int ny, int m);\r
-};\r
-//-----------------------------------------------------------------------------\r
-/// Structure contains everything for drawing\r
-struct mglDrawDat\r
-{\r
- std::vector<mglGroup> Grp; ///< List of groups with names -- need for export\r
- std::vector<mglPnt> Pnt; ///< Internal points\r
- std::vector<mglPrim> Prm; ///< Primitives (lines, triangles and so on) -- need for export\r
- std::vector<mglPrim> Sub; ///< InPlot regions {n1=x1,n2=x2,n3=y1,n4=y2,id}\r
- std::vector<mglText> Ptx; ///< Text labels for mglPrim\r
- std::vector<mglText> Leg; ///< Text labels for legend\r
- std::vector<mglTexture> Txt;///< Pointer to textures\r
-};\r
-//-----------------------------------------------------------------------------\r
-/// Class contains all functionality for creating different mathematical plots\r
-class mglCanvas : public mglBase\r
-{\r
-friend struct mglPrim;\r
-public:\r
-using mglBase::Light;\r
-\r
- mglCanvas(int w=800, int h=600);\r
- virtual ~mglCanvas();\r
-\r
- /// Set default parameter for plotting\r
- void DefaultPlotParam();\r
-\r
- /// Set angle of view indepently from mglCanvas::Rotate()\r
- virtual void View(float tetx,float tetz,float tety=0);\r
- /// Zoom in or zoom out (if Zoom(0, 0, 1, 1)) a part of picture\r
- virtual void Zoom(float x1, float y1, float x2, float y2);\r
- /// Restore image after View() and Zoom()\r
- virtual void Restore() { Bp.clear(); Bp.pf=0; }\r
-\r
- /// Clear transformation matrix.\r
- inline void Identity(bool rel=false) { InPlot(0,1,0,1,rel); }\r
- /// Push transformation matrix into stack\r
- inline void Push() { stack.push_back(B); }\r
- /// Set PlotFactor\r
- inline void SetPlotFactor(float val)\r
- { if(val<=0) {B.pf=1.55; set(MGL_AUTO_FACTOR);} else {B.pf=val; clr(MGL_AUTO_FACTOR);} }\r
- /// Get PlotFactor\r
- inline float GetPlotFactor() { return B.pf; }\r
- /// Pop transformation matrix from stack\r
- inline void Pop() { B = stack.back(); stack.pop_back(); }\r
- /// Clear up the frame\r
- virtual void Clf(mglColor back=WC);\r
-\r
- /// Put further plotting in cell of stick rotated on angles tet, phi\r
- void StickPlot(int num, int i, float tet, float phi);\r
- /// Put further plotting in some region of whole frame surface.\r
- void InPlot(float x1,float x2,float y1,float y2,bool rel=true);\r
- void InPlot(float x1,float x2,float y1,float y2, const char *style);\r
- /// Add title for current subplot/inplot\r
- void Title(const char *title,const char *stl="#",float size=-2);\r
- void Title(const wchar_t *title,const char *stl="#",float size=-2);\r
- /// Set aspect ratio for further plotting.\r
- void Aspect(float Ax,float Ay,float Az);\r
- /// Rotate a further plotting.\r
- void Rotate(float TetX,float TetZ,float TetY=0);\r
- /// Rotate a further plotting around vector {x,y,z}.\r
- void RotateN(float Tet,float x,float y,float z);\r
- /// Set perspective (in range [0,1)) for plot. Set to zero for switching off.\r
- void Perspective(float a) { Bp.pf = fabs(a); }\r
-\r
- /// Set size of frame in pixels. Normally this function is called internaly.\r
- virtual void SetSize(int w,int h);\r
- /// Get ratio (float width)/(float height).\r
- float GetRatio() const;\r
- /// Get bitmap data prepared for saving to file\r
- virtual unsigned char **GetRGBLines(long &w, long &h, unsigned char *&f, bool alpha=false);\r
- /// Get RGB bitmap of current state image.\r
- virtual const unsigned char *GetBits();\r
- /// Get RGBA bitmap of current state image.\r
- const unsigned char *GetRGBA() { Finish(); return G4; }\r
- /// Get width of the image\r
- int GetWidth() const { return Width; }\r
- /// Get height of the image\r
- int GetHeight() const { return Height; }\r
- /// Combine plots from 2 canvases. Result will be saved into this.\r
- void Combine(const mglCanvas *gr);\r
- /// Send graphical information to node id using MPI\r
- void MPI_Send(int id);\r
- /// Receive graphical information from node id using MPI\r
- void MPI_Recv(int id);\r
- inline float GetDelay() const { return Delay; }\r
- inline void SetDelay(float d) { Delay=d; }\r
-\r
- /// Calculate 3D coordinate {x,y,z} for screen point {xs,ys}\r
- mglPoint CalcXYZ(int xs, int ys) const;\r
- /// Calculate screen point {xs,ys} for 3D coordinate {x,y,z}\r
- void CalcScr(mglPoint p, int *xs, int *ys) const;\r
- mglPoint CalcScr(mglPoint p) const;\r
- /// Set object/subplot id\r
- inline void SetObjId(long id) { ObjId = id; }\r
- /// Get object id\r
- inline int GetObjId(long x,long y) const { return OI[x+Width*y]; }\r
- /// Get subplot id\r
- int GetSplId(long x,long y) const;\r
-\r
- /// Create new frame.\r
- virtual int NewFrame();\r
- /// Finish frame drawing\r
- virtual void EndFrame();\r
- /// Get the number of created frames\r
- inline int GetNumFrame() const { return CurFrameId; }\r
- /// Reset frames counter (start it from zero)\r
- inline void ResetFrames() { CurFrameId=0; DrwDat.clear(); }\r
-\r
- /// Start write frames to cinema using GIF format\r
- void StartGIF(const char *fname, int ms=100);\r
- /// Stop writing cinema using GIF format\r
- void CloseGIF();\r
- /// Finish plotting. Normally this function is called internaly.\r
- virtual void Finish(bool fast=true);\r
- /// Export points and primitives in file using MGLD format\r
- bool ExportMGLD(const char *fname, const char *descr=0);\r
- /// Import points and primitives from file using MGLD format\r
- bool ImportMGLD(const char *fname, bool add=false);\r
-\r
- /// Set the transparency type\r
- inline void SetTranspType(int val)\r
- { Flag=(Flag&(~3)) + (val&3); SetAxisStl(val==2?"w-":"k-"); }\r
- /// Set the fog distance or switch it off (if d=0).\r
- virtual void Fog(float d, float dz=0.25);\r
- /// Switch on/off the specified light source.\r
- virtual void Light(int n, bool enable);\r
- /// Add a light source.\r
- virtual void AddLight(int n,mglPoint r, mglPoint d, char c='w', float bright=0.5, float ap=0);\r
- inline void AddLight(int n,mglPoint d, char c='w', float bright=0.5, float ap=0)\r
- { AddLight(n,mglPoint(NAN),d,c,bright,ap); }\r
-\r
- /// Set ticks position and text (\n separated). Use n=0 to disable this feature.\r
- void SetTicksVal(char dir, const char *lbl, bool add=false);\r
- void SetTicksVal(char dir, HCDT v, const char *lbl, bool add=false);\r
- void SetTicksVal(char dir, HCDT v, const char **lbl, bool add=false);\r
- void SetTicksVal(char dir, const wchar_t *lbl, bool add=false);\r
- void SetTicksVal(char dir, HCDT v, const wchar_t *lbl, bool add=false);\r
- void SetTicksVal(char dir, HCDT v, const wchar_t **lbl, bool add=false);\r
- /// Set templates for ticks\r
- void SetTickTempl(char dir, const wchar_t *t);\r
- void SetTickTempl(char dir, const char *t);\r
- /// Set time templates for ticks\r
- void SetTickTime(char dir, float d=0, const char *t="");\r
- /// Set the ticks parameters\r
- void SetTicks(char dir, float d=0, int ns=0, float org=NAN);\r
- /// Auto adjust ticks\r
- void AdjustTicks(const char *dir="xyzc", bool force=false);\r
- /// Tune ticks\r
- inline void SetTuneTicks(int tune, float pos=1.15)\r
- { TuneTicks = tune; FactorPos = pos; };\r
- /// Set ticks styles\r
- void SetAxisStl(const char *stl="k", const char *tck=0, const char *sub=0);\r
- /// Set ticks length\r
- void SetTickLen(float tlen, float stt=1.);\r
-\r
- /// Draws bounding box outside the plotting volume with color \a c.\r
- void Box(const char *col=0, bool ticks=true);\r
- /// Draw axises with ticks in directions determined by string parameter \a dir.\r
- void Axis(const char *dir="xyzt", const char *stl="");\r
- /// Draw grid lines perpendicular to direction determined by string parameter \a dir.\r
- void Grid(const char *dir="xyzt",const char *pen="B-");\r
- /// Print the label \a text for axis \a dir.\r
- void Label(char dir, const char *text, float pos=0, float shift=0);\r
- void Labelw(char dir, const wchar_t *text, float pos=0, float shift=0);\r
-\r
- /// Print the \a text at arbitrary position of the picture \a x, \a y in range [0,1]x[0,1].\r
- void Label(float x, float y, const char *text, const char *fnt=0, bool rel=false);\r
- void Labelw(float x, float y, const wchar_t *text, const char *fnt=0, bool rel=false);\r
-// /// Print the title text for the picture\r
-// void Title(const wchar_t *text,const char *font=0);\r
-// void Title(const char *text,const char *font=0);\r
-\r
- /// Draw colorbar at edge of axis\r
- void Colorbar(const char *sch=0);\r
- void Colorbar(const char *sch, float x, float y, float w, float h);\r
- /// Draw colorbar at edge of axis for manual colors\r
- void Colorbar(HCDT v, const char *sch=0);\r
- void Colorbar(HCDT v, const char *sch, float x, float y, float w, float h);\r
-\r
- /// Draw legend of accumulated strings at position (x, y) by \a font with \a size\r
- inline void Legend(float x, float y, const char *font="#", float size=-0.8, float llen=0.1)\r
- { Legend(Leg,x,y,font,size,llen); }\r
- /// Draw legend of accumulated strings by \a font with \a size\r
- inline void Legend(int where=0x3, const char *font="#", float size=-0.8, float llen=0.1)\r
- { Legend(Leg,(where&1)?1:0,(where&2)?1:0,font,size,llen); }\r
- /// Draw legend of accumulated strings by \a font with \a size\r
- inline void Legend(const std::vector<mglText> &leg, int where=3, const char *font="#", float size=-0.8, float llen=0)\r
- { Legend(leg,(where&1)?1:0,(where&2)?1:0,font,size,llen); }\r
- /// Draw legend strings \a text at position (x, y) by \a font with \a size\r
- void Legend(const std::vector<mglText> &leg, float x, float y, const char *font="#", float size=-0.8, float llen=0);\r
- /// Number of marks in legend sample\r
- inline void SetLegendMarks(int num=1) { LegendMarks = num>0?num:1; };\r
-\r
- void StartAutoGroup (const char *);\r
- void EndGroup();\r
- /// Retur color for primitive depending lighting\r
- mglColor GetColor(const mglPrim &p);\r
-\r
-protected:\r
- float Delay; ///< Delay for animation in seconds\r
- float *Z; ///< Height for given level in Z-direction\r
- unsigned char *C; ///< Picture for given level in Z-direction\r
- int *OI; ///< ObjId arrays\r
- unsigned char *G4; ///< Final picture in RGBA format. Prepared in Finish().\r
- unsigned char *G; ///< Final picture in RGB format. Prepared in Finish().\r
- std::vector<mglDrawDat> DrwDat; ///< Set of ALL drawing data for each frames\r
-#if MGL_HAVE_PTHREAD\r
- pthread_mutex_t mutexSub, mutexPrm, mutexPtx, mutexStk, mutexGrp;\r
-#endif\r
-\r
- int LegendMarks; ///< Number of marks in the Legend\r
- unsigned char BDef[4]; ///< Background color\r
- mglAxis ax,ay,az,ac;///< Axis parameters\r
-\r
- int TuneTicks; ///< Draw tuned ticks with extracted common component\r
- float FactorPos; ///< Position of axis ticks factor (0 at Min, 1 at Max, 1.1 is default)\r
- float TickLen; ///< Length of tiks (subticks length is sqrt(1+st_t)=1.41... times smaller)\r
- char AxisStl[32]; ///< Axis line style. Default is "k"\r
- char TickStl[32]; ///< Tick line style. Default is "k"\r
- char SubTStl[32]; ///< Subtick line style. Default is "k"\r
- float st_t; ///< Subtick-to-tick ratio (ls=lt/sqrt(1+st_t)). Default is 1.\r
-\r
- int CurFrameId; ///< Number of automaticle created frames\r
- int Width; ///< Width of the image\r
- int Height; ///< Height of the image\r
- int Depth; ///< Depth of the image\r
- mglMatrix Bp; ///< Transformation matrix for View() and Zoom()\r
- mglMatrix B; ///< Transformation matrix\r
- mglMatrix B1; ///< Transformation matrix for colorbar\r
- float inW, inH; ///< Width and height of last InPlot\r
- mglLight light[10]; ///< Light sources\r
- float FogDist; ///< Inverse fog distance (fog ~ exp(-FogDist*Z))\r
- float FogDz; ///< Relative shift of fog\r
-\r
- /// Auto adjust ticks\r
- void AdjustTicks(mglAxis &aa, bool ff);\r
- /// Prepare labels for ticks\r
- void LabelTicks(mglAxis &aa);\r
- /// Draw axis\r
- void DrawAxis(mglAxis &aa, bool text=true, char arr=0,const char *stl="");\r
- /// Draw axis grid lines\r
- void DrawGrid(mglAxis &aa);\r
- /// Update axis ranges\r
- inline void UpdateAxis()\r
- { ax.v0=Org.x; ay.v0=Org.y; az.v0=Org.z; ac.v0=Org.c;\r
- ax.v1=Min.x; ay.v1=Min.y; az.v1=Min.z; ac.v1=Min.c;\r
- ax.v2=Max.x; ay.v2=Max.y; az.v2=Max.z; ac.v2=Max.c; }\r
-\r
- /// Clear ZBuffer only\r
- void ClfZB();\r
- /// Scale coordinates and cut off some points\r
- bool ScalePoint(mglPoint &p, mglPoint &n, bool use_nan=true) const;\r
- void LightScale(); ///< Additionally scale positions of light sources\r
-\r
- /// Push drawing data (for frames only). NOTE: can be VERY large\r
- long PushDrwDat();\r
- /// Get drawing data for i-th frame.\r
- void GetDrwDat(long i);\r
-\r
- float GetOrgX(char dir) const; ///< Get Org.x (parse NAN value)\r
- float GetOrgY(char dir) const; ///< Get Org.y (parse NAN value)\r
- float GetOrgZ(char dir) const; ///< Get Org.z (parse NAN value)\r
-\r
- void mark_plot(long p, char type, float size=1); // position in pntC\r
- void arrow_plot(long p1, long p2, char st); // position in pntC\r
- void line_plot(long p1, long p2); // position in pntC\r
- void trig_plot(long p1, long p2, long p3); // position in pntN\r
- void quad_plot(long p1, long p2, long p3, long p4); // position in pntN\r
- void Glyph(float x, float y, float f, int style, long icode, float col);\r
- float text_plot(long p,const wchar_t *text,const char *fnt,float size=-1,float sh=0,float col=-('k'), bool rot=true); // position in pntN\r
-\r
- void add_prim(mglPrim &a); ///< add primitive to list\r
- void mark_draw(long p, char type, float size, mglDrawReg *d);\r
- void arrow_draw(long p1, long p2, char st, float size, mglDrawReg *d);\r
- virtual void line_draw(long p1, long p2, mglDrawReg *d);\r
- virtual void trig_draw(long p1, long p2, long p3, bool anorm, mglDrawReg *d);\r
- virtual void quad_draw(long p1, long p2, long p3, long p4, mglDrawReg *d);\r
- virtual void pnt_draw(long p, mglDrawReg *d);\r
- void glyph_draw(const mglPrim *P, mglDrawReg *d);\r
- bool IsSame(const mglPrim &pr,float wp,mglColor cp,int st);\r
-\r
- // functions for multi-threading\r
- void PreparePrim(bool fast);\r
- void pxl_combine(unsigned long id, unsigned long n, const void *);\r
- void pxl_memcpy(unsigned long id, unsigned long n, const void *);\r
- void pxl_backgr(unsigned long id, unsigned long n, const void *);\r
- void pxl_primdr(unsigned long id, unsigned long n, const void *);\r
- void pxl_transform(unsigned long id, unsigned long n, const void *);\r
- void pxl_setz(unsigned long id, unsigned long n, const void *);\r
- void pxl_setz_adv(unsigned long id, unsigned long n, const void *);\r
- void pxl_other(unsigned long id, unsigned long n, const void *p);\r
- /// Put drawing from other mglCanvas (for multithreading, like subplots)\r
- void PutDrawReg(mglDrawReg *d, const mglCanvas *gr);\r
- \r
-private:\r
-// float _tetx,_tety,_tetz; // extra angles\r
- std::vector<mglMatrix> stack; ///< stack for transformation matrixes\r
- int dr_nx1, dr_nx2, dr_ny1, dr_ny2; // Allowed drawing region\r
- GifFileType *gif;\r
- float fscl,ftet; ///< last scale and rotation for glyphs\r
-\r
- /// Draw generic colorbar\r
- void colorbar(HCDT v, const float *s, int where, float x, float y, float w, float h);\r
- /// Draw labels for ticks\r
- void DrawLabels(mglAxis &aa);\r
- /// Draw tick\r
- void tick_draw(mglPoint o, mglPoint d1, mglPoint d2, int f, const char *stl);\r
- /// Plot point \a p with color \a c\r
- void pnt_plot(long x,long y,float z,const unsigned char c[4]);\r
- float FindOptOrg(char dir, int ind) const;\r
- /// Transform float color and alpha to bits format\r
- unsigned char* col2int(const mglPnt &p, unsigned char *r);\r
- /// Combine colors in 2 plane.\r
- void combine(unsigned char *c1,unsigned char *c2);\r
- /// Fast drawing of line between 2 points\r
- void fast_draw(long p1, long p2, mglDrawReg *d);\r
-\r
- /// Additionally scale points \a p for positioning in image\r
- void PostScale(mglPoint &p) const;\r
- /// Scale points \a p for projection to the face number \a nface in image\r
- long ProjScale(int nface, long p);\r
- inline void PostScale(mglPoint *p,long n) const { for(long i=0;i<n;i++) PostScale(p[i]); }\r
-\r
- // functions for glyph drawing\r
- void glyph_fill(const mglPnt &p, float f, int nt, const short *trig, mglDrawReg *d);\r
- void glyph_wire(const mglPnt &p, float f, int nl, const short *line, mglDrawReg *d);\r
- void glyph_line(const mglPnt &p, float f, bool solid, mglDrawReg *d);\r
-};\r
-//-----------------------------------------------------------------------------\r
-struct mglThreadG\r
-{\r
- mglCanvas *gr; // grapher\r
- void (mglCanvas::*f)(unsigned long i, unsigned long n, const void *);\r
- unsigned id; // thread id\r
- unsigned long n; // total number of iteration\r
- const void *p; // external parameter\r
-};\r
-/// Start several thread for the task\r
-void mglStartThread(void (mglCanvas::*func)(unsigned long i, unsigned long n), mglCanvas *gr, unsigned long n);\r
-//-----------------------------------------------------------------------------\r
-#endif\r
+++ /dev/null
-/***************************************************************************\r
- * canvas_cf.h is part of Math Graphic Library\r
- * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
- * *\r
- * This program is free software; you can redistribute it and/or modify *\r
- * it under the terms of the GNU Library General Public License as *\r
- * published by the Free Software Foundation; either version 3 of the *\r
- * License, or (at your option) any later version. *\r
- * *\r
- * This program is distributed in the hope that it will be useful, *\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
- * GNU General Public License for more details. *\r
- * *\r
- * You should have received a copy of the GNU Library General Public *\r
- * License along with this program; if not, write to the *\r
- * Free Software Foundation, Inc., *\r
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
- ***************************************************************************/\r
-#ifndef MGL_CANVAS_CF_H\r
-#define MGL_CANVAS_CF_H\r
-#include "mgl/base.h"\r
-/*****************************************************************************/\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-/*****************************************************************************/\r
-HMGL mgl_create_graph(int width, int height);\r
-void mgl_delete_graph(HMGL graph);\r
-void mgl_set_size(HMGL gr, int width, int height);\r
-void mgl_set_def_param(HMGL gr);\r
-void mgl_set_quality(HMGL gr, int qual);\r
-void mgl_combine_gr(HMGL gr, HMGL in);\r
-\r
-void mgl_set_tick_len(HMGL gr, float len, float stt);\r
-void mgl_set_axis_stl(HMGL gr, const char *stl, const char *tck, const char *sub);\r
-void mgl_adjust_ticks(HMGL gr, const char *dir);\r
-void mgl_set_ticks(HMGL gr, char dir, float d, int ns, float org);\r
-void mgl_set_ticks_str(HMGL gr, char dir, const char *lbl, int add);\r
-void mgl_set_ticks_wcs(HMGL gr, char dir, const wchar_t *lbl, int add);\r
-void mgl_set_ticks_val(HMGL gr, char dir, HCDT val, const char *lbl, int add);\r
-void mgl_set_ticks_valw(HMGL gr, char dir, HCDT val, const wchar_t *lbl, int add);\r
-void mgl_tune_ticks(HMGL gr, int tune, float fact_pos);\r
-void mgl_set_tick_templ(HMGL gr, char dir, const char *templ);\r
-void mgl_set_tick_templw(HMGL gr, char dir, const wchar_t *templ);\r
-void mgl_set_ticks_time(HMGL gr, char dir, float d, const char *t);\r
-\r
-void mgl_box(HMGL graph);\r
-void mgl_box_str(HMGL gr, const char *col, int ticks);\r
-void mgl_axis(HMGL gr, const char *dir, const char *stl);\r
-void mgl_axis_grid(HMGL gr, const char *dir,const char *pen);\r
-void mgl_label(HMGL gr, char dir, const char *text);\r
-void mgl_label_ext(HMGL gr, char dir, const char *text, float pos, float shift);\r
-void mgl_labelw_ext(HMGL gr, char dir, const wchar_t *text, float pos, float shift);\r
-\r
-void mgl_colorbar(HMGL gr, const char *sch);\r
-void mgl_colorbar_ext(HMGL gr, const char *sch, float x, float y, float w, float h);\r
-void mgl_colorbar_val(HMGL gr, HCDT dat, const char *sch);\r
-void mgl_colorbar_val_ext(HMGL gr, HCDT dat, const char *sch,float x, float y, float w, float h);\r
-\r
-void mgl_add_legend(HMGL gr, const char *text,const char *style);\r
-void mgl_add_legendw(HMGL gr, const wchar_t *text,const char *style);\r
-void mgl_clear_legend(HMGL graph);\r
-void mgl_legend_pos(HMGL gr, float x, float y, const char *font, float size, float llen);\r
-void mgl_legend(HMGL gr, int where, const char *font, float size, float llen);\r
-void mgl_set_legend_marks(HMGL gr, int num);\r
-\r
-HMEX mgl_create_expr(const char *expr);\r
-void mgl_delete_expr(HMEX ex);\r
-mreal mgl_expr_eval(HMEX ex, mreal x, mreal y,mreal z);\r
-mreal mgl_expr_eval_v(HMEX ex, mreal *var);\r
-mreal mgl_expr_diff(HMEX ex, char dir, mreal x, mreal y,mreal z);\r
-mreal mgl_expr_diff_v(HMEX ex, char dir, mreal *var);\r
-\r
-void mgl_show_image(HMGL gr, const char *viewer, int keep);\r
-void mgl_write_frame(HMGL gr, const char *fname,const char *descr);\r
-void mgl_write_tga(HMGL gr, const char *fname,const char *descr);\r
-void mgl_write_bmp(HMGL gr, const char *fname,const char *descr);\r
-void mgl_write_jpg(HMGL gr, const char *fname,const char *descr);\r
-void mgl_write_png(HMGL gr, const char *fname,const char *descr);\r
-void mgl_write_png_solid(HMGL gr, const char *fname,const char *descr);\r
-void mgl_write_bps(HMGL gr, const char *fname,const char *descr);\r
-void mgl_write_eps(HMGL gr, const char *fname,const char *descr);\r
-void mgl_write_svg(HMGL gr, const char *fname,const char *descr);\r
-void mgl_write_tex(HMGL gr, const char *fname,const char *descr);\r
-void mgl_write_obj(HMGL gr, const char *fname,const char *descr, int use_png);\r
-void mgl_write_stl(HMGL gr, const char *fname,const char *descr);\r
-void mgl_write_off(HMGL gr, const char *fname,const char *descr, int colored);\r
-void mgl_write_xyz(HMGL gr, const char *fname,const char *descr);\r
-//void mgl_write_x3d(HMGL gr, const char *fname,const char *descr);\r
-void mgl_write_wgl(HMGL gr, const char *fname,const char *descr);\r
-void mgl_write_prc(HMGL gr, const char *fname,const char *descr, int make_pdf);\r
-void mgl_write_gif(HMGL gr, const char *fname,const char *descr);\r
-void mgl_start_gif(HMGL gr, const char *fname,int ms);\r
-void mgl_close_gif(HMGL graph);\r
-void mgl_set_plotid(HMGL gr, const char *id);\r
-void mgl_export_mgld(HMGL gr, const char *fname,const char *descr);\r
-void mgl_import_mgld(HMGL gr, const char *fname, int add);\r
-\r
-const unsigned char *mgl_get_rgb(HMGL graph);\r
-const unsigned char *mgl_get_rgba(HMGL graph);\r
-void mgl_set_obj_id(HMGL gr, int id);\r
-int mgl_get_obj_id(HMGL gr, long x, long y);\r
-int mgl_get_spl_id(HMGL gr, long x, long y);\r
-int mgl_get_width(HMGL graph);\r
-int mgl_get_height(HMGL graph);\r
-void mgl_calc_xyz(HMGL gr, int xs, int ys, float *x, float *y, float *z);\r
-void mgl_calc_scr(HMGL gr, float x, float y, float z, int *xs, int *ys);\r
-\r
-int mgl_new_frame(HMGL graph);\r
-void mgl_end_frame(HMGL graph);\r
-int mgl_get_num_frame(HMGL graph);\r
-void mgl_reset_frames(HMGL graph);\r
-\r
-void mgl_set_transp_type(HMGL gr, int type);\r
-void mgl_set_alpha(HMGL gr, int enable);\r
-void mgl_set_fog(HMGL gr, float d, float dz);\r
-void mgl_set_light(HMGL gr, int enable);\r
-void mgl_set_light_n(HMGL gr, int n, int enable);\r
-\r
-void mgl_mat_pop(HMGL gr);\r
-void mgl_mat_push(HMGL gr);\r
-void mgl_clf(HMGL graph);\r
-void mgl_clf_rgb(HMGL gr, float r, float g, float b);\r
-\r
-void mgl_subplot_d(HMGL gr, int nx,int ny,int m,const char *style, float dx, float dy);\r
-void mgl_subplot(HMGL gr, int nx,int ny,int m,const char *style);\r
-void mgl_multiplot(HMGL gr, int nx,int ny,int m,int dx,int dy,const char *style);\r
-void mgl_inplot(HMGL gr, float x1,float x2,float y1,float y2);\r
-void mgl_relplot(HMGL gr, float x1,float x2,float y1,float y2);\r
-void mgl_columnplot(HMGL gr, int num, int ind, float d);\r
-void mgl_gridplot(HMGL gr, int nx, int ny, int m, float d);\r
-void mgl_stickplot(HMGL gr, int num, int ind, float tet, float phi);\r
-void mgl_title(HMGL gr, const char *title, const char *stl, float size);\r
-void mgl_titlew(HMGL gr, const wchar_t *title, const char *stl, float size);\r
-void mgl_set_plotfactor(HMGL gr, float val);\r
-\r
-void mgl_aspect(HMGL gr, float Ax,float Ay,float Az);\r
-void mgl_rotate(HMGL gr, float TetX,float TetZ,float TetY);\r
-void mgl_view(HMGL gr, float TetX,float TetZ,float TetY);\r
-void mgl_zoom(HMGL gr, float x1, float y1, float x2, float y2);\r
-void mgl_rotate_vector(HMGL gr, float Tet,float x,float y,float z);\r
-void mgl_perspective(HMGL gr, float val);\r
-\r
-void mgl_draw_thr(void *);\r
-/*****************************************************************************/\r
-uintptr_t mgl_create_graph_(int *width, int *height);\r
-void mgl_delete_graph_(uintptr_t *graph);\r
-void mgl_set_size_(uintptr_t *graph, int *width, int *height);\r
-void mgl_set_def_param_(uintptr_t *gr);\r
-void mgl_set_quality_(uintptr_t *gr, int *qual);\r
-void mgl_combine_gr_(uintptr_t *gr, uintptr_t *in);\r
-\r
-void mgl_set_tick_len_(uintptr_t *graph, float *len, float *stt);\r
-void mgl_set_axis_stl_(uintptr_t *graph, const char *stl, const char *tck, const char *sub, int,int,int);\r
-\r
-void mgl_adjust_ticks_(uintptr_t *gr, const char *dir, int l);\r
-void mgl_set_ticks_(uintptr_t *gr, char *dir, float *d, int *ns, float *org, int);\r
-void mgl_set_ticks_str_(uintptr_t *gr, const char *dir, const char *lbl, int *add,int,int l);\r
-void mgl_set_ticks_val_(uintptr_t *gr, const char *dir, uintptr_t *val, const char *lbl, int *add,int,int l);\r
-void mgl_tune_ticks_(uintptr_t *gr, int *tune, float *fact_pos);\r
-void mgl_set_tick_templ_(uintptr_t *gr, const char *dir, const char *templ,int,int l);\r
-void mgl_set_ticks_time_(uintptr_t *gr, const char *dir, float *d, const char *t,int,int l);\r
-void mgl_box_(uintptr_t *gr);\r
-void mgl_box_str_(uintptr_t *gr, const char *col, int *ticks, int l);\r
-void mgl_axis_(uintptr_t *gr, const char *dir, const char *stl,int,int);\r
-void mgl_axis_grid_(uintptr_t *gr, const char *dir,const char *pen,int l,int n);\r
-void mgl_label_(uintptr_t *gr, const char *dir, const char *text,int,int l);\r
-void mgl_label_ext_(uintptr_t *gr, const char *dir, const char *text, float *pos, float *shift,int,int l);\r
-/*****************************************************************************/\r
-void mgl_colorbar_(uintptr_t *gr, const char *sch,int l);\r
-void mgl_colorbar_ext_(uintptr_t *gr, const char *sch, float *x, float *y, float *w, float *h, int l);\r
-void mgl_colorbar_val_(uintptr_t *gr, uintptr_t *dat, const char *sch,int l);\r
-void mgl_colorbar_val_ext_(uintptr_t *gr, uintptr_t *dat, const char *sch, float *x, float *y, float *w, float *h, int l);\r
-\r
-void mgl_add_legend_(uintptr_t *gr, const char *text,const char *style,int l,int n);\r
-void mgl_clear_legend_(uintptr_t *gr);\r
-void mgl_legend_pos_(uintptr_t *gr, float *x, float *y, const char *font, float *size, float *llen,int l);\r
-void mgl_legend_(uintptr_t *gr, int *where, const char *font, float *size, float *llen,int l);\r
-void mgl_set_legend_marks_(uintptr_t *gr, int *num);\r
-\r
-uintptr_t mgl_create_expr_(const char *expr, int);\r
-void mgl_delete_expr_(uintptr_t *ex);\r
-float mgl_eval_expr_(uintptr_t *ex, float *x, float *y,float *z);\r
-float mgl_diff_expr_(uintptr_t *ex, const char *dir, float *x, float *y,float *z, int);\r
-\r
-void mgl_show_image_(uintptr_t *graph, const char *viewer, int *keep, int);\r
-void mgl_write_frame_(uintptr_t *graph, const char *fname,const char *descr,int lf,int ld);\r
-void mgl_write_tga_(uintptr_t *graph, const char *fname,const char *descr,int lf,int ld);\r
-void mgl_write_bmp_(uintptr_t *graph, const char *fname,const char *descr,int lf,int ld);\r
-void mgl_write_jpg_(uintptr_t *graph, const char *fname,const char *descr,int lf,int ld);\r
-void mgl_write_png_(uintptr_t *graph, const char *fname,const char *descr,int lf,int ld);\r
-void mgl_write_png_solid_(uintptr_t *graph, const char *fname,const char *descr,int lf,int ld);\r
-void mgl_write_eps_(uintptr_t *graph, const char *fname,const char *descr,int lf,int ld);\r
-void mgl_write_svg_(uintptr_t *graph, const char *fname,const char *descr,int lf,int ld);\r
-void mgl_write_prc_(uintptr_t *graph, const char *fname,const char *descr, int *make_pdf,int lf,int ld);\r
-void mgl_write_gif_(uintptr_t *graph, const char *fname,const char *descr,int lf,int ld);\r
-void mgl_start_gif_(uintptr_t *graph, const char *fname,int *ms,int l);\r
-void mgl_close_gif_(uintptr_t *graph);\r
-void mgl_write_obj_(uintptr_t *graph, const char *fname,const char *descr, int *use_png,int lf,int ld);\r
-void mgl_write_stl_(uintptr_t *graph, const char *fname,const char *descr,int lf,int ld);\r
-void mgl_write_off_(uintptr_t *graph, const char *fname,const char *descr,int *colored,int lf,int ld);\r
-void mgl_write_xyz_(uintptr_t *graph, const char *fname,const char *descr,int lf,int ld);\r
-//void mgl_write_x3d_(uintptr_t *graph, const char *fname,const char *descr,int lf,int ld);\r
-void mgl_write_tex_(uintptr_t *graph, const char *fname,const char *descr,int lf,int ld);\r
-void mgl_write_wgl_(uintptr_t *graph, const char *fname,const char *descr,int lf,int ld);\r
-void mgl_set_plotid_(uintptr_t *gr, const char *id,int l);\r
-void mgl_export_mgld_(uintptr_t *gr, const char *fname,const char *descr,int l,int n);\r
-void mgl_import_mgld_(uintptr_t *gr, const char *fname, int *add, int l);\r
-\r
-const unsigned char *mgl_get_rgb_(uintptr_t *graph);\r
-const unsigned char *mgl_get_rgba_(uintptr_t *graph);\r
-void mgl_set_obj_id_(uintptr_t *graph, int *id);\r
-int mgl_get_obj_id_(uintptr_t *graph, int *x, int *y);\r
-int mgl_get_spl_id_(uintptr_t *graph, int *x, int *y);\r
-int mgl_get_width_(uintptr_t *graph);\r
-int mgl_get_height_(uintptr_t *graph);\r
-void mgl_calc_xyz_(uintptr_t *gr, int *xs, int *ys, float *x, float *y, float *z);\r
-void mgl_calc_scr_(uintptr_t *gr, float *x, float *y, float *z, int *xs, int *ys);\r
-\r
-int mgl_new_frame_(uintptr_t *graph);\r
-void mgl_end_frame_(uintptr_t *graph);\r
-int mgl_get_num_frame_(uintptr_t *graph);\r
-void mgl_reset_frames_(uintptr_t *graph);\r
-\r
-void mgl_set_transp_type_(uintptr_t *graph, int *type);\r
-void mgl_set_alpha_(uintptr_t *graph, int *enable);\r
-void mgl_set_fog_(uintptr_t *graph, float *dist, float *dz);\r
-void mgl_set_light_(uintptr_t *graph, int *enable);\r
-void mgl_set_light_n_(uintptr_t *gr, int *n, int *enable);\r
-void mgl_add_light_(uintptr_t *graph, int *n, float *x, float *y, float *z);\r
-void mgl_add_light(HMGL gr, int n, float x, float y, float z);\r
-void mgl_add_light_ext_(uintptr_t *graph, int *n, float *x, float *y, float *z, char *c, float *br, float *ap, int);\r
-void mgl_add_light_ext(HMGL gr, int n, float x, float y, float z, char c, float br, float ap);\r
-void mgl_add_light_loc_(uintptr_t *graph, int *n, float *x, float *y, float *z, float *dx, float *dy, float *dz, char *c, float *br, float *ap, int);\r
-void mgl_add_light_loc(HMGL gr, int n, float x, float y, float z, float dx, float dy, float dz, char c, float br, float ap);\r
-\r
-void mgl_mat_push_(uintptr_t *gr);\r
-void mgl_mat_pop_(uintptr_t *gr);\r
-void mgl_clf_(uintptr_t *graph);\r
-void mgl_clf_rgb_(uintptr_t *graph, float *r, float *g, float *b);\r
-\r
-void mgl_subplot_(uintptr_t *graph, int *nx,int *ny,int *m);\r
-void mgl_subplot_d_(uintptr_t *graph, int *nx,int *ny,int *m,float *dx,float *dy);\r
-void mgl_subplot_s_(uintptr_t *graph, int *nx,int *ny,int *m, const char *s,int);\r
-void mgl_multiplot_(uintptr_t *graph, int *nx,int *ny,int *m,int *dx,int *dy, const char *s,int);\r
-void mgl_inplot_(uintptr_t *graph, float *x1,float *x2,float *y1,float *y2);\r
-void mgl_relplot_(uintptr_t *graph, float *x1,float *x2,float *y1,float *y2);\r
-void mgl_columnplot_(uintptr_t *graph, int *num, int *i, float *d);\r
-void mgl_gridplot_(uintptr_t *graph, int *nx, int *ny, int *i, float *d);\r
-void mgl_stickplot_(uintptr_t *graph, int *num, int *i, float *tet, float *phi);\r
-void mgl_set_plotfactor_(uintptr_t *graph, float *val);\r
-\r
-void mgl_title_(uintptr_t *gr, const char *title, const char *stl, float *size, int,int);\r
-void mgl_aspect_(uintptr_t *graph, float *Ax,float *Ay,float *Az);\r
-void mgl_rotate_(uintptr_t *graph, float *TetX,float *TetZ,float *TetY);\r
-void mgl_view_(uintptr_t *graph, float *TetX,float *TetZ,float *TetY);\r
-void mgl_zoom_(uintptr_t *graph, float *x1, float *y1, float *x2, float *y2);\r
-void mgl_rotate_vector_(uintptr_t *graph, float *Tet,float *x,float *y,float *z);\r
-void mgl_perspective_(uintptr_t *graph, float val);\r
-/*****************************************************************************/\r
-HMGL mgl_create_graph_qt(int (*draw)(HMGL gr, void *p), const char *title, void *par, void (*load)(void *p));\r
-HMGL mgl_create_graph_fltk(int (*draw)(HMGL gr, void *p), const char *title, void *par, void (*load)(void *p));\r
-void mgl_set_click_func(HMGL gr, void (*func)(void *p));\r
-int mgl_fltk_run();\r
-int mgl_fltk_thr();\r
-int mgl_qt_run();\r
-/*****************************************************************************/\r
-uintptr_t mgl_create_graph_qt_(const char *title, int);\r
-uintptr_t mgl_create_graph_fltk_(const char *title, int);\r
-int mgl_fltk_run_();\r
-int mgl_qt_run_();\r
-/*****************************************************************************/\r
-void mgl_wnd_set_delay(HMGL gr, float dt);\r
-void mgl_setup_window(HMGL gr, int clf_upd, int showpos);\r
-void mgl_wnd_toggle_alpha(HMGL gr);\r
-void mgl_wnd_toggle_light(HMGL gr);\r
-void mgl_wnd_toggle_zoom(HMGL gr);\r
-void mgl_wnd_toggle_rotate(HMGL gr);\r
-void mgl_wnd_toggle_no(HMGL gr);\r
-void mgl_wnd_update(HMGL gr);\r
-void mgl_wnd_reload(HMGL gr);\r
-void mgl_wnd_adjust(HMGL gr);\r
-void mgl_wnd_next_frame(HMGL gr);\r
-void mgl_wnd_prev_frame(HMGL gr);\r
-void mgl_wnd_animation(HMGL gr);\r
-void mgl_get_last_mouse_pos(HMGL gr, float *x, float *y, float *z);\r
-/*****************************************************************************/\r
-void mgl_get_last_mouse_pos_(uintptr_t *gr, float *x, float *y, float *z);\r
-void mgl_wnd_set_delay_(uintptr_t *gr, float *dt);\r
-void mgl_setup_window_(uintptr_t *gr, int *clf_upd, int *showpos);\r
-void mgl_wnd_toggle_alpha_(uintptr_t *gr);\r
-void mgl_wnd_toggle_light_(uintptr_t *gr);\r
-void mgl_wnd_toggle_zoom_(uintptr_t *gr);\r
-void mgl_wnd_toggle_rotate_(uintptr_t *gr);\r
-void mgl_wnd_toggle_no_(uintptr_t *gr);\r
-void mgl_wnd_update_(uintptr_t *gr);\r
-void mgl_wnd_reload_(uintptr_t *gr);\r
-void mgl_wnd_adjust_(uintptr_t *gr);\r
-void mgl_wnd_next_frame_(uintptr_t *gr);\r
-void mgl_wnd_prev_frame_(uintptr_t *gr);\r
-void mgl_wnd_animation_(uintptr_t *gr);\r
-/*****************************************************************************/\r
-void mgl_mpi_send(HMGL gr, int id);\r
-void mgl_mpi_recv(HMGL gr, int id);\r
-void mgl_mpi_send_(uintptr_t *gr, int *id);\r
-void mgl_mpi_recv_(uintptr_t *gr, int *id);\r
-/*****************************************************************************/\r
-HMPR mgl_create_parser();\r
-long mgl_use_parser(HMPR p, int inc);\r
-void mgl_delete_parser(HMPR p);\r
-void mgl_add_param(HMPR p, int id, const char *str);\r
-void mgl_add_paramw(HMPR p, int id, const wchar_t *str);\r
-/*===!!! NOTE !!! You must not delete obtained data arrays !!!===============*/\r
-HMDT mgl_add_var(HMPR p, const char *name);\r
-/*===!!! NOTE !!! You must not delete obtained data arrays !!!===============*/\r
-HMDT mgl_find_var(HMPR p, const char *name);\r
-void mgl_del_var(HMPR p, const char *name);\r
-int mgl_parse(HMGL gr, HMPR p, const char *str, int pos);\r
-int mgl_parsew(HMGL gr, HMPR p, const wchar_t *str, int pos);\r
-void mgl_parse_file(HMGL gr, HMPR p, FILE *fp, int print);\r
-void mgl_parse_text(HMGL gr, HMPR p, const char *str);\r
-void mgl_parsew_text(HMGL gr, HMPR p, const wchar_t *str);\r
-void mgl_restore_once(HMPR p);\r
-void mgl_parser_allow_setsize(HMPR p, int a);\r
-void mgl_parser_stop(HMPR p);\r
-int mgl_cmd_type(HMPR pr, const char *name);\r
-const char *mgl_cmd_desc(HMPR pr, const char *name);\r
-const char *mgl_cmd_frmt(HMPR pr, const char *name);\r
-//int mgl_parser_find_cmdw(HMPR pr, const wchar_t *name);\r
-/*****************************************************************************/\r
-uintptr_t mgl_create_parser_();\r
-long mgl_use_parser_(uintptr_t* , int *inc);\r
-void mgl_delete_parser_(uintptr_t* p);\r
-void mgl_add_param_(uintptr_t* p, int *id, const char *str, int l);\r
-/*===!!! NOTE !!! You must not delete obtained data arrays !!!===============*/\r
-uintptr_t mgl_add_var_(uintptr_t* p, const char *name, int l);\r
-/*===!!! NOTE !!! You must not delete obtained data arrays !!!===============*/\r
-uintptr_t mgl_find_var_(uintptr_t* p, const char *name, int l);\r
-void mgl_del_var_(uintptr_t* p, const char *name, int l);\r
-int mgl_parse_(uintptr_t* gr, uintptr_t* p, const char *str, int *pos, int l);\r
-void mgl_parse_text_(uintptr_t* gr, uintptr_t* p, const char *str, int l);\r
-void mgl_restore_once_(uintptr_t* p);\r
-void mgl_parser_allow_setsize_(uintptr_t* p, int *a);\r
-void mgl_parser_stop_(uintptr_t* p);\r
-int mgl_cmd_type_(uintptr_t* p, const char *name, int l);\r
-/*****************************************************************************/\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-/*****************************************************************************/\r
-#endif\r
-\r
+++ /dev/null
-/***************************************************************************\r
- * window.h is part of Math Graphic Library\r
- * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
- * *\r
- * This program is free software; you can redistribute it and/or modify *\r
- * it under the terms of the GNU Library General Public License as *\r
- * published by the Free Software Foundation; either version 3 of the *\r
- * License, or (at your option) any later version. *\r
- * *\r
- * This program is distributed in the hope that it will be useful, *\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
- * GNU General Public License for more details. *\r
- * *\r
- * You should have received a copy of the GNU Library General Public *\r
- * License along with this program; if not, write to the *\r
- * Free Software Foundation, Inc., *\r
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
- ***************************************************************************/\r
-//-----------------------------------------------------------------------------\r
-#ifndef _MGL_CANVAS_WND_H_\r
-#define _MGL_CANVAS_WND_H_\r
-/*****************************************************************************/\r
-#include "mgl/window.h"\r
-//-----------------------------------------------------------------------------\r
-/// Base class for windows containing MathGL graphics\r
-class mglCanvasWnd : public mglCanvas\r
-{\r
-public:\r
- mglPoint LastMousePos; ///< Last mouse position\r
- void (*ClickFunc)(void *par); ///< Callback function on click\r
-\r
- mglCanvasWnd();\r
- virtual ~mglCanvasWnd();\r
-\r
- void SetSize(int w,int h);\r
- void EndFrame();\r
- const unsigned char *GetBits();\r
- inline int GetNumFig() const { return NumFig; }\r
- inline int GetCurFig() const { return CurFig; }\r
- void SetCurFig(int c);\r
- void ClearFrames();\r
- inline mglPoint GetMousePos() const { return LastMousePos;}\r
- inline void SetMousePos(mglPoint p) { LastMousePos=p; }\r
- inline void Setup(bool clf_upd=true, bool showpos=false)\r
- { set(showpos,MGL_SHOW_POS); set(clf_upd,MGL_CLF_ON_UPD); }\r
-\r
- virtual void ToggleAlpha()=0; ///< Switch on/off transparency (do not overwrite user settings)\r
- virtual void ToggleLight()=0; ///< Switch on/off lighting (do not overwrite user settings)\r
- virtual void ToggleZoom()=0; ///< Switch on/off zooming by mouse\r
- virtual void ToggleRotate()=0; ///< Switch on/off rotation by mouse\r
- virtual void ToggleNo()=0; ///< Switch off all zooming and rotation\r
- virtual void Update()=0; ///< Update picture by calling user drawing function\r
- virtual void Adjust()=0; ///< Adjust size of bitmap to window size\r
- virtual void GotoFrame(int d)=0;///< Show arbitrary frame (use relative step)\r
- virtual void NextFrame() {GotoFrame(+1);} ///< Show next frame (if one)\r
- virtual void PrevFrame() {GotoFrame(-1);} ///< Show previous frame (if one)\r
- virtual void Animation()=0; ///< Run slideshow (animation) of frames\r
- void ReLoad(); ///< Reload user data and update picture\r
- /// Create a window for plotting based on callback function (can be NULL).\r
- virtual void Window(int argc, char **argv, int (*draw)(mglBase *gr, void *p),\r
- const char *title, void *par=NULL,\r
- void (*reload)(void *p)=NULL, bool maximize=false)=0;\r
- void SetDrawFunc(int (*draw)(mglBase *gr, void *p), void *par=NULL, void (*reload)(void *p)=NULL);\r
- \r
-private:\r
- int CurFig; ///< Current figure in the list.\r
-\r
- unsigned char *GG; ///< images for all frames (may be too LARGE !!!)\r
- int NumFig; ///< Number of figures in the list. If 0 then no list and mglCanvas::DrawFunc will called for each drawing.\r
- void (*LoadFunc)(void *par);\r
- void *FuncPar; ///< Parameters for drawing function mglCanvas::DrawFunc.\r
- /// Drawing function for window procedure. It should return the number of frames.\r
- int (*DrawFunc)(mglBase *gr, void *par);\r
-};\r
-//-----------------------------------------------------------------------------\r
-#endif\r
+++ /dev/null
-/* include/mgl/config.h.in. Generated from configure.ac by autoheader. */
-
-/* Define to 1 if you have the <dlfcn.h> header file. */
-#undef HAVE_DLFCN_H
-
-/* Define to 1 if you have the <hpdf.h> header file. */
-#undef HAVE_HPDF_H
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#undef HAVE_INTTYPES_H
-
-/* Define to 1 if you have the `hpdf' library (-lhpdf). */
-#undef HAVE_LIBHPDF
-
-/* Define to 1 if you have the <memory.h> header file. */
-#undef HAVE_MEMORY_H
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#undef HAVE_STDINT_H
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#undef HAVE_STDLIB_H
-
-/* Define to 1 if you have the <strings.h> header file. */
-#undef HAVE_STRINGS_H
-
-/* Define to 1 if you have the <string.h> header file. */
-#undef HAVE_STRING_H
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#undef HAVE_SYS_STAT_H
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#undef HAVE_SYS_TYPES_H
-
-/* Define if you have libIDTF */
-#undef HAVE_U3D
-
-/* Define to 1 if you have the <u3d/SceneConverterLib.h> header file. */
-#undef HAVE_U3D_SCENECONVERTERLIB_H
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#undef HAVE_UNISTD_H
-
-/* Define to the sub-directory in which libtool stores uninstalled libraries.
- */
-#undef LT_OBJDIR
-
-/* This define enables double precision in MathGL */
-#undef MGL_USE_DOUBLE
-
-/* Name of package */
-#undef PACKAGE
-
-/* Define to the address where bug reports for this package should be sent. */
-#undef PACKAGE_BUGREPORT
-
-/* Define to the full name of this package. */
-#undef PACKAGE_NAME
-
-/* Define to the full name and version of this package. */
-#undef PACKAGE_STRING
-
-/* Define to the one symbol short name of this package. */
-#undef PACKAGE_TARNAME
-
-/* Define to the home page for this package. */
-#undef PACKAGE_URL
-
-/* Define to the version of this package. */
-#undef PACKAGE_VERSION
-
-/* Define to 1 if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
-/* Version number of package */
-#undef VERSION
+++ /dev/null
-/***************************************************************************\r
- * cont.h is part of Math Graphic Library\r
- * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
- * *\r
- * This program is free software; you can redistribute it and/or modify *\r
- * it under the terms of the GNU Library General Public License as *\r
- * published by the Free Software Foundation; either version 3 of the *\r
- * License, or (at your option) any later version. *\r
- * *\r
- * This program is distributed in the hope that it will be useful, *\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
- * GNU General Public License for more details. *\r
- * *\r
- * You should have received a copy of the GNU Library General Public *\r
- * License along with this program; if not, write to the *\r
- * Free Software Foundation, Inc., *\r
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
- ***************************************************************************/\r
-#ifndef _MGL_CONT_H_\r
-#define _MGL_CONT_H_\r
-#include "mgl/base.h"\r
-/*****************************************************************************/\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-/*****************************************************************************/\r
-void mgl_textw_xyz(HMGL gr, HCDT x, HCDT y, HCDT z, const wchar_t *text, const char *font, const char *opt);\r
-void mgl_textw_xy(HMGL gr, HCDT x, HCDT y, const wchar_t *text, const char *font, const char *opt);\r
-void mgl_textw_y(HMGL gr, HCDT y, const wchar_t *text, const char *font, const char *opt);\r
-void mgl_text_xyz(HMGL gr, HCDT x, HCDT y, HCDT z, const char *text, const char *font, const char *opt);\r
-void mgl_text_xy(HMGL gr, HCDT x, HCDT y, const char *text, const char *font, const char *opt);\r
-void mgl_text_y(HMGL gr, HCDT y, const char *text, const char *font, const char *opt);\r
-\r
-void mgl_cont_gen(HMGL gr, float val, HCDT a, HCDT x, HCDT y, HCDT z, const char *stl);\r
-void mgl_contf_gen(HMGL gr, float v1, float v2, HCDT a, HCDT x, HCDT y, HCDT z, const char *stl);\r
-\r
-void mgl_cont_xy_val(HMGL graph, HCDT v, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
-void mgl_cont_val(HMGL graph, HCDT v, HCDT z, const char *sch, const char *opt);\r
-void mgl_cont_xy(HMGL graph, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
-void mgl_cont(HMGL graph, HCDT z, const char *sch, const char *opt);\r
-\r
-void mgl_contf_xy_val(HMGL graph, HCDT v, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
-void mgl_contf_val(HMGL graph, HCDT v, HCDT z, const char *sch, const char *opt);\r
-void mgl_contf_xy(HMGL graph, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
-void mgl_contf(HMGL graph, HCDT z, const char *sch, const char *opt);\r
-\r
-void mgl_contd_xy_val(HMGL graph, HCDT v, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
-void mgl_contd_val(HMGL graph, HCDT v, HCDT z, const char *sch, const char *opt);\r
-void mgl_contd_xy(HMGL graph, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
-void mgl_contd(HMGL graph, HCDT z, const char *sch, const char *opt);\r
-\r
-void mgl_contv_xy_val(HMGL graph, HCDT v, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
-void mgl_contv_val(HMGL graph, HCDT v, HCDT z, const char *sch, const char *opt);\r
-void mgl_contv_xy(HMGL graph, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
-void mgl_contv(HMGL graph, HCDT z, const char *sch, const char *opt);\r
-\r
-void mgl_axial_xy_val(HMGL graph, HCDT v, HCDT x, HCDT y, HCDT a, const char *sch, const char *opt);\r
-void mgl_axial_val(HMGL graph, HCDT v, HCDT a, const char *sch, const char *opt);\r
-void mgl_axial_xy(HMGL graph, HCDT x, HCDT y, HCDT a, const char *sch, const char *opt);\r
-void mgl_axial(HMGL graph, HCDT a, const char *sch, const char *opt);\r
-\r
-void mgl_torus(HMGL graph, HCDT r, HCDT z, const char *col, const char *opt);\r
-\r
-void mgl_grid3_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, HCDT a, const char *stl, float sVal, const char *opt);\r
-void mgl_grid3(HMGL graph, HCDT a, const char *stl, float sVal, const char *opt);\r
-\r
-void mgl_dens3_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, HCDT a, const char *stl, float sVal, const char *opt);\r
-void mgl_dens3(HMGL graph, HCDT a, const char *stl, float sVal, const char *opt);\r
-\r
-void mgl_cont3_xyz_val(HMGL graph, HCDT v, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, float sVal, const char *opt);\r
-void mgl_cont3_val(HMGL graph, HCDT v, HCDT a, const char *sch, float sVal, const char *opt);\r
-void mgl_cont3_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, float sVal, const char *opt);\r
-void mgl_cont3(HMGL graph, HCDT a, const char *sch, float sVal, const char *opt);\r
-\r
-void mgl_contf3_xyz_val(HMGL graph, HCDT v, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, float sVal, const char *opt);\r
-void mgl_contf3_val(HMGL graph, HCDT v, HCDT a, const char *sch, float sVal, const char *opt);\r
-void mgl_contf3_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, float sVal, const char *opt);\r
-void mgl_contf3(HMGL graph, HCDT a, const char *sch, float sVal, const char *opt);\r
-\r
-/*****************************************************************************/\r
-void mgl_text_xyz_(uintptr_t *gr, uintptr_t *x, uintptr_t *y, uintptr_t *z,const char *text,const char *font, const char *opt,int,int l,int n);\r
-void mgl_text_xy_(uintptr_t *gr, uintptr_t *x, uintptr_t *y, const char *text, const char *font, const char *opt,int, int l,int n);\r
-void mgl_text_y_(uintptr_t *gr, uintptr_t *y, const char *text, const char *font, const char *opt,int, int l,int n);\r
-\r
-void mgl_cont_xy_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int,int);\r
-void mgl_cont_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *z, const char *sch, const char *opt,int,int);\r
-void mgl_cont_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int,int);\r
-void mgl_cont_(uintptr_t *graph, uintptr_t *z, const char *sch, const char *opt,int,int);\r
-\r
-void mgl_contf_xy_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int,int);\r
-void mgl_contf_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *z, const char *sch, const char *opt,int,int);\r
-void mgl_contf_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int,int);\r
-void mgl_contf_(uintptr_t *graph, uintptr_t *z, const char *sch, const char *opt,int,int);\r
-\r
-void mgl_contd_xy_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int,int);\r
-void mgl_contd_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *z, const char *sch, const char *opt,int,int);\r
-void mgl_contd_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int,int);\r
-void mgl_contd_(uintptr_t *graph, uintptr_t *z, const char *sch, const char *opt,int,int);\r
-\r
-void mgl_contv_xy_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int,int);\r
-void mgl_contv_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *z, const char *sch, const char *opt,int,int);\r
-void mgl_contv_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int,int);\r
-void mgl_contv_(uintptr_t *graph, uintptr_t *z, const char *sch, const char *opt,int,int);\r
-\r
-void mgl_axial_xy_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *x, uintptr_t *y, uintptr_t *a, const char *sch, const char *opt,int,int);\r
-void mgl_axial_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *a, const char *sch, const char *opt,int,int);\r
-void mgl_axial_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *a, const char *sch, const char *opt,int,int);\r
-void mgl_axial_(uintptr_t *graph, uintptr_t *a, const char *sch, const char *opt,int,int);\r
-\r
-void mgl_torus_(uintptr_t *graph, uintptr_t *r, uintptr_t *z, const char *pen, const char *opt,int,int);\r
-\r
-void mgl_grid3_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *a, const char *sch, float *sVal, const char *opt,int,int);\r
-void mgl_grid3_(uintptr_t *graph, uintptr_t *a, const char *sch, float *sVal, const char *opt,int,int);\r
-\r
-void mgl_dens3_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *a, const char *sch, float *sVal, const char *opt,int,int);\r
-void mgl_dens3_(uintptr_t *graph, uintptr_t *a, const char *sch, float *sVal, const char *opt,int,int);\r
-\r
-void mgl_cont3_xyz_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *a, const char *sch, float *sVal, const char *opt,int,int);\r
-void mgl_cont3_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *a, const char *sch, float *sVal, const char *opt,int,int);\r
-void mgl_cont3_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *a, const char *sch, float *sVal, const char *opt,int,int);\r
-void mgl_cont3_(uintptr_t *graph, uintptr_t *a, const char *sch, float *sVal, const char *opt,int,int);\r
-\r
-void mgl_contf3_xyz_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *a, const char *sch, float *sVal, const char *opt,int,int);\r
-void mgl_contf3_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *a, const char *sch, float *sVal, const char *opt,int,int);\r
-void mgl_contf3_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *a, const char *sch, float *sVal, const char *opt,int,int);\r
-void mgl_contf3_(uintptr_t *graph, uintptr_t *a, const char *sch, float *sVal, const char *opt,int,int);\r
-\r
-/*****************************************************************************/\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-/*****************************************************************************/\r
-#endif\r
+++ /dev/null
-/***************************************************************************\r
- * data.h is part of Math Graphic Library\r
- * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
- * *\r
- * This program is free software; you can redistribute it and/or modify *\r
- * it under the terms of the GNU Library General Public License as *\r
- * published by the Free Software Foundation; either version 3 of the *\r
- * License, or (at your option) any later version. *\r
- * *\r
- * This program is distributed in the hope that it will be useful, *\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
- * GNU General Public License for more details. *\r
- * *\r
- * You should have received a copy of the GNU Library General Public *\r
- * License along with this program; if not, write to the *\r
- * Free Software Foundation, Inc., *\r
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
- ***************************************************************************/\r
-#ifndef _MGL_DATA_H_\r
-#define _MGL_DATA_H_\r
-/*****************************************************************************/\r
-#include "mgl/base.h"\r
-#include "mgl/data_cf.h"\r
-#ifdef __cplusplus\r
-//-----------------------------------------------------------------------------\r
-#include <vector>\r
-//-----------------------------------------------------------------------------\r
-/// Class for working with data array\r
-class mglData : public mglDataA\r
-{\r
-public:\r
-\r
- long nx; ///< number of points in 1st dimensions ('x' dimension)\r
- long ny; ///< number of points in 2nd dimensions ('y' dimension)\r
- long nz; ///< number of points in 3d dimensions ('z' dimension)\r
- mreal *a; ///< data array\r
- char *id; ///< column (or slice) names\r
- bool link; ///< use external data (i.e. don't free it)\r
-\r
- /// Initiate by other mglData variable\r
- inline mglData(const mglData &d) { a=0; mgl_data_set(this,&d); }\r
- inline mglData(const mglDataA *d) { a=0; mgl_data_set(this, d); }\r
- inline mglData(bool, mglData *d) // NOTE: Variable d will be deleted!!!\r
- { if(d) {memcpy((void*)this,(void*)d,sizeof(mglData)); d->id=0; d->link=true; delete d; }\r
- else { a=0; Create(1); } }\r
- /// Initiate by flat array\r
- inline mglData(int size, const float *d) { a=0; Set(d,size); }\r
- inline mglData(int rows, int cols, const float *d) { a=0; Set(d,cols,rows); }\r
- inline mglData(int size, const double *d) { a=0; Set(d,size); }\r
- inline mglData(int rows, int cols, const double *d) { a=0; Set(d,cols,rows); }\r
- inline mglData(const double *d, int size) { a=0; Set(d,size); }\r
- inline mglData(const double *d, int rows, int cols) { a=0; Set(d,cols,rows); }\r
- /// Read data from file\r
- inline mglData(const char *fname) { a=0; Read(fname); }\r
- /// Allocate the memory for data array and initialize it zero\r
- inline mglData(long xx=1,long yy=1,long zz=1) { a=0; Create(xx,yy,zz); }\r
- /// Delete the array\r
- virtual ~mglData() { if(id && a) delete []id; if(!link && a) delete []a; }\r
- inline mreal GetVal(long i, long j=0, long k=0)\r
- { return mgl_data_get_value(this,i,j,k);}\r
- inline void SetVal(mreal f, long i, long j=0, long k=0)\r
- { mgl_data_set_value(this,f,i,j,k); }\r
- /// Get sizes\r
- inline long GetNx() const { return nx; }\r
- inline long GetNy() const { return ny; }\r
- inline long GetNz() const { return nz; }\r
-\r
- /// Link external data array (don't delete it at exit)\r
- inline void Link(mreal *A, long NX, long NY=1, long NZ=1)\r
- { mgl_data_link(this,A,NX,NY,NZ); }\r
- inline void Link(mglData *d) { Link(d->a,d->nx,d->ny,d->nz); }\r
- /// Allocate memory and copy the data from the gsl_vector\r
- inline void Set(gsl_vector *m) { mgl_data_set_vector(this,m); }\r
- /// Allocate memory and copy the data from the gsl_matrix\r
- inline void Set(gsl_matrix *m) { mgl_data_set_matrix(this,m); }\r
-\r
- /// Allocate memory and copy the data from the (float *) array\r
- inline void Set(const float *A,long NX,long NY=1,long NZ=1)\r
- { mgl_data_set_float(this,A,NX,NY,NZ); }\r
- /// Allocate memory and copy the data from the (double *) array\r
- inline void Set(const double *A,long NX,long NY=1,long NZ=1)\r
- { mgl_data_set_double(this,A,NX,NY,NZ); }\r
- /// Allocate memory and copy the data from the (float **) array\r
- inline void Set(const float **A,long N1,long N2)\r
- { mgl_data_set_float2(this,A,N1,N2); }\r
- /// Allocate memory and copy the data from the (double **) array\r
- inline void Set(const double **A,long N1,long N2)\r
- { mgl_data_set_double2(this,A,N1,N2); }\r
- /// Allocate memory and copy the data from the (float ***) array\r
- inline void Set(const float ***A,long N1,long N2,long N3)\r
- { mgl_data_set_float3(this,A,N1,N2,N3); }\r
- /// Allocate memory and copy the data from the (double ***) array\r
- inline void Set(const double ***A,long N1,long N2,long N3)\r
- { mgl_data_set_double3(this,A,N1,N2,N3); }\r
- /// Allocate memory and scanf the data from the string\r
- inline void Set(const char *str,long NX,long NY=1,long NZ=1)\r
- { mgl_data_set_values(this,str,NX,NY,NZ); }\r
- /// Import data from abstract type\r
- inline void Set(HCDT dat) { mgl_data_set(this, dat); }\r
- inline void Set(const mglData &dat) { mgl_data_set(this, &dat); }\r
- /// Allocate memory and copy data from std::vector<T>\r
- inline void Set(const std::vector<int> &d)\r
- { if(d.size()<1) return;\r
- Create(d.size()); for(long i=0;i<nx;i++) a[i] = d[i]; }\r
- inline void Set(const std::vector<float> &d)\r
- { if(d.size()<1) return;\r
- Create(d.size()); for(long i=0;i<nx;i++) a[i] = d[i]; }\r
- inline void Set(const std::vector<double> &d)\r
- { if(d.size()<1) return;\r
- Create(d.size()); for(long i=0;i<nx;i++) a[i] = d[i]; }\r
-\r
- /// Create or recreate the array with specified size and fill it by zero\r
- inline void Create(long mx,long my=1,long mz=1)\r
- { mgl_data_create(this,mx,my,mz); }\r
- /// Rearange data dimensions\r
- inline void Rearrange(long mx, long my=0, long mz=0)\r
- { mgl_data_rearrange(this,mx,my,mz); }\r
- /// Transpose dimensions of the data (generalization of Transpose)\r
- inline void Transpose(const char *dim="yx")\r
- { mgl_data_transpose(this,dim); }\r
- /// Extend data dimensions\r
- inline void Extend(long n1, long n2=0)\r
- { mgl_data_extend(this,n1,n2); }\r
- /// Reduce size of the data\r
- inline void Squeeze(long rx,long ry=1,long rz=1,bool smooth=false)\r
- { mgl_data_squeeze(this,rx,ry,rz,smooth); }\r
- /// Crop the data\r
- inline void Crop(long n1, long n2,char dir='x')\r
- { mgl_data_crop(this,n1,n2,dir); }\r
- /// Insert data\r
- inline void Insert(char dir, long at=0, long num=1)\r
- { mgl_data_insert(this,dir,at,num); }\r
- /// Delete data\r
- inline void Delete(char dir, long at=0, long num=1)\r
- { mgl_data_delete(this,dir,at,num); }\r
-\r
- /// Modify the data by specified formula\r
- inline void Modify(const char *eq,long dim=0)\r
- { mgl_data_modify(this, eq, dim); }\r
- /// Modify the data by specified formula\r
- inline void Modify(const char *eq,const mglData &vdat, const mglData &wdat)\r
- { mgl_data_modify_vw(this,eq,&vdat,&wdat); }\r
- /// Modify the data by specified formula\r
- inline void Modify(const char *eq,const mglData &vdat)\r
- { mgl_data_modify_vw(this,eq,&vdat,0); }\r
- /// Modify the data by specified formula assuming x,y,z in range [r1,r2]\r
- inline void Fill(mglBase *gr, const char *eq, const char *opt="")\r
- { mgl_data_fill_eq(gr,this,eq,0,0,opt); }\r
- inline void Fill(mglBase *gr, const char *eq, const mglData &vdat, const char *opt="")\r
- { mgl_data_fill_eq(gr,this,eq,&vdat,0,opt); }\r
- inline void Fill(mglBase *gr, const char *eq, const mglData &vdat, const mglData &wdat,const char *opt="")\r
- { mgl_data_fill_eq(gr,this,eq,&vdat,&wdat,opt); }\r
- /// Eqidistantly fill the data to range [x1,x2] in direction \a dir\r
- inline void Fill(mreal x1,mreal x2=NaN,char dir='x')\r
- { return mgl_data_fill(this,x1,x2,dir); }\r
- /// Put value to data element(s)\r
- inline void Put(mreal val, long i=-1, long j=-1, long k=-1)\r
- { mgl_data_put_val(this,val,i,j,k); }\r
- /// Put array to data element(s)\r
- inline void Put(const mglData &dat, long i=-1, long j=-1, long k=-1)\r
- { mgl_data_put_dat(this,&dat,i,j,k); }\r
- /// Set names for columns (slices)\r
- inline void SetColumnId(const char *ids)\r
- { mgl_data_set_id(this,ids); }\r
- /// Make new id\r
- inline void NewId()\r
- { delete []id; id=new char[nx]; memset(id,0,nx*sizeof(char)); }\r
-\r
- /// Read data from tab-separated text file with auto determining size\r
- inline bool Read(const char *fname)\r
- { return mgl_data_read(this,fname); }\r
- /// Read data from text file with specifeid size\r
- inline bool Read(const char *fname,long mx,long my=1,long mz=1)\r
- { return mgl_data_read_dim(this,fname,mx,my,mz); }\r
- /// Save whole data array (for ns=-1) or only ns-th slice to text file\r
- inline void Save(const char *fname,long ns=-1) const\r
- { mgl_data_save(this,fname,ns); }\r
- /// Export data array (for ns=-1) or only ns-th slice to PNG file according color scheme\r
- inline void Export(const char *fname,const char *scheme,mreal v1=0,mreal v2=0,long ns=-1) const\r
- { mgl_data_export(this,fname,scheme,v1,v2,ns); }\r
- /// Import data array from PNG file according color scheme\r
- inline void Import(const char *fname,const char *scheme,mreal v1=0,mreal v2=1)\r
- { mgl_data_import(this,fname,scheme,v1,v2); }\r
- /// Read data from tab-separated text files with auto determining size which filenames are result of sprintf(fname,templ,t) where t=from:step:to\r
- inline bool ReadRange(const char *templ, double from, double to, double step=1, bool as_slice=false)\r
- { return mgl_data_read_range(this,templ,from,to,step,as_slice); }\r
- /// Read data from tab-separated text files with auto determining size which filenames are satisfied to template (like "t_*.dat")\r
- inline bool ReadAll(const char *templ, bool as_slice=false)\r
- { return mgl_data_read_all(this, templ, as_slice); }\r
- /// Read data from text file with size specified at beginning of the file\r
- inline bool ReadMat(const char *fname, long dim=2)\r
- { return mgl_data_read_mat(this,fname,dim); }\r
- /// Read data array from HDF file (parse HDF4 and HDF5 files)\r
- inline int ReadHDF(const char *fname,const char *data)\r
- { return mgl_data_read_hdf(this,fname,data); }\r
- /// Save data to HDF file\r
- inline void SaveHDF(const char *fname,const char *data,bool rewrite=false) const\r
- { mgl_data_save_hdf(this,fname,data,rewrite); }\r
- /// Put HDF data names into buf as '\t' separated.\r
- inline int DatasHDF(const char *fname, char *buf, long size) const\r
- { return mgl_datas_hdf(fname,buf,size); }\r
-\r
- /// Get column (or slice) of the data filled by formulas of named columns\r
- inline mglData Column(const char *eq) const\r
- { return mglData(true,mgl_data_column(this,eq)); }\r
- /// Get momentum (1D-array) of data along direction 'dir'. String looks like "x1" for median in x-direction, "x2" for width in x-dir and so on.\r
- inline mglData Momentum(char dir, const char *how) const\r
- { return mglData(true,mgl_data_momentum(this,dir,how)); }\r
- /// Get sub-array of the data with given fixed indexes\r
- inline mglData SubData(long xx,long yy=-1,long zz=-1) const\r
- { return mglData(true,mgl_data_subdata(this,xx,yy,zz)); }\r
- inline mglData SubData(const mglData &xx, const mglData &yy, const mglData &zz) const\r
- { return mglData(true,mgl_data_subdata_ext(this,&xx,&yy,&zz)); }\r
- /// Get trace of the data array\r
- inline mglData Trace() const\r
- { return mglData(true,mgl_data_trace(this)); }\r
- /// Create n-th points distribution of this data values in range [v1, v2]\r
- mglData Hist(long n,mreal v1=0,mreal v2=1, long nsub=0) const\r
- { return mglData(true,mgl_data_hist(this,n,v1,v2,nsub)); }\r
- /// Create n-th points distribution of this data values in range [v1, v2] with weight \a w\r
- mglData Hist(const mglData &w, long n,mreal v1=0,mreal v2=1, long nsub=0) const\r
- { return mglData(true,mgl_data_hist_w(this,&w,n,v1,v2,nsub)); }\r
- /// Get array which is result of summation in given direction or directions\r
- inline mglData Sum(const char *dir) const\r
- { return mglData(true,mgl_data_sum(this,dir)); }\r
- /// Get array which is result of maximal values in given direction or directions\r
- inline mglData Max(const char *dir) const\r
- { return mglData(true,mgl_data_max_dir(this,dir)); }\r
- /// Get array which is result of minimal values in given direction or directions\r
- inline mglData Min(const char *dir) const\r
- { return mglData(true,mgl_data_min_dir(this,dir)); }\r
- /// Get the data which is direct multiplication (like, d[i,j] = this[i]*a[j] and so on)\r
- inline mglData Combine(const mglData &dat) const\r
- { return mglData(true,mgl_data_combine(this,&dat)); }\r
- /// Resize the data to new size of box [x1,x2]*[y1,y2]*[z1,z2]\r
- inline mglData Resize(long mx,long my=1,long mz=1, mreal x1=0,mreal x2=1, mreal y1=0,mreal y2=1, mreal z1=0,mreal z2=1) const\r
- { return mglData(true,mgl_data_resize_box(this,mx,my,mz,x1,x2,y1,y2,z1,z2)); }\r
- /// Get array which values is result of interpolation this for coordinates from other arrays\r
- inline mglData Evaluate(const mglData &idat, bool norm=true) const\r
- { return mglData(true,mgl_data_evaluate(this,&idat,0,0,norm)); }\r
- inline mglData Evaluate(const mglData &idat, const mglData &jdat, bool norm=true) const\r
- { return mglData(true,mgl_data_evaluate(this,&idat,&jdat,0,norm)); }\r
- inline mglData Evaluate(const mglData &idat, const mglData &jdat, const mglData &kdat, bool norm=true) const\r
- { return mglData(true,mgl_data_evaluate(this,&idat,&jdat,&kdat,norm)); }\r
-\r
- /// Cumulative summation the data in given direction or directions\r
- inline void CumSum(const char *dir) { mgl_data_cumsum(this,dir); }\r
- /// Integrate (cumulative summation) the data in given direction or directions\r
- inline void Integral(const char *dir) { mgl_data_integral(this,dir); }\r
- /// Differentiate the data in given direction or directions\r
- inline void Diff(const char *dir) { mgl_data_diff(this,dir); }\r
- /// Differentiate the parametrically specified data along direction v1 with v2=const\r
- inline void Diff(const mglData &v1, const mglData &v2)\r
- { mgl_data_diff_par(this,&v1,&v2,0); }\r
- /// Differentiate the parametrically specified data along direction v1 with v2,v3=const\r
- inline void Diff(const mglData &v1, const mglData &v2, const mglData &v3)\r
- { mgl_data_diff_par(this,&v1,&v2,&v3); }\r
- /// Double-differentiate (like laplace operator) the data in given direction\r
- inline void Diff2(const char *dir) { mgl_data_diff2(this,dir); }\r
-\r
- /// Swap left and right part of the data in given direction (useful for fourier spectrums)\r
- inline void Swap(const char *dir) { mgl_data_swap(this,dir); }\r
- /// Roll data along direction \a dir by \a num slices\r
- inline void Roll(char dir, long num) { mgl_data_roll(this,dir,num); }\r
- /// Mirror the data in given direction (useful for fourier spectrums)\r
- inline void Mirror(const char *dir) { mgl_data_mirror(this,dir); }\r
- /// Sort rows (or slices) by values of specified column\r
- inline void Sort(long idx, long idy=-1) { mgl_data_sort(this,idx,idy); }\r
-\r
- /// Set as the data envelop\r
- inline void Envelop(char dir='x')\r
- { mgl_data_envelop(this,dir); }\r
- /// Remove phase jump\r
- inline void Sew(const char *dirs="xyz", mreal da=2*Pi)\r
- { mgl_data_sew(this,dirs,da); }\r
- /// Smooth the data on specified direction or directions\r
- inline void Smooth(const char *dirs="xyz",mreal delta=0)\r
- { mgl_data_smooth(this,dirs,delta); }\r
- /// Normalize the data to range [v1,v2]\r
- inline void Norm(mreal v1=0,mreal v2=1,bool sym=false,long dim=0)\r
- { mgl_data_norm(this,v1,v2,sym,dim); }\r
- /// Normalize the data to range [v1,v2] slice by slice\r
- inline void NormSl(mreal v1=0,mreal v2=1,char dir='z',bool keep_en=true,bool sym=false)\r
- { mgl_data_norm_slice(this,v1,v2,dir,keep_en,sym); }\r
-\r
- /// Hankel transform\r
- inline void Hankel(const char *dir) { mgl_data_hankel(this,dir); }\r
- /// Sin-Fourier transform\r
- inline void SinFFT(const char *dir) { mgl_data_sinfft(this,dir); }\r
- /// Cos-Fourier transform\r
- inline void CosFFT(const char *dir) { mgl_data_cosfft(this,dir); }\r
- /// Fill data by 'x'/'k' samples for Hankel ('h') or Fourier ('f') transform\r
- inline void FillSample(const char *how)\r
- { mgl_data_fill_sample(this,how); }\r
-\r
- /// Interpolate by qubic splain the data to given point x=[0...nx-1], y=[0...ny-1], z=[0...nz-1]\r
- inline mreal Spline(mreal x,mreal y=0,mreal z=0) const\r
- { return mgl_data_spline(this, x,y,z); }\r
- /// Interpolate by qubic splain the data to given point \a x,\a y,\a z which normalized in range [0, 1]\r
- inline mreal Spline1(mreal x,mreal y=0,mreal z=0) const\r
- { return mgl_data_spline(this, x*(nx-1),y*(ny-1),z*(nz-1)); }\r
- /// Interpolate by linear function the data to given point x=[0...nx-1], y=[0...ny-1], z=[0...nz-1]\r
- inline mreal Linear(mreal x,mreal y=0,mreal z=0) const\r
- { return mgl_data_linear(this,x,y,z); }\r
- /// Interpolate by line the data to given point \a x,\a y,\a z which normalized in range [0, 1]\r
- inline mreal Linear1(mreal x,mreal y=0,mreal z=0) const\r
- { return mgl_data_linear(this,x*(nx-1),y*(ny-1),z*(nz-1)); }\r
-\r
- /// Print information about the data (sizes and momentum) to string\r
- inline const char *PrintInfo() const { return mgl_data_info(this); }\r
- /// Print information about the data (sizes and momentum) to FILE (for example, stdout)\r
- inline void PrintInfo(FILE *fp) const\r
- { if(fp) { fprintf(fp,"%s",mgl_data_info(this)); fflush(fp); } }\r
- /// Get maximal value of the data\r
- inline float Maximal() const { return mgl_data_max(this); }\r
- /// Get minimal value of the data\r
- inline float Minimal() const { return mgl_data_min(this); }\r
- /// Get maximal value of the data and its position\r
- inline mreal Maximal(long &i,long &j,long &k) const\r
- { return mgl_data_max_int(this,&i,&j,&k); }\r
- /// Get minimal value of the data and its position\r
- inline mreal Minimal(long &i,long &j,long &k) const\r
- { return mgl_data_min_int(this,&i,&j,&k); }\r
- /// Get maximal value of the data and its approximated position\r
- inline mreal Maximal(mreal &x,mreal &y,mreal &z) const\r
- { return mgl_data_max_real(this,&x,&y,&z); }\r
- /// Get minimal value of the data and its approximated position\r
- inline mreal Minimal(mreal &x,mreal &y,mreal &z) const\r
- { return mgl_data_min_real(this,&x,&y,&z); }\r
- /// Get "energy" and find first (median) and second (width) momentums of data\r
- inline mreal Momentum(char dir,mreal &m,mreal &w) const\r
- { return mgl_data_momentum_val(this,dir,&m,&w,0,0); }\r
- /// Get "energy and find 4 momentums of data: median, width, skewness, kurtosis\r
- inline mreal Momentum(char dir,mreal &m,mreal &w,mreal &s,mreal &k) const\r
- { return mgl_data_momentum_val(this,dir,&m,&w,&s,&k); }\r
- /// Find position (after specified in i,j,k) of first nonzero value of formula\r
- inline mreal Find(const char *cond, long &i, long &j, long &k) const\r
- { return mgl_data_first(this,cond,&i,&j,&k); }\r
- /// Find position (before specified in i,j,k) of last nonzero value of formula\r
- inline mreal Last(const char *cond, long &i, long &j, long &k) const\r
- { return mgl_data_last(this,cond,&i,&j,&k); }\r
- /// Find position of first in direction 'dir' nonzero value of formula\r
- inline long Find(const char *cond, char dir, long i=0, long j=0, long k=0) const\r
- { return mgl_data_find(this,cond,dir,i,j,k); }\r
- /// Find if any nonzero value of formula\r
- inline bool FindAny(const char *cond) const\r
- { return mgl_data_find_any(this,cond); }\r
-\r
- /// Copy data from other mglData variable\r
- inline mglData &operator=(const mglData &d)\r
- { if(this!=&d) Set(d.a,d.nx,d.ny,d.nz); return *this; }\r
- inline mreal operator=(mreal val)\r
- { for(long i=0;i<nx*ny*nz;i++) a[i]=val; return val; }\r
- /// Multiplicate the data by other one for each element\r
- inline void operator*=(const mglData &d) { mgl_data_mul_dat(this,&d); }\r
- /// Divide the data by other one for each element\r
- inline void operator/=(const mglData &d) { mgl_data_div_dat(this,&d); }\r
- /// Add the other data\r
- inline void operator+=(const mglData &d) { mgl_data_add_dat(this,&d); }\r
- /// Substract the other data\r
- inline void operator-=(const mglData &d) { mgl_data_sub_dat(this,&d); }\r
- /// Multiplicate each element by the number\r
- inline void operator*=(mreal d) { mgl_data_mul_num(this,d); }\r
- /// Divide each element by the number\r
- inline void operator/=(mreal d) { mgl_data_div_num(this,d); }\r
- /// Add the number\r
- inline void operator+=(mreal d) { mgl_data_add_num(this,d); }\r
- /// Substract the number\r
- inline void operator-=(mreal d) { mgl_data_sub_num(this,d); }\r
-#ifndef SWIG\r
- /// Direct access to the data cell\r
- inline mreal &operator[](long i) { return a[i]; }\r
- // NOTE see 13.10 for operator(), operator[] -- m.b. I should add it ???\r
-#endif\r
-protected:\r
- /// Get the value in given cell of the data without border checking\r
- inline mreal v(long i,long j=0,long k=0) const\r
-#ifdef DEBUG\r
- { if(i<0 || j<0 || k<0 || i>=nx || j>=ny || k>=nz) printf("Wrong index in mglData");\r
- return a[i+nx*(j+ny*k)]; }\r
-#else\r
- { return a[i+nx*(j+ny*k)]; }\r
-#endif\r
- inline mreal vthr(long i) const { return a[i]; }\r
- // add for speeding up !!!\r
- inline mreal dvx(long i,long j=0,long k=0) const\r
- { register long i0=i+nx*(j+ny*k);\r
- return i>0? (i<nx-1? (a[i0+1]-a[i0-1])/2:a[i0]-a[i0-1]) : a[i0+1]-a[i0]; }\r
- inline mreal dvy(long i,long j=0,long k=0) const\r
- { register long i0=i+nx*(j+ny*k);\r
- return j>0? (j<ny-1? (a[i0+nx]-a[i0-nx])/2:a[i0]-a[i0-nx]) : a[i0+nx]-a[i0];}\r
- inline mreal dvz(long i,long j=0,long k=0) const\r
- { register long i0=i+nx*(j+ny*k), n=nx*ny;\r
- return k>0? (k<nz-1? (a[i0+n]-a[i0-n])/2:a[i0]-a[i0-n]) : a[i0+n]-a[i0]; }\r
-};\r
-//-----------------------------------------------------------------------------\r
-#ifndef SWIG\r
-inline mglData operator*(const mglData &b, const mglData &d)\r
-{ mglData a(b); a*=d; return a; }\r
-inline mglData operator*(mreal b, const mglData &d)\r
-{ mglData a(d); a*=b; return a; }\r
-inline mglData operator*(const mglData &d, mreal b)\r
-{ mglData a(d); a*=b; return a; }\r
-inline mglData operator-(const mglData &b, const mglData &d)\r
-{ mglData a(b); a-=d; return a; }\r
-inline mglData operator-(mreal b, const mglData &d)\r
-{ mglData a(d); a-=b; return a; }\r
-inline mglData operator-(const mglData &d, mreal b)\r
-{ mglData a(d); a-=b; return a; }\r
-inline mglData operator+(const mglData &b, const mglData &d)\r
-{ mglData a(b); a+=d; return a; }\r
-inline mglData operator+(mreal b, const mglData &d)\r
-{ mglData a(d); a+=b; return a; }\r
-inline mglData operator+(const mglData &d, mreal b)\r
-{ mglData a(d); a+=b; return a; }\r
-inline mglData operator/(const mglData &b, const mglData &d)\r
-{ mglData a(b); a/=d; return a; }\r
-inline mglData operator/(const mglData &d, mreal b)\r
-{ mglData a(d); a/=b; return a; }\r
-inline bool operator==(const mglData &b, const mglData &d)\r
-{ if(b.nx!=d.nx || b.ny!=d.ny || b.ny!=d.ny) return false;\r
- return !memcmp(b.a,d.a,b.nx*b.ny*b.nz*sizeof(mreal)); }\r
-#endif\r
-//-----------------------------------------------------------------------------\r
-#ifndef SWIG\r
-mreal mglLinear(const mreal *a, long nx, long ny, long nz, mreal x, mreal y, mreal z);\r
-mreal mglSpline3(const mreal *a, long nx, long ny, long nz, mreal x, mreal y, mreal z,mreal *dx=0, mreal *dy=0, mreal *dz=0);\r
-#endif\r
-//-----------------------------------------------------------------------------\r
-/// Integral data transformation (like Fourier 'f' or 'i', Hankel 'h' or None 'n') for amplitude and phase\r
-inline mglData mglTransformA(const mglDataA &am, const mglDataA &ph, const char *tr)\r
-{ return mgl_transform_a(&am,&ph,tr); }\r
-/// Integral data transformation (like Fourier 'f' or 'i', Hankel 'h' or None 'n') for real and imaginary parts\r
-inline mglData mglTransform(const mglDataA &re, const mglDataA &im, const char *tr)\r
-{ return mgl_transform(&re,&im,tr); }\r
-/// Apply Fourier transform for the data and save result into it\r
-inline void mglFourier(mglData &re, mglData &im, const char *dir)\r
-{ mgl_data_fourier(&re,&im,dir); }\r
-/// Short time Fourier analysis for real and imaginary parts. Output is amplitude of partial Fourier (result will have size {dn, floor(nx/dn), ny} for dir='x'\r
-inline mglData mglSTFA(const mglDataA &re, const mglDataA &im, long dn, char dir='x')\r
-{ return mglData(true, mgl_data_stfa(&re,&im,dn,dir)); }\r
-//-----------------------------------------------------------------------------\r
-/// Saves result of PDE solving (|u|^2) for "Hamiltonian" \a ham with initial conditions \a ini\r
-inline mglData mglPDE(mglBase *gr, const char *ham, const mglData &ini_re, const mglData &ini_im, mreal dz=0.1, mreal k0=100,const char *opt="")\r
-{ return mglData(true, mgl_pde_solve(gr,ham, &ini_re, &ini_im, dz, k0,opt)); }\r
-/// Saves result of PDE solving for "Hamiltonian" \a ham with initial conditions \a ini along a curve \a ray (must have nx>=7 - x,y,z,px,py,pz,tau or nx=5 - x,y,px,py,tau)\r
-inline mglData mglQO2d(const char *ham, const mglData &ini_re, const mglData &ini_im, const mglData &ray, mreal r=1, mreal k0=100)\r
-{ return mglData(true, mgl_qo2d_solve(ham, &ini_re, &ini_im, &ray, r, k0, 0, 0)); }\r
-inline mglData mglQO2d(const char *ham, const mglData &ini_re, const mglData &ini_im, const mglData &ray, mglData &xx, mglData &yy, mreal r=1, mreal k0=100)\r
-{ return mglData(true, mgl_qo2d_solve(ham, &ini_re, &ini_im, &ray, r, k0, &xx, &yy)); }\r
-/// Prepares ray data for mglQO_PDE with starting point \a r0, \a p0\r
-inline mglData mglRay(const char *ham, mglPoint r0, mglPoint p0, mreal dt=0.1, mreal tmax=10)\r
-{ return mglData(true, mgl_ray_trace(ham, r0.x, r0.y, r0.z, p0.x, p0.y, p0.z, dt, tmax)); }\r
-/// Calculate Jacobian determinant for D{x(u,v), y(u,v)} = dx/du*dy/dv-dx/dv*dy/du\r
-inline mglData mglJacobian(const mglData &x, const mglData &y)\r
-{ return mglData(true, mgl_jacobian_2d(&x, &y)); }\r
-/// Calculate Jacobian determinant for D{x(u,v,w), y(u,v,w), z(u,v,w)}\r
-inline mglData mglJacobian(const mglData &x, const mglData &y, const mglData &z)\r
-{ return mglData(true, mgl_jacobian_3d(&x, &y, &z)); }\r
-/// Do something like Delone triangulation\r
-inline mglData mglTriangulation(const mglData &x, const mglData &y, const mglData &z, float er=0)\r
-{ return mglData(true,mgl_triangulation_3d(&x,&y,&z,er)); }\r
-inline mglData mglTriangulation(const mglData &x, const mglData &y, float er=0)\r
-{ return mglData(true,mgl_triangulation_2d(&x,&y,er)); }\r
-//-----------------------------------------------------------------------------\r
-#endif\r
-#endif\r
+++ /dev/null
-/***************************************************************************\r
- * data_cf.h is part of Math Graphic Library\r
- * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
- * *\r
- * This program is free software; you can redistribute it and/or modify *\r
- * it under the terms of the GNU Library General Public License as *\r
- * published by the Free Software Foundation; either version 3 of the *\r
- * License, or (at your option) any later version. *\r
- * *\r
- * This program is distributed in the hope that it will be useful, *\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
- * GNU General Public License for more details. *\r
- * *\r
- * You should have received a copy of the GNU Library General Public *\r
- * License along with this program; if not, write to the *\r
- * Free Software Foundation, Inc., *\r
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
- ***************************************************************************/\r
-#ifndef _MGL_DATA_CF_H_\r
-#define _MGL_DATA_CF_H_\r
-/*****************************************************************************/\r
-#include "mgl/base.h"\r
-/*****************************************************************************/\r
-#if MGL_HAVE_GSL\r
-#include <gsl/gsl_vector.h>\r
-#include <gsl/gsl_matrix.h>\r
-#else\r
-struct gsl_vector;\r
-struct gsl_matrix;\r
-#endif\r
-/*****************************************************************************/\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-/*****************************************************************************/\r
-void mgl_srnd(long seed);\r
-double mgl_rnd();\r
-double mgl_ipow(double x,int n);\r
-/*****************************************************************************/\r
-HMDT mgl_create_data();\r
-HMDT mgl_create_data_size(long nx, long ny, long nz);\r
-HMDT mgl_create_data_file(const char *fname);\r
-void mgl_delete_data(HMDT dat);\r
-const char *mgl_data_info(HCDT dat);\r
-/*****************************************************************************/\r
-uintptr_t mgl_create_data_();\r
-uintptr_t mgl_create_data_size_(int *nx, int *ny, int *nz);\r
-uintptr_t mgl_create_data_file_(const char *fname, int len);\r
-void mgl_delete_data_(uintptr_t *dat);\r
-/*****************************************************************************/\r
-/* Data creation functions */\r
-/*****************************************************************************/\r
-void mgl_data_rearrange(HMDT dat, long mx,long my,long mz);\r
-void mgl_data_link(HMDT dat, mreal *A,long mx,long my,long mz);\r
-void mgl_data_set_float(HMDT dat, const float *A,long mx,long my,long mz);\r
-void mgl_data_set_double(HMDT dat, const double *A,long mx,long my,long mz);\r
-void mgl_data_set_float2(HMDT d, const float **A,long N1,long N2);\r
-void mgl_data_set_double2(HMDT d, const double **A,long N1,long N2);\r
-void mgl_data_set_float3(HMDT d, const float ***A,long N1,long N2,long N3);\r
-void mgl_data_set_double3(HMDT d, const double ***A,long N1,long N2,long N3);\r
-void mgl_data_set(HMDT dat, HCDT a);\r
-void mgl_data_set_vector(HMDT dat, gsl_vector *v);\r
-void mgl_data_set_matrix(HMDT dat, gsl_matrix *m);\r
-void mgl_data_set_value(HMDT dat, float v, long i, long j, long k);\r
-float mgl_data_get_value(HCDT dat, long i, long j, long k);\r
-void mgl_data_set_values(HMDT dat, const char *val, long nx, long ny, long nz);\r
-\r
-int mgl_data_read_hdf(HMDT d,const char *fname,const char *data);\r
-void mgl_data_save_hdf(HCDT d,const char *fname,const char *data,int rewrite);\r
-int mgl_datas_hdf(const char *fname, char *buf, long size);\r
-int mgl_data_read(HMDT dat, const char *fname);\r
-int mgl_data_read_mat(HMDT dat, const char *fname, long dim);\r
-int mgl_data_read_dim(HMDT dat, const char *fname,long mx,long my,long mz);\r
-int mgl_data_read_range(HMDT d, const char *templ, double from, double to, double step, int as_slice);\r
-int mgl_data_read_all(HMDT dat, const char *templ, int as_slice);\r
-void mgl_data_save(HCDT dat, const char *fname,long ns);\r
-void mgl_data_export(HCDT dat, const char *fname, const char *scheme,float v1,float v2,long ns);\r
-void mgl_data_import(HMDT dat, const char *fname, const char *scheme,float v1,float v2);\r
-\r
-void mgl_data_create(HMDT dat, long nx,long ny,long nz);\r
-void mgl_data_transpose(HMDT dat, const char *dim);\r
-void mgl_data_norm(HMDT dat, float v1,float v2,long sym,long dim);\r
-void mgl_data_norm_slice(HMDT dat, float v1,float v2,char dir,long keep_en,long sym);\r
-HMDT mgl_data_subdata(HCDT dat, long xx,long yy,long zz);\r
-HMDT mgl_data_subdata_ext(HCDT dat, HCDT xx, HCDT yy, HCDT zz);\r
-HMDT mgl_data_column(HCDT dat, const char *eq);\r
-void mgl_data_set_id(HMDT d, const char *id);\r
-void mgl_data_fill(HMDT dat, float x1,float x2,char dir);\r
-void mgl_data_fill_eq(HMGL gr, HMDT dat, const char *eq, HCDT vdat, HCDT wdat,const char *opt);\r
-void mgl_data_put_val(HMDT dat, mreal val, long i, long j, long k);\r
-void mgl_data_put_dat(HMDT dat, HCDT val, long i, long j, long k);\r
-void mgl_data_modify(HMDT dat, const char *eq,long dim);\r
-void mgl_data_modify_vw(HMDT dat, const char *eq,HCDT vdat,HCDT wdat);\r
-void mgl_data_squeeze(HMDT dat, long rx,long ry,long rz,long smooth);\r
-float mgl_data_max(HCDT dat);\r
-float mgl_data_min(HCDT dat);\r
-mreal *mgl_data_value(HMDT dat, long i,long j,long k);\r
-mreal *mgl_data_data(HMDT dat);\r
-\r
-float mgl_data_first(HCDT dat, const char *cond, long *i, long *j, long *k);\r
-float mgl_data_last(HCDT dat, const char *cond, long *i, long *j, long *k);\r
-long mgl_data_find(HCDT dat, const char *cond, char dir, long i, long j, long k);\r
-int mgl_data_find_any(HCDT dat, const char *cond);\r
-float mgl_data_max_int(HCDT dat, long *i, long *j, long *k);\r
-float mgl_data_max_real(HCDT dat, mreal *x, mreal *y, mreal *z);\r
-float mgl_data_min_int(HCDT dat, long *i, long *j, long *k);\r
-float mgl_data_min_real(HCDT dat, mreal *x, mreal *y, mreal *z);\r
-float mgl_data_momentum_val(HCDT d, char dir, mreal *m, mreal *w, mreal *s, mreal *k);\r
-\r
-HMDT mgl_data_combine(HCDT dat1, HCDT dat2);\r
-void mgl_data_extend(HMDT dat, long n1, long n2);\r
-void mgl_data_insert(HMDT dat, char dir, long at, long num);\r
-void mgl_data_delete(HMDT dat, char dir, long at, long num);\r
-/*****************************************************************************/\r
-/* Data manipulation functions */\r
-/*****************************************************************************/\r
-void mgl_data_smooth(HMDT d, const char *dirs, float delta);\r
-HMDT mgl_data_sum(HCDT dat, const char *dir);\r
-HMDT mgl_data_max_dir(HCDT dat, const char *dir);\r
-HMDT mgl_data_min_dir(HCDT dat, const char *dir);\r
-void mgl_data_cumsum(HMDT dat, const char *dir);\r
-void mgl_data_integral(HMDT dat, const char *dir);\r
-void mgl_data_diff(HMDT dat, const char *dir);\r
-void mgl_data_diff_par(HMDT dat, HCDT v1, HCDT v2, HCDT v3);\r
-void mgl_data_diff2(HMDT dat, const char *dir);\r
-void mgl_data_swap(HMDT dat, const char *dir);\r
-void mgl_data_roll(HMDT dat, char dir, long num);\r
-void mgl_data_mirror(HMDT dat, const char *dir);\r
-void mgl_data_sort(HMDT dat, long idx, long idy);\r
-\r
-void mgl_data_hankel(HMDT dat, const char *dir);\r
-void mgl_data_sinfft(HMDT dat, const char *dir);\r
-void mgl_data_cosfft(HMDT dat, const char *dir);\r
-void mgl_data_fill_sample(HMDT dat, const char *how);\r
-\r
-float mgl_data_spline(HCDT dat, float x,float y,float z);\r
-float mgl_data_linear(HCDT dat, float x,float y,float z);\r
-HMDT mgl_data_trace(HCDT d);\r
-HMDT mgl_data_resize(HCDT dat, long mx,long my,long mz);\r
-HMDT mgl_data_resize_box(HCDT dat, long mx,long my,long mz,float x1,float x2,float y1,float y2,float z1,float z2);\r
-HMDT mgl_data_hist(HCDT dat, long n, float v1, float v2, long nsub);\r
-HMDT mgl_data_hist_w(HCDT dat, HCDT weight, long n, float v1, float v2, long nsub);\r
-HMDT mgl_data_momentum(HCDT dat, char dir, const char *how);\r
-HMDT mgl_data_evaluate(HCDT dat, HCDT idat, HCDT jdat, HCDT kdat, int norm);\r
-void mgl_data_envelop(HMDT dat, char dir);\r
-void mgl_data_sew(HMDT dat, const char *dirs, float da);\r
-void mgl_data_crop(HMDT dat, long n1, long n2, char dir);\r
-/*****************************************************************************/\r
-/* Data operations */\r
-/*****************************************************************************/\r
-void mgl_data_mul_dat(HMDT dat, HCDT d);\r
-void mgl_data_div_dat(HMDT dat, HCDT d);\r
-void mgl_data_add_dat(HMDT dat, HCDT d);\r
-void mgl_data_sub_dat(HMDT dat, HCDT d);\r
-void mgl_data_mul_num(HMDT dat, float d);\r
-void mgl_data_div_num(HMDT dat, float d);\r
-void mgl_data_add_num(HMDT dat, float d);\r
-void mgl_data_sub_num(HMDT dat, float d);\r
-/*****************************************************************************/\r
-HMDT mgl_pde_solve(HMGL gr, const char *ham, HCDT ini_re, HCDT ini_im, float dz, float k0,const char *opt);\r
-HMDT mgl_qo2d_solve(const char *ham, HCDT ini_re, HCDT ini_im, HCDT ray, float r, float k0, HMDT xx, HMDT yy);\r
-HMDT mgl_ray_trace(const char *ham, float x0, float y0, float z0, float px, float py, float pz, float dt, float tmax);\r
-HMDT mgl_jacobian_2d(HCDT x, HCDT y);\r
-HMDT mgl_jacobian_3d(HCDT x, HCDT y, HCDT z);\r
-HMDT mgl_transform_a(HCDT am, HCDT ph, const char *tr);\r
-HMDT mgl_transform(HCDT re, HCDT im, const char *tr);\r
-void mgl_data_fourier(HMDT re, HMDT im, const char *dir);\r
-HMDT mgl_data_stfa(HCDT re, HCDT im, long dn, char dir);\r
-\r
-HMDT mgl_triangulation_3d(HCDT x, HCDT y, HCDT z, float er);\r
-HMDT mgl_triangulation_2d(HCDT x, HCDT y, float er);\r
-/*****************************************************************************/\r
-/* Data creation functions */\r
-/*****************************************************************************/\r
-void mgl_data_rearrange_(uintptr_t *dat, int *mx, int *my, int *mz);\r
-void mgl_data_set_float_(uintptr_t *dat, const float *A,int *NX,int *NY,int *NZ);\r
-void mgl_data_set_double_(uintptr_t *dat, const double *A,int *NX,int *NY,int *NZ);\r
-void mgl_data_set_float1_(uintptr_t *d, const float *A,int *N1);\r
-void mgl_data_set_double1_(uintptr_t *d, const double *A,int *N1);\r
-void mgl_data_set_float2_(uintptr_t *d, const float *A,int *N1,int *N2);\r
-void mgl_data_set_double2_(uintptr_t *d, const double *A,int *N1,int *N2);\r
-void mgl_data_set_float3_(uintptr_t *d, const float *A,int *N1,int *N2,int *N3);\r
-void mgl_data_set_double3_(uintptr_t *d, const double *A,int *N1,int *N2,int *N3);\r
-void mgl_data_set_(uintptr_t *dat, uintptr_t *a);\r
-\r
-void mgl_data_set_value_(uintptr_t *d, float *v, int *i, int *j, int *k);\r
-void mgl_data_set_values_(uintptr_t *d, const char *val, int *nx, int *ny, int *nz, int l);\r
-float mgl_data_get_value_(uintptr_t *d, int *i, int *j, int *k);\r
-int mgl_data_read_(uintptr_t *d, const char *fname,int l);\r
-int mgl_data_read_mat_(uintptr_t *dat, const char *fname, int *dim, int);\r
-int mgl_data_read_dim_(uintptr_t *dat, const char *fname,int *mx,int *my,int *mz,int);\r
-void mgl_data_save_(uintptr_t *dat, const char *fname,int *ns,int);\r
-void mgl_data_export_(uintptr_t *dat, const char *fname, const char *scheme,float *v1,float *v2,int *ns,int,int);\r
-void mgl_data_import_(uintptr_t *dat, const char *fname, const char *scheme,float *v1,float *v2,int,int);\r
-void mgl_data_create_(uintptr_t *dat, int *nx,int *ny,int *nz);\r
-void mgl_data_transpose_(uintptr_t *dat, const char *dim,int);\r
-void mgl_data_norm_(uintptr_t *dat, float *v1,float *v2,int *sym,int *dim);\r
-void mgl_data_norm_slice_(uintptr_t *dat, float *v1,float *v2,char *dir,int *keep_en,int *sym,int l);\r
-uintptr_t mgl_data_subdata_(uintptr_t *dat, int *xx,int *yy,int *zz);\r
-uintptr_t mgl_data_subdata_ext_(uintptr_t *dat, uintptr_t *xx,uintptr_t *yy,uintptr_t *zz);\r
-uintptr_t mgl_data_column_(uintptr_t *dat, const char *eq,int l);\r
-void mgl_data_set_id_(uintptr_t *dat, const char *id,int l);\r
-void mgl_data_fill_(uintptr_t *dat, float *x1,float *x2,const char *dir,int);\r
-void mgl_data_fill_eq_(uintptr_t *gr, uintptr_t *dat, const char *eq, uintptr_t *vdat, uintptr_t *wdat,const char *opt, int, int);\r
-void mgl_data_put_val_(uintptr_t *dat, float *val, int *i, int *j, int *k);\r
-void mgl_data_put_dat_(uintptr_t *dat, uintptr_t *val, int *i, int *j, int *k);\r
-void mgl_data_modify_(uintptr_t *dat, const char *eq,int *dim,int);\r
-void mgl_data_modify_vw_(uintptr_t *dat, const char *eq, uintptr_t *vdat, uintptr_t *wdat,int);\r
-void mgl_data_squeeze_(uintptr_t *dat, int *rx,int *ry,int *rz,int *smooth);\r
-float mgl_data_max_(uintptr_t *dat);\r
-float mgl_data_min_(uintptr_t *dat);\r
-\r
-float mgl_data_first_(uintptr_t *dat, const char *cond, int *i, int *j, int *k, int);\r
-float mgl_data_last_(uintptr_t *dat, const char *cond, int *i, int *j, int *k, int);\r
-int mgl_data_find_(uintptr_t *dat, const char *cond, char *dir, int *i, int *j, int *k, int,int);\r
-int mgl_data_find_any_(uintptr_t *dat, const char *cond, int);\r
-float mgl_data_max_int_(uintptr_t *dat, int *i, int *j, int *k);\r
-float mgl_data_max_real_(uintptr_t *dat, float *x, float *y, float *z);\r
-float mgl_data_min_int_(uintptr_t *dat, int *i, int *j, int *k);\r
-float mgl_data_min_real_(uintptr_t *dat, float *x, float *y, float *z);\r
-float mgl_data_momentum_val_(uintptr_t *dat, char *dir, float *m, float *w, float *s, float *k,int);\r
-\r
-uintptr_t mgl_data_combine_(uintptr_t *dat1, uintptr_t *dat2);\r
-void mgl_data_extend_(uintptr_t *dat, int *n1, int *n2);\r
-void mgl_data_insert_(uintptr_t *dat, const char *dir, int *at, int *num, int);\r
-void mgl_data_delete_(uintptr_t *dat, const char *dir, int *at, int *num, int);\r
-/*****************************************************************************/\r
-/* Data manipulation functions */\r
-/*****************************************************************************/\r
-void mgl_data_smooth_(uintptr_t *dat, const char *dirs, float *delta,int);\r
-uintptr_t mgl_data_sum_(uintptr_t *dat, const char *dir,int);\r
-uintptr_t mgl_data_max_dir_(uintptr_t *dat, const char *dir,int);\r
-uintptr_t mgl_data_min_dir_(uintptr_t *dat, const char *dir,int);\r
-void mgl_data_cumsum_(uintptr_t *dat, const char *dir,int);\r
-void mgl_data_integral_(uintptr_t *dat, const char *dir,int);\r
-void mgl_data_diff_(uintptr_t *dat, const char *dir,int);\r
-void mgl_data_diff_par_(uintptr_t *dat, uintptr_t *v1, uintptr_t *v2, uintptr_t *v3);\r
-void mgl_data_diff2_(uintptr_t *dat, const char *dir,int);\r
-void mgl_data_swap_(uintptr_t *dat, const char *dir,int);\r
-void mgl_data_roll_(uintptr_t *dat, const char *dir, int *num, int);\r
-void mgl_data_mirror_(uintptr_t *dat, const char *dir,int);\r
-void mgl_data_sort_(uintptr_t *dat, int *idx, int *idy);\r
-\r
-void mgl_data_hankel_(uintptr_t *dat, const char *dir,int);\r
-void mgl_data_sinfft_(uintptr_t *dat, const char *dir,int);\r
-void mgl_data_cosfft_(uintptr_t *dat, const char *dir,int);\r
-void mgl_data_fill_sample_(uintptr_t *dat, const char *how,int);\r
-\r
-float mgl_data_spline_(uintptr_t *dat, float *x,float *y,float *z);\r
-float mgl_data_linear_(uintptr_t *dat, float *x,float *y,float *z);\r
-uintptr_t mgl_data_trace_(uintptr_t *d);\r
-uintptr_t mgl_data_resize_(uintptr_t *dat, int *mx,int *my,int *mz);\r
-uintptr_t mgl_data_resize_box_(uintptr_t *dat, int *mx,int *my,int *mz,float *x1,float *x2,float *y1,float *y2,float *z1,float *z2);\r
-uintptr_t mgl_data_momentum_(uintptr_t *dat, char *dir, const char *how, int,int);\r
-uintptr_t mgl_data_hist_(uintptr_t *dat, int *n, float *v1, float *v2, int *nsub);\r
-uintptr_t mgl_data_hist_w_(uintptr_t *dat, uintptr_t *weight, int *n, float *v1, float *v2, int *nsub);\r
-uintptr_t mgl_data_evaluate_(uintptr_t *dat, uintptr_t *idat, uintptr_t *jdat, uintptr_t *kdat, int *norm);\r
-void mgl_data_envelop_(uintptr_t *dat, const char *dir, int);\r
-void mgl_data_sew_(uintptr_t *dat, const char *dirs, float *da, int);\r
-void mgl_data_crop_(uintptr_t *dat, int *n1, int *n2, const char *dir,int);\r
-/*****************************************************************************/\r
-/* Data operations */\r
-/*****************************************************************************/\r
-void mgl_data_mul_dat_(uintptr_t *dat, uintptr_t *d);\r
-void mgl_data_div_dat_(uintptr_t *dat, uintptr_t *d);\r
-void mgl_data_add_dat_(uintptr_t *dat, uintptr_t *d);\r
-void mgl_data_sub_dat_(uintptr_t *dat, uintptr_t *d);\r
-void mgl_data_mul_num_(uintptr_t *dat, float *d);\r
-void mgl_data_div_num_(uintptr_t *dat, float *d);\r
-void mgl_data_add_num_(uintptr_t *dat, float *d);\r
-void mgl_data_sub_num_(uintptr_t *dat, float *d);\r
-/*****************************************************************************/\r
-/* Nonlinear fitting */\r
-/*****************************************************************************/\r
-uintptr_t mgl_pde_solve_(uintptr_t* gr, const char *ham, uintptr_t* ini_re, uintptr_t* ini_im, float *dz, float *k0,const char *opt,int,int);\r
-uintptr_t mgl_qo2d_solve_(const char *ham, uintptr_t* ini_re, uintptr_t* ini_im, uintptr_t* ray, float *r, float *k0, uintptr_t* xx, uintptr_t* yy, int);\r
-uintptr_t mgl_ray_trace_(const char *ham, float *x0, float *y0, float *z0, float *px, float *py, float *pz, float *dt, float *tmax,int);\r
-uintptr_t mgl_jacobian_2d_(uintptr_t* x, uintptr_t* y);\r
-uintptr_t mgl_jacobian_3d_(uintptr_t* x, uintptr_t* y, uintptr_t* z);\r
-\r
-uintptr_t mgl_transform_a_(uintptr_t *am, uintptr_t *ph, const char *tr, int);\r
-uintptr_t mgl_transform_(uintptr_t *re, uintptr_t *im, const char *tr, int);\r
-void mgl_data_fourier_(uintptr_t *re, uintptr_t *im, const char *dir, int l);\r
-uintptr_t mgl_data_stfa_(uintptr_t *re, uintptr_t *im, int *dn, char *dir, int);\r
-\r
-uintptr_t mgl_triangulation_3d_(uintptr_t *x, uintptr_t *y, uintptr_t *z, float *er);\r
-uintptr_t mgl_triangulation_2d_(uintptr_t *x, uintptr_t *y, float *er);\r
-/*****************************************************************************/\r
-int mgl_data_read_hdf_(uintptr_t *d, const char *fname, const char *data,int l,int n);\r
-void mgl_data_link_(uintptr_t *d, float *A, int *nx,int *ny,int *nz);\r
-void mgl_data_save_hdf_(uintptr_t *d, const char *fname, const char *data, int *rewrite,int l,int n);\r
-int mgl_data_read_range_(uintptr_t *d, const char *fname, double *from, double *to, double *step, int *as_slice,int l);\r
-int mgl_data_read_all_(uintptr_t *d, const char *fname, int *as_slice,int l);\r
-/*****************************************************************************/\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-#endif\r
+++ /dev/null
-/***************************************************************************\r
- * define.h is part of Math Graphic Library\r
- * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
- * *\r
- * This program is free software; you can redistribute it and/or modify *\r
- * it under the terms of the GNU Library General Public License as *\r
- * published by the Free Software Foundation; either version 3 of the *\r
- * License, or (at your option) any later version. *\r
- * *\r
- * This program is distributed in the hope that it will be useful, *\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
- * GNU General Public License for more details. *\r
- * *\r
- * You should have received a copy of the GNU Library General Public *\r
- * License along with this program; if not, write to the *\r
- * Free Software Foundation, Inc., *\r
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
- ***************************************************************************/\r
-#ifndef _MGL_DEFINE_H_\r
-#define _MGL_DEFINE_H_\r
-//-----------------------------------------------------------------------------\r
-#ifdef WIN32 //_MSC_VER needs this before math.h\r
-#define _USE_MATH_DEFINES\r
-#endif\r
-\r
-#include <math.h>\r
-#include <stdlib.h>\r
-#include <string.h>\r
-\r
-#define MGL_VER2 0.0\r
-\r
-//#ifdef WIN32\r
-#ifdef _MSC_VER\r
-#define hypot _hypot\r
-#define getcwd _getcwd\r
-#define isfinite _finite\r
-#define chdir _chdir // BORLAND has chdir\r
-#include <float.h>\r
-\r
-const unsigned long mgl_nan[2] = {0xffffffff, 0x7fffffff};\r
-#define NANd (*(double*)mgl_nan)\r
-#define NANf (*(float*)&(mgl_nan[1]))\r
-#if MGL_USE_DOUBLE\r
-#define NAN NANd\r
-#else\r
-#define NAN NANd\r
-#endif\r
-#endif\r
-\r
-#ifndef M_PI\r
-#define M_PI 3.14159265358979323846 /* pi */\r
-#endif\r
-//-----------------------------------------------------------------------------\r
-#ifdef WIN32\r
-#define mglprintf _snwprintf\r
-#else\r
-#define mglprintf swprintf\r
-#endif\r
-//#define FLT_EPS 1.1920928955078125e-07\r
-#define MGL_FLT_EPS (1.+1e-05)\r
-//-----------------------------------------------------------------------------\r
-#ifndef isnan\r
-#define isnan(a) ((a)!=(a))\r
-#endif\r
-//-----------------------------------------------------------------------------\r
-#include <mgl/config.h>\r
-//-----------------------------------------------------------------------------\r
-#if MGL_USE_DOUBLE\r
-typedef double mreal;\r
-#else\r
-typedef float mreal;\r
-#endif\r
-//-----------------------------------------------------------------------------\r
-#ifndef MGL_CMAP_COLOR\r
-#define MGL_CMAP_COLOR 32\r
-#endif\r
-//-----------------------------------------------------------------------------\r
-#ifndef MGL_STACK_ENTRY\r
-#define MGL_STACK_ENTRY 10\r
-#endif\r
-//-----------------------------------------------------------------------------\r
-#ifndef MGL_DEF_VIEWER\r
-#define MGL_DEF_VIEWER "evince"\r
-#endif\r
-//-----------------------------------------------------------------------------\r
-#ifndef MGL_FONT_PATH\r
-#ifdef WIN32\r
-#define MGL_FONT_PATH "." // path to fonts\r
-#else\r
-#define MGL_FONT_PATH "/usr/local/share/mathgl/fonts" // path to fonts\r
-#endif\r
-#endif\r
-//-----------------------------------------------------------------------------\r
-#define mgl_min(a,b) (((a)>(b)) ? (b) : (a))\r
-#define mgl_max(a,b) (((a)>(b)) ? (a) : (b))\r
-//-----------------------------------------------------------------------------\r
-#define SMOOTH_NONE 0\r
-#define SMOOTH_LINE_3 1\r
-#define SMOOTH_LINE_5 2\r
-#define SMOOTH_QUAD_5 3\r
-//-----------------------------------------------------------------------------\r
-#define MGL_HIST_IN 0\r
-#define MGL_HIST_SUM 1\r
-#define MGL_HIST_UP 2\r
-#define MGL_HIST_DOWN 3\r
-//-----------------------------------------------------------------------------\r
-enum{ // types of predefined curvelinear coordinate systems\r
- mglCartesian = 0, // no transformation\r
- mglPolar,\r
- mglSpherical,\r
- mglParabolic,\r
- mglParaboloidal,\r
- mglOblate,\r
- mglProlate,\r
- mglElliptic,\r
- mglToroidal,\r
- mglBispherical,\r
- mglBipolar,\r
- mglLogLog,\r
- mglLogX,\r
- mglLogY\r
-};\r
-//-----------------------------------------------------------------------------\r
-// types of drawing\r
-#define MGL_DRAW_WIRE 0 // fastest, no faces\r
-#define MGL_DRAW_FAST 1 // fast, no color interpolation\r
-#define MGL_DRAW_NORM 2 // high quality, slower\r
-#define MGL_DRAW_LMEM 4 // low memory usage (direct to pixel)\r
-//-----------------------------------------------------------------------------\r
-enum{ // Codes for warnings/messages\r
- mglWarnNone = 0,// Everything OK\r
- mglWarnDim, // Data dimension(s) is incompatible\r
- mglWarnLow, // Data dimension(s) is too small\r
- mglWarnNeg, // Minimal data value is negative\r
- mglWarnFile, // No file or wrong data dimensions\r
- mglWarnMem, // Not enough memory\r
- mglWarnZero, // Data values are zero\r
- mglWarnLeg, // No legend entries\r
- mglWarnSlc, // Slice value is out of range\r
- mglWarnCnt, // Number of contours is zero or negative\r
- mglWarnOpen, // Couldn't open file\r
- mglWarnLId, // Light: ID is out of range\r
- mglWarnSize, // Setsize: size(s) is zero or negative\r
- mglWarnFmt, // Format is not supported for that build\r
- mglWarnTern, // Axis ranges are incompatible\r
- mglWarnNull, // Pointer is NULL\r
- mglWarnSpc, // Not enough space for plot\r
- mglWarnEnd // Maximal number of warnings (must be last)\r
-};\r
-//-----------------------------------------------------------------------------\r
-#ifndef MGL_DEF_PAL\r
-#define MGL_DEF_PAL "bgrcmyhlnqeupH" // default palette\r
-#endif\r
-#define MGL_COLORS "kwrgbcymhWRGBCYMHlenpquLENPQU"\r
-//-----------------------------------------------------------------------------\r
-#define MGL_TRANSP_NORM 0x000000\r
-#define MGL_TRANSP_GLASS 0x000001\r
-#define MGL_TRANSP_LAMP 0x000002\r
-#define MGL_ENABLE_CUT 0x000004 ///< Flag which determines how points outside bounding box are drown.\r
-#define MGL_ENABLE_RTEXT 0x000008 ///< Use text rotation along axis\r
-#define MGL_AUTO_FACTOR 0x000010 ///< Enable autochange PlotFactor\r
-#define MGL_ENABLE_ALPHA 0x000020 ///< Flag that Alpha is used\r
-#define MGL_ENABLE_LIGHT 0x000040 ///< Flag of using lightning\r
-#define MGL_TICKS_ROTATE 0x000080 ///< Allow ticks rotation\r
-#define MGL_TICKS_SKIP 0x000100 ///< Allow ticks rotation\r
-// flags for internal use only\r
-#define MGL_DISABLE_SCALE 0x000200 ///< Temporary flag for disable scaling (used for axis)\r
-#define MGL_FINISHED 0x000400 ///< Flag that final picture (i.e. mglCanvas::G) is ready\r
-//#define MGL_AUTO_CLF 0x000800 ///< Clear canvas between drawing\r
-#define MGL_SHOW_POS 0x001000 ///< Switch to show or not mouse click position\r
-#define MGL_CLF_ON_UPD 0x002000 ///< Clear plot before Update()\r
-//#define MGL_HIGHLIGHT 0x004000 ///< Highlight plot\r
-#define MGL_DIFFUSIVE 0x008000 ///< Use diffusive light instead of specular\r
-#define MGL_USEDRWDAT 0x010000 ///< Use DrwDat to remember all data of frames\r
-#define MGL_REDUCEACC 0x020000 ///< Reduce accuracy of points (to reduc size of output files)\r
-//-----------------------------------------------------------------------------\r
-//#define mgl_realloc(T,o,no,nn) {T *_tmp = new T[nn]; memcpy(_tmp,o,(no)*sizeof(T)); delete []o; o=_tmp;}\r
-//-----------------------------------------------------------------------------\r
-#ifdef __cplusplus\r
-//-----------------------------------------------------------------------------\r
-struct mglThreadD\r
-{\r
- mreal *a; // float* array with parameters or results\r
- const mreal *b,*c,*d,*e; // float* arrays with parameters\r
- const long *p; // long* array with parameters\r
- void *v; // pointer to data/grapher\r
- int id; // thread id\r
- long n; // total number of iteration\r
- char *s;\r
-};\r
-/// Start several thread for the task\r
-void mglStartThread(void *(*func)(void *), void (*post)(mglThreadD *,mreal *), long n,\r
- mreal *a=0, const mreal *b=0, const mreal *c=0, const long *p=0,\r
- void *v=0, const mreal *d=0, const mreal *e=0, char *s=0);\r
-extern int mglNumThr; ///< Number of thread for plotting and data handling\r
-//-----------------------------------------------------------------------------\r
-extern "C" {\r
-#endif\r
-/** Set number of thread for plotting and data handling*/\r
-void mgl_set_num_thr(int n);\r
-void mgl_test_txt(const char *str, ...);\r
-void mgl_set_test_mode(int enable);\r
-/** Duplicate string (returned pointer must be free() after usage) */\r
-char *mgl_strdup(const char *s);\r
-wchar_t *mgl_wcsdup(const wchar_t *s);\r
-/** Remove spaces at begining and at the end of the string */\r
-void mgl_strtrim(char *str);\r
-void mgl_wcstrim(wchar_t *str);\r
-/** Change register to lowercase (only for ANSI symbols) */\r
-void mgl_strlwr(char *str);\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-#if MGL_HAVE_PTHREAD\r
-#include <pthread.h>\r
-#define MGL_PUSH(a,v,m) {pthread_mutex_lock(&m); a.push_back(v); pthread_mutex_unlock(&m);}\r
-#else\r
-#define MGL_PUSH(a,v,m) a.push_back(v);\r
-#endif\r
-//-----------------------------------------------------------------------------\r
-#endif\r
-//-----------------------------------------------------------------------------\r
+++ /dev/null
-/***************************************************************************\r
- * eval.h is part of Math Graphic Library\r
- * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
- * *\r
- * This program is free software; you can redistribute it and/or modify *\r
- * it under the terms of the GNU Library General Public License as *\r
- * published by the Free Software Foundation; either version 3 of the *\r
- * License, or (at your option) any later version. *\r
- * *\r
- * This program is distributed in the hope that it will be useful, *\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
- * GNU General Public License for more details. *\r
- * *\r
- * You should have received a copy of the GNU Library General Public *\r
- * License along with this program; if not, write to the *\r
- * Free Software Foundation, Inc., *\r
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
- ***************************************************************************/\r
-//---------------------------------------------------------------------------\r
-#ifndef _MGL_EVAL_H_\r
-#define _MGL_EVAL_H_\r
-//---------------------------------------------------------------------------\r
-#include <math.h>\r
-#include "mgl/define.h"\r
-/// types of errors\r
-#define MGL_ERR_LOG 1\r
-#define MGL_ERR_ARC 2\r
-#define MGL_ERR_SQRT 3\r
-/// size of \a var array\r
-const int MGL_VS = 'z'-'a'+1;\r
-//---------------------------------------------------------------------------\r
-/// Class for evaluating formula specified by the string\r
-class mglFormula // îáúåêò äëÿ ââîäà è âû÷èñëåíèÿ ôîðìóë\r
-{\r
-public:\r
- /// Evaluates the formula for 'x','r'=\a x, 'y','n'=\a y, 'z','t'=\a z, 'u'=\a u\r
- mreal Calc(mreal x,mreal y=0,mreal z=0,mreal u=0) const;\r
- /// Evaluates the formula for 'x, y, z, u, v, w'\r
- mreal Calc(mreal x,mreal y,mreal z,mreal u,mreal v,mreal w) const;\r
- /// Evaluates the formula for variables \a var\r
- mreal Calc(const mreal var[MGL_VS]) const;\r
- /// Evaluates the formula for 'x','r'=\a x, 'y','n'=\a y, 'z','t'=\a z, 'u'=\a u\r
- mreal CalcD(char diff, mreal x,mreal y=0,mreal z=0,mreal u=0) const;\r
- /// Evaluates the formula for 'x, y, z, u, v, w'\r
- mreal CalcD(char diff, mreal x,mreal y,mreal z,mreal u,mreal v,mreal w) const;\r
- /// Evaluates the derivates of the formula for variables \a var respect to variable \a diff\r
- mreal CalcD(const mreal var[MGL_VS], char diff) const;\r
- /// Return error code\r
- int GetError() const;\r
- /// Parse the formula \a str and create formula-tree\r
- mglFormula(const char *str);\r
- /// Clean up formula-tree\r
- ~mglFormula();\r
-protected:\r
- mreal CalcIn(const mreal *a1) const;\r
- mreal CalcDIn(int id, const mreal *a1) const;\r
- mglFormula *Left,*Right; // first and second argument of the function\r
- int Kod; // the function ID\r
- mreal Res; // the number or the variable ID\r
- static int Error;\r
-};\r
-//---------------------------------------------------------------------------\r
-#endif\r
+++ /dev/null
-/***************************************************************************\r
- * evalc.h is part of Math Graphic Library\r
- * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
- * *\r
- * This program is free software; you can redistribute it and/or modify *\r
- * it under the terms of the GNU Library General Public License as *\r
- * published by the Free Software Foundation; either version 3 of the *\r
- * License, or (at your option) any later version. *\r
- * *\r
- * This program is distributed in the hope that it will be useful, *\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
- * GNU General Public License for more details. *\r
- * *\r
- * You should have received a copy of the GNU Library General Public *\r
- * License along with this program; if not, write to the *\r
- * Free Software Foundation, Inc., *\r
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
- ***************************************************************************/\r
-//---------------------------------------------------------------------------\r
-#ifndef _MGL_EVALC_H_\r
-#define _MGL_EVALC_H_\r
-//---------------------------------------------------------------------------\r
-#include <complex>\r
-#ifndef dual\r
-#define dual std::complex<double> ///< short name for complex numbers\r
-#endif\r
-#include "mgl/eval.h"\r
-//---------------------------------------------------------------------------\r
-/// Class for evaluating formula specified by the string\r
-class mglFormulaC // îáúåêò äëÿ ââîäà è âû÷èñëåíèÿ ôîðìóë\r
-{\r
-public:\r
- /// Evaluates the formula for 'x','r'=\a x, 'y','n'=\a y, 'z','t'=\a z, 'u'=\a u\r
- dual Calc(dual x,dual y=0,dual z=0,dual u=0) const;\r
- /// Evaluates the formula for 'x, y, z, u, v, w'\r
- dual Calc(dual x,dual y,dual z,dual u,dual v,dual w) const;\r
- /// Evaluates the formula for variables \a var\r
- dual Calc(const dual var[MGL_VS]) const;\r
- /// Return error code\r
- int GetError() const;\r
- /// Parse the formula \a str and create formula-tree\r
- mglFormulaC(const char *str);\r
- /// Clean up formula-tree\r
- virtual ~mglFormulaC();\r
-protected:\r
- dual CalcIn(const dual *a1) const;\r
- mglFormulaC *Left,*Right; // first and second argument of the function\r
- int Kod; // the function ID\r
- dual Res; // the number or the variable ID\r
- static int Error;\r
-};\r
-//---------------------------------------------------------------------------\r
-#endif\r
+++ /dev/null
-/***************************************************************************\r
- * fit.h is part of Math Graphic Library\r
- * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
- * *\r
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU Library General Public License as *
- * published by the Free Software Foundation; either version 3 of the *
- * License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU Library General Public *
- * License along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
- ***************************************************************************/
-#ifndef _MGL_FIT_H_\r
-#define _MGL_FIT_H_
-#include "mgl/base.h"\r
-/*****************************************************************************/\r
-#ifdef __cplusplus
-extern "C" {\r
-#endif\r
-/*****************************************************************************/
-extern int mglFitPnts; ///< Number of output points in fitting
-extern char mglFitRes[1024]; ///< Last fitted formula\r
-HMDT mgl_fit_1(HMGL gr, HCDT y, const char *eq, const char *var, HMDT ini, const char *opt);\r
-HMDT mgl_fit_2(HMGL gr, HCDT z, const char *eq, const char *var, HMDT ini, const char *opt);\r
-HMDT mgl_fit_3(HMGL gr, HCDT a, const char *eq, const char *var, HMDT ini, const char *opt);\r
-HMDT mgl_fit_xy(HMGL gr, HCDT x, HCDT y, const char *eq, const char *var, HMDT ini, const char *opt);\r
-HMDT mgl_fit_xyz(HMGL gr, HCDT x, HCDT y, HCDT z, const char *eq, const char *var, HMDT ini, const char *opt);\r
-HMDT mgl_fit_xyza(HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *eq, const char *var, HMDT ini, const char *opt);\r
-HMDT mgl_fit_ys(HMGL gr, HCDT y, HCDT s, const char *eq, const char *var, HMDT ini, const char *opt);\r
-HMDT mgl_fit_xys(HMGL gr, HCDT x, HCDT y, HCDT s, const char *eq, const char *var, HMDT ini, const char *opt);\r
-HMDT mgl_fit_xyzs(HMGL gr, HCDT x, HCDT y, HCDT z, HCDT s, const char *eq, const char *var, HMDT ini, const char *opt);\r
-HMDT mgl_fit_xyzas(HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, HCDT s, const char *eq, const char *var, HMDT ini, const char *opt);\r
-\r
-const char *mgl_get_fit(HMGL gr);\r
-
-HMDT mgl_hist_x(HMGL gr, HCDT x, HCDT a, const char *opt);\r
-HMDT mgl_hist_xy(HMGL gr, HCDT x, HCDT y, HCDT a, const char *opt);\r
-HMDT mgl_hist_xyz(HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *opt);\r
-
-/*****************************************************************************/\r
-uintptr_t mgl_fit_1_(uintptr_t* gr, uintptr_t* y, const char *eq, const char *var, uintptr_t *ini, const char *opt,int, int l, int n);\r
-uintptr_t mgl_fit_2_(uintptr_t* gr, uintptr_t* z, const char *eq, const char *var, uintptr_t *ini, const char *opt,int, int l, int n);\r
-uintptr_t mgl_fit_3_(uintptr_t* gr, uintptr_t* a, const char *eq, const char *var, uintptr_t *ini, const char *opt,int, int l, int n);\r
-uintptr_t mgl_fit_xy_(uintptr_t* gr, uintptr_t* x, uintptr_t* y, const char *eq, const char *var, uintptr_t *ini, const char *opt,int, int l, int n);\r
-uintptr_t mgl_fit_xyz_(uintptr_t* gr, uintptr_t* x, uintptr_t* y, uintptr_t* z, const char *eq, const char *var, uintptr_t *ini, const char *opt,int, int l, int n);\r
-uintptr_t mgl_fit_xyza_(uintptr_t* gr, uintptr_t* x, uintptr_t* y, uintptr_t* z, uintptr_t* a, const char *eq, const char *var, uintptr_t *ini, const char *opt,int, int l, int n);\r
-uintptr_t mgl_fit_ys_(uintptr_t* gr, uintptr_t* y, uintptr_t* ss, const char *eq, const char *var, uintptr_t *ini, const char *opt,int, int l, int n);\r
-uintptr_t mgl_fit_xys_(uintptr_t* gr, uintptr_t* x, uintptr_t* y, uintptr_t* ss, const char *eq, const char *var, uintptr_t *ini, const char *opt,int, int l, int n);\r
-uintptr_t mgl_fit_xyzs_(uintptr_t* gr, uintptr_t* x, uintptr_t* y, uintptr_t* z, uintptr_t* ss, const char *eq, const char *var, uintptr_t *ini, const char *opt,int, int l, int n);\r
-uintptr_t mgl_fit_xyzas_(uintptr_t* gr, uintptr_t* x, uintptr_t* y, uintptr_t* z, uintptr_t* a, uintptr_t* ss, const char *eq, const char *var, uintptr_t *ini, const char *opt,int, int l, int n);\r
-
-uintptr_t mgl_hist_x_(uintptr_t* gr, uintptr_t* x, uintptr_t* a, const char *opt,int);
-uintptr_t mgl_hist_xy_(uintptr_t* gr, uintptr_t* x, uintptr_t* y, uintptr_t* a, const char *opt,int);
-uintptr_t mgl_hist_xyz_(uintptr_t* gr, uintptr_t* x, uintptr_t* y, uintptr_t* z, uintptr_t* a, const char *opt,int);
-/*****************************************************************************/\r
-#ifdef __cplusplus\r
-}\r
-#endif
-/*****************************************************************************/\r
-#endif
+++ /dev/null
-/***************************************************************************\r
- * window.h is part of Math Graphic Library\r
- * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
- * *\r
- * This program is free software; you can redistribute it and/or modify *\r
- * it under the terms of the GNU Library General Public License as *\r
- * published by the Free Software Foundation; either version 3 of the *\r
- * License, or (at your option) any later version. *\r
- * *\r
- * This program is distributed in the hope that it will be useful, *\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
- * GNU General Public License for more details. *\r
- * *\r
- * You should have received a copy of the GNU Library General Public *\r
- * License along with this program; if not, write to the *\r
- * Free Software Foundation, Inc., *\r
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
- ***************************************************************************/\r
-//-----------------------------------------------------------------------------\r
-#ifndef _MGL_FLTK_H_\r
-#define _MGL_FLTK_H_\r
-/*****************************************************************************/\r
-#ifdef __cplusplus\r
-#include "mgl/canvas_wnd.h"\r
-#if MGL_HAVE_FLTK\r
-//-----------------------------------------------------------------------------\r
-#ifdef __MWERKS__\r
-# define FL_DLL\r
-#endif\r
-\r
-#include <FL/Fl.H>\r
-#include <Fl/Fl_Window.H>\r
-#include <Fl/Fl_Scroll.H>\r
-#include <FL/Fl_Button.H>\r
-#include <FL/Fl_Counter.H>\r
-#include <FL/Fl_Menu_Bar.H>\r
-//-----------------------------------------------------------------------------\r
-/// Class is FLTK widget which display MathGL graphics\r
-class Fl_MathGL : public Fl_Widget\r
-{\r
-public:\r
- Fl_Valuator *tet_val; ///< pointer to external tet-angle validator\r
- Fl_Valuator *phi_val; ///< pointer to external phi-angle validator\r
-\r
- Fl_MathGL(int x, int y, int w, int h, char *label=0);\r
- ~Fl_MathGL();\r
-\r
- /// Update (redraw) plot\r
- virtual void update();\r
- /// Set angles for additional plot rotation\r
- inline void set_angle(float t, float p){ tet = t; phi = p; }\r
- /// Set bitwise flags for general state (1-Alpha, 2-Light)\r
- inline void set_flag(int f) { flag = f; }\r
- /// Set flags for handling mouse\r
- void set_graph(mglCanvas *gr); ///< Set grapher object\r
- inline void set_graph(mglGraph *Gr)\r
- { set_graph(dynamic_cast<mglCanvas *>(Gr->Self())); }\r
- /// Get pointer to grapher\r
- inline HMGL get_graph() { return gr; }\r
- /// Set drawing functions and its parameter\r
- inline void set_draw(int (*func)(mglBase *gr, void *par), void *par=0)\r
- { draw_func = func; draw_par = par; }\r
- inline void set_draw(mglDraw *dr)\r
- { set_draw(mgl_draw_class,(void*)dr); }\r
- inline void set_draw(int (*dr)(mglGraph *gr))\r
- { set_draw(mgl_draw_graph,(void*)dr); }\r
- void set_state(bool z, bool r) { zoom = z; rotate = r; }\r
- /// Set zoom in/out region\r
- inline void set_zoom(mreal X1, mreal Y1, mreal X2, mreal Y2)\r
- { x1 = X1; x2 = X2; y1 = Y1; y2 = Y2; update(); };\r
- /// Get zoom region\r
- inline void get_zoom(mreal *X1, mreal *Y1, mreal *X2, mreal *Y2)\r
- { *X1 = x1; *X2 = x2; *Y1 = y1; *Y2 = y2; };\r
- /// Set popup menu pointer\r
- inline void set_popup(const Fl_Menu_Item *pmenu, Fl_Widget *wdg, void *v)\r
- { popup = pmenu; wpar = wdg; vpar = v; }\r
-protected:\r
- mglCanvas *gr; ///< pointer to grapher\r
- void *draw_par; ///< Parameters for drawing function mglCanvasWnd::DrawFunc.\r
- /// Drawing function for window procedure. It should return the number of frames.\r
- int (*draw_func)(mglBase *gr, void *par);\r
-\r
- const Fl_Menu_Item *popup; ///< pointer to popup menu items\r
- Fl_Widget *wpar; ///< widget for popup menu\r
- void *vpar; ///< parameter for popup menu\r
- float tet,phi; ///< rotation angles\r
- bool rotate; ///< flag for handle mouse\r
- bool zoom; ///< flag for zoom by mouse\r
- bool wire;\r
- float x1,x2,y1,y2; ///< zoom region\r
- int flag; ///< bitwise flag for general state (1-Alpha, 2-Light)\r
- int x0,y0,xe,ye; ///< mouse position\r
- char pos[128];\r
-\r
- virtual void draw(); ///< quick drawing function\r
- int handle(int code); ///< handle mouse events\r
- void resize(int x, int y, int w, int h); ///< resize control\r
-};\r
-//-----------------------------------------------------------------------------\r
-class Fl_MGLView : public Fl_Window\r
-{\r
-public:\r
- Fl_MathGL *FMGL; ///< Control which draw graphics\r
- Fl_Scroll *scroll;\r
- Fl_Menu_Bar *menu;\r
-\r
- void *par; ///< Parameter for handling animation\r
- void (*next)(void*); ///< Callback function for next frame\r
- void (*prev)(void*); ///< Callback function for prev frame\r
- float (*delay)(void*); ///< Callback function for delay\r
- void (*reload)(void*); ///< Callback function for reloading\r
-\r
- void toggle_alpha() { toggle(alpha, alpha_bt, "Graphics/Alpha"); }\r
- void toggle_light() { toggle(light, light_bt, "Graphics/Light"); }\r
- void toggle_sshow() { toggle(sshow, anim_bt, "Graphics/Slideshow"); }\r
- void toggle_wire() { toggle(wire, wire_bt, "Graphics/Wire"); }\r
- void toggle_zoom() { toggle(zoom, zoom_bt); }\r
- void toggle_rotate(){ toggle(rotate, rotate_bt); }\r
- void setoff_zoom() { setoff(zoom,zoom_bt); }\r
- void setoff_rotate(){ setoff(rotate, rotate_bt); }\r
- bool is_sshow() { return sshow; }\r
-\r
- Fl_MGLView(int x, int y, int w, int h, char *label=0);\r
- ~Fl_MGLView();\r
- void update(); ///< Update picture by calling user drawing function\r
-protected:\r
- Fl_Button *alpha_bt, *light_bt, *rotate_bt, *anim_bt, *zoom_bt, *wire_bt;\r
-// Fl_Counter *tet, *phi;\r
-\r
- int wire, alpha, light; ///< Current states of wire, alpha, light switches (toggle buttons)\r
- int sshow, rotate, zoom;///< Current states of slideshow, rotate, zoom switches (toggle buttons)\r
-\r
- void toggle(int &val, Fl_Button *b, const char *txt=NULL);\r
- void setoff(int &val, Fl_Button *b, const char *txt=NULL);\r
-};\r
-//-----------------------------------------------------------------------------\r
-/// Class allows the window creation for displaying plot bitmap with the help of FLTK library\r
-/** NOTE!!! All frames are saved in memory. So animation with many frames require a lot memory and CPU time (for example, for mouse rotation).*/\r
-class mglCanvasFL : public mglCanvasWnd\r
-{\r
-public:\r
-using mglCanvasWnd::Window;\r
- Fl_Window *Wnd; ///< Pointer to window\r
- Fl_MGLView *mgl; ///< Pointer to MGL widget with buttons\r
-\r
- mglCanvasFL();\r
- ~mglCanvasFL();\r
-\r
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Ñëóæåáíûå ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r
- /// Create a window for plotting. Now implemeted only for GLUT.\r
- void Window(int argc, char **argv, int (*draw)(mglBase *gr, void *p), const char *title,\r
- void *par=NULL, void (*reload)(void *p)=NULL, bool maximize=false);\r
- /// Switch on/off transparency (do not overwrite switches in user drawing function)\r
- void ToggleAlpha();\r
- /// Switch on/off lighting (do not overwrite switches in user drawing function)\r
- void ToggleLight();\r
- void ToggleRotate(); ///< Switch on/off rotation by mouse\r
- void ToggleZoom(); ///< Switch on/off zooming by mouse\r
- void ToggleNo(); ///< Switch off all zooming and rotation\r
- void Update(); ///< Update picture by calling user drawing function\r
- void Adjust(); ///< Adjust size of bitmap to window size\r
- void GotoFrame(int d); ///< Show arbitrary frame (use relative step)\r
- void Animation(); ///< Run animation (I'm too lasy to change it)\r
-};\r
-//-----------------------------------------------------------------------------\r
-void mgl_ask_fltk(const wchar_t *quest, wchar_t *res);\r
-//-----------------------------------------------------------------------------\r
-#else\r
-#error "Please enable FLTK support"\r
-#endif\r
-#endif\r
-#endif\r
+++ /dev/null
-/***************************************************************************\r
- * font.h is part of Math Graphic Library\r
- * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
- * *\r
- * This program is free software; you can redistribute it and/or modify *\r
- * it under the terms of the GNU Library General Public License as *\r
- * published by the Free Software Foundation; either version 3 of the *\r
- * License, or (at your option) any later version. *\r
- * *\r
- * This program is distributed in the hope that it will be useful, *\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
- * GNU General Public License for more details. *\r
- * *\r
- * You should have received a copy of the GNU Library General Public *\r
- * License along with this program; if not, write to the *\r
- * Free Software Foundation, Inc., *\r
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
- ***************************************************************************/\r
-//-----------------------------------------------------------------------------\r
-#ifndef _MGL_FONT_H_\r
-#define _MGL_FONT_H_\r
-\r
-#include <stdio.h>\r
-#include "mgl/define.h"\r
-//-----------------------------------------------------------------------------\r
-#define MGL_FONT_BOLD 0x01000000 // This value is used binary\r
-#define MGL_FONT_ITAL 0x02000000 // This value is used binary\r
-#define MGL_FONT_BOLD_ITAL 0x03000000\r
-#define MGL_FONT_WIRE 0x04000000\r
-#define MGL_FONT_OLINE 0x08000000 // This value is used binary\r
-#define MGL_FONT_ULINE 0x10000000\r
-#define MGL_FONT_ZEROW 0x20000000 // internal codes\r
-#define MGL_FONT_UPPER 0x40000000\r
-#define MGL_FONT_LOWER 0x80000000\r
-#define MGL_FONT_ROMAN 0xfcffffff\r
-#define MGL_FONT_MASK 0x00ffffff\r
-#define MGL_COLOR_MASK 0xffffff00\r
-#define MGL_FONT_STYLE 0x3f000000\r
-//-----------------------------------------------------------------------------\r
-#ifdef WIN32 // a man ask to use built-in font under Windows\r
-#define MGL_DEF_FONT_NAME 0\r
-#else\r
-#define MGL_DEF_FONT_NAME "STIX"\r
-#endif\r
-//-----------------------------------------------------------------------------\r
-struct mglTeXsymb { unsigned kod; const wchar_t *tex; };\r
-/// Get font color, style and align for internal parser\r
-char mglGetStyle(const char *how, int *font, int *align=0);\r
-class mglBase;\r
-//-----------------------------------------------------------------------------\r
-/// Class for incapsulating font plotting procedures\r
-class mglFont\r
-{\r
-public:\r
- mglBase *gr; ///< mglBase class used for drawing characters\r
- mglFont(const char *name=0, const char *path=0);\r
- ~mglFont();\r
- bool parse; ///< Parse LaTeX symbols\r
-\r
- /// Load font data to memory. Normally used by constructor.\r
- bool Load(const char *base, const char *path=0);\r
- /// Free memory\r
- void Clear();\r
- /// Copy data from other font\r
- void Copy(mglFont *);\r
- /// Restore default font\r
- void Restore();\r
- /// Return true if font is loaded\r
- inline bool Ready() const { return numg!=0; };\r
-\r
- /// Get height of text\r
- float Height(int font) const;\r
- /// Get height of text\r
- float Height(const char *how) const;\r
- /// Print text string for font specified by string\r
- float Puts(const char *str,const char *how,float col) const;\r
- /// Get width of text string for font specified by string\r
- float Width(const char *str,const char *how) const;\r
- /// Print text string for font specified by string\r
- float Puts(const wchar_t *str,const char *how,float col) const;\r
- /// Get width of text string for font specified by string\r
- float Width(const wchar_t *str,const char *how) const;\r
-\r
- /// Return number of glyphs\r
- inline unsigned GetNumGlyph() const { return numg; };\r
- /// Return some of pointers\r
- inline const short *GetTr(int s, long j) const { return Buf+tr[s][j]; };\r
- inline const short *GetLn(int s, long j) const { return Buf+ln[s][j]; };\r
- inline int GetNt(int s, long j) const { return numt[s][j]; };\r
- inline int GetNl(int s, long j) const { return numl[s][j]; };\r
- inline float GetFact(int s) const { return fact[s]; };\r
-protected:\r
- wchar_t *id; ///< Unicode ID for glyph\r
- unsigned *tr[4]; ///< Shift of glyph description by triangles (for solid font)\r
- unsigned *ln[4]; ///< Shift of glyph description by lines (for wire font)\r
- short *numt[4]; ///< Number of triangles in glyph description (for solid font)\r
- short *numl[4]; ///< Number of lines in glyph description (for wire font)\r
- short *width[4]; ///< Width of glyph for wire font\r
- float fact[4]; ///< Divider for width of glyph\r
- unsigned numg; ///< Number of glyphs\r
- short *Buf; ///< Buffer for glyph descriptions\r
- long numb; ///< Buffer size\r
-\r
- /// Print text string for font specified by integer constant\r
- float Puts(const wchar_t *str,int font,int align, float col) const;\r
- /// Get width of text string for font specified by integer constant\r
- float Width(const wchar_t *str,int font=0) const;\r
- /// Replace TeX symbols by its UTF code and add font styles\r
- void Convert(const wchar_t *str, unsigned *res) const;\r
-\r
- /// Draw string recursively\r
- /* x,y - position, f - factor, style: 0x1 - italic, 0x2 - bold, 0x4 - overline, 0x8 - underline, 0x10 - empty (not draw) */\r
- float Puts(const unsigned *str, float x,float y,float f,int style,float col) const;\r
- /// Parse LaTeX command\r
- unsigned Parse(const wchar_t *s) const;\r
- /// Get internal code for symbol\r
- long Internal(unsigned s) const;\r
-\r
- /// Get symbol for character \a ch with given \a font style\r
- unsigned Symbol(char ch) const;\r
-private:\r
- float get_ptr(long &i,unsigned *str, unsigned **b1, unsigned **b2,float &w1,float &w2, float f1, float f2, int st) const;\r
- bool read_data(const char *fname, float *ff, short *wdt, short *numl, unsigned *posl, short *numt, unsigned *post, unsigned &cur);\r
- void main_copy();\r
- bool read_main(const char *fname, unsigned &cur);\r
- void mem_alloc();\r
- bool read_def(unsigned &cur);\r
- void draw_ouline(int st, float x, float y, float f, float g, float ww, float ccol) const;\r
-};\r
-//-----------------------------------------------------------------------------\r
-#endif\r
-//-----------------------------------------------------------------------------\r
+++ /dev/null
-/***************************************************************************\r
- * mgl_glut.h is part of Math Graphic Library\r
- * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
- * *\r
- * This program is free software; you can redistribute it and/or modify *\r
- * it under the terms of the GNU Library General Public License as *\r
- * published by the Free Software Foundation; either version 3 of the *\r
- * License, or (at your option) any later version. *\r
- * *\r
- * This program is distributed in the hope that it will be useful, *\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
- * GNU General Public License for more details. *\r
- * *\r
- * You should have received a copy of the GNU Library General Public *\r
- * License along with this program; if not, write to the *\r
- * Free Software Foundation, Inc., *\r
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
- ***************************************************************************/\r
-//-----------------------------------------------------------------------------\r
-#ifndef _MGL_GLUT_H_\r
-#define _MGL_GLUT_H_\r
-#ifdef __cplusplus\r
-#include "mgl/opengl.h"\r
-#include "mgl/window.h"\r
-//-----------------------------------------------------------------------------\r
-extern "C" {\r
-#endif\r
-/*****************************************************************************/\r
-void _mgl_key_up(unsigned char ch,int ,int );\r
-HMGL mgl_create_graph_glut(int (*draw)(HMGL gr, void *p), const char *title, void *par, void (*load)(void *p));\r
-/*****************************************************************************/\r
-#ifdef __cplusplus\r
-}\r
-/// Class allows the window creation under OpenGL with the help of GLUT library\r
-class mglCanvasGLUT : public mglCanvasGL\r
-{\r
-friend void _mgl_display();\r
-friend void _mgl_key_up(unsigned char ch,int ,int );\r
-friend void _mgl_timer(int);\r
-public:\r
- float Delay; ///< Delay for animation in seconds\r
- bool AutoClf; ///< Clear canvas between drawing\r
-\r
- mglCanvasGLUT();\r
- mglCanvasGLUT(int (*draw)(mglGraph *gr, void *p), const char *title, void *par=NULL,\r
- void (*reload)(int next, void *p)=NULL, bool maximize=false);\r
- virtual ~mglCanvasGLUT();\r
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Ñëóæåáíûå ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r
- /// Create a window for plotting. Now implemeted only for GLUT.\r
- void Window(int argc, char **argv, int (*draw)(mglBase *gr, void *p),\r
- const char *title,void *par=NULL,\r
- void (*reload)(void *p)=NULL, bool maximize=false);\r
- void Window(int argc, char **argv, int (*draw)(mglGraph *gr),\r
- const char *title, bool maximize=false)\r
- { Window(argc,argv,mgl_draw_graph,title,(void*)draw,0,maximize); }\r
- /// Create a window for plotting based on class mglDraw.\r
- void Window(int argc, char **argv, const char *title, mglDraw *draw, bool maximize=false)\r
- { Window(argc, argv, mgl_draw_class, title, draw, mgl_reload_class, maximize); }\r
- /// Switch on/off transparency (do not overwrite switches in user drawing function)\r
- void ToggleAlpha() { _mgl_key_up('r',0,0); }\r
- /// Switch on/off lighting (do not overwrite switches in user drawing function)\r
- void ToggleLight() { _mgl_key_up('f',0,0); }\r
- void ToggleNo() { _mgl_key_up('n',0,0); } ///< Switch off all zooming and rotation\r
- void Update() { _mgl_key_up(' ',0,0); } ///< Update picture by calling user drawing function\r
- void ReLoad(bool o) { _mgl_key_up(o?']':'[',0,0); } ///< Reload user data and update picture\r
- void NextFrame() { _mgl_key_up('.',0,0); } ///< Show next frame (if one)\r
- void PrevFrame() { _mgl_key_up(',',0,0); } ///< Show previous frame (if one)\r
- void Animation() { _mgl_key_up('m',0,0); } ///< Run slideshow (animation) of frames\r
-private:\r
- void (*LoadFunc)(void *par);\r
- void *FuncPar; ///< Parameters for drawing function mglCanvas::DrawFunc.\r
- /// Drawing function for window procedure. It should return the number of frames.\r
- int (*DrawFunc)(mglBase *gr, void *par);\r
- int NumFig; ///< Number of figures in the list. If 0 then no list and mglCanvas::DrawFunc will called for each drawing.\r
- int curr_fig; ///< Current figure in the list.\r
- int tt; ///< Temporal variable\r
-};\r
-//-----------------------------------------------------------------------------\r
-class mglGLUT: public mglGraph\r
-{\r
-public:\r
- mglGLUT(int (*draw)(HMGL gr, void *p), const char *title="MathGL", void *par=0, void (*load)(void *p)=0) : mglGraph(-1)\r
- { gr = mgl_create_graph_glut(draw,title,par,load); }\r
- mglGLUT(int (*draw)(mglGraph *gr), const char *title="MathGL") : mglGraph(-1)\r
- { gr = mgl_create_graph_glut(mgl_draw_graph,title,(void*)draw,0); }\r
- mglGLUT(mglDraw *dr=0, const char *title="MathGL") : mglGraph(-1)\r
- { mgl_create_graph_glut(mgl_draw_class,title,dr,0); }\r
-};\r
-//-----------------------------------------------------------------------------\r
-#endif\r
-#endif\r
+++ /dev/null
-/***************************************************************************\r
- * mgl.h is part of Math Graphic Library\r
- * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
- * *\r
- * This program is free software; you can redistribute it and/or modify *\r
- * it under the terms of the GNU General Public License as published by *\r
- * the Free Software Foundation; either version 2 of the License, or *\r
- * (at your option) any later version. *\r
- * *\r
- * This program is distributed in the hope that it will be useful, *\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
- * GNU General Public License for more details. *\r
- * *\r
- * You should have received a copy of the GNU General Public License *\r
- * along with this program; if not, write to the *\r
- * Free Software Foundation, Inc., *\r
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
- ***************************************************************************/\r
-#ifndef _MGL_H_\r
-#define _MGL_H_\r
-\r
-#include "mgl/define.h"\r
-#include "mgl/mgl_cf.h"\r
-#include "mgl/data.h"\r
-#ifndef NO_OPENGL\r
-#include "mgl/opengl.h"\r
-#endif\r
-//-----------------------------------------------------------------------------\r
-/// Wrapper class for all graphics\r
-class mglGraph\r
-{\r
-protected:\r
- HMGL gr;\r
-public:\r
- inline mglGraph(int kind=0, int width=600, int height=400)\r
- {\r
- if(kind==-1) gr=NULL;\r
-#ifndef NO_OPENGL\r
- else if(kind==1) gr=mgl_create_graph_gl();\r
-#endif\r
-// else if(kind==2) gr=mgl_create_graph_idtf();\r
- else gr=mgl_create_graph(width, height);\r
- }\r
- inline mglGraph(const mglGraph &graph)\r
- { gr = graph.gr; mgl_use_graph(gr,1); }\r
- inline mglGraph(HMGL graph)\r
- { gr = graph; mgl_use_graph(gr,1); }\r
- virtual ~mglGraph()\r
- { if(mgl_use_graph(gr,-1)<1) mgl_delete_graph(gr); }\r
- /// Get pointer to internal mglCanvas object\r
- inline HMGL Self() { return gr; }\r
- /// Set default parameter for plotting\r
- inline void DefaultPlotParam() { mgl_set_def_param(gr); }\r
- /// Set name of plot for saving filename\r
- inline void SetPlotId(const char *id) { mgl_set_plotid(gr,id); }\r
-\r
- /// Set the transparency on/off.\r
- inline void Alpha(bool enable) { mgl_set_alpha(gr, enable); }\r
- /// Set default value of alpha-channel\r
- inline void SetAlphaDef(float alpha) { mgl_set_alpha_default(gr, alpha); }\r
- /// Set the transparency type (0 - usual, 1 - glass, 2 - lamp)\r
- inline void SetTranspType(int type) { mgl_set_transp_type(gr, type);}\r
-\r
- /// Set the using of light on/off.\r
- inline void Light(bool enable) { mgl_set_light(gr, enable); }\r
- /// Switch on/off the specified light source.\r
- inline void Light(int n,bool enable) { mgl_set_light_n(gr, n, enable); }\r
- /// Use diffusive light (only for local light sources)\r
- inline void SetDifLight(bool dif) { mgl_set_light_dif(gr, dif); }\r
- /// Add a light source.\r
- inline void AddLight(int n, mglPoint p, char col='w', float bright=0.5, float ap=0)\r
- { mgl_add_light_ext(gr, n, p.x, p.y, p.z, col, bright, ap); }\r
- inline void AddLight(int n, mglPoint r, mglPoint p, char col='w', float bright=0.5, float ap=0)\r
- { mgl_add_light_loc(gr, n, r.x, r.y, r.z, p.x, p.y, p.z, col, bright, ap); }\r
- /// Set ambient light brightness\r
- inline void SetAmbient(float i) { mgl_set_ambbr(gr, i); }\r
- /// Set the fog distance or switch it off (if d=0).\r
- inline void Fog(float d, float dz=0.25) { mgl_set_fog(gr, d, dz); }\r
-\r
- /// Set relative width of rectangles in Bars, Barh, BoxPlot\r
- inline void SetBarWidth(float width) { mgl_set_bar_width(gr, width); }\r
- /// Set size of marks\r
- inline void SetMarkSize(float size) { mgl_set_mark_size(gr, size); }\r
- /// Set size of arrows\r
- inline void SetArrowSize(float size) { mgl_set_arrow_size(gr, size); }\r
- /// Set number of mesh lines\r
- inline void SetMeshNum(int num) { mgl_set_meshnum(gr, num); }\r
-\r
- /// Set cutting for points outside of bounding box\r
- inline void SetCut(bool cut) { mgl_set_cut(gr, cut); }\r
- /// Set additional cutting box\r
- inline void SetCutBox(mglPoint p1, mglPoint p2)\r
- { mgl_set_cut_box(gr, p1.x, p1.y, p1.z, p2.x, p2.y, p2.z); }\r
- /// Set the cutting off condition (formula)\r
- inline void CutOff(const char *EqC) { mgl_set_cutoff(gr, EqC); }\r
-\r
- /// Set default font size\r
- inline void SetFontSize(float size) { mgl_set_font_size(gr, size); }\r
- /// Set default font style and color\r
- inline void SetFontDef(const char *fnt) { mgl_set_font_def(gr, fnt); }\r
- /// Set FontSize by size in pt and picture DPI (default is 16 pt for dpi=72)\r
- virtual void SetFontSizePT(float pt, int dpi=72){ SetFontSize(pt*27.f/dpi); }\r
- /// Set FontSize by size in centimeters and picture DPI (default is 0.56 cm = 16 pt)\r
- inline void SetFontSizeCM(float cm, int dpi=72) { SetFontSizePT(cm*28.45f,dpi); }\r
- /// Set FontSize by size in inch and picture DPI (default is 0.22 in = 16 pt)\r
- inline void SetFontSizeIN(float in, int dpi=72) { SetFontSizePT(in*72.27f,dpi); }\r
- /// Load font from file\r
- inline void LoadFont(const char *name, const char *path=NULL)\r
- { mgl_load_font(gr, name, path); }\r
- /// Copy font from another mglGraph instance\r
- inline void CopyFont(mglGraph *GR) { mgl_copy_font(gr, GR->Self());}\r
- /// Restore font\r
- inline void RestoreFont() { mgl_restore_font(gr); }\r
- /// Set to use or not text rotation\r
- inline void SetRotatedText(bool rotated) { mgl_set_rotated_text(gr, rotated); }\r
-\r
- /// Set default palette\r
- inline void SetPalette(const char *colors) { mgl_set_palette(gr, colors); }\r
-\r
- /// Get last warning code\r
- inline int GetWarn() { return mgl_get_warn(gr);}\r
- /// Set warning code ant fill message\r
- inline void SetWarn(int code, const char *info="") { mgl_set_warn(gr,code,info); }\r
- /// Set buffer for warning messages\r
- inline const char *Message() { return mgl_get_mess(gr); }\r
-\r
- /// Set range in direction dir as [v1, v2]\r
- inline void SetRange(char dir, float v1, float v2)\r
- { mgl_set_range_val(gr, dir, v1, v2); }\r
- /// Set range in direction dir as minimal and maximal values of data a\r
- inline void SetRange(char dir, const mglDataA &dat, bool add=false)\r
- { mgl_set_range_dat(gr, dir, &dat, add); }\r
- /// Set values of mglGraph::Min and mglGraph::Max as minimal and maximal values of datas\r
- inline void SetRanges(const mglData &xx, const mglData &yy, const mglData &zz, const mglData &cc)\r
- { mgl_set_range_dat(gr,'x',&xx,0); mgl_set_range_dat(gr,'y',&yy,0);\r
- mgl_set_range_dat(gr,'z',&zz,0); mgl_set_range_dat(gr,'c',&cc,0); }\r
- /// Set values of mglGraph::Min and mglGraph::Max as minimal and maximal values of datas\r
- inline void SetRanges(const mglData &xx, const mglData &yy, const mglData &zz)\r
- { mgl_set_range_dat(gr,'x',&xx,0); mgl_set_range_dat(gr,'y',&yy,0);\r
- mgl_set_range_dat(gr,'z',&zz,0); mgl_set_range_dat(gr,'c',&zz,0); }\r
- /// Set values of mglGraph::Min and mglGraph::Max as minimal and maximal values of datas\r
- inline void SetRanges(const mglData &xx, const mglData &yy)\r
- { mgl_set_range_dat(gr,'x',&xx,0); mgl_set_range_dat(gr,'y',&yy,0); }\r
- /// Set values of mglGraph::Min and mglGraph::Max\r
- inline void SetRanges(float x1, float x2, float y1, float y2, float z1=0, float z2=0)\r
- { mgl_set_ranges(gr, x1, x2, y1, y2, z1, z2); }\r
- /// Set values of mglGraph::Min and mglGraph::Max\r
- inline void SetRanges(mglPoint p1, mglPoint p2)\r
- { mgl_set_ranges(gr, p1.x, p2.x, p1.y, p2.y, p1.z, p2.z); }\r
- /// Set axis origin\r
- inline void SetOrigin(mglPoint p)\r
- { mgl_set_origin(gr, p.x, p.y, p.z); }\r
- inline void SetOrigin(float x0, float y0, float z0=NaN)\r
- { mgl_set_origin(gr, x0, y0, z0); }\r
-\r
- /// Set the transformation formulas for coordinate\r
- inline void SetFunc(const char *EqX, const char *EqY, const char *EqZ=NULL, const char *EqA=NULL)\r
- { mgl_set_func(gr, EqX, EqY, EqZ, EqA); }\r
- /// Set one of predefined transformation rule\r
- inline void SetCoor(int how) { mgl_set_coor(gr, how); }\r
- /// Set to draw Ternary axis (triangle like axis, grid and so on)\r
- inline void Ternary(int val) { mgl_set_ternary(gr, val); }\r
-\r
- /// Set to use or not tick labels rotation\r
- inline void SetTickRotate(bool val) { mgl_set_tick_rotate(gr,val); }\r
- /// Set to use or not tick labels skipping\r
- inline void SetTickSkip(bool val) { mgl_set_tick_skip(gr,val); }\r
- /// Set tick length\r
- inline void SetTickLen(float len, float stt=1)\r
- { mgl_set_tick_len(gr, len, stt); }\r
- /// Set axis and ticks style\r
- inline void SetAxisStl(const char *stl="k", const char *tck=0, const char *sub=0)\r
- { mgl_set_axis_stl(gr, stl, tck, sub); }\r
-\r
- /// Set time templates for ticks\r
- inline void SetTicksTime(char dir, float d=0, const char *t="")\r
- { mgl_set_ticks_time(gr,dir,d,t); }\r
- /// Set ticks text (\n separated). Use "" to disable this feature.\r
- inline void SetTicksVal(char dir, const char *lbl, bool add=false)\r
- { mgl_set_ticks_str(gr,dir,lbl,add); }\r
- inline void SetTicksVal(char dir, const wchar_t *lbl, bool add=false)\r
- { mgl_set_ticks_wcs(gr,dir,lbl,add); }\r
- /// Set ticks position and text (\n separated). Use "" to disable this feature.\r
- inline void SetTicksVal(char dir, const mglDataA &v, const char *lbl, bool add=false)\r
- { mgl_set_ticks_val(gr,dir,&v,lbl,add); }\r
- inline void SetTicksVal(char dir, const mglDataA &v, const wchar_t *lbl, bool add=false)\r
- { mgl_set_ticks_valw(gr,dir,&v,lbl,add); }\r
- /// Set the ticks parameters\r
- inline void SetTicks(char dir, float d=0, int ns=0, float org=NaN)\r
- { mgl_set_ticks(gr, dir, d, ns, org); }\r
- /// Auto adjust ticks\r
- inline void Adjust(const char *dir="xyzc")\r
- { mgl_adjust_ticks(gr, dir); }\r
- /// Set templates for ticks\r
- inline void SetTickTempl(char dir, const char *t)\r
- { mgl_set_tick_templ(gr,dir,t); }\r
- inline void SetTickTempl(char dir, const wchar_t *t)\r
- { mgl_set_tick_templw(gr,dir,t); }\r
- /// Tune ticks\r
- inline void SetTuneTicks(int tune, float fact_pos=1.15)\r
- { mgl_tune_ticks(gr, tune, fact_pos); }\r
-\r
- /// Put further plotting in some region of whole frame surface.\r
- inline void SubPlot(int nx,int ny,int m,const char *style="<>_^", float dx=0, float dy=0)\r
- { mgl_subplot_d(gr, nx, ny, m, style, dx, dy); }\r
- /// Like SubPlot bot "join" several cells\r
- inline void MultiPlot(int nx,int ny,int m, int dx, int dy, const char *style="<>_^")\r
- { mgl_multiplot(gr, nx, ny, m, dx, dy, style); }\r
- /// Put further plotting in some region of whole frame surface.\r
- inline void InPlot(float x1,float x2,float y1,float y2, bool rel=true)\r
- { if(rel) mgl_relplot(gr, x1, x2, y1, y2);\r
- else mgl_inplot(gr, x1, x2, y1, y2); }\r
- /// Put further plotting in column cell of previous subplot\r
- inline void ColumnPlot(int num, int ind, float d=0)\r
- { mgl_columnplot(gr,num,ind,d); }\r
- /// Put further plotting in matrix cell of previous subplot\r
- inline void GridPlot(int nx, int ny, int ind, float d=0)\r
- { mgl_gridplot(gr,nx,ny,ind,d); }\r
- /// Put further plotting in cell of stick rotated on angles tet, phi\r
- inline void StickPlot(int num, int i, float tet, float phi)\r
- { mgl_stickplot(gr,num,i,tet,phi); }\r
-\r
- /// Set PlotFactor\r
- inline void SetPlotFactor(float val)\r
- { mgl_set_plotfactor(gr,val); }\r
- /// Push transformation matrix into stack\r
- inline void Push() { mgl_mat_push(gr); }\r
- /// Pop transformation matrix from stack\r
- inline void Pop() { mgl_mat_pop(gr); }\r
- \r
- /// Add title for current subplot/inplot\r
- inline void Title(const char *title,const char *stl="",float size=-2)\r
- { mgl_title(gr,title,stl,size); }\r
- inline void Title(const wchar_t *title,const char *stl="",float size=-2)\r
- { mgl_titlew(gr,title,stl,size); }\r
- /// Set aspect ratio for further plotting.\r
- inline void Aspect(float Ax,float Ay,float Az=1)\r
- { mgl_aspect(gr, Ax, Ay, Az); }\r
- /// Rotate a further plotting.\r
- inline void Rotate(float TetX,float TetZ=0,float TetY=0)\r
- { mgl_rotate(gr, TetX, TetZ, TetY); }\r
- /// Rotate a further plotting around vector {x,y,z}.\r
- inline void RotateN(float Tet,float x,float y,float z)\r
- { mgl_rotate_vector(gr, Tet, x, y, z); }\r
- /// Set perspective (in range [0,1)) for plot. Set to zero for switching off.\r
- inline void Perspective(float val)\r
- { mgl_perspective(gr, val); }\r
- /// Set angle of view independently from Rotate().\r
- inline void View(float TetX,float TetZ=0,float TetY=0)\r
- { mgl_view(gr, TetX, TetZ, TetY); }\r
- /// Zoom in or zoom out (if Zoom(0, 0, 1, 1)) a part of picture\r
- inline void Zoom(float x1, float y1, float x2, float y2)\r
- { mgl_zoom(gr, x1, y1, x2, y2); }\r
-\r
- /// Set size of frame in pixels. Normally this function is called internaly.\r
- inline void SetSize(int width, int height) { mgl_set_size(gr, width, height); }\r
- /// Set plot quality\r
- inline void SetQuality(int qual=MGL_DRAW_NORM) { mgl_set_quality(gr, qual); }\r
- /// Start group of objects\r
- inline void StartGroup(const char *name) { mgl_start_group(gr, name); }\r
- /// End group of objects\r
- inline void EndGroup() { mgl_end_group(gr); }\r
- /// Highlight next group\r
- inline void Highlight(int id) { mgl_highlight(gr, id); }\r
-\r
- /// Show currently produced image\r
- inline void ShowImage(const char *viewer, bool keep=0)\r
- { mgl_show_image(gr, viewer, keep); }\r
- /// Write the frame in file (depending extension, write current frame if fname is empty)\r
- inline void WriteFrame(const char *fname=0,const char *descr="")\r
- { mgl_write_frame(gr, fname, descr); }\r
- /// Write the frame in file using JPEG format\r
- inline void WriteJPEG(const char *fname,const char *descr="")\r
- { mgl_write_jpg(gr, fname, descr); }\r
- /// Write the frame in file using PNG format with transparency\r
- inline void WritePNG(const char *fname,const char *descr="", bool alpha=true)\r
- { if(alpha) mgl_write_png(gr, fname, descr);\r
- else mgl_write_png_solid(gr, fname, descr); }\r
- /// Write the frame in file using BMP format\r
- inline void WriteBMP(const char *fname,const char *descr="")\r
- { mgl_write_bmp(gr, fname, descr); }\r
- /// Write the frame in file using BMP format\r
- inline void WriteTGA(const char *fname,const char *descr="")\r
- { mgl_write_tga(gr, fname, descr); }\r
- /// Write the frame in file using PostScript format\r
- inline void WriteEPS(const char *fname,const char *descr="")\r
- { mgl_write_eps(gr, fname, descr); }\r
- /// Write the frame in file using PostScript format\r
- inline void WriteTEX(const char *fname,const char *descr="")\r
- { mgl_write_tex(gr, fname, descr); }\r
- /// Write the frame in file using PostScript format as bitmap\r
- inline void WriteBPS(const char *fname,const char *descr="")\r
- { mgl_write_bps(gr, fname, descr); }\r
- /// Write the frame in file using SVG format\r
- inline void WriteSVG(const char *fname,const char *descr="")\r
- { mgl_write_svg(gr, fname, descr); }\r
- /// Write the frame in file using GIF format (only for current frame!)\r
- inline void WriteGIF(const char *fname,const char *descr="")\r
- { mgl_write_gif(gr, fname, descr); }\r
-\r
- /// Write the frame in file using OBJ format\r
- inline void WriteOBJ(const char *fname,const char *descr="",bool use_png=true)\r
- { mgl_write_obj(gr, fname, descr, use_png); }\r
- /// Write the frame in file using XYZ format\r
- inline void WriteXYZ(const char *fname,const char *descr="")\r
- { mgl_write_xyz(gr, fname, descr); }\r
- /// Write the frame in file using STL format (faces only)\r
- inline void WriteSTL(const char *fname,const char *descr="")\r
- { mgl_write_stl(gr, fname, descr); }\r
- /// Write the frame in file using OFF format\r
- inline void WriteOFF(const char *fname,const char *descr="", bool colored=false)\r
- { mgl_write_off(gr, fname, descr,colored); }\r
-// /// Write the frame in file using X3D format\r
-// inline void WriteX3D(const char *fname,const char *descr="")\r
-// { mgl_write_x3d(gr, fname, descr); }\r
- /// Write the frame in file using PRC format\r
- inline void WritePRC(const char *fname,const char *descr="",bool make_pdf=true)\r
- { mgl_write_prc(gr, fname, descr, make_pdf); }\r
-\r
- /// Create new frame.\r
- inline void NewFrame() { mgl_new_frame(gr); }\r
- /// Finish frame drawing\r
- inline void EndFrame() { mgl_end_frame(gr); }\r
- /// Get the number of created frames\r
- inline int GetNumFrame() { return mgl_get_num_frame(gr); }\r
- /// Reset frames counter (start it from zero)\r
- inline void ResetFrames() { mgl_reset_frames(gr); }\r
- /// Start write frames to cinema using GIF format\r
- inline void StartGIF(const char *fname, int ms=100)\r
- { mgl_start_gif(gr, fname,ms); }\r
- /// Stop writing cinema using GIF format\r
- inline void CloseGIF() { mgl_close_gif(gr); }\r
- /// Export points and primitives in file using MGLD format\r
- inline void ExportMGLD(const char *fname, const char *descr=0)\r
- { mgl_export_mgld(gr, fname, descr); }\r
- /// Import points and primitives from file using MGLD format\r
- inline void ImportMGLD(const char *fname, bool add=false)\r
- { mgl_import_mgld(gr, fname, add); }\r
-\r
- /// Copy RGB values into array which is allocated by user\r
- inline void GetRGB(char *imgdata, int imglen)\r
- {\r
- long w=mgl_get_width(gr), h=mgl_get_height(gr);\r
- if(imglen>=3*w*h) memcpy(imgdata, mgl_get_rgb(gr),3*w*h);\r
- }\r
- inline const unsigned char *GetRGB() { return mgl_get_rgb(gr); }\r
- /// Copy RGBA values into array which is allocated by user\r
- inline void GetRGBA(char *imgdata, int imglen)\r
- {\r
- long w=mgl_get_width(gr), h=mgl_get_height(gr);\r
- if(imglen>=4*w*h) memcpy(imgdata, mgl_get_rgba(gr),4*w*h);\r
- }\r
- inline const unsigned char *GetRGBA() { return mgl_get_rgba(gr); }\r
- /// Copy BGRN values into array which is allocated by user\r
- inline void GetBGRN(unsigned char *imgdata, int imglen)\r
- {\r
- long w=mgl_get_width(gr), h=mgl_get_height(gr), i;\r
- const unsigned char *buf=mgl_get_rgb(gr);\r
- if(imglen>=4*w*h) for(i=0;i<w*h;i++)\r
- {\r
- imgdata[4*i] = buf[3*i+2];\r
- imgdata[4*i+1] = buf[3*i+1];\r
- imgdata[4*i+2] = buf[3*i];\r
- imgdata[4*i+3] = 255;\r
- }\r
- }\r
- /// Get width of the image\r
- inline int GetWidth() { return mgl_get_width(gr); }\r
- /// Get height of the image\r
- inline int GetHeight() { return mgl_get_height(gr);}\r
- /// Calculate 3D coordinate {x,y,z} for screen point {xs,ys}\r
- inline mglPoint CalcXYZ(int xs, int ys)\r
- {\r
- float x,y,z;\r
- mgl_calc_xyz(gr,xs,ys,&x,&y,&z);\r
- return mglPoint(x,y,z);\r
- }\r
- /// Calculate screen point {xs,ys} for 3D coordinate {x,y,z}\r
- inline mglPoint CalcScr(mglPoint p)\r
- {\r
- int xs,ys;\r
- mgl_calc_scr(gr,p.x,p.y,p.z,&xs,&ys);\r
- return mglPoint(xs,ys);\r
- }\r
- /// Set object/subplot id\r
- inline void SetObjId(int id) { mgl_set_obj_id(gr,id); }\r
- /// Get object id\r
- inline int GetObjId(long x,long y) { return mgl_get_obj_id(gr,x,y); }\r
- /// Get subplot id\r
- inline int GetSplId(long x,long y) { return mgl_get_spl_id(gr,x,y); }\r
-\r
- /// Combine plots from 2 canvases. Result will be saved into this\r
- inline void Combine(const mglGraph *g) { mgl_combine_gr(gr,g->gr); }\r
- /// Send graphical information to node id using MPI\r
- inline void MPI_Send(int id) { mgl_mpi_send(gr,id); }\r
- /// Receive graphical information from node id using MPI\r
- inline void MPI_Recv(int id) { mgl_mpi_recv(gr,id); }\r
-\r
- /// Clear up the frame\r
- inline void Clf(float r, float g, float b) { mgl_clf_rgb(gr, r, g, b); }\r
- inline void Clf() { mgl_clf(gr); }\r
- /// Draws the point (ball) at position {x,y,z} with color c\r
- inline void Ball(mglPoint p, char c)\r
- { char s[3]={'.',c,0}; mgl_mark(gr, p.x, p.y, p.z, s); }\r
- /// Draws the mark at position p\r
- inline void Mark(mglPoint p, const char *mark)\r
- { mgl_mark(gr, p.x, p.y, p.z, mark); }\r
- /// Draws the line between points by specified pen\r
- inline void Line(mglPoint p1, mglPoint p2, const char *pen="B",int n=2)\r
- { mgl_line(gr, p1.x, p1.y, p1.z, p2.x, p2.y, p2.z, pen, n); }\r
- /// Draws the spline curve between points by specified pen\r
- inline void Curve(mglPoint p1, mglPoint d1, mglPoint p2, mglPoint d2, const char *pen="B", int n=100)\r
- { mgl_curve(gr, p1.x, p1.y, p1.z, d1.x, d1.y, d1.z, p2.x, p2.y, p2.z, d2.x, d2.y, d2.z, pen, n); }\r
- /// Draws the 3d error box e for point p\r
- inline void Error(mglPoint p, mglPoint e, const char *pen="k")\r
- { mgl_error_box(gr, p.x, p.y, p.z, e.x, e.y, e.z, pen); }\r
-\r
- /// Draws the face between points with color stl (include interpolation up to 4 colors).\r
- inline void Face(mglPoint p1, mglPoint p2, mglPoint p3, mglPoint p4, const char *stl="r")\r
- { mgl_face(gr, p1.x, p1.y, p1.z, p2.x, p2.y, p2.z, p3.x, p3.y, p3.z, p4.x, p4.y, p4.z, stl); }\r
- /// Draws the face in y-z plane at point p with color stl (include interpolation up to 4 colors).\r
- inline void FaceX(mglPoint p, float wy, float wz, const char *stl="w", float dx=0, float dy=0)\r
- { mgl_facex(gr, p.x, p.y, p.z, wy, wz, stl, dx, dy); }\r
- /// Draws the face in x-z plane at point p with color stl (include interpolation up to 4 colors).\r
- inline void FaceY(mglPoint p, float wx, float wz, const char *stl="w", float dx=0, float dy=0)\r
- { mgl_facey(gr, p.x, p.y, p.z, wx, wz, stl, dx, dy); }\r
- /// Draws the face in x-y plane at point p with color stl (include interpolation up to 4 colors).\r
- inline void FaceZ(mglPoint p, float wx, float wy, const char *stl="w", float dx=0, float dy=0)\r
- { mgl_facez(gr, p.x, p.y, p.z, wx, wy, stl, dx, dy); }\r
- /// Draws the drop at point p in direction d with color col and radius r\r
- inline void Drop(mglPoint p, mglPoint d, float r, const char *col="r", float shift=1, float ap=1)\r
- { mgl_drop(gr, p.x, p.y, p.z, d.x, d.y, d.z, r, col, shift, ap); }\r
- /// Draws the sphere at point p with color col and radius r\r
- inline void Sphere(mglPoint p, float r, const char *col="r")\r
- { mgl_sphere(gr, p.x, p.y, p.z, r, col); }\r
- /// Draws the cone between points p1,p2 with radius r1,r2 with style stl\r
- inline void Cone(mglPoint p1, mglPoint p2, float r1, float r2=-1, const char *stl="r@")\r
- { mgl_cone(gr, p1.x, p1.y, p1.z, p2.x, p2.y, p2.z,r1,r2,stl); }\r
- /// Draws the ellipse between points p1,p2 with color stl and width r\r
- inline void Ellipse(mglPoint p1, mglPoint p2, float r, const char *stl="r")\r
- { mgl_ellipse(gr, p1.x, p1.y, p1.z, p2.x, p2.y, p2.z, r,stl); }\r
- /// Draws the circle at point p with color stl and radius r\r
- inline void Circle(mglPoint p, float r, const char *stl="r")\r
- { mgl_ellipse(gr, p.x, p.y, p.z, p.x, p.y, p.z, r,stl); }\r
- /// Draws the rhomb between points p1,p2 with color stl and width r\r
- inline void Rhomb(mglPoint p1, mglPoint p2, float r, const char *stl="r")\r
- { mgl_rhomb(gr, p1.x, p1.y, p1.z, p2.x, p2.y, p2.z, r,stl); }\r
-\r
- /// Print text in position p with specified font\r
- inline void Putsw(mglPoint p,const wchar_t *text,const char *font=":C",float size=-1)\r
- { mgl_putsw(gr, p.x, p.y, p.z, text, font, size); }\r
- inline void Puts(mglPoint p,const char *text,const char *font=":C",float size=-1)\r
- { mgl_puts(gr, p.x, p.y, p.z, text, font, size); }\r
- inline void Putsw(float x, float y,const wchar_t *text,const char *font=":AC",float size=-1)\r
- { mgl_putsw(gr, x, y, 0, text, font, size); }\r
- inline void Puts(float x, float y,const char *text,const char *font=":AC",float size=-1)\r
- { mgl_puts(gr, x, y, 0, text, font, size); }\r
- /// Print text in position p along direction d with specified font\r
- inline void Putsw(mglPoint p, mglPoint d, const wchar_t *text, const char *font=":L", float size=-1)\r
- { mgl_putsw_dir(gr, p.x, p.y, p.z, d.x, d.y, d.z, text, font, size); }\r
- inline void Puts(mglPoint p, mglPoint d, const char *text, const char *font=":L", float size=-1)\r
- { mgl_puts_dir(gr, p.x, p.y, p.z, d.x, d.y, d.z, text, font, size); }\r
-\r
- /// Print text along the curve\r
- inline void Text(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *text, const char *font="", const char *opt="")\r
- { mgl_text_xyz(gr, &x, &y, &z, text, font, opt); }\r
- inline void Text(const mglDataA &x, const mglDataA &y, const char *text, const char *font="", const char *opt="")\r
- { mgl_text_xy(gr, &x, &y, text, font, opt); }\r
- inline void Text(const mglDataA &y, const char *text, const char *font="", const char *opt="")\r
- { mgl_text_y(gr, &y, text, font, opt); }\r
- inline void Text(const mglDataA &x, const mglDataA &y, const mglDataA &z, const wchar_t *text, const char *font="", const char *opt="")\r
- { mgl_textw_xyz(gr, &x, &y, &z, text, font, opt); }\r
- inline void Text(const mglDataA &x, const mglDataA &y, const wchar_t *text, const char *font="", const char *opt="")\r
- { mgl_textw_xy(gr, &x, &y, text, font, opt); }\r
- inline void Text(const mglDataA &y, const wchar_t *text, const char *font="", const char *opt="")\r
- { mgl_textw_y(gr, &y, text, font, opt); }\r
-\r
- /// Draws bounding box outside the plotting volume with color \a c.\r
- inline void Box(const char *col="", bool ticks=true)\r
- { mgl_box_str(gr, col, ticks); }\r
- /// Draw axises with ticks in directions determined by string parameter \a dir.\r
- inline void Axis(const char *dir="xyzt", const char *stl="")\r
- { mgl_axis(gr, dir,stl); }\r
- /// Draw grid lines perpendicular to direction determined by string parameter \a dir.\r
- inline void Grid(const char *dir="xyzt",const char *pen="B")\r
- { mgl_axis_grid(gr, dir, pen); }\r
- /// Print the label \a text for axis \a dir.\r
- inline void Label(char dir, const char *text, float pos=+1, float shift=0)\r
- { mgl_label_ext(gr, dir, text, pos, shift); }\r
- inline void Label(char dir, const wchar_t *text, float pos=+1, float shift=0)\r
- { mgl_labelw_ext(gr, dir, text, pos, shift); }\r
-\r
- /// Draw colorbar at edge of axis\r
- inline void Colorbar(const char *sch="")\r
- { mgl_colorbar(gr, sch); }\r
- inline void Colorbar(const char *sch,float x,float y,float w=1,float h=1)\r
- { mgl_colorbar_ext(gr, sch, x,y,w,h); }\r
- /// Draw colorbar with manual colors at edge of axis\r
- inline void Colorbar(const mglDataA &val, const char *sch="")\r
- { mgl_colorbar_val(gr, &val, sch); }\r
- inline void Colorbar(const mglDataA &val, const char *sch,float x,float y,float w=1,float h=1)\r
- { mgl_colorbar_val_ext(gr, &val, sch, x,y,w,h); }\r
-\r
- /// Add string to legend\r
- inline void AddLegend(const char *text,const char *style)\r
- { mgl_add_legend(gr, text, style); }\r
- inline void AddLegend(const wchar_t *text,const char *style)\r
- { mgl_add_legendw(gr, text, style); }\r
- /// Clear saved legend string\r
- inline void ClearLegend()\r
- { mgl_clear_legend(gr); }\r
- /// Draw legend of accumulated strings at position {x,y}\r
- inline void Legend(float x, float y, const char *font="#", float size=-0.8, float llen=0)\r
- { mgl_legend_pos(gr, x, y, font, size, llen); }\r
- /// Draw legend of accumulated strings\r
- inline void Legend(int where=3, const char *font="#", float size=-0.8, float llen=0)\r
- { mgl_legend(gr, where, font, size, llen); }\r
- /// Set number of marks in legend sample\r
- inline void SetLegendMarks(int num) { mgl_set_legend_marks(gr, num); }\r
-\r
- /// Draw usual curve {x,y,z}\r
- inline void Plot(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *pen="", const char *opt="")\r
- { mgl_plot_xyz(gr, &x, &y, &z, pen, opt); }\r
- inline void Plot(const mglDataA &x, const mglDataA &y, const char *pen="", const char *opt="")\r
- { mgl_plot_xy(gr, &x, &y, pen,opt); }\r
- inline void Plot(const mglDataA &y, const char *pen="", const char *opt="")\r
- { mgl_plot(gr, &y, pen,opt); }\r
- /// Draw tape(s) which rotates as (bi-)normales of curve {x,y,z}\r
- inline void Tape(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *pen="", const char *opt="")\r
- { mgl_tape_xyz(gr, &x, &y, &z, pen, opt); }\r
- inline void Tape(const mglDataA &x, const mglDataA &y, const char *pen="", const char *opt="")\r
- { mgl_tape_xy(gr, &x, &y, pen,opt); }\r
- inline void Tape(const mglDataA &y, const char *pen="", const char *opt="")\r
- { mgl_tape(gr, &y, pen,opt); }\r
- /// Draw radar chart (plot in curved coordinates)\r
- inline void Radar(const mglDataA &a, const char *pen="", const char *opt="")\r
- { mgl_radar(gr, &a, pen, opt); }\r
- /// Draw stairs for points in arrays {x,y,z}\r
- inline void Step(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *pen="", const char *opt="")\r
- { mgl_step_xyz(gr, &x, &y, &z, pen, opt); }\r
- inline void Step(const mglDataA &x, const mglDataA &y, const char *pen="", const char *opt="")\r
- { mgl_step_xy(gr, &x, &y, pen, opt); }\r
- inline void Step(const mglDataA &y, const char *pen="", const char *opt="")\r
- { mgl_step(gr, &y, pen, opt); }\r
- /// Draw curve {x,y,z} which is colored by c (like tension plot)\r
- inline void Tens(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const char *pen="", const char *opt="")\r
- { mgl_tens_xyz(gr, &x, &y, &z, &c, pen, opt); }\r
- inline void Tens(const mglDataA &x, const mglDataA &y, const mglDataA &c, const char *pen="", const char *opt="")\r
- { mgl_tens_xy(gr, &x, &y, &c, pen, opt); }\r
- inline void Tens(const mglDataA &y, const mglDataA &c, const char *pen="", const char *opt="")\r
- { mgl_tens(gr, &y, &c, pen, opt); }\r
- /// Fill area between curve {x,y,z} and axis plane\r
- inline void Area(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *pen="", const char *opt="")\r
- { mgl_area_xyz(gr, &x, &y, &z, pen, opt); }\r
- inline void Area(const mglDataA &x, const mglDataA &y, const char *pen="", const char *opt="")\r
- { mgl_area_xy(gr, &x, &y, pen, opt); }\r
- inline void Area(const mglDataA &y, const char *pen="", const char *opt="")\r
- { mgl_area(gr, &y, pen, opt); }\r
- /// Fill area between curves y1 and y2 specified parametrically\r
- inline void Region(const mglDataA &y1, const mglDataA &y2, const char *pen="", const char *opt="")\r
- { mgl_region(gr, &y1, &y2, pen, opt); }\r
- inline void Region(const mglDataA &x, const mglDataA &y1, const mglDataA &y2, const char *pen="", const char *opt="")\r
- { mgl_region_xy(gr, &x, &y1, &y2, pen, opt); }\r
- /// Draw vertical lines from points {x,y,z} to axis plane\r
- inline void Stem(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *pen="", const char *opt="")\r
- { mgl_stem_xyz(gr, &x, &y, &z, pen, opt); }\r
- inline void Stem(const mglDataA &x, const mglDataA &y, const char *pen="", const char *opt="")\r
- { mgl_stem_xy(gr, &x, &y, pen, opt); }\r
- inline void Stem(const mglDataA &y, const char *pen="", const char *opt="")\r
- { mgl_stem(gr, &y, pen, opt); }\r
-\r
- /// Draw vertical bars from points {x,y,z} to axis plane\r
- inline void Bars(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *pen="", const char *opt="")\r
- { mgl_bars_xyz(gr, &x, &y, &z, pen, opt); }\r
- inline void Bars(const mglDataA &x, const mglDataA &y, const char *pen="", const char *opt="")\r
- { mgl_bars_xy(gr, &x, &y, pen, opt); }\r
- inline void Bars(const mglDataA &y, const char *pen="", const char *opt="")\r
- { mgl_bars(gr, &y, pen, opt); }\r
- /// Draw horizontal bars from points {x,y} to axis plane\r
- inline void Barh(const mglDataA &y, const mglDataA &v, const char *pen="", const char *opt="")\r
- { mgl_barh_yx(gr, &y, &v, pen, opt); }\r
- inline void Barh(const mglDataA &v, const char *pen="", const char *opt="")\r
- { mgl_barh(gr, &v, pen, opt); }\r
- /// Draw chart for data a\r
- inline void Chart(const mglDataA &a, const char *colors="", const char *opt="")\r
- { mgl_chart(gr, &a, colors,opt); }\r
- /// Draw box-plot (special 5-value plot used in statistic)\r
- inline void BoxPlot(const mglDataA &x, const mglDataA &y, const char *pen="", const char *opt="")\r
- { mgl_boxplot_xy(gr, &x, &y, pen,opt); }\r
- inline void BoxPlot(const mglDataA &y, const char *pen="", const char *opt="")\r
- { mgl_boxplot(gr, &y, pen,opt); }\r
- /// Draw candle plot\r
- inline void Candle(const mglDataA &x, const mglDataA &v1, const mglDataA &v2, const mglDataA &y1, const mglDataA &y2, const char *pen="", const char *opt="")\r
- { mgl_candle_xyv(gr, &x, &v1, &v2, &y1, &y2, pen, opt); }\r
- inline void Candle(const mglDataA &v1, const mglDataA &v2, const mglDataA &y1, const mglDataA &y2, const char *pen="", const char *opt="")\r
- { mgl_candle_yv(gr, &v1, &v2, &y1, &y2, pen, opt); }\r
- inline void Candle(const mglDataA &v1, const mglDataA &v2, const char *pen="", const char *opt="")\r
- { mgl_candle_yv(gr, &v1, &v2, NULL, NULL, pen, opt); }\r
- inline void Candle(const mglDataA &y, const mglDataA &y1, const mglDataA &y2, const char *pen="", const char *opt="")\r
- { mgl_candle(gr, &y, &y1, &y2, pen, opt); }\r
- inline void Candle(const mglDataA &y, const char *pen="", const char *opt="")\r
- { mgl_candle(gr, &y, NULL, NULL, pen, opt); }\r
- /// Draw cones from points {x,y,z} to axis plane\r
- inline void Cones(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *pen="@", const char *opt="")\r
- { mgl_cones_xyz(gr, &x, &y, &z, pen, opt); }\r
- inline void Cones(const mglDataA &x, const mglDataA &z, const char *pen="@", const char *opt="")\r
- { mgl_cones_xz(gr, &x, &z, pen, opt); }\r
- inline void Cones(const mglDataA &z, const char *pen="@", const char *opt="")\r
- { mgl_cones(gr, &z, pen, opt); }\r
-\r
- /// Draw error boxes {ex,ey} at points {x,y}\r
- inline void Error(const mglDataA &y, const mglDataA &ey, const char *pen="", const char *opt="")\r
- { mgl_error(gr, &y, &ey, pen, opt); }\r
- inline void Error(const mglDataA &x, const mglDataA &y, const mglDataA &ey, const char *pen="", const char *opt="")\r
- { mgl_error_xy(gr, &x, &y, &ey, pen, opt); }\r
- inline void Error(const mglDataA &x, const mglDataA &y, const mglDataA &ex, const mglDataA &ey, const char *pen="", const char *opt="")\r
- { mgl_error_exy(gr, &x, &y, &ex, &ey, pen, opt); }\r
- /// Draw marks with size r at points {x,y,z}\r
- inline void Mark(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &r, const char *pen, const char *opt="")\r
- { mgl_mark_xyz(gr, &x, &y, &z, &r, pen, opt); }\r
- inline void Mark(const mglDataA &x, const mglDataA &y, const mglDataA &r, const char *pen, const char *opt="")\r
- { mgl_mark_xy(gr, &x, &y, &r, pen, opt); }\r
- inline void Mark(const mglDataA &y, const mglDataA &r, const char *pen, const char *opt="")\r
- { mgl_mark_y(gr, &y, &r, pen, opt); }\r
- /// Draw textual marks with size r at points {x,y,z}\r
- inline void TextMark(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &r, const char *text, const char *fnt="", const char *opt="")\r
- { mgl_textmark_xyzr(gr, &x, &y, &z, &r, text, fnt, opt); }\r
- inline void TextMark(const mglDataA &x, const mglDataA &y, const mglDataA &r, const char *text, const char *fnt="", const char *opt="")\r
- { mgl_textmark_xyr(gr, &x, &y, &r, text, fnt, opt); }\r
- inline void TextMark(const mglDataA &y, const mglDataA &r, const char *text, const char *fnt="", const char *opt="")\r
- { mgl_textmark_yr(gr, &y, &r, text, fnt, opt); }\r
- inline void TextMark(const mglDataA &y, const char *text, const char *fnt="", const char *opt="")\r
- { mgl_textmark(gr, &y, text, fnt, opt); }\r
- inline void TextMark(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &r, const wchar_t *text, const char *fnt="", const char *opt="")\r
- { mgl_textmarkw_xyzr(gr, &x, &y, &z, &r, text, fnt, opt); }\r
- inline void TextMark(const mglDataA &x, const mglDataA &y, const mglDataA &r, const wchar_t *text, const char *fnt="", const char *opt="")\r
- { mgl_textmarkw_xyr(gr, &x, &y, &r, text, fnt, opt); }\r
- inline void TextMark(const mglDataA &y, const mglDataA &r, const wchar_t *text, const char *fnt="", const char *opt="")\r
- { mgl_textmarkw_yr(gr, &y, &r, text, fnt, opt); }\r
- inline void TextMark(const mglDataA &y, const wchar_t *text, const char *fnt="", const char *opt="")\r
- { mgl_textmarkw(gr, &y, text, fnt, opt); }\r
-\r
- /// Draw labels for points coordinate(s) at points {x,y,z}\r
- inline void Label(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *text, const char *fnt="", const char *opt="")\r
- { mgl_label_xyz(gr, &x, &y, &z, text, fnt, opt); }\r
- inline void Label(const mglDataA &x, const mglDataA &y, const char *text, const char *fnt="", const char *opt="")\r
- { mgl_label_xy(gr, &x, &y, text, fnt, opt); }\r
- inline void Label(const mglDataA &y, const char *text, const char *fnt="", const char *opt="")\r
- { mgl_label_y(gr, &y, text, fnt, opt); }\r
- inline void Label(const mglDataA &x, const mglDataA &y, const mglDataA &z, const wchar_t *text, const char *fnt="", const char *opt="")\r
- { mgl_labelw_xyz(gr, &x, &y, &z, text, fnt, opt); }\r
- inline void Label(const mglDataA &x, const mglDataA &y, const wchar_t *text, const char *fnt="", const char *opt="")\r
- { mgl_labelw_xy(gr, &x, &y, text, fnt, opt); }\r
- inline void Label(const mglDataA &y, const wchar_t *text, const char *fnt="", const char *opt="")\r
- { mgl_labelw_y(gr, &y, text, fnt, opt); }\r
-\r
- /// Draw tube with radius r for points in arrays {x,y,z}\r
- inline void Tube(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &r, const char *pen="", const char *opt="")\r
- { mgl_tube_xyzr(gr, &x, &y, &z, &r, pen, opt); }\r
- inline void Tube(const mglDataA &x, const mglDataA &y, const mglDataA &z, float r, const char *pen="", const char *opt="")\r
- { mgl_tube_xyz(gr, &x, &y, &z, r, pen, opt); }\r
- inline void Tube(const mglDataA &x, const mglDataA &y, const mglDataA &r, const char *pen="", const char *opt="")\r
- { mgl_tube_xyr(gr, &x, &y, &r, pen, opt); }\r
- inline void Tube(const mglDataA &x, const mglDataA &y, float r, const char *pen="", const char *opt="")\r
- { mgl_tube_xy(gr, &x, &y, r, pen, opt); }\r
- inline void Tube(const mglDataA &y, const mglDataA &r, const char *pen="", const char *opt="")\r
- { mgl_tube_r(gr, &y, &r, pen, opt); }\r
- inline void Tube(const mglDataA &y, float r, const char *pen="", const char *opt="")\r
- { mgl_tube(gr, &y, r, pen, opt); }\r
- /// Draw surface of curve {r,z} rotatation around axis\r
- inline void Torus(const mglDataA &r, const mglDataA &z, const char *pen="", const char *opt="")\r
- { mgl_torus(gr, &r, &z, pen,opt); }\r
-\r
- /// Draw mesh lines for 2d data specified parametrically\r
- inline void Mesh(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *stl="", const char *opt="")\r
- { mgl_mesh_xy(gr, &x, &y, &z, stl, opt); }\r
- inline void Mesh(const mglDataA &z, const char *stl="", const char *opt="")\r
- { mgl_mesh(gr, &z, stl, opt); }\r
- /// Draw mesh lines for 2d data specified parametrically\r
- inline void Fall(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *stl="", const char *opt="")\r
- { mgl_fall_xy(gr, &x, &y, &z, stl, opt); }\r
- inline void Fall(const mglDataA &z, const char *stl="", const char *opt="")\r
- { mgl_fall(gr, &z, stl, opt); }\r
- /// Draw belts for 2d data specified parametrically\r
- inline void Belt(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *stl="", const char *opt="")\r
- { mgl_belt_xy(gr, &x, &y, &z, stl, opt); }\r
- inline void Belt(const mglDataA &z, const char *stl="", const char *opt="")\r
- { mgl_belt(gr, &z, stl, opt); }\r
- /// Draw surface for 2d data specified parametrically with color proportional to z\r
- inline void Surf(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *stl="", const char *opt="")\r
- { mgl_surf_xy(gr, &x, &y, &z, stl, opt); }\r
- inline void Surf(const mglDataA &z, const char *stl="", const char *opt="")\r
- { mgl_surf(gr, &z, stl, opt); }\r
- /// Draw grid lines for density plot of 2d data specified parametrically\r
- inline void Grid(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *stl="", const char *opt="")\r
- { mgl_grid_xy(gr, &x, &y, &z, stl, opt); }\r
- inline void Grid(const mglDataA &z, const char *stl="", const char *opt="")\r
- { mgl_grid(gr, &z, stl, opt); }\r
- /// Draw vertical tiles for 2d data specified parametrically\r
- inline void Tile(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *stl="", const char *opt="")\r
- { mgl_tile_xy(gr, &x, &y, &z, stl, opt); }\r
- inline void Tile(const mglDataA &z, const char *stl="", const char *opt="")\r
- { mgl_tile(gr, &z, stl, opt); }\r
- /// Draw density plot for 2d data specified parametrically\r
- inline void Dens(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *stl="", const char *opt="")\r
- { mgl_dens_xy(gr, &x, &y, &z, stl, opt); }\r
- inline void Dens(const mglDataA &z, const char *stl="", const char *opt="")\r
- { mgl_dens(gr, &z, stl, opt); }\r
- /// Draw vertical boxes for 2d data specified parametrically\r
- inline void Boxs(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *stl="", const char *opt="")\r
- { mgl_boxs_xy(gr, &x, &y, &z, stl, opt); }\r
- inline void Boxs(const mglDataA &z, const char *stl="", const char *opt="")\r
- { mgl_boxs(gr, &z, stl, opt); }\r
-\r
- /// Draw contour lines for 2d data specified parametrically\r
- inline void Cont(const mglDataA &v, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")\r
- { mgl_cont_xy_val(gr, &v, &x, &y, &z, sch, opt); }\r
- inline void Cont(const mglDataA &v, const mglDataA &z, const char *sch="", const char *opt="")\r
- { mgl_cont_val(gr, &v, &z, sch, opt); }\r
- inline void Cont(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")\r
- { mgl_cont_xy(gr, &x, &y, &z, sch, opt); }\r
- inline void Cont(const mglDataA &z, const char *sch="", const char *opt="")\r
- { mgl_cont(gr, &z, sch, opt); }\r
- /// Draw solid contours for 2d data specified parametrically\r
- inline void ContF(const mglDataA &v, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")\r
- { mgl_contf_xy_val(gr, &v, &x, &y, &z, sch, opt); }\r
- inline void ContF(const mglDataA &v, const mglDataA &z, const char *sch="", const char *opt="")\r
- { mgl_contf_val(gr, &v, &z, sch, opt); }\r
- inline void ContF(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")\r
- { mgl_contf_xy(gr, &x, &y, &z, sch, opt); }\r
- inline void ContF(const mglDataA &z, const char *sch="", const char *opt="")\r
- { mgl_contf(gr, &z, sch, opt); }\r
- /// Draw solid contours for 2d data specified parametrically with manual colors\r
- inline void ContD(const mglDataA &v, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")\r
- { mgl_contd_xy_val(gr, &v, &x, &y, &z, sch, opt); }\r
- inline void ContD(const mglDataA &v, const mglDataA &z, const char *sch="", const char *opt="")\r
- { mgl_contd_val(gr, &v, &z, sch, opt); }\r
- inline void ContD(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")\r
- { mgl_contd_xy(gr, &x, &y, &z, sch, opt); }\r
- inline void ContD(const mglDataA &z, const char *sch="", const char *opt="")\r
- { mgl_contd(gr, &z, sch, opt); }\r
- /// Draw contour lines for 2d data specified parametrically\r
- inline void ContV(const mglDataA &v, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")\r
- { mgl_contv_xy_val(gr, &v, &x, &y, &z, sch, opt); }\r
- inline void ContV(const mglDataA &v, const mglDataA &z, const char *sch="", const char *opt="")\r
- { mgl_contv_val(gr, &v, &z, sch, opt); }\r
- inline void ContV(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")\r
- { mgl_contv_xy(gr, &x, &y, &z, sch, opt); }\r
- inline void ContV(const mglDataA &z, const char *sch="", const char *opt="")\r
- { mgl_contv(gr, &z, sch, opt); }\r
- /// Draw axial-symmetric isosurfaces for 2d data specified parametrically\r
- inline void Axial(const mglDataA &v, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")\r
- { mgl_axial_xy_val(gr, &v, &x, &y, &z, sch,opt); }\r
- inline void Axial(const mglDataA &v, const mglDataA &z, const char *sch="", const char *opt="")\r
- { mgl_axial_val(gr, &v, &z, sch, opt); }\r
- inline void Axial(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")\r
- { mgl_axial_xy(gr, &x, &y, &z, sch, opt); }\r
- inline void Axial(const mglDataA &z, const char *sch="", const char *opt="")\r
- { mgl_axial(gr, &z, sch, opt); }\r
-\r
- /// Draw grid lines for density plot at slice for 3d data specified parametrically\r
- inline void Grid3(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *stl="", float sVal=-1, const char *opt="")\r
- { mgl_grid3_xyz(gr, &x, &y, &z, &a, stl, sVal, opt); }\r
- inline void Grid3(const mglDataA &a, const char *stl="", float sVal=-1, const char *opt="")\r
- { mgl_grid3(gr, &a, stl, sVal, opt); }\r
- /// Draw density plot at slice for 3d data specified parametrically\r
- inline void Dens3(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *stl="", float sVal=-1, const char *opt="")\r
- { mgl_dens3_xyz(gr, &x, &y, &z, &a, stl, sVal, opt); }\r
- inline void Dens3(const mglDataA &a, const char *stl="", float sVal=-1, const char *opt="")\r
- { mgl_dens3(gr, &a, stl, sVal, opt); }\r
-\r
- /// Draw isosurface(s) for 3d data specified parametrically\r
- inline void Surf3(float Val, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *stl="", const char *opt="")\r
- { mgl_surf3_xyz_val(gr, Val, &x, &y, &z, &a, stl, opt); }\r
- inline void Surf3(float Val, const mglDataA &a, const char *stl="", const char *opt="")\r
- { mgl_surf3_val(gr, Val, &a, stl, opt); }\r
- inline void Surf3(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *stl="", const char *opt="")\r
- { mgl_surf3_xyz(gr, &x, &y, &z, &a, stl, opt); }\r
- inline void Surf3(const mglDataA &a, const char *stl="", const char *opt="")\r
- { mgl_surf3(gr, &a, stl, opt); }\r
-\r
- /// Draw a semi-transparent cloud for 3d data\r
- inline void Cloud(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *stl="", const char *opt="")\r
- { mgl_cloud_xyz(gr, &x, &y, &z, &a, stl, opt); }\r
- inline void Cloud(const mglDataA &a, const char *stl="", const char *opt="")\r
- { mgl_cloud(gr, &a, stl, opt); }\r
-\r
- /// Draw contour lines at slice for 3d data specified parametrically\r
- inline void Cont3(const mglDataA &v, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", float sVal=-1, const char *opt="")\r
- { mgl_cont3_xyz_val(gr, &v, &x, &y, &z, &a, sch, sVal, opt); }\r
- inline void Cont3(const mglDataA &v, const mglDataA &a, const char *sch="", float sVal=-1, const char *opt="")\r
- { mgl_cont3_val(gr, &v, &a, sch, sVal, opt); }\r
- inline void Cont3(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", float sVal=-1, const char *opt="")\r
- { mgl_cont3_xyz(gr, &x, &y, &z, &a, sch, sVal, opt); }\r
- inline void Cont3(const mglDataA &a, const char *sch="", float sVal=-1, const char *opt="")\r
- { mgl_cont3(gr, &a, sch, sVal, opt); }\r
-\r
- /// Draw solid contours at slice for 3d data specified parametrically\r
- inline void ContF3(const mglDataA &v, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", float sVal=-1, const char *opt="")\r
- { mgl_contf3_xyz_val(gr, &v, &x, &y, &z, &a, sch, sVal, opt); }\r
- inline void ContF3(const mglDataA &v, const mglDataA &a, const char *sch="", float sVal=-1, const char *opt="")\r
- { mgl_contf3_val(gr, &v, &a, sch, sVal, opt); }\r
- inline void ContF3(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", float sVal=-1, const char *opt="")\r
- { mgl_contf3_xyz(gr, &x, &y, &z, &a, sch, sVal, opt); }\r
- inline void ContF3(const mglDataA &a, const char *sch="", float sVal=-1, const char *opt="")\r
- { mgl_contf3(gr, &a, sch, sVal, opt); }\r
-\r
- /// Draw several isosurfaces for 3d beam in curvilinear coordinates\r
- inline void Beam(const mglDataA &tr, const mglDataA &g1, const mglDataA &g2, const mglDataA &a, float r, const char *stl=0, int flag=0, int num=3)\r
- { mgl_beam(gr, &tr,&g1,&g2,&a,r,stl,flag,num); }\r
- inline void Beam(float val, const mglDataA &tr, const mglDataA &g1, const mglDataA &g2, const mglDataA &a, float r, const char *stl=NULL, int flag=0)\r
- { mgl_beam_val(gr,val,&tr,&g1,&g2,&a,r,stl,flag); }\r
-\r
- /// Draw vertical tiles with variable size for 2d data specified parametrically\r
- inline void TileS(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &r, const char *stl="", const char *opt="")\r
- { mgl_tiles_xy(gr, &x, &y, &z, &r, stl, opt); }\r
- inline void TileS(const mglDataA &z, const mglDataA &r, const char *stl="", const char *opt="")\r
- { mgl_tiles(gr, &z, &r, stl, opt); }\r
- /// Draw surface for 2d data specified parametrically with color proportional to c\r
- inline void SurfC(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")\r
- { mgl_surfc_xy(gr, &x, &y, &z, &c, sch,opt); }\r
- inline void SurfC(const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")\r
- { mgl_surfc(gr, &z, &c, sch,opt); }\r
- /// Draw surface for 2d data specified parametrically with alpha proportional to c\r
- inline void SurfA(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")\r
- { mgl_surfa_xy(gr, &x, &y, &z, &c, sch,opt); }\r
- inline void SurfA(const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")\r
- { mgl_surfa(gr, &z, &c, sch,opt); }\r
- /// Color map of matrix a to matrix b, both matrix can parametrically depend on coordinates\r
- inline void Map(const mglDataA &x, const mglDataA &y, const mglDataA &a, const mglDataA &b, const char *sch="", const char *opt="")\r
- { mgl_map_xy(gr, &x, &y, &a, &b, sch, opt); }\r
- inline void Map(const mglDataA &a, const mglDataA &b, const char *sch="", const char *opt="")\r
- { mgl_map(gr, &a, &b, sch, opt); }\r
- /// Draw density plot for spectra-gramm specified parametrically\r
- inline void STFA(const mglDataA &x, const mglDataA &y, const mglDataA &re, const mglDataA &im, int dn, const char *sch="", const char *opt="")\r
- { mgl_stfa_xy(gr, &x, &y, &re, &im, dn, sch, opt); }\r
- inline void STFA(const mglDataA &re, const mglDataA &im, int dn, const char *sch="", const char *opt="")\r
- { mgl_stfa(gr, &re, &im, dn, sch, opt); }\r
-\r
- /// Draw isosurface(s) for 3d data specified parametrically with alpha proportional to b\r
- inline void Surf3A(float Val, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const mglDataA &b, const char *stl="", const char *opt="")\r
- { mgl_surf3a_xyz_val(gr, Val, &x, &y, &z, &a, &b, stl, opt); }\r
- inline void Surf3A(float Val, const mglDataA &a, const mglDataA &b, const char *stl="", const char *opt="")\r
- { mgl_surf3a_val(gr, Val, &a, &b, stl, opt); }\r
- inline void Surf3A(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const mglDataA &b, const char *stl="", const char *opt="")\r
- { mgl_surf3a_xyz(gr, &x, &y, &z, &a, &b, stl, opt); }\r
- inline void Surf3A(const mglDataA &a, const mglDataA &b, const char *stl="", const char *opt="")\r
- { mgl_surf3a(gr, &a, &b, stl, opt); }\r
- /// Draw isosurface(s) for 3d data specified parametrically with color proportional to b\r
- inline void Surf3C(float Val, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const mglDataA &b, const char *stl="", const char *opt="")\r
- { mgl_surf3c_xyz_val(gr, Val, &x, &y, &z, &a, &b, stl,opt); }\r
- inline void Surf3C(float Val, const mglDataA &a, const mglDataA &b, const char *stl="", const char *opt="")\r
- { mgl_surf3c_val(gr, Val, &a, &b, stl, opt); }\r
- inline void Surf3C(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const mglDataA &b, const char *stl="", const char *opt="")\r
- { mgl_surf3c_xyz(gr, &x, &y, &z, &a, &b, stl, opt); }\r
- inline void Surf3C(const mglDataA &a, const mglDataA &b, const char *stl="", const char *opt="")\r
- { mgl_surf3c(gr, &a, &b, stl, opt); }\r
-\r
- /// Plot dew drops for vector field {ax,ay} parametrically depended on coordinate {x,y}\r
- inline void Dew(const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")\r
- { mgl_dew_xy(gr, &x, &y, &ax, &ay, sch, opt); }\r
- inline void Dew(const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")\r
- { mgl_dew_2d(gr, &ax, &ay, sch, opt); }\r
- /// Plot vectors at position {x,y,z} along {ax,ay,az} with length/color proportional to |a|\r
- inline void Traj(const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")\r
- { mgl_traj_xy(gr, &x, &y, &ax, &ay, sch, opt); }\r
- inline void Traj(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")\r
- { mgl_traj_xyz(gr, &x, &y, &z, &ax, &ay, &az, sch, opt); }\r
- /// Plot vector field {ax,ay,ay} parametrically depended on coordinate {x,y,z} with length/color proportional to |a|\r
- inline void Vect(const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")\r
- { mgl_vect_xy(gr, &x, &y, &ax, &ay, sch, opt); }\r
- inline void Vect(const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")\r
- { mgl_vect_2d(gr, &ax, &ay, sch, opt); }\r
- inline void Vect(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")\r
- { mgl_vect_xyz(gr, &x, &y, &z, &ax, &ay, &az, sch, opt); }\r
- inline void Vect(const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")\r
- { mgl_vect_3d(gr, &ax, &ay, &az, sch, opt); }\r
-\r
- /// Plot flows for vector field {ax,ay,ay} parametrically depended on coordinate {x,y,z} with color proportional to |a|\r
- inline void Flow(const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")\r
- { mgl_flow_xy(gr, &x, &y, &ax, &ay, sch, opt); }\r
- inline void Flow(const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")\r
- { mgl_flow_2d(gr, &ax, &ay, sch, opt); }\r
- inline void Flow(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")\r
- { mgl_flow_xyz(gr, &x, &y, &z, &ax, &ay, &az, sch, opt); }\r
- inline void Flow(const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")\r
- { mgl_flow_3d(gr, &ax, &ay, &az, sch, opt); }\r
- /// Plot flow from point p for vector field {ax,ay,ay} parametrically depended on coordinate {x,y,z} with color proportional to |a|\r
- inline void FlowP(mglPoint p, const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")\r
- { mgl_flowp_xy(gr, p.x, p.y, p.z, &x, &y, &ax, &ay, sch, opt); }\r
- inline void FlowP(mglPoint p, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")\r
- { mgl_flowp_2d(gr, p.x, p.y, p.z, &ax, &ay, sch, opt); }\r
- inline void FlowP(mglPoint p, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")\r
- { mgl_flowp_xyz(gr, p.x, p.y, p.z, &x, &y, &z, &ax, &ay, &az, sch, opt); }\r
- inline void FlowP(mglPoint p, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")\r
- { mgl_flowp_3d(gr, p.x, p.y, p.z, &ax, &ay, &az, sch, opt); }\r
-\r
- /// Plot flows for gradient of scalar field phi parametrically depended on coordinate {x,y,z}\r
- inline void Grad(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &phi, const char *sch="", const char *opt="")\r
- { mgl_grad_xyz(gr,&x,&y,&z,&phi,sch,opt); }\r
- inline void Grad(const mglDataA &x, const mglDataA &y, const mglDataA &phi, const char *sch="", const char *opt="")\r
- { mgl_grad_xy(gr,&x,&y,&phi,sch,opt); }\r
- inline void Grad(const mglDataA &phi, const char *sch="", const char *opt="")\r
- { mgl_grad(gr,&phi,sch,opt); }\r
-\r
- /// Plot flow pipes for vector field {ax,ay,ay} parametrically depended on coordinate {x,y,z} with color proportional to |a|\r
- inline void Pipe(const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", float r0=0.05, const char *opt="")\r
- { mgl_pipe_xy(gr, &x, &y, &ax, &ay, sch, r0, opt); }\r
- inline void Pipe(const mglDataA &ax, const mglDataA &ay, const char *sch="", float r0=0.05, const char *opt="")\r
- { mgl_pipe_2d(gr, &ax, &ay, sch, r0, opt); }\r
- inline void Pipe(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", float r0=0.05, const char *opt="")\r
- { mgl_pipe_xyz(gr, &x, &y, &z, &ax, &ay, &az, sch, r0, opt); }\r
- inline void Pipe(const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", float r0=0.05, const char *opt="")\r
- { mgl_pipe_3d(gr, &ax, &ay, &az, sch, r0, opt); }\r
-\r
- /// Draw density plot for data at x = sVal\r
- inline void DensX(const mglDataA &a, const char *stl="", float sVal=NaN, const char *opt="")\r
- { mgl_dens_x(gr, &a, stl, sVal, opt); }\r
- /// Draw density plot for data at y = sVal\r
- inline void DensY(const mglDataA &a, const char *stl="", float sVal=NaN, const char *opt="")\r
- { mgl_dens_y(gr, &a, stl, sVal, opt); }\r
- /// Draw density plot for data at z = sVal\r
- inline void DensZ(const mglDataA &a, const char *stl="", float sVal=NaN, const char *opt="")\r
- { mgl_dens_z(gr, &a, stl, sVal, opt); }\r
- /// Draw contour plots for data at x = sVal\r
- inline void ContX(const mglDataA &a, const char *stl="", float sVal=NaN, const char *opt="")\r
- { mgl_cont_x(gr, &a, stl, sVal, opt); }\r
- inline void ContX(const mglDataA &v, const mglDataA &a, const char *stl="", float sVal=NaN, const char *opt="")\r
- { mgl_cont_x_val(gr, &v, &a, stl, sVal, opt); }\r
- /// Draw contour plots for data at y = sVal\r
- inline void ContY(const mglDataA &a, const char *stl="", float sVal=NaN, const char *opt="")\r
- { mgl_cont_y(gr, &a, stl, sVal, opt); }\r
- inline void ContY(const mglDataA &v, const mglDataA &a, const char *stl="", float sVal=NaN, const char *opt="")\r
- { mgl_cont_y_val(gr, &v, &a, stl, sVal, opt); }\r
- /// Draw contour plots for data at z = sVal\r
- inline void ContZ(const mglDataA &a, const char *stl="", float sVal=NaN, const char *opt="")\r
- { mgl_cont_z(gr, &a, stl, sVal, opt); }\r
- inline void ContZ(const mglDataA &v, const mglDataA &a, const char *stl="", float sVal=NaN, const char *opt="")\r
- { mgl_cont_z_val(gr, &v, &a, stl, sVal, opt); }\r
- /// Draw solid contour plots for data at x = sVal\r
- inline void ContFX(const mglDataA &a, const char *stl="", float sVal=NaN, const char *opt="")\r
- { mgl_contf_x(gr, &a, stl, sVal, opt); }\r
- inline void ContFX(const mglDataA &v, const mglDataA &a, const char *stl="", float sVal=NaN, const char *opt="")\r
- { mgl_contf_x_val(gr, &v, &a, stl, sVal, opt); }\r
- /// Draw solid contour plots for data at y = sVal\r
- inline void ContFY(const mglDataA &a, const char *stl="", float sVal=NaN, const char *opt="")\r
- { mgl_contf_y(gr, &a, stl, sVal, opt); }\r
- inline void ContFY(const mglDataA &v, const mglDataA &a, const char *stl="", float sVal=NaN, const char *opt="")\r
- { mgl_contf_y_val(gr, &v, &a, stl, sVal, opt); }\r
- /// Draw solid contour plots for data at z = sVal\r
- inline void ContFZ(const mglDataA &a, const char *stl="", float sVal=NaN, const char *opt="")\r
- { mgl_contf_z(gr, &a, stl, sVal, opt); }\r
- inline void ContFZ(const mglDataA &v, const mglDataA &a, const char *stl="", float sVal=NaN, const char *opt="")\r
- { mgl_contf_z_val(gr, &v, &a, stl, sVal, opt); }\r
-\r
- /// Draw curve for formula with x in range [Min.x, Max.x]\r
- inline void FPlot(const char *fy, const char *stl="", const char *opt="")\r
- { mgl_fplot(gr, fy, stl, opt); }\r
- /// Draw curve for formulas parametrically depended on t in range [0,1]\r
- inline void FPlot(const char *fx, const char *fy, const char *fz, const char *stl, const char *opt="")\r
- { mgl_fplot_xyz(gr, fx, fy, fz, stl, opt); }\r
- /// Draw surface by formula with x,y in range [Min, Max]\r
- inline void FSurf(const char *fz, const char *stl="", const char *opt="")\r
- { mgl_fsurf(gr, fz, stl, opt); }\r
- /// Draw surface by formulas parametrically depended on u,v in range [0,1]\r
- inline void FSurf(const char *fx, const char *fy, const char *fz, const char *stl, const char *opt="")\r
- { mgl_fsurf_xyz(gr, fx, fy, fz, stl, opt); }\r
-\r
- /// Draw triangle mesh for points in arrays {x,y,z} with specified color c.\r
- inline void TriPlot(const mglDataA &nums, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")\r
- { mgl_triplot_xyzc(gr, &nums, &x, &y, &z, &c, sch, opt); }\r
- inline void TriPlot(const mglDataA &nums, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")\r
- { mgl_triplot_xyz(gr, &nums, &x, &y, &z, sch, opt); }\r
- inline void TriPlot(const mglDataA &nums, const mglDataA &x, const mglDataA &y, const char *sch="", const char *opt="")\r
- { mgl_triplot_xy(gr, &nums, &x, &y, sch, opt); }\r
- /// Draw quad mesh for points in arrays {x,y,z} with specified color c.\r
- inline void QuadPlot(const mglDataA &nums, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")\r
- { mgl_quadplot_xyzc(gr, &nums, &x, &y, &z, &c, sch, opt); }\r
- inline void QuadPlot(const mglDataA &nums, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")\r
- { mgl_quadplot_xyz(gr, &nums, &x, &y, &z, sch, opt); }\r
- inline void QuadPlot(const mglDataA &nums, const mglDataA &x, const mglDataA &y, const char *sch="", const char *opt="")\r
- { mgl_quadplot_xy(gr, &nums, &x, &y, sch, opt); }\r
-\r
- /// Draw contour lines for triangle mesh for points in arrays {x,y,z}.\r
- inline void TriCont(const mglDataA &nums, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")\r
- { mgl_tricont_xyc(gr, &nums, &x, &y, &z, sch, opt); }\r
- inline void TriContV(const mglDataA &v, const mglDataA &nums, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")\r
- { mgl_tricont_xycv(gr, &v, &nums, &x, &y, &z, sch, opt); }\r
- inline void TriCont(const mglDataA &nums, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", const char *opt="")\r
- { mgl_tricont_xyzc(gr, &nums, &x, &y, &z, &a, sch, opt); }\r
- inline void TriContV(const mglDataA &v, const mglDataA &nums, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", const char *opt="")\r
- { mgl_tricont_xyzcv(gr, &v, &nums, &x, &y, &z, &a, sch, opt); }\r
-\r
- /// Draw dots in points {x,y,z}.\r
- inline void Dots(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")\r
- { mgl_dots(gr, &x, &y, &z, sch, opt); }\r
- /// Draw semitransparent dots in points {x,y,z}.\r
- inline void Dots(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", const char *opt="")\r
- { mgl_dots_a(gr, &x, &y, &z, &a, sch, opt); }\r
- /// Draw surface reconstructed for points in arrays {x,y,z}.\r
- inline void Crust(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")\r
- { mgl_crust(gr, &x, &y, &z, sch, opt); }\r
-\r
- /// Fit data along x-direction for each data row. Return array with values for found formula.\r
- inline mglData Fit(const mglDataA &y, const char *eq, const char *var, const char *opt="")\r
- { return mglData(true,mgl_fit_1(gr, &y, eq,var,0, opt)); }\r
- inline mglData Fit(const mglDataA &y, const char *eq, const char *var, mglData &ini, const char *opt="")\r
- { return mglData(true,mgl_fit_1(gr, &y, eq, var, &ini, opt)); }\r
- /// Fit data along x-, y-directions for each data slice. Return array with values for found formula.\r
- inline mglData Fit2(const mglDataA &z, const char *eq, const char *var, const char *opt="")\r
- { return mglData(true,mgl_fit_2(gr, &z, eq, var,0, opt)); }\r
- inline mglData Fit2(const mglDataA &z, const char *eq, const char *var, mglData &ini, const char *opt="")\r
- { return mglData(true,mgl_fit_2(gr, &z, eq, var, &ini, opt)); }\r
- /// Fit data along along all directions. Return array with values for found formula.\r
- inline mglData Fit3(const mglDataA &a, const char *eq, const char *var, const char *opt="")\r
- { return mglData(true,mgl_fit_3(gr, &a, eq, var,0, opt)); }\r
- inline mglData Fit3(const mglDataA &a, const char *eq, const char *var, mglData &ini, const char *opt="")\r
- { return mglData(true,mgl_fit_3(gr, &a, eq, var, &ini, opt)); }\r
- /// Fit data along x-direction for each data row. Return array with values for found formula.\r
- inline mglData Fit(const mglDataA &x, const mglDataA &y, const char *eq, const char *var, const char *opt="")\r
- { return mglData(true,mgl_fit_xy(gr, &x, &y, eq, var,0, opt)); }\r
- inline mglData Fit(const mglDataA &x, const mglDataA &y, const char *eq, const char *var, mglData &ini, const char *opt="")\r
- { return mglData(true,mgl_fit_xy(gr, &x, &y, eq, var, &ini, opt)); }\r
- /// Fit data along x-, y-directions for each data slice. Return array with values for found formula.\r
- inline mglData Fit(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *eq, const char *var, const char *opt="")\r
- { return mglData(true,mgl_fit_xyz(gr, &x, &y, &z, eq, var,0, opt)); }\r
- inline mglData Fit(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *eq, const char *var, mglData &ini, const char *opt="")\r
- { return mglData(true,mgl_fit_xyz(gr, &x, &y, &z, eq, var, &ini, opt)); }\r
- /// Fit data along along all directions. Return array with values for found formula.\r
- inline mglData Fit(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *eq, const char *var, const char *opt="")\r
- { return mglData(true,mgl_fit_xyza(gr, &x, &y, &z, &a, eq, var,0, opt)); }\r
- inline mglData Fit(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *eq, const char *var, mglData &ini, const char *opt="")\r
- { return mglData(true,mgl_fit_xyza(gr, &x, &y, &z, &a, eq,var, &ini, opt)); }\r
- /// Fit data with dispersion s along x-direction for each data row. Return array with values for found formula.\r
- inline mglData FitS(const mglDataA &y, const mglDataA &s, const char *eq, const char *var, const char *opt="")\r
- { return mglData(true,mgl_fit_ys(gr, &y, &s, eq, var,0, opt)); }\r
- inline mglData FitS(const mglDataA &y, const mglDataA &s, const char *eq, const char *var, mglData &ini, const char *opt="")\r
- { return mglData(true,mgl_fit_ys(gr, &y, &s, eq, var, &ini, opt)); }\r
- inline mglData FitS(const mglDataA &x, const mglDataA &y, const mglDataA &s, const char *eq, const char *var, const char *opt="")\r
- { return mglData(true,mgl_fit_xys(gr, &x, &y, &s, eq, var,0, opt)); }\r
- inline mglData FitS(const mglDataA &x, const mglDataA &y, const mglDataA &s, const char *eq, const char *var, mglData &ini, const char *opt="")\r
- { return mglData(true,mgl_fit_xys(gr, &x, &y, &s, eq, var, &ini, opt)); }\r
- /// Fit data with dispersion s along x-, y-directions for each data slice. Return array with values for found formula.\r
- inline mglData FitS(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &s, const char *eq, const char *var, const char *opt="")\r
- { return mglData(true,mgl_fit_xyzs(gr, &x, &y, &z, &s, eq, var,0, opt)); }\r
- inline mglData FitS(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &s, const char *eq, const char *var, mglData &ini, const char *opt="")\r
- { return mglData(true,mgl_fit_xyzs(gr, &x, &y, &z, &s, eq, var, &ini, opt)); }\r
- /// Fit data with dispersion s along all directions. Return array with values for found formula.\r
- inline mglData FitS(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const mglDataA &s, const char *eq, const char *var, const char *opt="")\r
- { return mglData(true,mgl_fit_xyzas(gr, &x, &y, &z, &a, &s, eq, var,0, opt)); }\r
- inline mglData FitS(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const mglDataA &s, const char *eq, const char *var, mglData &ini, const char *opt="")\r
- { return mglData(true,mgl_fit_xyzas(gr, &x, &y, &z, &a, &s, eq, var, &ini, opt)); }\r
- /// Print fitted last formula (with coefficients)\r
- inline void PutsFit(mglPoint p, const char *prefix=0, const char *font=0, float size=-1)\r
- { mgl_puts_fit(gr, p.x, p.y, p.z, prefix, font, size); }\r
- /// Get last fitted formula\r
- inline const char *GetFit()\r
- { return mgl_get_fit(gr); }\r
-\r
- /// Solve PDE with x,y,z in range [Min, Max]\r
- inline mglData PDE(const char *ham, const mglDataA &ini_re, const mglDataA &ini_im, float dz=0.1, float k0=100, const char *opt="")\r
- { return mglData(true,mgl_pde_solve(gr,ham,&ini_re,&ini_im,dz,k0, opt)); }\r
- /// Fill data by formula with x,y,z in range [Min, Max]\r
- inline void Fill(mglData &u, const char *eq, const char *opt="")\r
- { mgl_data_fill_eq(gr, &u, eq, 0, 0, opt); }\r
- inline void Fill(mglData &u, const char *eq, const mglDataA &v, const char *opt="")\r
- { mgl_data_fill_eq(gr, &u, eq, &v, 0, opt); }\r
- inline void Fill(mglData &u, const char *eq, const mglDataA &v, const mglDataA &w, const char *opt="")\r
- { mgl_data_fill_eq(gr, &u, eq, &v, &w, opt); }\r
-\r
- /// Make histogram (distribution) of data. This function do not plot data.\r
- inline mglData Hist(const mglDataA &x, const mglDataA &a, const char *opt="")\r
- { return mglData(true, mgl_hist_x(gr, &x, &a, opt)); }\r
- inline mglData Hist(const mglDataA &x, const mglDataA &y, const mglDataA &a, const char *opt="")\r
- { return mglData(true, mgl_hist_xy(gr, &x, &y, &a, opt)); }\r
- inline mglData Hist(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *opt="")\r
- { return mglData(true, mgl_hist_xyz(gr, &x, &y, &z, &a, opt)); }\r
-\r
- inline void Compression(bool){} // NOTE: Add later -- IDTF\r
- inline void VertexColor(bool){} // NOTE: Add later -- IDTF\r
- inline void DoubleSided(bool){} // NOTE: Add later -- IDTF\r
- inline void TextureColor(bool){} // NOTE: Add later -- IDTF\r
-};\r
-//-----------------------------------------------------------------------------\r
-/// Callback function for asking user a question. Result shouldn't exceed 1024.\r
-extern void (*mgl_ask_func)(const wchar_t *quest, wchar_t *res);\r
-//-----------------------------------------------------------------------------\r
-/// Wrapper class for MGL parsing\r
-class mglParse\r
-{\r
- HMPR pr;\r
-public:\r
- mglParse(HMPR p) { pr = p; mgl_use_parser(pr,1); }\r
- mglParse(mglParse &p) { pr = p.pr; mgl_use_parser(pr,1); }\r
- mglParse(bool setsize=false)\r
- { pr=mgl_create_parser(); mgl_parser_allow_setsize(pr, setsize); }\r
- ~mglParse() { if(mgl_use_parser(pr,-1)<1) mgl_delete_parser(pr); }\r
- inline HMPR Self() { return pr; }\r
- inline int Parse(mglGraph *gr, const char *str, int pos)\r
- { return mgl_parse(gr->Self(), pr, str, pos); }\r
- inline int Parse(mglGraph *gr, const wchar_t *str, int pos)\r
- { return mgl_parsew(gr->Self(), pr, str, pos); }\r
- inline void Execute(mglGraph *gr, const char *str)\r
- { mgl_parse_text(gr->Self(), pr, str); }\r
- inline void Execute(mglGraph *gr, const wchar_t *str)\r
- { mgl_parsew_text(gr->Self(), pr, str); }\r
- inline void Execute(mglGraph *gr, FILE *fp, bool print=false)\r
- { mgl_parse_file(gr->Self(), pr, fp, print); }\r
- inline int CmdType(const char *name)\r
- { return mgl_cmd_type(pr, name); }\r
- inline const char *CmdFormat(const char *name)\r
- { return mgl_cmd_frmt(pr, name); }\r
- inline const char *CmdDesc(const char *name)\r
- { return mgl_cmd_desc(pr, name); }\r
-\r
- inline void AddParam(int id, const char *str) { mgl_add_param(pr, id, str); }\r
- inline void AddParam(int id, const wchar_t *str){ mgl_add_paramw(pr, id, str); }\r
- inline void RestoreOnce() { mgl_restore_once(pr); }\r
- inline void AllowSetSize(bool allow) { mgl_parser_allow_setsize(pr, allow); }\r
-\r
- /*===!!! NOTE !!! You must not delete obtained data arrays !!!===============*/\r
- inline mglData *AddVar(const char *name) { return mgl_add_var(pr, name); }\r
- /*===!!! NOTE !!! You must not delete obtained data arrays !!!===============*/\r
- inline mglData *FindVar(const char *name) { return mgl_find_var(pr, name); }\r
- inline void DeleteVar(const char *name) { mgl_del_var(pr, name); }\r
- inline void Stop() { mgl_parser_stop(pr); }\r
-};\r
-//-----------------------------------------------------------------------------\r
-/// Wrapper class expression evaluating\r
-class mglExpr\r
-{\r
- HMEX ex;\r
-public:\r
- mglExpr(const char *expr) { ex = mgl_create_expr(expr); }\r
- ~mglExpr() { mgl_delete_expr(ex); }\r
- inline mreal Eval(mreal x, mreal y=0, mreal z=0)\r
- { return mgl_expr_eval(ex,x,y,z); }\r
- inline mreal Diff(char dir, mreal x, mreal y=0, mreal z=0)\r
- { return mgl_expr_diff(ex,dir, x,y,z); }\r
-#ifndef SWIG\r
- inline mreal Eval(mreal var[26])\r
- { return mgl_expr_eval_v(ex,var); }\r
- inline mreal Diff(char dir, mreal var[26])\r
- { return mgl_expr_diff_v(ex,dir, var); }\r
-#endif\r
-};\r
-//-----------------------------------------------------------------------------\r
-#endif\r
+++ /dev/null
-/***************************************************************************\r
- * mgl_cf.cpp is part of Math Graphic Library\r
- * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
- * *\r
- * This program is free software; you can redistribute it and/or modify *\r
- * it under the terms of the GNU Library General Public License as *\r
- * published by the Free Software Foundation; either version 3 of the *\r
- * License, or (at your option) any later version. *\r
- * *\r
- * This program is distributed in the hope that it will be useful, *\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
- * GNU General Public License for more details. *\r
- * *\r
- * You should have received a copy of the GNU Library General Public *\r
- * License along with this program; if not, write to the *\r
- * Free Software Foundation, Inc., *\r
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
- ***************************************************************************/\r
-#ifndef _MGL_CF_H_\r
-#define _MGL_CF_H_\r
-/*****************************************************************************/\r
-#include "mgl/base_cf.h"\r
-#include "mgl/data_cf.h"\r
-#include "mgl/cont.h"\r
-#include "mgl/fit.h"\r
-#include "mgl/plot.h"\r
-#include "mgl/surf.h"\r
-#include "mgl/volume.h"\r
-#include "mgl/vect.h"\r
-#include "mgl/prim.h"\r
-#include "mgl/other.h"\r
-#include "mgl/canvas_cf.h"\r
-#include "mgl/addon.h"\r
-/*****************************************************************************/\r
-#endif\r
+++ /dev/null
-/***************************************************************************\r
- * opengl.h is part of Math Graphic Library\r
- * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
- * *\r
- * This program is free software; you can redistribute it and/or modify *\r
- * it under the terms of the GNU Library General Public License as *\r
- * published by the Free Software Foundation; either version 3 of the *\r
- * License, or (at your option) any later version. *\r
- * *\r
- * This program is distributed in the hope that it will be useful, *\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
- * GNU General Public License for more details. *\r
- * *\r
- * You should have received a copy of the GNU Library General Public *\r
- * License along with this program; if not, write to the *\r
- * Free Software Foundation, Inc., *\r
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
- ***************************************************************************/\r
-#ifndef MGL_CANVAS_GL_H\r
-#define MGL_CANVAS_GL_H\r
-/*****************************************************************************/\r
-#ifdef __cplusplus\r
-#include "mgl/canvas.h"\r
-\r
-class mglCanvasGL : public mglCanvas\r
-{\r
-public:\r
- mglCanvasGL();\r
- ~mglCanvasGL();\r
-\r
- void SetQuality(int =0) { Quality=2; }\r
- void Finish(bool fast=true);\r
- void SetSize(int ,int ) {}\r
- void View(float tetX,float tetY,float tetZ);\r
- int NewFrame();\r
- void EndFrame();\r
-\r
- bool Alpha(bool enable);\r
- void Fog(float d, float dz=0.25);\r
- bool Light(bool enable);\r
- void Light(int n, bool enable);\r
- void AddLight(int n,mglPoint r,mglPoint d, char c='w', float bright=0.5, float ap=0);\r
- void Clf(mglColor Back=WC);\r
-\r
-protected:\r
- void line_draw(long p1, long p2, mglDrawReg *d);\r
- void trig_draw(long p1, long p2, long p3, bool anorm, mglDrawReg *d);\r
- void quad_draw(long p1, long p2, long p3, long p4, mglDrawReg *d);\r
- void pnt_draw(long p, mglDrawReg *d);\r
-\r
- unsigned char **GetRGBLines(long &w, long &h, unsigned char *&f, bool solid=true);\r
- void LightScale();\r
- void set_pen(unsigned style,float width);\r
-};\r
-extern "C" {\r
-#endif\r
-/*****************************************************************************/\r
-HMGL mgl_create_graph_gl();\r
-/*****************************************************************************/\r
-uintptr_t mgl_create_graph_gl_();\r
-/*****************************************************************************/\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-/*****************************************************************************/\r
-#endif\r
-\r
+++ /dev/null
-/***************************************************************************\r
- * other.h is part of Math Graphic Library\r
- * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
- * *\r
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU Library General Public License as *
- * published by the Free Software Foundation; either version 3 of the *
- * License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU Library General Public *
- * License along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
- ***************************************************************************/
-#ifndef _MGL_OTHER_H_\r
-#define _MGL_OTHER_H_
-#include "mgl/base.h"\r
-/*****************************************************************************/\r
-#ifdef __cplusplus
-extern "C" {\r
-#endif\r
-/*****************************************************************************/\r
-void mgl_triplot_xyzc(HMGL gr, HCDT nums, HCDT x, HCDT y, HCDT z, HCDT c, const char *sch, const char *opt);\r
-void mgl_triplot_xyz(HMGL gr, HCDT nums, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
-void mgl_triplot_xy(HMGL gr, HCDT nums, HCDT x, HCDT y, const char *sch, const char *opt);\r
-
-void mgl_quadplot_xyzc(HMGL gr, HCDT nums, HCDT x, HCDT y, HCDT z, HCDT c, const char *sch, const char *opt);\r
-void mgl_quadplot_xyz(HMGL gr, HCDT nums, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
-void mgl_quadplot_xy(HMGL gr, HCDT nums, HCDT x, HCDT y, const char *sch, const char *opt);\r
-
-void mgl_tricont_xyzcv(HMGL gr, HCDT v, HCDT nums, HCDT x, HCDT y, HCDT z, HCDT c, const char *sch, const char *opt);\r
-void mgl_tricont_xycv(HMGL gr, HCDT v, HCDT nums, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
-void mgl_tricont_xyzc(HMGL gr, HCDT nums, HCDT x, HCDT y, HCDT z, HCDT c, const char *sch, const char *opt);\r
-void mgl_tricont_xyc(HMGL gr, HCDT nums, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
-
-void mgl_dots(HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
-void mgl_dots_a(HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, const char *opt);\r
-
-void mgl_crust(HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
-
-void mgl_dens_x(HMGL graph, HCDT a, const char *stl, float sVal, const char *opt);\r
-void mgl_dens_y(HMGL graph, HCDT a, const char *stl, float sVal, const char *opt);\r
-void mgl_dens_z(HMGL graph, HCDT a, const char *stl, float sVal, const char *opt);
-\r
-void mgl_cont_x(HMGL graph, HCDT a, const char *stl, float sVal, const char *opt);\r
-void mgl_cont_y(HMGL graph, HCDT a, const char *stl, float sVal, const char *opt);\r
-void mgl_cont_z(HMGL graph, HCDT a, const char *stl, float sVal, const char *opt);
-\r
-void mgl_cont_x_val(HMGL graph, HCDT v, HCDT a, const char *stl, float sVal, const char *opt);\r
-void mgl_cont_y_val(HMGL graph, HCDT v, HCDT a, const char *stl, float sVal, const char *opt);\r
-void mgl_cont_z_val(HMGL graph, HCDT v, HCDT a, const char *stl, float sVal, const char *opt);
-\r
-void mgl_contf_x(HMGL graph, HCDT a, const char *stl, float sVal, const char *opt);\r
-void mgl_contf_y(HMGL graph, HCDT a, const char *stl, float sVal, const char *opt);\r
-void mgl_contf_z(HMGL graph, HCDT a, const char *stl, float sVal, const char *opt);
-\r
-void mgl_contf_x_val(HMGL graph, HCDT v, HCDT a, const char *stl, float sVal, const char *opt);\r
-void mgl_contf_y_val(HMGL graph, HCDT v, HCDT a, const char *stl, float sVal, const char *opt);\r
-void mgl_contf_z_val(HMGL graph, HCDT v, HCDT a, const char *stl, float sVal, const char *opt);\r
-
-/*****************************************************************************/\r
-\r
-void mgl_triplot_xyzc_(uintptr_t *gr, uintptr_t *nums, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *c, const char *sch, const char *opt,int,int);\r
-void mgl_triplot_xyz_(uintptr_t *gr, uintptr_t *nums, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int,int);\r
-void mgl_triplot_xy_(uintptr_t *gr, uintptr_t *nums, uintptr_t *x, uintptr_t *y, const char *sch, const char *opt,int,int);\r
-void mgl_quadplot_xyzc_(uintptr_t *gr, uintptr_t *nums, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *c, const char *sch, const char *opt,int,int);\r
-void mgl_quadplot_xyz_(uintptr_t *gr, uintptr_t *nums, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int,int);\r
-void mgl_quadplot_xy_(uintptr_t *gr, uintptr_t *nums, uintptr_t *x, uintptr_t *y, const char *sch, const char *opt,int,int);\r
-
-void mgl_tricont_xyzcv_(uintptr_t *gr, uintptr_t *v, uintptr_t *nums, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *c, const char *sch, const char *opt,int,int);\r
-void mgl_tricont_xycv_(uintptr_t *gr, uintptr_t *v, uintptr_t *nums, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int,int);\r
-void mgl_tricont_xyzc_(uintptr_t *gr, uintptr_t *nums, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *c, const char *sch, const char *opt,int, int);\r
-void mgl_tricont_xyc_(uintptr_t *gr, uintptr_t *nums, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int, int);\r
-
-void mgl_dots_(uintptr_t *gr, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int,int);\r
-void mgl_dots_a_(uintptr_t *gr, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *a, const char *sch, const char *opt,int,int);\r
-void mgl_dots_tr_(uintptr_t *gr, uintptr_t *tr, const char *sch, const char *opt,int,int);\r
-void mgl_crust_(uintptr_t *gr, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int,int);\r
-void mgl_crust_tr_(uintptr_t *gr, uintptr_t *tr, const char *sch, const char *opt,int,int);\r
-
-void mgl_dens_x_(uintptr_t *graph, uintptr_t *a, const char *stl, float *sVal, const char *opt,int,int);\r
-void mgl_dens_y_(uintptr_t *graph, uintptr_t *a, const char *stl, float *sVal, const char *opt,int,int);\r
-void mgl_dens_z_(uintptr_t *graph, uintptr_t *a, const char *stl, float *sVal, const char *opt,int,int);\r
-void mgl_cont_x_(uintptr_t *graph, uintptr_t *a, const char *stl, float *sVal, const char *opt,int,int);\r
-void mgl_cont_y_(uintptr_t *graph, uintptr_t *a, const char *stl, float *sVal, const char *opt,int,int);\r
-void mgl_cont_z_(uintptr_t *graph, uintptr_t *a, const char *stl, float *sVal, const char *opt,int,int);\r
-void mgl_cont_x_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *a, const char *stl, float *sVal, const char *opt,int,int);\r
-void mgl_cont_y_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *a, const char *stl, float *sVal, const char *opt,int,int);\r
-void mgl_cont_z_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *a, const char *stl, float *sVal, const char *opt,int,int);\r
-void mgl_contf_x_(uintptr_t *graph, uintptr_t *a, const char *stl, float *sVal, const char *opt,int,int);\r
-void mgl_contf_y_(uintptr_t *graph, uintptr_t *a, const char *stl, float *sVal, const char *opt,int,int);\r
-void mgl_contf_z_(uintptr_t *graph, uintptr_t *a, const char *stl, float *sVal, const char *opt,int,int);\r
-void mgl_contf_x_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *a, const char *stl, float *sVal, const char *opt,int,int);\r
-void mgl_contf_y_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *a, const char *stl, float *sVal, const char *opt,int,int);\r
-void mgl_contf_z_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *a, const char *stl, float *sVal, const char *opt,int,int);\r
-
-/*****************************************************************************/\r
-#ifdef __cplusplus\r
-}\r
-#endif
-/*****************************************************************************/\r
-#endif
+++ /dev/null
-/***************************************************************************\r
- * parser.h is part of Math Graphic Library\r
- * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
- * *\r
- * This program is free software; you can redistribute it and/or modify *\r
- * it under the terms of the GNU Library General Public License as *\r
- * published by the Free Software Foundation; either version 3 of the *\r
- * License, or (at your option) any later version. *\r
- * *\r
- * This program is distributed in the hope that it will be useful, *\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
- * GNU General Public License for more details. *\r
- * *\r
- * You should have received a copy of the GNU Library General Public *\r
- * License along with this program; if not, write to the *\r
- * Free Software Foundation, Inc., *\r
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
- ***************************************************************************/\r
-#ifndef _MGL_PARSER_H_\r
-#define _MGL_PARSER_H_\r
-\r
-#ifdef __cplusplus\r
-#include "mgl/mgl.h"\r
-#include <string>\r
-//-----------------------------------------------------------------------------\r
-/// Structure for the command argument.\r
-struct mglArg\r
-{\r
- int type; ///< Type of argument {0-data,1-string,2-number}\r
- mglData *d; ///< Pointer to data (used if type==0)\r
- std::wstring w; ///< String with parameters\r
- std::string s; ///< String with parameters\r
- mreal v; ///< Numerical value (used if type==2)\r
- mglArg() { type=-1; d=0; v=0; };\r
-};\r
-//-----------------------------------------------------------------------------\r
-/// Structure for MGL command\r
-struct mglCommand\r
-{\r
- const char *name; ///< Name of command\r
- const char *desc; ///< Short command description (can be NULL)\r
- const char *form; ///< Format of command arguments (can be NULL)\r
- /// Function for executing (plotting)\r
- int (*exec)(mglGraph *gr, long n, mglArg *a, int k[10], const char *opt);\r
- /// Function for exporting in C++ (can be NULL)\r
- void (*save)(wchar_t out[1024], long n, mglArg *a, int k[10], const char *opt);\r
- int type; ///< Type of command: 0 - data plot, 1 - other plot, 2 - setup, 3 - data handle, 4 - data create, 5 - subplot, 6 - program\r
-};\r
-extern mglCommand mgls_base_cmd[];\r
-//-----------------------------------------------------------------------------\r
-/// Structure for the mglData handling (see mglParse class).\r
-struct mglVar\r
-{\r
- mglData d; ///< Data itself\r
- std::wstring s; ///< Data name\r
- void *o; ///< Pointer to external object\r
- mglVar *next; ///< Pointer to next instance in list\r
- mglVar *prev; ///< Pointer to prev instance in list\r
- bool temp; ///< This temporar variable\r
- void (*func)(void *); ///< Callback function for destroying\r
-\r
- mglVar() { o=0; next=prev=0; func=0; temp=false; };\r
- ~mglVar();\r
- /// Move variable after \a var and copy \a func from \a var (if \a func is 0)\r
- void MoveAfter(mglVar *var);\r
-};\r
-//-----------------------------------------------------------------------------\r
-/// Structure for the number handling (see mglParse class).\r
-struct mglNum\r
-{\r
- mreal d; ///< Number itself\r
- std::wstring s; ///< Number name\r
- mglNum *next; ///< Pointer to next instance in list\r
- mglNum *prev; ///< Pointer to prev instance in list\r
- mglNum() { d=0; next=prev=0; };\r
- ~mglNum();\r
- /// Move variable after \a var and copy \a func from \a var (if \a func is 0)\r
- void MoveAfter(mglNum *var);\r
-};\r
-//-----------------------------------------------------------------------------\r
-/// Structure for function name and position.\r
-struct mglFunc\r
-{\r
- long pos;\r
- int narg;\r
- std::wstring func;\r
- mglFunc *next;\r
- mglFunc(long p, const wchar_t *f, mglFunc *prev=0);\r
- ~mglFunc() { if(next) delete next; };\r
-};\r
-//-----------------------------------------------------------------------------\r
-/// Structure for stack of functions and its arguments.\r
-struct mglFnStack\r
-{\r
- long pos;\r
- wchar_t *par[9];\r
-};\r
-//-----------------------------------------------------------------------------\r
-/// Function for asking question in console mode\r
-void mgl_ask_gets(const wchar_t *quest, wchar_t *res);\r
-//-----------------------------------------------------------------------------\r
-/// Structure for the command argument (see mglGraph::Exec()).\r
-class mglParser\r
-{\r
-friend void mgl_export(wchar_t *out, const wchar_t *in, int type);\r
-public:\r
- mglVar *DataList; ///< List with data and its names\r
- mglNum *NumList; ///< List with numbers and its names\r
- bool AllowSetSize; ///< Allow using setsize command\r
- bool Stop; ///< Stop command was. Flag prevent further execution\r
- mglCommand *Cmd; ///< Table of MGL commands (can be changed by user). It MUST be sorted by 'name'!!!\r
- wchar_t *op1, *op2; ///< Buffer for options (are used if out!=NULL)\r
- long InUse; ///< Smart pointer (number of users)\r
-\r
- mglParser(bool setsize=false);\r
- ~mglParser();\r
- /// Find the command by the keyword name\r
- mglCommand *FindCommand(const char *name);\r
- mglCommand *FindCommand(const wchar_t *name);\r
- /// Parse and execute the string of MGL script\r
- inline int Parse(HMGL gr, const char *str, long pos=0)\r
- { mglGraph GR(gr); return Parse(&GR,str,pos); }\r
- int Parse(mglGraph *gr, const char *str, long pos=0);\r
- /// Parse and execute the unicode string of MGL script\r
- inline int Parse(HMGL gr, const wchar_t *str, long pos=0)\r
- { mglGraph GR(gr); return Parse(&GR,str,pos); }\r
- int Parse(mglGraph *gr, const wchar_t *str, long pos=0);\r
- /// Parse, execute and export it in C++ code the string of MGL script\r
- inline int Export(wchar_t cpp_out[1024], HMGL gr, const wchar_t *str)\r
- { mglGraph GR(gr); return Export(cpp_out,&GR,str); }\r
- int Export(wchar_t cpp_out[1024], mglGraph *gr, const wchar_t *str);\r
- /// Execute MGL script file \a fname\r
- inline void Execute(HMGL gr, FILE *fp, bool print=false)\r
- { mglGraph GR(gr); Execute(&GR,fp,print); }\r
- void Execute(mglGraph *gr, FILE *fp, bool print=false);\r
- /// Execute MGL script from array of lines\r
- inline void Execute(HMGL gr, int num, const wchar_t **text)\r
- { mglGraph GR(gr); Execute(&GR,num,text); }\r
- void Execute(mglGraph *gr, int num, const wchar_t **text);\r
- /// Execute MGL script text with '\n' separated lines\r
- inline void Execute(HMGL gr, const wchar_t *text)\r
- { mglGraph GR(gr); Execute(&GR,text); }\r
- void Execute(mglGraph *gr, const wchar_t *text);\r
- /// Execute MGL script text with '\n' separated lines\r
- inline void Execute(HMGL gr, const char *text)\r
- { mglGraph GR(gr); Execute(&GR,text); }\r
- void Execute(mglGraph *gr, const char *text);\r
- /// Scan for functions (use NULL for reset)\r
- void ScanFunc(const wchar_t *line);\r
- /// Check if name is function and return its address (or 0 if no)\r
- long IsFunc(const wchar_t *name, int *narg=0);\r
- /// Find variable or return 0 if absent\r
- mglVar *FindVar(const char *name);\r
- /// Find variable or return 0 if absent\r
- mglVar *FindVar(const wchar_t *name);\r
- /// Find variable or create it if absent\r
- mglVar *AddVar(const char *name);\r
- /// Find variable or create it if absent\r
- mglVar *AddVar(const wchar_t *name);\r
- /// Find number or return 0 if absent\r
- mglNum *FindNum(const char *name);\r
- /// Find number or return 0 if absent\r
- mglNum *FindNum(const wchar_t *name);\r
- /// Find number or create it if absent\r
- mglNum *AddNum(const char *name);\r
- /// Find number or create it if absent\r
- mglNum *AddNum(const wchar_t *name);\r
- /// Add string for parameter $1, ..., $9\r
- bool AddParam(int n, const char *str, bool isstr=true);\r
- /// Add unicode string for parameter $1, ..., $9\r
- bool AddParam(int n, const wchar_t *str, bool isstr=true);\r
- /// Add new MGL command(s) (last command MUST HAVE name[0]=0 !!!)\r
- void AddCommand(mglCommand *cmd, int num=0);\r
- /// Restore Once flag\r
- inline void RestoreOnce() { Once = true; };\r
- /// Delete variable\r
- void DeleteVar(mglVar *v);\r
- /// Delete variable by its name\r
- void DeleteVar(const char *name);\r
- /// Delete variable by its name\r
- void DeleteVar(const wchar_t *name);\r
-private:\r
- long parlen; ///< Length of parameter strings\r
- wchar_t *par[40]; ///< Parameter for substituting instead of $1, ..., $9\r
- wchar_t *out; ///< Buffer for writing C++ code (if not NULL)\r
- wchar_t leg[128]; ///< Buffer for legend\r
- bool Once; ///< Flag for command which should be executed only once\r
- bool Skip; ///< Flag that commands should be skiped (inside 'once' block)\r
- int if_stack[40]; ///< Stack for if-else-endif commands\r
- int if_pos; ///< position in if_stack\r
- mglFunc *func; ///< function names and position\r
- mglFnStack *fn_stack; ///< function calls stack\r
- int fn_pos; ///< position in function stack\r
- int fn_num; ///< size of function stack\r
- int if_for[40]; ///< position in if_stack for for-cycle start\r
- mglData *fval; ///< Values for for-cycle. Note that nx - number of elements, ny - next element, nz - address (or string number) of first cycle command\r
- int for_stack[40]; ///< The order of for-variables\r
- int for_addr; ///< Flag for saving address in variable (for_addr-1)\r
- bool for_br; ///< Break is switched on (skip all comands until 'next')\r
-\r
- /// Parse command\r
- int Exec(mglGraph *gr, const wchar_t *com, long n, mglArg *a, const wchar_t *var, const wchar_t *opt);\r
- /// Fill arguments \a a from strings\r
- void FillArg(mglGraph *gr, int n, wchar_t **arg, mglArg *a);\r
- /// PreExecute stage -- parse some commands and create variables\r
- int PreExec(mglGraph *gr, long n, wchar_t **arg, mglArg *a);\r
- /// Execute program-flow control commands\r
- int FlowExec(mglGraph *gr, const wchar_t *com, long n, mglArg *a);\r
- /// Parse and execute the unicode string of MGL script\r
- int ParseDat(mglGraph *gr, const wchar_t *str, mglData &res);\r
- /// Parse $N arguments\r
- void PutArg(const wchar_t *string, wchar_t *str, bool def);\r
- /// In skip mode\r
- bool inline ifskip() { return (if_pos>0 && !(if_stack[if_pos-1]&1)); };\r
- bool inline skip() { return (Skip || ifskip() || for_br); };\r
-};\r
-//-----------------------------------------------------------------------------\r
-#endif\r
-#endif\r
+++ /dev/null
-/***************************************************************************\r
- * plot.h is part of Math Graphic Library\r
- * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
- * *\r
- * This program is free software; you can redistribute it and/or modify *\r
- * it under the terms of the GNU Library General Public License as *\r
- * published by the Free Software Foundation; either version 3 of the *\r
- * License, or (at your option) any later version. *\r
- * *\r
- * This program is distributed in the hope that it will be useful, *\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
- * GNU General Public License for more details. *\r
- * *\r
- * You should have received a copy of the GNU Library General Public *\r
- * License along with this program; if not, write to the *\r
- * Free Software Foundation, Inc., *\r
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
- ***************************************************************************/\r
-#ifndef _MGL_1D_H_\r
-#define _MGL_1D_H_\r
-#include "mgl/base.h"\r
-/*****************************************************************************/\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-/*****************************************************************************/\r
-void mgl_fplot(HMGL gr, const char *eqY, const char *pen, const char *opt);\r
-void mgl_fplot_xyz(HMGL gr, const char *eqX, const char *eqY, const char *eqZ, const char *pen, const char *opt);\r
-void mgl_fplot_(uintptr_t *gr, const char *fy, const char *stl, const char *opt, int ly, int ls, int lo);\r
-void mgl_fplot_xyz_(uintptr_t *gr, const char *fx, const char *fy, const char *fz, const char *stl, const char *opt, int lx, int ly, int lz, int ls, int lo);\r
-/*****************************************************************************/\r
-void mgl_radar(HMGL graph, HCDT a, const char *pen, const char *opt);\r
-void mgl_radar_(uintptr_t *gr, uintptr_t *a, const char *pen, const char *opt, int l,int lo);\r
-/*****************************************************************************/\r
-void mgl_plot_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, const char *pen, const char *opt);\r
-void mgl_plot_xy(HMGL graph, HCDT x, HCDT y, const char *pen, const char *opt);\r
-void mgl_plot(HMGL graph, HCDT y, const char *pen, const char *opt);\r
-void mgl_plot_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *pen, const char *opt,int,int);\r
-void mgl_plot_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, const char *pen, const char *opt,int,int);\r
-void mgl_plot_(uintptr_t *graph, uintptr_t *y, const char *pen, const char *opt,int,int);\r
-/*****************************************************************************/\r
-void mgl_tens_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, HCDT c, const char *pen, const char *opt);\r
-void mgl_tens_xy(HMGL graph, HCDT x, HCDT y, HCDT c, const char *pen, const char *opt);\r
-void mgl_tens(HMGL graph, HCDT y, HCDT c, const char *pen, const char *opt);\r
-void mgl_tens_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *c, const char *pen, const char *opt,int,int);\r
-void mgl_tens_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *c, const char *pen, const char *opt,int,int);\r
-void mgl_tens_(uintptr_t *graph, uintptr_t *y, uintptr_t *c, const char *pen, const char *opt,int,int);\r
-/*****************************************************************************/\r
-void mgl_tape_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, const char *pen, const char *opt);\r
-void mgl_tape_xy(HMGL graph, HCDT x, HCDT y, const char *pen, const char *opt);\r
-void mgl_tape(HMGL graph, HCDT y, const char *pen, const char *opt);\r
-void mgl_tape_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *pen, const char *opt,int,int);\r
-void mgl_tape_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, const char *pen, const char *opt,int,int);\r
-void mgl_tape_(uintptr_t *graph, uintptr_t *y, const char *pen, const char *opt,int,int);\r
-/*****************************************************************************/\r
-void mgl_boxplot_xy(HMGL graph, HCDT x, HCDT a, const char *pen, const char *opt);\r
-void mgl_boxplot(HMGL graph, HCDT a, const char *pen, const char *opt);\r
-/*****************************************************************************/\r
-void mgl_area_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, const char *pen, const char *opt);\r
-void mgl_area_xy(HMGL graph, HCDT x, HCDT y, const char *pen, const char *opt);\r
-void mgl_area(HMGL graph, HCDT y, const char *pen, const char *opt);\r
-/*****************************************************************************/\r
-void mgl_region_xy(HMGL graph, HCDT x, HCDT y1, HCDT y2, const char *pen, const char *opt);\r
-void mgl_region(HMGL graph, HCDT y1, HCDT y2, const char *pen, const char *opt);\r
-/*****************************************************************************/\r
-void mgl_stem_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, const char *pen, const char *opt);\r
-void mgl_stem_xy(HMGL graph, HCDT x, HCDT y, const char *pen, const char *opt);\r
-void mgl_stem(HMGL graph, HCDT y, const char *pen, const char *opt);\r
-/*****************************************************************************/\r
-void mgl_step_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, const char *pen, const char *opt);\r
-void mgl_step_xy(HMGL graph, HCDT x, HCDT y, const char *pen, const char *opt);\r
-void mgl_step(HMGL graph, HCDT y, const char *pen, const char *opt);\r
-/*****************************************************************************/\r
-void mgl_bars_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, const char *pen, const char *opt);\r
-void mgl_bars_xy(HMGL graph, HCDT x, HCDT y, const char *pen, const char *opt);\r
-void mgl_bars(HMGL graph, HCDT y, const char *pen, const char *opt);\r
-/*****************************************************************************/\r
-void mgl_barh_yx(HMGL graph, HCDT y, HCDT v, const char *pen, const char *opt);\r
-void mgl_barh(HMGL graph, HCDT v, const char *pen, const char *opt);\r
-/*****************************************************************************/\r
-void mgl_chart(HMGL graph, HCDT a, const char *col, const char *opt);\r
-/*****************************************************************************/\r
-void mgl_error_exy(HMGL graph, HCDT x, HCDT y, HCDT ex, HCDT ey, const char *pen, const char *opt);\r
-void mgl_error_xy(HMGL graph, HCDT x, HCDT y, HCDT ey, const char *pen, const char *opt);\r
-void mgl_error(HMGL graph, HCDT y, HCDT ey, const char *pen, const char *opt);\r
-/*****************************************************************************/\r
-void mgl_mark_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, HCDT r, const char *pen, const char *opt);\r
-void mgl_mark_xy(HMGL graph, HCDT x, HCDT y, HCDT r, const char *pen, const char *opt);\r
-void mgl_mark_y(HMGL graph, HCDT y, HCDT r, const char *pen, const char *opt);\r
-/*****************************************************************************/\r
-void mgl_tube_xyzr(HMGL graph, HCDT x, HCDT y, HCDT z, HCDT r, const char *pen, const char *opt);\r
-void mgl_tube_xyr(HMGL graph, HCDT x, HCDT y, HCDT r, const char *pen, const char *opt);\r
-void mgl_tube_r(HMGL graph, HCDT y, HCDT r, const char *pen, const char *opt);\r
-void mgl_tube_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, float r, const char *pen, const char *opt);\r
-void mgl_tube_xy(HMGL graph, HCDT x, HCDT y, float r, const char *penl, const char *opt);\r
-void mgl_tube(HMGL graph, HCDT y, float r, const char *pen, const char *opt);\r
-/*****************************************************************************/\r
-void mgl_candle_xyv(HMGL gr, HCDT x, HCDT v1, HCDT v2, HCDT y1, HCDT y2, const char *pen, const char *opt);\r
-void mgl_candle_yv(HMGL gr, HCDT v1, HCDT v2, HCDT y1, HCDT y2, const char *pen, const char *opt);\r
-void mgl_candle(HMGL gr, HCDT v, HCDT y1, HCDT y2, const char *pen, const char *opt);\r
-/*****************************************************************************/\r
-void mgl_boxplot_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, const char *pen, const char *opt,int,int);\r
-void mgl_boxplot_(uintptr_t *graph, uintptr_t *y, const char *pen, const char *opt,int,int);\r
-void mgl_area_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *pen, const char *opt,int,int);\r
-void mgl_area_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, const char *pen, const char *opt,int,int);\r
-void mgl_area_s_(uintptr_t *graph, uintptr_t *y, const char *pen, const char *opt,int,int);\r
-void mgl_area_(uintptr_t *graph, uintptr_t *y, const char *pen, const char *opt,int,int);\r
-void mgl_region_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y1, uintptr_t *y2, const char *pen, const char *opt,int, int);\r
-void mgl_region_(uintptr_t *graph, uintptr_t *y1, uintptr_t *y2, const char *pen, const char *opt,int, int);\r
-void mgl_stem_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *pen, const char *opt,int,int);\r
-void mgl_stem_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, const char *pen, const char *opt,int,int);\r
-void mgl_stem_(uintptr_t *graph, uintptr_t *y, const char *pen, const char *opt,int,int);\r
-void mgl_step_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *pen, const char *opt,int,int);\r
-void mgl_step_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, const char *pen, const char *opt,int,int);\r
-void mgl_step_(uintptr_t *graph, uintptr_t *y, const char *pen, const char *opt,int,int);\r
-void mgl_bars_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *pen, const char *opt,int,int);\r
-void mgl_bars_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, const char *pen, const char *opt,int,int);\r
-void mgl_bars_(uintptr_t *graph, uintptr_t *y, const char *pen, const char *opt,int,int);\r
-void mgl_barh_yx_(uintptr_t *graph, uintptr_t *y, uintptr_t *v, const char *pen, const char *opt,int,int);\r
-void mgl_barh_(uintptr_t *graph, uintptr_t *v, const char *pen, const char *opt,int,int);\r
-void mgl_chart_(uintptr_t *graph, uintptr_t *a, const char *col, const char *opt,int,int);\r
-void mgl_error_(uintptr_t *graph, uintptr_t *y, uintptr_t *ey, const char *pen, const char *opt,int,int);\r
-void mgl_error_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *ey, const char *pen, const char *opt,int,int);\r
-void mgl_error_exy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *ex, uintptr_t *ey, const char *pen, const char *opt,int,int);\r
-void mgl_mark_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *r, const char *pen, const char *opt,int,int);\r
-void mgl_mark_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *r, const char *pen, const char *opt,int,int);\r
-void mgl_mark_y_(uintptr_t *graph, uintptr_t *y, uintptr_t *r, const char *pen, const char *opt,int,int);\r
-void mgl_tube_xyzr_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *r, const char *pen, const char *opt,int,int);\r
-void mgl_tube_xyr_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *r, const char *pen, const char *opt,int,int);\r
-void mgl_tube_r_(uintptr_t *graph, uintptr_t *y, uintptr_t *r, const char *pen, const char *opt,int,int);\r
-void mgl_tube_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, float *r, const char *pen, const char *opt,int,int);\r
-void mgl_tube_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, float *r, const char *pen, const char *opt,int,int);\r
-void mgl_tube_(uintptr_t *graph, uintptr_t *y, float *r, const char *pen, const char *opt,int,int);\r
-void mgl_candle_xyv_(uintptr_t *gr, uintptr_t *x, uintptr_t *v1, uintptr_t *v2, uintptr_t *y1, uintptr_t *y2, const char *pen, const char *opt,int,int);\r
-void mgl_candle_yv_(uintptr_t *gr, uintptr_t *v1, uintptr_t *v2, uintptr_t *y1, uintptr_t *y2, const char *pen, const char *opt,int,int);\r
-void mgl_candle_(uintptr_t *gr, uintptr_t *y, uintptr_t *y1, uintptr_t *y2, const char *pen, const char *opt,int,int);\r
-/*****************************************************************************/\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-/*****************************************************************************/\r
-#endif\r
+++ /dev/null
-/***************************************************************************\r
- * prim.h is part of Math Graphic Library\r
- * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
- * *\r
- * This program is free software; you can redistribute it and/or modify *\r
- * it under the terms of the GNU Library General Public License as *\r
- * published by the Free Software Foundation; either version 3 of the *\r
- * License, or (at your option) any later version. *\r
- * *\r
- * This program is distributed in the hope that it will be useful, *\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
- * GNU General Public License for more details. *\r
- * *\r
- * You should have received a copy of the GNU Library General Public *\r
- * License along with this program; if not, write to the *\r
- * Free Software Foundation, Inc., *\r
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
- ***************************************************************************/\r
-#ifndef _MGL_PRIM_H_\r
-#define _MGL_PRIM_H_\r
-#include "mgl/base.h"\r
-/*****************************************************************************/\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-/*****************************************************************************/\r
-void mgl_mark(HMGL gr, float x,float y,float z,const char *mark);\r
-void mgl_ball(HMGL gr, float x,float y,float z);\r
-/*****************************************************************************/\r
-void mgl_line(HMGL gr, float x1, float y1, float z1, float x2, float y2, float z2, const char *pen,int n);\r
-void mgl_curve(HMGL gr, float x1, float y1, float z1, float dx1, float dy1, float dz1, float x2, float y2, float z2, float dx2, float dy2, float dz2, const char *pen,int n);\r
-/*****************************************************************************/\r
-void mgl_error_box(HMGL gr, float x, float y, float z, float ex, float ey, float ez, const char *pen);\r
-/*****************************************************************************/\r
-void mgl_face(HMGL gr, float x0, float y0, float z0, float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, const char *stl);\r
-void mgl_facex(HMGL gr, float x0, float y0, float z0, float wy, float wz, const char *stl, float dx, float dy);\r
-void mgl_facey(HMGL gr, float x0, float y0, float z0, float wx, float wz, const char *stl, float dx, float dy);\r
-void mgl_facez(HMGL gr, float x0, float y0, float z0, float wx, float wy, const char *stl, float dx, float dy);\r
-/*****************************************************************************/\r
-void mgl_sphere(HMGL gr, float x, float y, float z, float r, const char *stl);\r
-void mgl_drop(HMGL gr, float x1, float y1, float z1, float x2, float y2, float z2, float r, const char *stl, float shift, float ap);\r
-void mgl_cone(HMGL gr, float x1, float y1, float z1, float x2, float y2, float z2, float r1, float r2, const char *stl);\r
-void mgl_ellipse(HMGL gr, float x1, float y1, float z1, float x2, float y2, float z2, float r, const char *stl);\r
-void mgl_rhomb(HMGL gr, float x1, float y1, float z1, float x2, float y2, float z2, float r, const char *stl);\r
-/*****************************************************************************/\r
-void mgl_cones_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, const char *pen, const char *opt);\r
-void mgl_cones_xz(HMGL graph, HCDT x, HCDT z, const char *pen, const char *opt);\r
-void mgl_cones(HMGL graph, HCDT z, const char *pen, const char *opt);\r
-/*****************************************************************************/\r
-void mgl_dew_xy(HMGL gr, HCDT x, HCDT y, HCDT ax, HCDT ay, const char *sch, const char *opt);\r
-void mgl_dew_2d(HMGL gr, HCDT ax, HCDT ay, const char *sch, const char *optl);\r
-/*****************************************************************************/\r
-void mgl_puts(HMGL graph, float x, float y, float z,const char *text, const char *font, float size);\r
-void mgl_putsw(HMGL graph, float x, float y, float z,const wchar_t *text, const char *font, float size);\r
-/*****************************************************************************/\r
-void mgl_puts_dir(HMGL graph, float x, float y, float z, float dx, float dy, float dz, const char *text, const char *font, float size);\r
-void mgl_putsw_dir(HMGL graph, float x, float y, float z, float dx, float dy, float dz, const wchar_t *text, const char *font, float size);\r
-/*****************************************************************************/\r
-void mgl_textmark_xyzr(HMGL graph, HCDT x, HCDT y, HCDT z, HCDT r, const char *text, const char *fnt, const char *opt);\r
-void mgl_textmark_xyr(HMGL graph, HCDT x, HCDT y, HCDT r, const char *text, const char *fnt, const char *opt);\r
-void mgl_textmark_yr(HMGL graph, HCDT y, HCDT r, const char *text, const char *fnt, const char *opt);\r
-void mgl_textmark(HMGL graph, HCDT y, const char *text, const char *fnt, const char *opt);\r
-void mgl_textmarkw_xyzr(HMGL graph, HCDT x, HCDT y, HCDT z, HCDT r, const wchar_t *text, const char *fnt, const char *opt);\r
-void mgl_textmarkw_xyr(HMGL graph, HCDT x, HCDT y, HCDT r, const wchar_t *text, const char *fnt, const char *opt);\r
-void mgl_textmarkw_yr(HMGL graph, HCDT y, HCDT r, const wchar_t *text, const char *fnt, const char *opt);\r
-void mgl_textmarkw(HMGL graph, HCDT y, const wchar_t *text, const char *fnt, const char *opt);\r
-/*****************************************************************************/\r
-void mgl_puts_fit(HMGL gr, float x, float y, float z, const char *prefix, const char *font, float size);\r
-/*****************************************************************************/\r
-void mgl_label_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, const char *text, const char *fnt, const char *opt);\r
-void mgl_labelw_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, const wchar_t *text, const char *fnt, const char *opt);\r
-void mgl_label_xy(HMGL graph, HCDT x, HCDT y, const char *text, const char *fnt, const char *opt);\r
-void mgl_labelw_xy(HMGL graph, HCDT x, HCDT y, const wchar_t *text, const char *fnt, const char *opt);\r
-void mgl_label_y(HMGL graph, HCDT y, const char *text, const char *fnt, const char *opt);\r
-void mgl_labelw_y(HMGL graph, HCDT y, const wchar_t *text, const char *fnt, const char *opt);\r
-/*****************************************************************************/\r
-/*****************************************************************************/\r
-void mgl_mark_(uintptr_t *gr, float *x,float *y,float *z,const char *mark,int);\r
-void mgl_ball_(uintptr_t *gr, float *x,float *y,float *z);\r
-/*****************************************************************************/\r
-void mgl_line_(uintptr_t *gr, float *x1, float *y1, float *z1, float *x2, float *y2, float *z2, const char *pen,int *n,int);\r
-void mgl_curve_(uintptr_t* gr, float *x1, float *y1, float *z1, float *dx1, float *dy1, float *dz1, float *x2, float *y2, float *z2, float *dx2, float *dy2, float *dz2, const char *pen,int *n, int l);\r
-/*****************************************************************************/\r
-void mgl_error_box_(uintptr_t* gr, float *x, float *y, float *z, float *ex, float *ey, float *ez, const char *pen, int);\r
-/*****************************************************************************/\r
-void mgl_face_(uintptr_t* gr, float *x0, float *y0, float *z0, float *x1, float *y1, float *z1, float *x2, float *y2, float *z2, float *x3, float *y3, float *z3, const char *stl, int);\r
-void mgl_facex_(uintptr_t* gr, float *x0, float *y0, float *z0, float *wy, float *wz, const char *stl, float *dx, float *dy, int l);\r
-void mgl_facey_(uintptr_t* gr, float *x0, float *y0, float *z0, float *wx, float *wz, const char *stl, float *dx, float *dy, int l);\r
-void mgl_facez_(uintptr_t* gr, float *x0, float *y0, float *z0, float *wx, float *wy, const char *stl, float *dx, float *dy, int l);\r
-/*****************************************************************************/\r
-void mgl_sphere_(uintptr_t* gr, float *x, float *y, float *z, float *r, const char *stl, int);\r
-void mgl_drop_(uintptr_t* gr, float *x1, float *y1, float *z1, float *x2, float *y2, float *z2, float *r, const char *stl, float *shift, float *ap, int);\r
-void mgl_cone_(uintptr_t* gr, float *x1, float *y1, float *z1, float *x2, float *y2, float *z2, float *r1, float *r2, const char *stl, int);\r
-void mgl_ellipse_(uintptr_t* gr, float *x1, float *y1, float *z1, float *x2, float *y2, float *z2, float *r, const char *stl, int);\r
-void mgl_rhomb_(uintptr_t* gr, float *x1, float *y1, float *z1, float *x2, float *y2, float *z2, float *r, const char *stl, int);\r
-/*****************************************************************************/\r
-void mgl_cones_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *pen, const char *opt,int,int);\r
-void mgl_coners_xz_(uintptr_t *graph, uintptr_t *x, uintptr_t *z, const char *pen, const char *opt,int,int);\r
-void mgl_cones_(uintptr_t *graph, uintptr_t *z, const char *pen, const char *opt,int,int);\r
-/*****************************************************************************/\r
-void mgl_puts_(uintptr_t *graph, float *x, float *y, float *z,const char *text, const char *font, float *size, int, int);\r
-void mgl_puts_dir_(uintptr_t *graph, float *x, float *y, float *z, float *dx, float *dy, float *dz, const char *text, const char *font, float *size, int, int);\r
-/*****************************************************************************/\r
-void mgl_textmark_xyzr_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *r, const char *text, const char *fnt, const char *opt,int,int,int);\r
-void mgl_textmark_xyr_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *r, const char *text, const char *fnt, const char *opt,int,int,int);\r
-void mgl_textmark_yr_(uintptr_t *graph, uintptr_t *y, uintptr_t *r, const char *text, const char *fnt, const char *opt,int,int,int);\r
-void mgl_textmark_(uintptr_t *graph, uintptr_t *y, const char *text, const char *fnt, const char *opt,int,int,int);\r
-/*****************************************************************************/\r
-void mgl_puts_fit_(uintptr_t* gr, float *x, float *y, float *z, const char *prefix, const char *font, float *size, int l, int n);\r
-/*****************************************************************************/\r
-void mgl_label_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *text, const char *fnt, const char *opt,int,int,int);\r
-void mgl_label_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, const char *text, const char *fnt, const char *opt,int,int,int);\r
-void mgl_label_y_(uintptr_t *graph, uintptr_t *y, const char *text, const char *fnt, const char *opt,int,int,int);\r
-/*****************************************************************************/\r
-void mgl_dew_xy_(uintptr_t *gr, uintptr_t *x, uintptr_t *y, uintptr_t *ax, uintptr_t *ay, const char *sch, const char *opt,int,int);\r
-void mgl_dew_2d_(uintptr_t *gr, uintptr_t *ax, uintptr_t *ay, const char *sch, const char *opt,int,int l);\r
-/*****************************************************************************/\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-/*****************************************************************************/\r
-#endif\r
+++ /dev/null
-/***************************************************************************\r
- * window.h is part of Math Graphic Library\r
- * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
- * *\r
- * This program is free software; you can redistribute it and/or modify *\r
- * it under the terms of the GNU Library General Public License as *\r
- * published by the Free Software Foundation; either version 3 of the *\r
- * License, or (at your option) any later version. *\r
- * *\r
- * This program is distributed in the hope that it will be useful, *\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
- * GNU General Public License for more details. *\r
- * *\r
- * You should have received a copy of the GNU Library General Public *\r
- * License along with this program; if not, write to the *\r
- * Free Software Foundation, Inc., *\r
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
- ***************************************************************************/\r
-#ifndef _MGL_QT_H_\r
-#define _MGL_QT_H_\r
-/*****************************************************************************/\r
-#ifdef __cplusplus\r
-//-----------------------------------------------------------------------------\r
-#include "mgl/canvas_wnd.h"\r
-#if MGL_HAVE_QT\r
-#include <QtGui/QWidget>\r
-#include <QtGui/QPixmap>\r
-//-----------------------------------------------------------------------------\r
-class QTextEdit;\r
-class QMenu;\r
-class QMainWindow;\r
-class QScrollArea;\r
-class QSpinBox;\r
-class QTimer;\r
-//-----------------------------------------------------------------------------\r
-/// Class is Qt widget which display MathGL graphics\r
-class QMathGL : public QWidget\r
-{\r
- Q_OBJECT\r
-public:\r
- QString appName; ///< Application name for message boxes\r
- bool autoResize; ///< Allow auto resizing (default is false)\r
-\r
- QMathGL(QWidget *parent = 0, Qt::WindowFlags f = 0);\r
- ~QMathGL();\r
- double getRatio() { return double(gr->GetWidth())/gr->GetHeight(); };\r
- void setPopup(QMenu *p) { popup = p; }; ///< Set popup menu pointer\r
- void setSize(int w, int h); ///< Set window/picture sizes\r
- void setGraph(mglCanvas *GR) ///< Set grapher object\r
- { if(gr) { delete gr; gr=GR; } }\r
- inline void setGraph(mglGraph *GR)\r
- { setGraph(dynamic_cast<mglCanvas *>(GR->Self())); }\r
- inline HMGL getGraph() { return gr; }\r
- /// Set drawing functions and its parameter\r
- inline void setDraw(int (*func)(mglBase *gr, void *par), void *par=0)\r
- { draw_func = func; draw_par = par; }\r
- inline void setDraw(mglDraw *dr)\r
- { draw = dr; }\r
- inline void setDraw(int (*draw)(mglGraph *gr))\r
- { setDraw(mgl_draw_graph,(void*)draw); }\r
-\r
- int getPer() {return int(per);}; ///< Get perspective value\r
- int getPhi() {return int(phi);}; ///< Get Phi-angle value\r
- int getTet() {return int(tet);}; ///< Get Theta-angle value\r
- bool getAlpha() {return alpha;}; ///< Get transparency state\r
- bool getLight() {return light;}; ///< Get lightning state\r
- bool getZoom() {return zoom;}; ///< Get mouse zooming state\r
- bool getRotate(){return rotate;}; ///< Get mouse rotation state\r
-\r
-public slots:\r
- void refresh();\r
- void update(); ///< Update picture\r
- void copy(); ///< copy graphics to clipboard\r
- void copyClickCoor(); ///< copy click coordinates to clipboard\r
- void print(); ///< Print plot\r
- void stop(); ///< Stop execution\r
- void setPer(int p); ///< Set perspective value\r
- void setPhi(int p); ///< Set Phi-angle value\r
- void setTet(int t); ///< Set Theta-angle value\r
- void setAlpha(bool a); ///< Switch on/off transparency\r
- void setLight(bool l); ///< Switch on/off lightning\r
- void setGrid(bool r); ///< Switch on/off grid drawing\r
- void imgSize(int w, int h); ///< Set image size\r
-\r
- void setZoom(bool z); ///< Switch on/off mouse zooming\r
- void setRotate(bool r); ///< Switch on/off mouse rotation\r
- void zoomIn(); ///< Zoom in graphics\r
- void zoomOut(); ///< Zoom out graphics\r
- void restore(); ///< Restore zoom and rotation to default values\r
- // void reload(); ///< Reload data and execute script\r
- void shiftLeft(); ///< Shift graphics to left direction\r
- void shiftRight(); ///< Shift graphics to right direction\r
- void shiftUp(); ///< Shift graphics to up direction\r
- void shiftDown(); ///< Shift graphics to down direction\r
-\r
- void exportPNG(QString fname=""); ///< export to PNG file\r
- void exportPNGs(QString fname=""); ///< export to PNG file (no transparency)\r
- void exportGIF(QString fname=""); ///< export to GIF file\r
- void exportJPG(QString fname=""); ///< export to JPEG file\r
- void exportBPS(QString fname=""); ///< export to bitmap EPS file\r
- void exportEPS(QString fname=""); ///< export to vector EPS file\r
- void exportSVG(QString fname=""); ///< export to SVG file\r
- void exportTEX(QString fname=""); ///< export to SVG file\r
- void exportTGA(QString fname=""); ///< export to TGA file\r
-\r
- void exportXYZ(QString fname=""); ///< export to XYZ file\r
- void exportOBJ(QString fname=""); ///< export to OBJ file\r
- void exportSTL(QString fname=""); ///< export to STL file\r
- void exportOFF(QString fname=""); ///< export to OFF file\r
-// void exportX3D(QString fname=""); ///< export to XYZ file\r
- void exportPRC(QString fname=""); ///< export to PRC file\r
- void setMGLFont(QString path); ///< restore/load font for graphics\r
-\r
- void adjust(); ///< Adjust plot size to fill entire window\r
- void nextSlide(); ///< Show next slide\r
- void prevSlide(); ///< Show previous slide\r
- void animation(bool st=true); ///< Start animation\r
- void about(); ///< Show about information\r
- void aboutQt(); ///< Show information about Qt version\r
-signals:\r
- void gridChanged(int); ///< Grid drawing changed (by mouse or by toolbar)\r
- void phiChanged(int); ///< Phi angle changed (by mouse or by toolbar)\r
- void tetChanged(int); ///< Tet angle changed (by mouse or by toolbar)\r
- void perChanged(int); ///< Perspective changed (by mouse or by toolbar)\r
- void alphaChanged(bool); ///< Transparency changed (by toolbar)\r
- void lightChanged(bool); ///< Lighting changed (by toolbar)\r
- void zoomChanged(bool); ///< Zooming changed (by toolbar)\r
- void rotateChanged(bool); ///< Rotation changed (by toolbar)\r
- void mouseClick(float,float,float); ///< Position of mouse click\r
- void frameChanged(int); ///< Need another frame to show\r
- void showWarn(QString); ///< Show warnings\r
- void posChanged(QString message); ///< user click to show mouse position\r
- void objChanged(int objId); ///< User double-click to select object/line\r
- void refreshData();\r
-\r
-protected:\r
- void paintEvent(QPaintEvent *);\r
- void resizeEvent(QResizeEvent *);\r
- void mousePressEvent(QMouseEvent *);\r
- void mouseReleaseEvent(QMouseEvent *);\r
- void mouseMoveEvent(QMouseEvent *);\r
-\r
- mglCanvas *gr; ///< Built-in mglCanvasQT-er instance (used by default)\r
- void *draw_par; ///< Parameters for drawing function mglCanvasWnd::DrawFunc.\r
- /// Drawing function for window procedure. It should return the number of frames.\r
- int (*draw_func)(mglBase *gr, void *par);\r
- mglDraw *draw; ///< Class for drawing -- need to call directly due to inheritance mechanism\r
- QString mousePos; ///< Last mouse position\r
- QPixmap pic; ///< Pixmap for drawing (changed by update)\r
- double tet, phi; ///< Rotation angles\r
- double per; ///< Value of perspective ( must be in [0,1) )\r
- bool alpha; ///< Transparency state\r
- bool light; ///< Lightning state\r
- bool zoom; ///< Mouse zoom state\r
- bool grid; ///< Grid drawing state\r
- bool rotate; ///< Mouse rotation state\r
- float x1,x2,y1,y2; ///< Zoom in region\r
- bool showMessage; ///< Flag for showing messages (enabled by each execute())\r
- QMenu *popup; ///< Pointer to pop-up menu\r
- QTimer *timer; ///< Timer for animation\r
-private:\r
- int x0, y0, xe, ye; ///< Temporary variables for mouse\r
- uchar *grBuf;\r
-};\r
-//-----------------------------------------------------------------------------\r
-/// Base class for windows containing MathGL graphics\r
-class mglCanvasQT : public mglCanvasWnd\r
-{\r
-public:\r
-using mglCanvasWnd::Window;\r
- int sshow; ///< Current state of animation switch (toggle button)\r
- QMathGL *QMGL; ///< Control which draw graphics\r
- QMainWindow *Wnd; ///< Pointer to window\r
-\r
- mglCanvasQT();\r
-\r
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Ñëóæåáíûå ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r
- /// Create a window for plotting. Now implemeted only for GLUT.\r
- void Window(int argc, char **argv, int (*draw)(mglBase *gr, void *p),const char *title,\r
- void *par=NULL, void (*reload)(void *p)=NULL, bool maximize=false);\r
- /// Switch on/off transparency (do not overwrite switches in user drawing function)\r
- void ToggleAlpha();\r
- /// Switch on/off lighting (do not overwrite switches in user drawing function)\r
- void ToggleLight();\r
- void ToggleRotate();///< Switch on/off rotation by mouse\r
- void ToggleZoom(); ///< Switch on/off zooming by mouse\r
- void ToggleNo(); ///< Switch off all zooming and rotation\r
- void Update(); ///< Update picture by calling user drawing function\r
- void Adjust(); ///< Adjust size of bitmap to window size\r
- void GotoFrame(int d); ///< Show arbitrary frame (use relative step)\r
- void Animation(); ///< Run slideshow (animation) of frames\r
-\r
-protected:\r
- QScrollArea *scroll; ///< Scrolling area\r
- QMenu *popup; ///< Popup menu\r
- QSpinBox *tet, *phi; ///< Spin box for angles\r
-};\r
-//-----------------------------------------------------------------------------\r
-/// Class for drawing the MGL script\r
-struct mglDrawScript : public mglDraw\r
-{\r
- HMPR par; ///< Parser to be used\r
- QString text; ///< Script to be drawn\r
- long line; ///< Line which will be highlited\r
- mglDrawScript(HMPR p) { par=p; line=-1; }\r
- int Draw(mglGraph *gr)\r
- { gr->Highlight(line+1); mgl_parse_text(gr->Self(),par,text.toAscii()); return 0; }\r
-};\r
-//-----------------------------------------------------------------------------\r
-/// Convert bitmap from mglCanvasWnd to QPixmap\r
-void mglConvertFromGraph(QPixmap &pic, mglCanvas *gr, uchar **buf);\r
-/// Make menu, toolbars and return popup menu for MainWindow\r
-QMenu *mglMakeMenu(QMainWindow *Wnd, QMathGL *QMGL, QSpinBox *tet, QSpinBox *phi);\r
-//-----------------------------------------------------------------------------\r
-void mgl_ask_qt(const wchar_t *quest, wchar_t *res);\r
-//-----------------------------------------------------------------------------\r
-#else\r
-#error "Please enable Qt support"\r
-#endif\r
-#endif\r
-#endif\r
+++ /dev/null
-/***************************************************************************\r
- * surf.h is part of Math Graphic Library\r
- * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
- * *\r
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU Library General Public License as *
- * published by the Free Software Foundation; either version 3 of the *
- * License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU Library General Public *
- * License along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
- ***************************************************************************/
-#ifndef _MGL_SURF_H_\r
-#define _MGL_SURF_H_
-#include "mgl/base.h"\r
-/*****************************************************************************/\r
-#ifdef __cplusplus
-extern "C" {\r
-#endif\r
-/*****************************************************************************/\r
-void mgl_fsurf(HMGL graph, const char *fz, const char *stl, const char *opt);\r
-void mgl_fsurf_xyz(HMGL graph, const char *fx, const char *fy, const char *fz, const char *stl, const char *opt);\r
-void mgl_grid_xy(HMGL graph, HCDT x, HCDT y, HCDT z, const char *stl, const char *opt);\r
-void mgl_grid(HMGL graph, HCDT a,const char *stl, const char *opt);\r
-void mgl_mesh_xy(HMGL graph, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
-void mgl_mesh(HMGL graph, HCDT z, const char *sch, const char *opt);\r
-void mgl_fall_xy(HMGL graph, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
-void mgl_fall(HMGL graph, HCDT z, const char *sch, const char *opt);\r
-void mgl_belt_xy(HMGL graph, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
-void mgl_belt(HMGL graph, HCDT z, const char *sch, const char *opt);\r
-void mgl_surf_xy(HMGL graph, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
-void mgl_surf(HMGL graph, HCDT z, const char *sch, const char *opt);\r
-void mgl_dens_xy(HMGL graph, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
-void mgl_dens(HMGL graph, HCDT z, const char *sch, const char *opt);\r
-void mgl_boxs_xy(HMGL graph, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
-void mgl_boxs(HMGL graph, HCDT z, const char *sch, const char *opt);\r
-void mgl_tile_xy(HMGL graph, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
-void mgl_tile(HMGL graph, HCDT z, const char *sch, const char *opt);\r
-void mgl_tiles_xy(HMGL graph, HCDT x, HCDT y, HCDT z, HCDT r, const char *sch, const char *opt);\r
-void mgl_tiles(HMGL graph, HCDT z, HCDT r, const char *sch, const char *opt);\r
-void mgl_surfc_xy(HMGL graph, HCDT x, HCDT y, HCDT z, HCDT c, const char *sch, const char *opt);\r
-void mgl_surfc(HMGL graph, HCDT z, HCDT c, const char *sch, const char *opt);\r
-void mgl_surfa_xy(HMGL graph, HCDT x, HCDT y, HCDT z, HCDT c, const char *sch, const char *opt);\r
-void mgl_surfa(HMGL graph, HCDT z, HCDT c, const char *sch, const char *opt);\r
-void mgl_stfa_xy(HMGL graph, HCDT x, HCDT y, HCDT re, HCDT im, int dn, const char *sch, const char *opt);\r
-void mgl_stfa(HMGL graph, HCDT re, HCDT im, int dn, const char *sch, const char *opt);\r
-void mgl_map_xy(HMGL graph, HCDT x, HCDT y, HCDT a, HCDT b, const char *sch, const char *opt);\r
-void mgl_map(HMGL graph, HCDT a, HCDT b, const char *sch, const char *opt);\r
-/*****************************************************************************/\r
-void mgl_fsurf_(uintptr_t *graph, const char *fz, const char *stl, const char *opt,int,int,int);\r
-void mgl_fsurf_xyz_(uintptr_t *graph, const char *fx, const char *fy, const char *fz, const char *stl, const char *opt, int, int, int, int, int);
-void mgl_grid_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *stl, const char *opt,int,int);\r
-void mgl_grid_(uintptr_t *graph, uintptr_t *a,const char *stl, const char *opt,int,int);\r
-void mgl_mesh_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int,int);\r
-void mgl_mesh_(uintptr_t *graph, uintptr_t *z, const char *sch, const char *opt,int,int);\r
-void mgl_fall_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int,int);\r
-void mgl_fall_(uintptr_t *graph, uintptr_t *z, const char *sch, const char *opt,int,int);\r
-void mgl_belt_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int,int);\r
-void mgl_belt_(uintptr_t *graph, uintptr_t *z, const char *sch, const char *opt,int,int);\r
-void mgl_surf_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int,int);\r
-void mgl_surf_(uintptr_t *graph, uintptr_t *z, const char *sch, const char *opt,int,int);\r
-void mgl_dens_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int,int);\r
-void mgl_dens_(uintptr_t *graph, uintptr_t *z, const char *sch, const char *opt,int,int);\r
-void mgl_boxs_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int,int);\r
-void mgl_boxs_(uintptr_t *graph, uintptr_t *z, const char *sch, const char *opt,int,int);\r
-void mgl_tile_xy_(uintptr_t *gr, uintptr_t *x, uintptr_t *y, uintptr_t *a, const char *sch, const char *opt,int,int);
-void mgl_tile_(uintptr_t *graph, uintptr_t *z, const char *sch, const char *opt,int,int);\r
-void mgl_tiles_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *c, const char *sch, const char *opt,int,int);\r
-void mgl_tiles_(uintptr_t *graph, uintptr_t *z, uintptr_t *r, const char *sch, const char *opt,int,int);\r
-void mgl_surfc_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *c, const char *sch, const char *opt,int,int);\r
-void mgl_surfc_(uintptr_t *graph, uintptr_t *z, uintptr_t *c, const char *sch, const char *opt,int,int);\r
-void mgl_surfa_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *c, const char *sch, const char *opt,int,int);\r
-void mgl_surfa_(uintptr_t *graph, uintptr_t *z, uintptr_t *c, const char *sch, const char *opt,int,int);\r
-void mgl_stfa_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *re, uintptr_t *im, int *dn, const char *sch, const char *opt,int, int);\r
-void mgl_stfa_(uintptr_t *graph, uintptr_t *re, uintptr_t *im, int *dn, const char *sch, const char *opt,int, int);\r
-void mgl_map_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *a, uintptr_t *b, const char *sch, const char *opt,int,int);\r
-void mgl_map_(uintptr_t *graph, uintptr_t *a, uintptr_t *b, const char *sch, const char *opt,int,int);\r
-/*****************************************************************************/\r
-#ifdef __cplusplus\r
-}\r
-#endif
-/*****************************************************************************/\r
-#endif
+++ /dev/null
-/***************************************************************************
- * type.h is part of Math Graphic Library
- * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU Library General Public License as *
- * published by the Free Software Foundation; either version 3 of the *
- * License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU Library General Public *
- * License along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
- ***************************************************************************/
-#ifndef _MGL_TYPE_H_
-#define _MGL_TYPE_H_
-#include <math.h>
-#ifndef _MSC_VER
-#include <stdint.h>
-#endif
-#include "mgl/define.h"
-//-----------------------------------------------------------------------------
-const mreal Pi = M_PI;
-const mreal NaN = NAN;
-//-----------------------------------------------------------------------------
-/// Class for incapsulating point in space
-struct mglPoint
-{
- float x,y,z,c;
- mglPoint(float X=0,float Y=0,float Z=0,float C=0){x=X;y=Y;z=Z;c=C;}
- inline bool IsNAN() { return (x!=x || y!=y || z!=z || c!=c); }
- inline float val(int i) { return (i<2 ? (i==0 ? x:y) : (i==2 ? z:c)); }
- inline float norm() { return sqrt(x*x+y*y+z*z); }
- inline void Normalize() { float v=norm(); x/=v; y/=v; z/=v; }
-
- inline void operator+=(const mglPoint &a) { x+=a.x; y+=a.y; z+=a.z; c+=a.c; }
- inline void operator-=(const mglPoint &a) { x-=a.x; y-=a.y; z-=a.z; c-=a.c; }
- inline void operator+=(float a) { x+=a; y+=a; z+=a; }
- inline void operator-=(float a) { x-=a; y-=a; z-=a; }
- inline void operator*=(float a) { x*=a; y*=a; z*=a; }
- inline void operator/=(float a) { x/=a; y/=a; z/=a; }
-};
-#ifndef SWIG
-inline mglPoint operator+(const mglPoint &a, const mglPoint &b)
-{ return mglPoint(a.x+b.x, a.y+b.y, a.z+b.z, a.c+b.c); }
-inline mglPoint operator-(const mglPoint &a, const mglPoint &b)
-{ return mglPoint(a.x-b.x, a.y-b.y, a.z-b.z, a.c-b.c); }
-inline mglPoint operator-(const mglPoint &a)
-{ return mglPoint(-a.x, -a.y, -a.z, -a.c); }
-inline mglPoint operator*(float b, const mglPoint &a)
-{ return mglPoint(a.x*b, a.y*b, a.z*b); }
-inline mglPoint operator*(const mglPoint &a, float b)
-{ return mglPoint(a.x*b, a.y*b, a.z*b); }
-inline mglPoint operator/(const mglPoint &a, float b)
-{ return mglPoint(a.x/b, a.y/b, a.z/b); }
-inline float operator*(const mglPoint &a, const mglPoint &b)
-{ return a.x*b.x+a.y*b.y+a.z*b.z; }
-inline mglPoint operator/(const mglPoint &a, const mglPoint &b)
-{ return mglPoint(a.x*b.x, a.y*b.y, a.z*b.z); }
-inline mglPoint operator&(const mglPoint &a, const mglPoint &b)
-{ return a - b*((a*b)/(b*b)); }
-inline mglPoint operator|(const mglPoint &a, const mglPoint &b)
-{ return b*((a*b)/(b*b)); }
-inline mglPoint operator^(const mglPoint &a, const mglPoint &b)
-{ return mglPoint(a.y*b.z-a.z*b.y, a.z*b.x-a.x*b.z, a.x*b.y-a.y*b.x); }
-inline mglPoint operator!(const mglPoint &a)
-{ float f=hypot(a.x,a.y); return f==0?mglPoint(0,1,0):mglPoint(-a.y/f, a.x/f, 0); }
-inline bool operator==(const mglPoint &a, const mglPoint &b)
-{ return !memcmp(&a, &b, sizeof(mglPoint)); }
-inline bool operator!=(const mglPoint &a, const mglPoint &b)
-{ return memcmp(&a, &b, sizeof(mglPoint)); }
-inline float mgl_norm(const mglPoint &p)
-{ return sqrt(p.x*p.x+p.y*p.y+p.z*p.z); }
-#endif
-//-----------------------------------------------------------------------------
-/// Class for incapsulating color
-struct mglColor
-{
- float r; ///< Red component of color
- float g; ///< Green component of color
- float b; ///< Blue component of color
- float a; ///< Alpha component of color
-
- /// Constructor for RGB components manualy
- mglColor(float R,float G,float B, float A=1){ r=R; g=G; b=B; a=A; }
- /// Constructor set color from character id
- mglColor(char c='k', float bright=1) { Set(c,bright); }
- /// Set color as Red, Green, Blue values
- void Set(float R,float G,float B,float A=1) { r=R; g=G; b=B; a=A; }
- /// Set color as Red, Green, Blue values
- void Set(mglColor c, float bright=1);
- /// Check if color is valid
- inline bool Valid()
- { return (r>=0 && r<=1 && g>=0 && g<=1 && b>=0 && b<=1 && a>=0 && a<=1); }
- /// Get maximal spectral component
- inline float Norm()
- { return r>g ? r : (g>b ? g : b); }
- inline float NormS()
- { return r*r+g*g+b*b; }
- /// Set color from symbolic id
- void Set(char p, float bright=1);
- /// Copy color from other one
- inline bool operator==(const mglColor &c)
- { return (r==c.r && g==c.g && b==c.b && a==c.a); }
- inline bool operator!=(const mglColor &c)
- { return (r!=c.r || g!=c.g || b!=c.b || a!=c.a); }
- // transparency still the same
- inline void operator*=(float v) { r*=v; g*=v; b*=v; }
- inline void operator+=(const mglColor &c) { r+=c.r; g+=c.g; b+=c.b; }
- inline void operator-=(const mglColor &c) { r-=c.r; g-=c.g; b-=c.b; }
-};
-#ifndef SWIG
-inline mglColor operator+(const mglColor &a, const mglColor &b)
-{ return mglColor(a.r+b.r, a.g+b.g, a.b+b.b, a.a+b.a); }
-inline mglColor operator-(const mglColor &a, const mglColor &b)
-{ return mglColor(a.r-b.r, a.g-b.g, a.b-b.b, a.a-b.a); }
-inline mglColor operator*(const mglColor &a, float b)
-{ return mglColor(a.r*b, a.g*b, a.b*b, a.a*b); }
-inline mglColor operator*(float b, const mglColor &a)
-{ return mglColor(a.r*b, a.g*b, a.b*b, a.a*b); }
-inline mglColor operator/(const mglColor &a, float b)
-{ return mglColor(a.r/b, a.g/b, a.b/b, a.a/b); }
-inline mglColor operator!(const mglColor &a)
-{ return mglColor(1-a.r, 1-a.g, 1-a.b, a.a); }
-#endif
-//-----------------------------------------------------------------------------
-#endif
\ No newline at end of file
+++ /dev/null
-/***************************************************************************\r
- * vect.h is part of Math Graphic Library\r
- * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
- * *\r
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU Library General Public License as *
- * published by the Free Software Foundation; either version 3 of the *
- * License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU Library General Public *
- * License along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
- ***************************************************************************/
-#ifndef _MGL_VECT_H_\r
-#define _MGL_VECT_H_
-#include "mgl/base.h"\r
-/*****************************************************************************/\r
-#ifdef __cplusplus
-extern "C" {\r
-#endif\r
-/*****************************************************************************/\r
-void mgl_traj_xy(HMGL gr, HCDT x, HCDT y, HCDT ax, HCDT ay, const char *sch, const char *opt);\r
-void mgl_traj_xyz(HMGL gr, HCDT x, HCDT y, HCDT z, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt);\r
-
-void mgl_vect_xy(HMGL gr, HCDT x, HCDT y, HCDT ax, HCDT ay, const char *sch, const char *opt);\r
-void mgl_vect_2d(HMGL gr, HCDT ax, HCDT ay, const char *sch, const char *opt);\r
-void mgl_vect_xyz(HMGL gr, HCDT x, HCDT y, HCDT z, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt);\r
-void mgl_vect_3d(HMGL gr, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt);\r
-
-void mgl_flow_xy(HMGL gr, HCDT x, HCDT y, HCDT ax, HCDT ay, const char *sch, const char *opt);\r
-void mgl_flow_2d(HMGL gr, HCDT ax, HCDT ay, const char *sch, const char *opt);\r
-void mgl_flow_xyz(HMGL gr, HCDT x, HCDT y, HCDT z, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt);\r
-void mgl_flow_3d(HMGL gr, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt);\r
-\r
-void mgl_flowp_xy(HMGL gr, float x0, float y0, float z0, HCDT x, HCDT y, HCDT ax, HCDT ay, const char *sch, const char *opt);\r
-void mgl_flowp_2d(HMGL gr, float x0, float y0, float z0, HCDT ax, HCDT ay, const char *sch, const char *opt);\r
-void mgl_flowp_xyz(HMGL gr, float x0, float y0, float z0, HCDT x, HCDT y, HCDT z, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt);\r
-void mgl_flowp_3d(HMGL gr, float x0, float y0, float z0, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt);\r
-\r
-void mgl_pipe_xy(HMGL gr, HCDT x, HCDT y, HCDT ax, HCDT ay, const char *sch, float r0, const char *opt);\r
-void mgl_pipe_2d(HMGL gr, HCDT ax, HCDT ay, const char *sch, float r0, const char *opt);\r
-void mgl_pipe_xyz(HMGL gr, HCDT x, HCDT y, HCDT z, HCDT ax, HCDT ay, HCDT az, const char *sch, float r0, const char *opt);\r
-void mgl_pipe_3d(HMGL gr, HCDT ax, HCDT ay, HCDT az, const char *sch, float r0, const char *opt);\r
-
-void mgl_grad_xyz(HMGL gr, HCDT x, HCDT y, HCDT z, HCDT ph, const char *sch, const char *opt);\r
-void mgl_grad_xy(HMGL gr, HCDT x, HCDT y, HCDT ph, const char *sch, const char *opt);\r
-void mgl_grad(HMGL gr, HCDT ph, const char *sch, const char *opt);\r
-
-/*****************************************************************************/\r
-void mgl_traj_xy_(uintptr_t *gr, uintptr_t *x, uintptr_t *y, uintptr_t *ax, uintptr_t *ay, const char *sch, const char *opt,int,int);\r
-void mgl_traj_xyz_(uintptr_t *gr, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *ax, uintptr_t *ay, uintptr_t *az, const char *sch, const char *opt,int,int);\r
-
-void mgl_vect_xy_(uintptr_t *gr, uintptr_t *x, uintptr_t *y, uintptr_t *ax, uintptr_t *ay, const char *sch, const char *opt,int,int);\r
-void mgl_vect_2d_(uintptr_t *gr, uintptr_t *ax, uintptr_t *ay, const char *sch, const char *opt,int,int);\r
-void mgl_vect_xyz_(uintptr_t *gr, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *ax, uintptr_t *ay, uintptr_t *az, const char *sch, const char *opt,int,int);\r
-void mgl_vect_3d_(uintptr_t *gr, uintptr_t *ax, uintptr_t *ay, uintptr_t *az, const char *sch, const char *opt,int,int);\r
-
-void mgl_flow_xy_(uintptr_t *gr, uintptr_t *x, uintptr_t *y, uintptr_t *ax, uintptr_t *ay, const char *sch, const char *opt,int,int);\r
-void mgl_flow_2d_(uintptr_t *gr, uintptr_t *ax, uintptr_t *ay, const char *sch, const char *opt,int,int);\r
-void mgl_flow_xyz_(uintptr_t *gr, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *ax, uintptr_t *ay, uintptr_t *az, const char *sch, const char *opt,int,int);\r
-void mgl_flow_3d_(uintptr_t *gr, uintptr_t *ax, uintptr_t *ay, uintptr_t *az, const char *sch, const char *opt,int,int);\r
-\r
-void mgl_flowp_xy_(uintptr_t *gr, float *x0, float *y0, float *z0, uintptr_t *x, uintptr_t *y, uintptr_t *ax, uintptr_t *ay, const char *sch, const char *opt,int, int);\r
-void mgl_flowp_2d_(uintptr_t *gr, float *x0, float *y0, float *z0, uintptr_t *ax, uintptr_t *ay, const char *sch, const char *opt,int, int);\r
-void mgl_flowp_xyz_(uintptr_t *gr, float *x0, float *y0, float *z0, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *ax, uintptr_t *ay, uintptr_t *az, const char *sch, const char *opt,int, int);\r
-void mgl_flowp_3d_(uintptr_t *gr, float *x0, float *y0, float *z0, uintptr_t *ax, uintptr_t *ay, uintptr_t *az, const char *sch, const char *opt,int,int);\r
-\r
-void mgl_pipe_xy_(uintptr_t *gr, uintptr_t *x, uintptr_t *y, uintptr_t *ax, uintptr_t *ay, const char *sch, float *r0, const char *opt,int,int);\r
-void mgl_pipe_2d_(uintptr_t *gr, uintptr_t *ax, uintptr_t *ay, const char *sch, float *r0, const char *opt,int,int);\r
-void mgl_pipe_xyz_(uintptr_t *gr, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *ax, uintptr_t *ay, uintptr_t *az, const char *sch, float *r0, const char *opt,int,int);\r
-void mgl_pipe_3d_(uintptr_t *gr, uintptr_t *ax, uintptr_t *ay, uintptr_t *az, const char *sch, float *r0, const char *opt,int,int);\r
-
-void mgl_grad_xyz_(uintptr_t *gr, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *ph, const char *sch, const char *opt,int, int);\r
-void mgl_grad_xy_(uintptr_t *gr, uintptr_t *x, uintptr_t *y, uintptr_t *ph, const char *sch, const char *opt,int,int);\r
-void mgl_grad_(uintptr_t *gr, uintptr_t *ph, const char *sch, const char *opt,int,int);\r
-
-/*****************************************************************************/\r
-#ifdef __cplusplus\r
-}\r
-#endif
-/*****************************************************************************/\r
-#endif
+++ /dev/null
-/***************************************************************************\r
- * volume.h is part of Math Graphic Library\r
- * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
- * *\r
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU Library General Public License as *
- * published by the Free Software Foundation; either version 3 of the *
- * License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU Library General Public *
- * License along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
- ***************************************************************************/
-#ifndef _MGL_VOL_H_\r
-#define _MGL_VOL_H_
-#include "mgl/base.h"\r
-/*****************************************************************************/\r
-#ifdef __cplusplus
-extern "C" {\r
-#endif\r
-/*****************************************************************************/\r
-void mgl_surf3_xyz_val(HMGL graph, float Val, HCDT x, HCDT y, HCDT z, HCDT a, const char *stl, const char *opt);\r
-void mgl_surf3_val(HMGL graph, float Val, HCDT a, const char *stl, const char *opt);\r
-void mgl_surf3_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, HCDT a, const char *stl, const char *opt);\r
-void mgl_surf3(HMGL graph, HCDT a, const char *stl, const char *opt);\r
-
-void mgl_surf3a_xyz_val(HMGL graph, float Val, HCDT x, HCDT y, HCDT z, HCDT a, HCDT b, const char *stl, const char *opt);\r
-void mgl_surf3a_val(HMGL graph, float Val, HCDT a, HCDT b, const char *stl, const char *opt);\r
-void mgl_surf3a_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, HCDT a, HCDT b, const char *stl, const char *opt);\r
-void mgl_surf3a(HMGL graph, HCDT a, HCDT b, const char *stl, const char *opt);\r
-
-void mgl_surf3c_xyz_val(HMGL graph, float Val, HCDT x, HCDT y, HCDT z, HCDT a, HCDT b, const char *stl, const char *opt);\r
-void mgl_surf3c_val(HMGL graph, float Val, HCDT a, HCDT b, const char *stl, const char *opt);\r
-void mgl_surf3c_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, HCDT a, HCDT b, const char *stl, const char *opt);\r
-void mgl_surf3c(HMGL graph, HCDT a, HCDT b, const char *stl, const char *opt);\r
-
-// NOTE: now style '.' draws dots instead of faces
-void mgl_cloud_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, HCDT a, const char *stl, const char *opt);\r
-void mgl_cloud(HMGL graph, HCDT a, const char *stl, const char *opt);\r
-
-void mgl_beam_val(HMGL graph, float Val, HCDT tr, HCDT g1, HCDT g2, HCDT a, float r, const char *stl, int norm);\r
-void mgl_beam(HMGL graph, HCDT tr, HCDT g1, HCDT g2, HCDT a, float r, const char *stl, int norm, int num);\r
-
-/*****************************************************************************/\r
-void mgl_surf3_xyz_val_(uintptr_t *graph, float *Val, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *a, const char *stl, const char *opt,int,int);\r
-void mgl_surf3_val_(uintptr_t *graph, float *Val, uintptr_t *a, const char *stl, const char *opt,int,int);\r
-void mgl_surf3_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *a, const char *stl, const char *opt,int,int);\r
-void mgl_surf3_(uintptr_t *graph, uintptr_t *a, const char *stl, const char *opt,int,int);\r
-
-void mgl_surf3a_xyz_val_(uintptr_t *graph, float *Val, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *a, uintptr_t *b, const char *stl, const char *opt,int,int);\r
-void mgl_surf3a_val_(uintptr_t *graph, float *Val, uintptr_t *a, uintptr_t *b, const char *stl, const char *opt,int,int);\r
-void mgl_surf3a_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *a, uintptr_t *b, const char *stl, const char *opt,int,int);\r
-void mgl_surf3a_(uintptr_t *graph, uintptr_t *a, uintptr_t *b, const char *stl, const char *opt,int,int);\r
-
-void mgl_surf3c_xyz_val_(uintptr_t *graph, float *Val, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *a, uintptr_t *b, const char *stl, const char *opt,int,int);\r
-void mgl_surf3c_val_(uintptr_t *graph, float *Val, uintptr_t *a, uintptr_t *b, const char *stl, const char *opt,int,int);\r
-void mgl_surf3c_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *a, uintptr_t *b, const char *stl, const char *opt,int,int);\r
-void mgl_surf3c_(uintptr_t *graph, uintptr_t *a, uintptr_t *b, const char *stl, const char *opt,int,int);\r
-
-void mgl_cloudp_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *a, const char *stl, const char *opt,int,int);\r
-void mgl_cloudp_(uintptr_t *graph, uintptr_t *a, const char *stl, const char *opt,int,int);\r
-void mgl_cloud_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *a, const char *stl, const char *opt,int,int);\r
-void mgl_cloud_(uintptr_t *graph, uintptr_t *a, const char *stl, const char *opt,int,int);\r
-
-void mgl_beam_val_(uintptr_t *gr, float *val, uintptr_t *tr, uintptr_t *g1, uintptr_t *g2, uintptr_t *a, float *r, const char *sch, int *norm,int l);\r
-void mgl_beam_(uintptr_t *gr, uintptr_t *tr, uintptr_t *g1, uintptr_t *g2, uintptr_t *a, float *r, const char *sch, int *norm, int *num,int l);\r
-
-/*****************************************************************************/\r
-#ifdef __cplusplus\r
-}\r
-#endif
-/*****************************************************************************/\r
-#endif
+++ /dev/null
-/***************************************************************************\r
- * window.h is part of Math Graphic Library\r
- * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
- * *\r
- * This program is free software; you can redistribute it and/or modify *\r
- * it under the terms of the GNU Library General Public License as *\r
- * published by the Free Software Foundation; either version 3 of the *\r
- * License, or (at your option) any later version. *\r
- * *\r
- * This program is distributed in the hope that it will be useful, *\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
- * GNU General Public License for more details. *\r
- * *\r
- * You should have received a copy of the GNU Library General Public *\r
- * License along with this program; if not, write to the *\r
- * Free Software Foundation, Inc., *\r
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
- ***************************************************************************/\r
-//-----------------------------------------------------------------------------\r
-#ifndef _MGL_WINDOW_H_\r
-#define _MGL_WINDOW_H_\r
-/*****************************************************************************/\r
-#include "mgl/mgl.h"\r
-//-----------------------------------------------------------------------------\r
-/// Class for drawing in windows (like, mglCanvasFL, mglCanvasQT and so on)\r
-/// Make inherited class and redefine Draw() function if you don't want to use function pointers.\r
-struct mglDraw\r
-{\r
- virtual int Draw(mglGraph *)=0; ///< Function for drawing\r
- virtual void Reload() {} ///< Function for reloading data\r
- virtual void Click() {} ///< Callback function on mouse click\r
-#if MGL_HAVE_PTHREAD\r
- pthread_t thr;\r
- bool running;\r
- mglDraw() { running=false; }\r
- virtual void Calc() {} ///< Function for calculations\r
- inline void Run() ///< Run calculations in other thread\r
- { mgl_draw_thr(this); }\r
-#endif\r
-};\r
-typedef int (*draw_func)(mglGraph *gr);\r
-int mgl_draw_graph(mglBase *gr, void *p);\r
-// NOTE: mgl_draw_class() and mgl_draw_load() use mglWindow* only. Don't use it with inherited classes\r
-int mgl_draw_class(mglBase *gr, void *p);\r
-void mgl_click_class(void *p);\r
-void mgl_reload_class(void *p);\r
-//-----------------------------------------------------------------------------\r
-#if MGL_HAVE_QT\r
-#define MGL_WND_KIND 1\r
-#else\r
-#define MGL_WND_KIND 0\r
-#endif\r
-/// Wrapper class for windows displaying graphics\r
-class mglWindow : public mglGraph\r
-{\r
-friend int mgl_draw_class(mglBase *gr, void *p);\r
-friend void mgl_click_class(void *p);\r
-friend void mgl_reload_class(void *p);\r
-protected:\r
- mglDraw *dr;\r
- int wnd; ///< Type of window\r
-public:\r
- mglWindow(const char *title="MathGL") : mglGraph(-1)\r
- { wnd=0; dr=0; gr = mgl_create_graph_fltk(0,title,0,0); }\r
- inline int RunThr() ///< Run main loop for event handling in separate thread (for FLTK only)\r
- { return wnd==0 ? mgl_fltk_thr():0; }\r
-#ifndef SWIG\r
- mglWindow(int (*draw)(HMGL gr, void *p), const char *title="MathGL", void *par=NULL, int kind=MGL_WND_KIND, void (*load)(void *p)=0) : mglGraph(-1)\r
- {\r
- wnd=kind; dr=0;\r
- if(wnd==1) gr = mgl_create_graph_qt(draw,title,par,load);\r
- else gr = mgl_create_graph_fltk(draw,title,par,load);\r
- }\r
- mglWindow(int (*draw)(mglGraph *gr), const char *title="MathGL", int kind=MGL_WND_KIND) : mglGraph(-1)\r
- {\r
- wnd=kind; dr=0;\r
- if(wnd==1) gr = mgl_create_graph_qt(mgl_draw_graph,title,(void*)draw,0);\r
- else gr = mgl_create_graph_fltk(mgl_draw_graph,title,(void*)draw,0);\r
- }\r
- mglWindow(mglDraw *draw, const char *title="MathGL", int kind=MGL_WND_KIND) : mglGraph(-1)\r
- {\r
- wnd=kind; dr=draw;\r
- if(wnd==1) gr = mgl_create_graph_qt(mgl_draw_class,title,this,mgl_reload_class);\r
- else gr = mgl_create_graph_fltk(mgl_draw_class,title,this,mgl_reload_class);\r
- mgl_set_click_func(gr, mgl_click_class);\r
- }\r
- inline int Run() ///< Run main loop for event handling\r
- { return (wnd==1)? mgl_qt_run() : mgl_fltk_run(); }\r
-#endif\r
-\r
- inline void ToggleAlpha() ///< Switch on/off transparency (do not overwrite user settings)\r
- { mgl_wnd_toggle_alpha(gr); }\r
- inline void ToggleLight() ///< Switch on/off lighting (do not overwrite user settings)\r
- { mgl_wnd_toggle_light(gr); }\r
- inline void ToggleZoom() ///< Switch on/off zooming by mouse\r
- { mgl_wnd_toggle_zoom(gr); }\r
- inline void ToggleRotate() ///< Switch on/off rotation by mouse\r
- { mgl_wnd_toggle_rotate(gr); }\r
- inline void ToggleNo() ///< Switch off all zooming and rotation\r
- { mgl_wnd_toggle_no(gr); }\r
- inline void Update() ///< Update picture by calling user drawing function\r
- { mgl_wnd_update(gr); }\r
- inline void ReLoad() ///< Reload user data and update picture\r
- { mgl_wnd_reload(gr); }\r
- inline void Adjust() ///< Adjust size of bitmap to window size\r
- { mgl_wnd_adjust(gr); }\r
- inline void NextFrame() ///< Show next frame (if one)\r
- { mgl_wnd_next_frame(gr); }\r
- inline void PrevFrame() ///< Show previous frame (if one)\r
- { mgl_wnd_prev_frame(gr); }\r
- inline void Animation() ///< Run slideshow (animation) of frames\r
- { mgl_wnd_animation(gr); }\r
- void SetClickFunc(void (*func)(void *p))\r
- { if(!dr) mgl_set_click_func(gr,func); }\r
-\r
- inline void SetDelay(float dt) ///< Delay for animation in seconds\r
- { mgl_wnd_set_delay(gr, dt); }\r
- inline void Setup(bool clf_upd=true, bool showpos=false)\r
- { mgl_setup_window(gr, clf_upd, showpos); }\r
- inline mglPoint LastMousePos() ///< Last mouse position\r
- { mglPoint p; mgl_get_last_mouse_pos(gr,&p.x,&p.y,&p.z); return p; }\r
-};\r
-//-----------------------------------------------------------------------------\r
-#endif\r
--- /dev/null
+/***************************************************************************
+ * addon.h is part of Math Graphic Library
+ * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Library General Public License as *
+ * published by the Free Software Foundation; either version 3 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef _MGL_ADDON_H_
+#define _MGL_ADDON_H_
+/***************************************************************************/
+#include <stdio.h>
+#ifdef __cplusplus
+/***************************************************************************/
+#include <complex>
+#ifndef dual
+#define dual std::complex<double>
+#endif
+//---------------------------------------------------------------------------
+dual mgl_ipowc(dual x,int n);
+dual expi(dual a);
+dual expi(double a);
+//---------------------------------------------------------------------------
+/// Explicit scheme for 1 step of axial diffraction
+bool mgl_difr_axial(dual *a, int n, dual q, int Border,dual *b, dual *d, int kk, double di);
+/// Explicit scheme for 1 step of plane diffraction
+bool mgl_difr_grid(dual *a,int n,dual q,int Border,dual *b,dual *d,int kk);
+/***************************************************************************/
+extern "C" {
+#endif
+/***************************************************************************/
+double mgl_gauss_rnd();
+void mgl_fft_freq(double *freq,unsigned nn);
+/***************************************************************************/
+/** Remove double spaces from the string */
+void mgl_strcls(char *str);
+/** Get position of substring or return -1 if not found */
+int mgl_strpos(const char *str,char *fnd);
+/** Get position of symbol or return -1 if not found */
+int mgl_chrpos(const char *str,char fnd);
+/***************************************************************************/
+/** Get uncommented string from file (NOTE: it is not thread safe!!!) */
+char *mgl_fgetstr(FILE *fp);
+/** Check if symbol denote true */
+bool mgl_istrue(char ch);
+/** Print test message */
+void mgl_test(const char *str, ...);
+/** Print info message */
+void mgl_info(const char *str, ...);
+/** Locate next data block (block started by -----) */
+FILE *mgl_next_data(const char *fname,int p);
+/***************************************************************************/
+#ifdef __cplusplus
+};
+#endif
+#endif
--- /dev/null
+/***************************************************************************\r
+ * base.h is part of Math Graphic Library\r
+ * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
+ * *\r
+ * This program is free software; you can redistribute it and/or modify *\r
+ * it under the terms of the GNU Library General Public License as *\r
+ * published by the Free Software Foundation; either version 3 of the *\r
+ * License, or (at your option) any later version. *\r
+ * *\r
+ * This program is distributed in the hope that it will be useful, *\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
+ * GNU General Public License for more details. *\r
+ * *\r
+ * You should have received a copy of the GNU Library General Public *\r
+ * License along with this program; if not, write to the *\r
+ * Free Software Foundation, Inc., *\r
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
+ ***************************************************************************/\r
+#ifndef _MGL_BASE_H_\r
+#define _MGL_BASE_H_\r
+#include <string.h>\r
+#include <stdlib.h>\r
+#include <stdio.h>\r
+#include <math.h>\r
+#ifndef _MSC_VER\r
+#include <stdint.h>\r
+#endif\r
+#include "mgl2/define.h"\r
+/*****************************************************************************/\r
+#ifdef __cplusplus\r
+#include <vector>\r
+#include <string>\r
+#include "mgl2/type.h"\r
+#include "mgl2/eval.h"\r
+#include "mgl2/font.h"\r
+//-----------------------------------------------------------------------------\r
+/// Abstract class for data array\r
+class mglDataA\r
+{\r
+public:\r
+ virtual mreal v(long i,long j=0,long k=0) const = 0;\r
+ virtual mreal vthr(long i) const = 0;\r
+ virtual long GetNx() const = 0;\r
+ virtual long GetNy() const = 0;\r
+ virtual long GetNz() const = 0;\r
+ inline long GetNN() const { return GetNx()*GetNy()*GetNz(); }\r
+ virtual float Maximal() const = 0;\r
+ virtual float Minimal() const = 0;\r
+ virtual mreal dvx(long i,long j=0,long k=0) const = 0;\r
+// { return i>0 ? (i<GetNx()-1 ? (v(i+1,j,k)-v(i-1,j,k))/2 : v(i,j,k)-v(i-1,j,k)) : v(1,j,k)-v(0,j,k); }\r
+ virtual mreal dvy(long i,long j=0,long k=0) const = 0;\r
+// { return j>0 ? (j<GetNy()-1 ? (v(i,j+1,k)-v(i,j-1,k))/2 : v(i,j,k)-v(i,j-1,k)) : v(i,1,k)-v(i,0,k); }\r
+ virtual mreal dvz(long i,long j=0,long k=0) const = 0;\r
+// { return k>0 ? (k<GetNz()-1 ? (v(i,j,k+1)-v(i,j,k-1))/2 : v(i,j,k)-v(i,j,k-1)) : v(i,j,1)-v(i,j,0); }\r
+};\r
+//-----------------------------------------------------------------------------\r
+inline float mgl_d(float v,float v1,float v2) { return v2!=v1?(v-v1)/(v2-v1):NAN; }\r
+//-----------------------------------------------------------------------------\r
+mglPoint GetX(const mglDataA *x, int i, int j, int k=0);\r
+mglPoint GetY(const mglDataA *y, int i, int j, int k=0);\r
+mglPoint GetZ(const mglDataA *z, int i, int j, int k=0);\r
+inline mglPoint GetX(const mglDataA &x, int i, int j, int k=0)\r
+{ return GetX(&x,i,j,k); }\r
+inline mglPoint GetY(const mglDataA &y, int i, int j, int k=0)\r
+{ return GetY(&y,i,j,k); }\r
+inline mglPoint GetZ(const mglDataA &z, int i, int j, int k=0)\r
+{ return GetZ(&z,i,j,k); }\r
+//-----------------------------------------------------------------------------\r
+/// Structure for simplest primitives\r
+struct mglPrim\r
+{\r
+ // NOTE: n4 is used as mark; n3 -- as pen style for type=0,1,4\r
+ // NOTE: n3 is used as position of txt,font in Ptxt for type=6\r
+ long n1,n2,n3,n4; ///< coordinates of corners\r
+ int type; ///< primitive type (0-point, 1-line, 2-trig, 3-quad, 4-glyph, 6-text)\r
+ int id; ///< object id\r
+ float z; ///< z-position\r
+ float s; ///< size (if applicable) or fscl\r
+ float w; ///< width (if applicable) or ftet\r
+ float p;\r
+\r
+ mglPrim(int t=0) { n1=n2=n3=n4=id=0; z=s=w=p=0; type = t; }\r
+};\r
+bool operator<(const mglPrim &a,const mglPrim &b);\r
+bool operator>(const mglPrim &a,const mglPrim &b);\r
+//-----------------------------------------------------------------------------\r
+/// Structure for group of primitives\r
+struct mglGroup\r
+{\r
+ std::vector<long> p;///< list of primitives (not filled!!!)\r
+ int Id; ///< Current list of primitives\r
+ std::string Lbl; ///< Group label\r
+ mglGroup(const char *lbl="", int id=0) { Lbl=lbl; Id=id; }\r
+};\r
+//-----------------------------------------------------------------------------\r
+/// Structure for text label\r
+struct mglText\r
+{\r
+ std::wstring text;\r
+ std::string stl;\r
+ float val;\r
+ mglText(const wchar_t *txt=0, const char *fnt=0, float v=0) { text=txt; stl=fnt; val=v; }\r
+ mglText(const std::wstring &txt, float v=0) { text=txt; val=v; }\r
+};\r
+//-----------------------------------------------------------------------------\r
+/// Structure for internal point represenatation\r
+struct mglPnt\r
+{\r
+ float xx,yy,zz; // original coordinates\r
+ float x,y,z; // coordinates\r
+ float c,t,ta; // index in color scheme\r
+ float u,v,w; // normales\r
+ float r,g,b,a; // RGBA color\r
+ mglPnt() { xx=yy=zz=x=y=z=c=t=ta=u=v=w=r=g=b=a=0; }\r
+};\r
+inline mglPnt operator+(const mglPnt &a, const mglPnt &b)\r
+{ mglPnt c=a;\r
+ c.x+=b.x; c.y+=b.y; c.z+=b.z; c.u+=b.u; c.v+=b.v; c.w+=b.w;\r
+ c.r+=b.r; c.g+=b.g; c.b+=b.b; c.a+=b.a; return c; }\r
+inline mglPnt operator-(const mglPnt &a, const mglPnt &b)\r
+{ mglPnt c=a;\r
+ c.x-=b.x; c.y-=b.y; c.z-=b.z; c.u-=b.u; c.v-=b.v; c.w-=b.w;\r
+ c.r-=b.r; c.g-=b.g; c.b-=b.b; c.a-=b.a; return c; }\r
+inline mglPnt operator*(const mglPnt &a, float b)\r
+{ mglPnt c=a;\r
+ c.x*=b; c.y*=b; c.z*=b; c.u*=b; c.v*=b; c.w*=b;\r
+ c.r*=b; c.g*=b; c.b*=b; c.a*=b; return c; }\r
+inline mglPnt operator*(float b, const mglPnt &a)\r
+{ mglPnt c=a;\r
+ c.x*=b; c.y*=b; c.z*=b; c.u*=b; c.v*=b; c.w*=b;\r
+ c.r*=b; c.g*=b; c.b*=b; c.a*=b; return c; }\r
+//-----------------------------------------------------------------------------\r
+struct mglTexture\r
+{\r
+ mglColor col[512]; ///< Colors itself\r
+ long n; ///< Number of initial colors along u\r
+\r
+ char Sch[260]; ///< Color scheme used\r
+ int Smooth; ///< Type of texture (smoothing and so on)\r
+ float Alpha; ///< Transparency\r
+ \r
+ mglTexture() { n=0; }\r
+ mglTexture(const char *cols, int smooth=0,float alpha=1)\r
+ { n=0; Set(cols,smooth,alpha); }\r
+ void Clear() { n=0; }\r
+ void Set(const char *cols, int smooth=0,float alpha=1);\r
+ void GetC(float u,float v,mglPnt &p) const;\r
+ inline bool IsSame(const mglTexture &t) const\r
+ { return n==t.n && !memcmp(col,t.col,512*sizeof(mglColor)); }\r
+ void GetRGBA(unsigned char *f) const; // Write as BGRA for fastest export to TGA\r
+};\r
+//-----------------------------------------------------------------------------\r
+const mglColor NC(-1,-1,-1);\r
+const mglColor BC( 0, 0, 0);\r
+const mglColor WC( 1, 1, 1);\r
+const mglColor RC( 1, 0, 0);\r
+long mgl_have_color(const char *stl);\r
+//-----------------------------------------------------------------------------\r
+/// Structure for color ID\r
+struct mglColorID\r
+{\r
+ char id;\r
+ mglColor col;\r
+};\r
+extern mglColorID mglColorIds[31];\r
+//-----------------------------------------------------------------------------\r
+/// Base class for canvas which handle all basic drawing\r
+class mglBase\r
+{\r
+public:\r
+ mglBase();\r
+ virtual ~mglBase();\r
+\r
+ bool Stop; ///< Flag that execution should be terminated.\r
+ mglPoint Min; ///< Lower edge of bounding box for graphics.\r
+ mglPoint Max; ///< Upper edge of bounding box for graphics.\r
+ std::string Mess; ///< Buffer for receiving messages\r
+ int ObjId; ///< object id for mglPrim\r
+ int HighId; ///< object id to be highlited\r
+ std::vector<mglGroup> Grp; ///< List of groups with names -- need for export\r
+ std::string PlotId; ///< Id of plot for saving filename (in GLUT window for example)\r
+\r
+ float CDef; ///< Default (current) color in texture\r
+ float AlphaDef; ///< Default value of alpha channel (transparency)\r
+ float BarWidth; ///< Relative width of rectangles in Bars().\r
+ int MeshNum; ///< Set approximate number of lines in Mesh and Grid. By default (=0) it draw all lines.\r
+ char Arrow1, Arrow2;///< Style of arrows at end and at start of curve\r
+ long InUse; ///< Smart pointer (number of users)\r
+ long Flag; ///< Flags for controlling drawing\r
+\r
+ inline bool get(long fl) const { return Flag&fl; }\r
+ inline void set(long fl) { Flag |= fl; }\r
+ inline void clr(long fl) { Flag &=~fl; }\r
+ inline void set(bool v,long fl) { Flag = v ? Flag|fl : Flag&(~fl); }\r
+\r
+ /// Set values of mglGraph::Min and mglGraph::Max\r
+ inline void SetRanges(float x1, float x2, float y1, float y2, float z1=0, float z2=0, float c1=0, float c2=0)\r
+ { SetRanges(mglPoint(x1,y1,z1,c1),mglPoint(x2,y2,z2,c2)); }\r
+ void SetRanges(mglPoint v1, mglPoint v2);\r
+ /// Set values of mglGraph::Cmin and mglGraph::Cmax as minimal and maximal values of data a\r
+ void CRange(const mglDataA &a, bool add = false, float fact=0);\r
+ inline void CRange(float v1,float v2) { if(v1!=v2) {Min.c=v1; Max.c=v2; RecalcCRange();} }\r
+ /// Set values of mglGraph::Min.x and mglGraph::Max.x as minimal and maximal values of data a\r
+ void XRange(const mglDataA &a, bool add = false, float fact=0);\r
+ inline void XRange(float v1,float v2) { if(v1!=v2) {Min.x=v1; Max.x=v2; RecalcBorder();} }\r
+ /// Set values of mglGraph::Min.x and mglGraph::Max.x as minimal and maximal values of data a\r
+ void YRange(const mglDataA &a, bool add = false, float fact=0);\r
+ inline void YRange(float v1,float v2) { if(v1!=v2) {Min.y=v1; Max.y=v2; RecalcBorder();} }\r
+ /// Set values of mglGraph::Min.x and mglGraph::Max.x as minimal and maximal values of data a\r
+ void ZRange(const mglDataA &a, bool add = false, float fact=0);\r
+ inline void ZRange(float v1,float v2) { if(v1!=v2) {Min.z=v1; Max.z=v2; RecalcBorder();} }\r
+ /// Set ranges for automatic variables\r
+ void SetAutoRanges(float x1, float x2, float y1=0, float y2=0, float z1=0, float z2=0, float c1=0, float c2=0);\r
+ /// Set axis origin\r
+ inline void SetOrigin(float x0, float y0, float z0=NAN, float c0=NAN)\r
+ { Org=mglPoint(x0,y0,z0,c0); }\r
+ /// Save ranges into internal variable and put parsed\r
+ float SaveState(const char *opt);\r
+ /// Load ranges from internal variable\r
+ void LoadState();\r
+\r
+ /// Safetly set the transformation formulas for coordinate.\r
+ void SetFunc(const char *EqX, const char *EqY, const char *EqZ=0, const char *EqA=0);\r
+ /// Set one of predefined transformation rule\r
+ void SetCoor(int how);\r
+ /// Safetly set the cutting off condition (formula).\r
+ void CutOff(const char *EqCut);\r
+ /// Set to draw Ternary axis (triangle like axis, grid and so on)\r
+ void Ternary(int tern);\r
+\r
+ /// Set cutting for points outside of bounding box\r
+ inline void SetCut(bool val) { set(val, MGL_ENABLE_CUT); }\r
+ /// Set additional cutting box\r
+ inline void SetCutBox(float x1, float y1, float z1, float x2, float y2, float z2)\r
+ { CutMin=mglPoint(x1,y1,z1); CutMax=mglPoint(x2,y2,z2); }\r
+ inline void SetCutBox(mglPoint v1, mglPoint v2) { CutMin=v1; CutMax=v2; }\r
+\r
+ /// Set the using of light on/off.\r
+ virtual bool Light(bool enable)\r
+ { bool t=get(MGL_ENABLE_LIGHT); set(enable,MGL_ENABLE_LIGHT); return t; }\r
+ /// Set ambient light brightness\r
+ virtual void SetAmbient(float bright=0.5);\r
+ /// Use diffusive light (only for local light sources)\r
+ inline void SetDifLight(bool dif) { set(dif,MGL_DIFFUSIVE); }\r
+ /// Set the transparency on/off.\r
+ virtual bool Alpha(bool enable)\r
+ { bool t=get(MGL_ENABLE_ALPHA); set(enable,MGL_ENABLE_ALPHA); return t; }\r
+ /// Set default value of alpha-channel\r
+ inline void SetAlphaDef(float val) { AlphaDef=val; };\r
+ /// Set default palette\r
+ inline void SetPalette(const char *colors)\r
+ { Txt[0].Set(mgl_have_color(colors)?colors:MGL_DEF_PAL,-1); }\r
+ inline long GetNumPal(long id) const { return Txt[abs(id)/256].n; }\r
+ /// Set default color scheme\r
+ inline void SetDefScheme(const char *colors)\r
+ { Txt[1].Set(mgl_have_color(colors)?colors:"BbcyrR"); }\r
+\r
+ /// Set number of mesh lines\r
+ inline void SetMeshNum(int val) { MeshNum=val; };\r
+ /// Set relative width of rectangles in Bars, Barh, BoxPlot\r
+ inline void SetBarWidth(float val) { BarWidth=val; };\r
+ /// Set size of marks\r
+ inline void SetMarkSize(float val) { MarkSize=0.02*val; }\r
+ /// Set size of arrows\r
+ inline void SetArrowSize(float val) { ArrowSize=0.03*val; }\r
+\r
+ /// Set warning code ant fill Message\r
+ void SetWarn(int code, const char *who="");\r
+ int inline GetWarn() const { return WarnCode; }\r
+\r
+ virtual void StartAutoGroup (const char *)=0;\r
+ void StartGroup(const char *name, int id);\r
+ virtual void EndGroup()=0; // { LoadState(); }\r
+ /// Highlight group\r
+ inline void Highlight(int id) { HighId=id; }\r
+\r
+ /// Set FontSize by size in pt and picture DPI (default is 16 pt for dpi=72)\r
+ virtual void SetFontSizePT(float pt, int dpi=72){ FontSize = pt*27.f/dpi; }\r
+ /// Set FontSize by size in centimeters and picture DPI (default is 0.56 cm = 16 pt)\r
+ inline void SetFontSizeCM(float cm, int dpi=72) { SetFontSizePT(cm*28.45f,dpi); };\r
+ /// Set FontSize by size in inch and picture DPI (default is 0.22 in = 16 pt)\r
+ inline void SetFontSizeIN(float in, int dpi=72) { SetFontSizePT(in*72.27f,dpi); };\r
+ /// Set font typeface. Note that each mglFont instance can be used with ONLY ONE mglGraph instance at a moment of time!\r
+ void SetFont(mglFont *f);\r
+ /// Get current typeface. Note that this variable can be deleted at next SetFont() call!\r
+ inline mglFont *GetFont() { return fnt; }\r
+ /// Restore font\r
+ inline void RestoreFont() { fnt->Restore(); }\r
+ /// Load font from file\r
+ inline void LoadFont (const char *name, const char *path=NULL)\r
+ { fnt->Load(name,path); };\r
+ /// Copy font from another mglGraph instance\r
+ inline void CopyFont(mglBase *gr) { fnt->Copy(gr->GetFont()); }\r
+ /// Set default font size\r
+ inline void SetFontSize(float val) { FontSize=val>0 ? val:FontSize*val; }\r
+ inline float GetFontSize() const { return FontSize; };\r
+ inline float TextWidth(const wchar_t *text, const char *font, float size) const\r
+ { return (size<0?-size*FontSize:size)*font_factor*fnt->Width(text,(font&&*font)?font:FontDef)/8; }\r
+ inline float TextHeight(const char *font, float size) const\r
+ { return (size<0?-size*FontSize:size)*font_factor*fnt->Height(font?font:FontDef)/8; }\r
+ inline float FontFactor() const { return font_factor; }\r
+ virtual float GetRatio() const;\r
+ /// Set to use or not text rotation\r
+ inline void SetRotatedText(bool val) { set(val,MGL_ENABLE_RTEXT); }\r
+ /// Set default font style and color\r
+ inline void SetFontDef(const char *font) { strncpy(FontDef, font, 31); }\r
+ /// Set to use or not text rotation\r
+ inline void SetTickRotate(bool val) { set(val,MGL_TICKS_ROTATE); }\r
+ /// Set to use or not text rotation\r
+ inline void SetTickSkip(bool val) { set(val,MGL_TICKS_SKIP); }\r
+\r
+ /// Add string to legend\r
+ void AddLegend(const char *text,const char *style);\r
+ void AddLegend(const wchar_t *text,const char *style);\r
+ /// Clear saved legend string\r
+ inline void ClearLegend() { Leg.clear(); }\r
+\r
+ /// Set plot quality\r
+ virtual void SetQuality(int qual=MGL_DRAW_NORM) { Quality=qual; }\r
+ inline int GetQuality() const { return Quality; }\r
+\r
+ // ~~~~~~~~~~~~~~~~~~~~~~ Developer functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r
+ /// Add point to the pntN and return its position\r
+ long AddPnt(mglPoint p, float c=-1, mglPoint n=mglPoint(NAN), float a=-1, int scl=1);\r
+ long CopyNtoC(long k, float c);\r
+ long CopyProj(long from, mglPoint p, mglPoint n);\r
+ virtual void Reserve(long n); ///< Allocate n-cells for pntC and return current position\r
+ /// Set to reduce accuracy of points (to reduc size of output files)\r
+ inline void SetReduceAcc(bool val) { set(val, MGL_REDUCEACC); }\r
+\r
+// inline long GetPos() { return Pnt.size()-1; }\r
+ inline mglPoint GetPntP(long i) const\r
+ { const mglPnt &p=Pnt[i]; return mglPoint(p.x,p.y,p.z); }\r
+ inline float GetClrC(long i) const { return Pnt[i].c; }\r
+ inline const mglPnt &GetPnt(long i) const { return Pnt[i]; }\r
+ inline long GetPntNum() const { return Pnt.size(); }\r
+ inline mglPrim &GetPrm(long i) { return Prm[i]; }\r
+ inline long GetPrmNum() const { return Prm.size(); }\r
+ inline const mglText &GetPtx(long i) const { return Ptx[i]; }\r
+ inline long GetPtxNum() const { return Ptx.size(); }\r
+ inline const mglTexture &GetTxt(long i) const { return Txt[i]; }\r
+ inline long GetTxtNum() const { return Txt.size(); }\r
+ /// Scale coordinates and cut off some points\r
+ virtual bool ScalePoint(mglPoint &p, mglPoint &n, bool use_nan=true) const;\r
+\r
+ virtual float GetOrgX(char dir) const=0; ///< Get Org.x (parse NAN value)\r
+ virtual float GetOrgY(char dir) const=0; ///< Get Org.y (parse NAN value)\r
+ virtual float GetOrgZ(char dir) const=0; ///< Get Org.z (parse NAN value)\r
+\r
+ /// Get color depending on single variable z, which should be scaled if scale=true\r
+ inline float GetC(long s,float z,bool scale = true) const\r
+ { return s+(scale?GetA(z):(z>0?z/MGL_FLT_EPS:0)); }\r
+ /// Get alpha value depending on single variable \a a\r
+ float GetA(float a) const;\r
+ /// Set pen/palette\r
+ char SetPenPal(const char *stl, long *id=0);\r
+ /// Add texture (like color scheme) and return the position of first color\r
+ long AddTexture(const char *cols, int smooth=0);\r
+// inline float AddTexture(char col) { return AddTexture(mglColor(col)); };\r
+ float AddTexture(mglColor col);\r
+ inline void DefColor(mglColor col) { CDef = AddTexture(col); }\r
+ /// Set next color from palette\r
+ float NextColor(long &id);\r
+\r
+ virtual void mark_plot(long p, char type, float size=1)=0;\r
+ virtual void arrow_plot(long p1, long p2, char st)=0;\r
+ virtual void line_plot(long p1, long p2)=0;\r
+ virtual void trig_plot(long p1, long p2, long p3)=0;\r
+ virtual void quad_plot(long p1, long p2, long p3, long p4)=0;\r
+ virtual void Glyph(float x, float y, float f, int style, long icode, float col)=0;\r
+ virtual float text_plot(long p,const wchar_t *text,const char *fnt,float size=-1,float sh=0,float col=-('k'),bool rot=true)=0;\r
+ void vect_plot(long p1, long p2, float s=1);\r
+ inline float mark_size() { return MarkSize*font_factor; }\r
+// inline char last_color() { return last_style[1]; }\r
+ inline const char *last_line() { return last_style; }\r
+\r
+protected:\r
+ mglPoint FMin; ///< Actual lower edge after transformation formulas.\r
+ mglPoint FMax; ///< Actual upper edge after transformation formulas.\r
+ mglPoint Org; ///< Center of axis cross section.\r
+ int WarnCode; ///< Warning code\r
+ std::vector<mglPnt> Pnt; ///< Internal points\r
+ std::vector<mglPrim> Prm; ///< Primitives (lines, triangles and so on) -- need for export\r
+ std::vector<mglPrim> Sub; ///< InPlot regions {n1=x1,n2=x2,n3=y1,n4=y2,id}\r
+ std::vector<mglText> Ptx; ///< Text labels for mglPrim\r
+ std::vector<mglText> Leg; ///< Text labels for legend\r
+ std::vector<mglTexture> Txt;///< Pointer to textures\r
+#if MGL_HAVE_PTHREAD\r
+ pthread_mutex_t mutexPnt, mutexTxt, mutexLeg;\r
+#endif\r
+\r
+ int TernAxis; ///< Flag that Ternary axis is used\r
+ unsigned PDef; ///< Pen bit mask\r
+ float pPos; ///< Current position in pen mask\r
+ float PenWidth; ///< Pen width for further line plotting (must be >0 !!!)\r
+// long numT; ///< Number of textures\r
+ float AmbBr; ///< Default ambient light brightness\r
+\r
+ mglFont *fnt; ///< Class for printing vector text\r
+ float FontSize; ///< The size of font for tick and axis labels\r
+ char FontDef[32]; ///< Font specification (see mglGraph::Puts). Default is Roman with align at center.\r
+ int Quality; ///< Quality of plot (0x0-pure, 0x1-fast; 0x2-fine; 0x4 - low memory)\r
+\r
+ mglFormula *fx; ///< Transformation formula for x direction.\r
+ mglFormula *fy; ///< Transformation formula for y direction.\r
+ mglFormula *fz; ///< Transformation formula for z direction.\r
+ mglFormula *fa; ///< Transformation formula for coloring.\r
+ mglFormula *fc; ///< Cutting off condition (formula).\r
+\r
+ long CurrPal; ///< Current palette index\r
+ float MarkSize; ///< The size of marks for 1D plots.\r
+ float ArrowSize; ///< The size of arrows.\r
+ char last_style[64];///< Last pen style\r
+ float font_factor; ///< Font scaling factor\r
+\r
+ virtual void LightScale()=0; ///< Scale positions of light sources\r
+\r
+private:\r
+ mglPoint MinS; ///< Saved lower edge of bounding box for graphics.\r
+ mglPoint MaxS; ///< Saved upper edge of bounding box for graphics.\r
+ float MSS, ASS, FSS, ADS, MNS, LSS; ///< Saved state\r
+ long CSS; ///< Saved flags\r
+ bool saved; ///< State is saved\r
+ std::string leg_str;///< text to be save in legend\r
+\r
+ mglPoint CutMin; ///< Lower edge of bounding box for cut off.\r
+ mglPoint CutMax; ///< Upper edge of bounding box for cut off.\r
+\r
+ void RecalcCRange(); ///< Recalculate internal parameter for correct coloring.\r
+ void RecalcBorder(); ///< Recalculate internal parameter for correct transformation rules.\r
+ void SetFBord(float x,float y,float z); ///< Set internal boundng box depending on transformation formula\r
+ void ClearEq(); ///< Clear the used variables for axis transformation\r
+};\r
+//-----------------------------------------------------------------------------\r
+#define _Da_(d) (*((const mglDataA *)(d)))\r
+#define _DA_(a) ((const mglDataA *)*(a))\r
+#define _GR_ ((mglBase *)(*gr))\r
+//-----------------------------------------------------------------------------\r
+//#define _D_(d) *((mglData *)*(d))\r
+#define _DM_(a) ((mglData *)*(a))\r
+#define _DT_ ((mglData *)*d)\r
+//-----------------------------------------------------------------------------\r
+class mglData;\r
+class mglParser;\r
+class mglFormula;\r
+typedef mglBase* HMGL;\r
+typedef mglData* HMDT;\r
+typedef mglParser* HMPR;\r
+typedef mglFormula* HMEX;\r
+typedef const mglDataA* HCDT;\r
+#else\r
+typedef void *HMGL;\r
+typedef void *HMDT;\r
+typedef void *HMEX;\r
+typedef void *HMPR;\r
+typedef const void *HCDT;\r
+#endif\r
+/*****************************************************************************/\r
+#endif\r
--- /dev/null
+/***************************************************************************\r
+ * base_cf.h is part of Math Graphic Library\r
+ * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
+ * *\r
+ * This program is free software; you can redistribute it and/or modify *\r
+ * it under the terms of the GNU Library General Public License as *\r
+ * published by the Free Software Foundation; either version 3 of the *\r
+ * License, or (at your option) any later version. *\r
+ * *\r
+ * This program is distributed in the hope that it will be useful, *\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
+ * GNU General Public License for more details. *\r
+ * *\r
+ * You should have received a copy of the GNU Library General Public *\r
+ * License along with this program; if not, write to the *\r
+ * Free Software Foundation, Inc., *\r
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
+ ***************************************************************************/\r
+#ifndef _MGL_BASE_CF_H_\r
+#define _MGL_BASE_CF_H_\r
+#include "mgl2/base.h"\r
+/*****************************************************************************/\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+/*****************************************************************************/\r
+int mgl_get_warn(HMGL gr);\r
+void mgl_set_warn(HMGL gr, int code, const char *text);\r
+const char *mgl_get_mess(HMGL gr);\r
+long mgl_use_graph(HMGL gr, int inc);\r
+void mgl_start_group(HMGL gr, const char *);\r
+void mgl_end_group(HMGL gr);\r
+void mgl_highlight(HMGL gr, int id);\r
+\r
+void mgl_set_palette(HMGL gr, const char *colors);\r
+void mgl_set_alpha_default(HMGL graph, float alpha);\r
+void mgl_set_bar_width(HMGL graph, float width);\r
+void mgl_set_meshnum(HMGL graph, int num);\r
+void mgl_set_ambbr(HMGL gr, float i);\r
+void mgl_set_light_dif(HMGL gr, int enable);\r
+\r
+void mgl_set_rdc_acc(HMGL graph, int reduce);\r
+void mgl_set_cut(HMGL graph, int cut);\r
+void mgl_set_cut_box(HMGL gr, float x1,float y1,float z1,float x2,float y2,float z2);\r
+void mgl_set_ranges(HMGL graph, float x1, float x2, float y1, float y2, float z1, float z2);\r
+void mgl_set_range_val(HMGL gr, char dir, float v1,float v2);\r
+void mgl_set_range_dat(HMGL gr, char dir, HCDT a, int add);\r
+\r
+void mgl_set_origin(HMGL graph, float x0, float y0, float z0);\r
+void mgl_set_func(HMGL graph, const char *EqX,const char *EqY,const char *EqZ,const char *EqA);\r
+void mgl_set_coor(HMGL gr, int how);\r
+void mgl_set_ternary(HMGL gr, int enable);\r
+void mgl_set_cutoff(HMGL graph, const char *EqC);\r
+\r
+void mgl_set_tick_rotate(HMGL graph, int enable);\r
+void mgl_set_tick_skip(HMGL graph, int enable);\r
+\r
+float mgl_data_get_value(HCDT d, long i, long j, long k);\r
+long mgl_data_get_nx(HCDT d);\r
+long mgl_data_get_ny(HCDT d);\r
+long mgl_data_get_nz(HCDT d);\r
+\r
+void mgl_set_mark_size(HMGL graph, float size);\r
+void mgl_set_arrow_size(HMGL graph, float size);\r
+void mgl_set_font_size(HMGL graph, float size);\r
+void mgl_set_font_def(HMGL graph, const char *fnt);\r
+void mgl_set_rotated_text(HMGL graph, int enable);\r
+void mgl_load_font(HMGL gr, const char *name, const char *path);\r
+void mgl_copy_font(HMGL gr, HMGL gr_from);\r
+void mgl_restore_font(HMGL gr);\r
+void mgl_set_color(char id, float r, float g, float b);\r
+void mgl_set_def_sch(HMGL gr, const char *sch);\r
+/*****************************************************************************/\r
+void mgl_set_def_sch_(uintptr_t *gr, const char *sch,int);\r
+void mgl_set_color_(char *id, float *r, float *g, float *b, int);\r
+int mgl_get_warn_(uintptr_t *gr);\r
+void mgl_set_warn_(uintptr_t *gr, int *code, const char *text,int);\r
+long mgl_use_graph_(uintptr_t *gr, int *inc);\r
+void mgl_start_group_(uintptr_t *gr, const char *,int);\r
+void mgl_end_group_(uintptr_t *gr);\r
+void mgl_highlight_(uintptr_t *gr, int *id);\r
+\r
+void mgl_set_palette_(uintptr_t *gr, const char *colors, int);\r
+void mgl_set_pal_color_(uintptr_t *graph, int *n, float *r, float *g, float *b);\r
+void mgl_set_pal_num_(uintptr_t *graph, int *num);\r
+void mgl_set_alpha_default_(uintptr_t *graph, float *alpha);\r
+void mgl_set_bar_width_(uintptr_t *graph, float *width);\r
+void mgl_set_meshnum_(uintptr_t *graph, int *num);\r
+void mgl_set_ambbr_(uintptr_t *gr, float *i);\r
+void mgl_set_light_dif_(uintptr_t *graph, int *enable);\r
+\r
+void mgl_set_rdc_acc_(uintptr_t *graph, int *reduce);\r
+void mgl_set_cut_(uintptr_t *graph, int *cut);\r
+void mgl_set_cut_box_(uintptr_t *gr, float *x1,float *y1,float *z1,float *x2,float *y2,float *z2);\r
+void mgl_set_ranges_(uintptr_t *graph, float *x1, float *x2, float *y1, float *y2, float *z1, float *z2);\r
+void mgl_set_range_val_(uintptr_t *gr, const char *dir, float *v1,float *v2,int);\r
+void mgl_set_range_dat_(uintptr_t *gr, const char *dir, uintptr_t *a, int *add,int);\r
+\r
+void mgl_set_origin_(uintptr_t *gr, float *x0, float *y0, float *z0);\r
+void mgl_set_func_(uintptr_t *graph, const char *EqX, const char *EqY, const char *EqZ, const char *EqA, int, int, int, int);\r
+void mgl_set_coor_(uintptr_t *gr, int *how);\r
+void mgl_set_ternary_(uintptr_t *graph, int *enable);\r
+void mgl_set_cutoff_(uintptr_t *graph, const char *EqC, int);\r
+\r
+void mgl_set_tick_rotate_(uintptr_t *graph, int *enable);\r
+void mgl_set_tick_skip_(uintptr_t *graph, int *enable);\r
+\r
+float mgl_data_get_value_(uintptr_t *d, int *i, int *j, int *k);\r
+long mgl_data_get_nx_(uintptr_t *d);\r
+long mgl_data_get_ny_(uintptr_t *d);\r
+long mgl_data_get_nz_(uintptr_t *d);\r
+\r
+void mgl_set_mark_size_(uintptr_t *graph, float *size);\r
+void mgl_set_arrow_size_(uintptr_t *graph, float *size);\r
+void mgl_set_font_size_(uintptr_t *graph, float *size);\r
+void mgl_set_font_def_(uintptr_t *graph, const char *fnt, int);\r
+void mgl_set_rotated_text_(uintptr_t *graph, int *enable);\r
+void mgl_load_font_(uintptr_t *gr, char *name, char *path, int l, int n);\r
+void mgl_copy_font_(uintptr_t *gr, uintptr_t *gr_from);\r
+void mgl_restore_font_(uintptr_t *gr);\r
+/*****************************************************************************/\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+/*****************************************************************************/\r
+#endif\r
--- /dev/null
+/***************************************************************************\r
+ * canvas.h is part of Math Graphic Library\r
+ * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
+ * *\r
+ * This program is free software; you can redistribute it and/or modify *\r
+ * it under the terms of the GNU Library General Public License as *\r
+ * published by the Free Software Foundation; either version 3 of the *\r
+ * License, or (at your option) any later version. *\r
+ * *\r
+ * This program is distributed in the hope that it will be useful, *\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
+ * GNU General Public License for more details. *\r
+ * *\r
+ * You should have received a copy of the GNU Library General Public *\r
+ * License along with this program; if not, write to the *\r
+ * Free Software Foundation, Inc., *\r
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
+ ***************************************************************************/\r
+#ifndef MGL_CANVAS_H\r
+#define MGL_CANVAS_H\r
+#include "mgl2/base.h"\r
+//-----------------------------------------------------------------------------\r
+#ifndef MGL_STACK_ENTRY\r
+#define MGL_STACK_ENTRY 10\r
+#endif\r
+//-----------------------------------------------------------------------------\r
+#if MGL_HAVE_GIF\r
+#include <gif_lib.h>\r
+#else\r
+struct GifFileType;\r
+#endif\r
+//-----------------------------------------------------------------------------\r
+/// Structure for transformation matrix\r
+struct mglMatrix\r
+{\r
+ float b[9];\r
+ float x,y,z,pf;\r
+ mglMatrix() { clear(); }\r
+ inline void clear() { x=y=z=0; memset(b,0,9*sizeof(float)); b[0]=b[4]=b[8]=1; }\r
+ inline mglMatrix &operator=(mglMatrix &a)\r
+ { x=a.x; y=a.y; z=a.z; pf=a.pf; memcpy(b,a.b,9*sizeof(float)); return *this; }\r
+};\r
+//-----------------------------------------------------------------------------\r
+/// Structure for drawing axis and ticks\r
+struct mglAxis\r
+{\r
+ mglAxis() { dv=ds=d=v0=v1=v2=o=0; ns=f=ch=*t=0; }\r
+ mglAxis(const mglAxis &aa)\r
+ { dv=aa.dv; ds=aa.ds; d=aa.d; dir=aa.dir;\r
+ v0=aa.v0; v1=aa.v1; v2=aa.v2; o=aa.o;\r
+ a = aa.a; b = aa.b; org=aa.org; txt=aa.txt;\r
+ ns=aa.ns; f=aa.f; ch=aa.ch; wcscpy(t,aa.t); }\r
+ inline void AddLabel(const wchar_t *lbl, float v)\r
+ { txt.push_back(mglText(lbl,"",v)); }\r
+ inline void AddLabel(const std::wstring &lbl, float v)\r
+ { txt.push_back(mglText(lbl,v)); }\r
+\r
+ float dv,ds; ///< Actual step for ticks and subticks.\r
+ float d; ///< Step for axis ticks (if positive) or its number (if negative).\r
+ int ns; ///< Number of axis subticks.\r
+ wchar_t t[256]; ///< Tick template (set NULL to use default one ("%.2g" in simplest case))\r
+ mglPoint dir; ///< Axis direction\r
+ mglPoint a,b; ///< Directions of over axis\r
+ mglPoint org;\r
+ float v0; ///< Center of axis cross section\r
+ float v1; ///< Minimal axis range.\r
+ float v2; ///< Maximal axis range.\r
+ float o; ///< Point of starting ticks numbering (if NAN then Org is used).\r
+ int f; ///< Flag 0x1 - time, 0x2 - manual, 0x4 - fixed dv\r
+ std::vector<mglText> txt; ///< Axis labels\r
+ char ch; ///< Character of axis (like 'x','y','z','c')\r
+};\r
+//-----------------------------------------------------------------------------\r
+/// Structure for light source\r
+struct mglLight\r
+{\r
+ mglLight() { n=false; a=b=0; }\r
+ bool n; ///< Availability of light sources\r
+ mglPoint d; ///< Direction of light sources\r
+ mglPoint r; ///< Position of light sources (NAN for infinity)\r
+ mglPoint q; ///< Actual position of light sources (filled by LightScale() function)\r
+ mglPoint p; ///< Actual direction of light sources (filled by LightScale() function)\r
+ float a; ///< Aperture of light sources\r
+ float b; ///< Brightness of light sources\r
+ mglColor c; ///< Color of light sources\r
+};\r
+//-----------------------------------------------------------------------------\r
+class mglCanvas;\r
+/// Structure for light source\r
+struct mglDrawReg\r
+{\r
+ int x1,x2,y1,y2;\r
+ void set(mglCanvas *gr, int nx, int ny, int m);\r
+};\r
+//-----------------------------------------------------------------------------\r
+/// Structure contains everything for drawing\r
+struct mglDrawDat\r
+{\r
+ std::vector<mglGroup> Grp; ///< List of groups with names -- need for export\r
+ std::vector<mglPnt> Pnt; ///< Internal points\r
+ std::vector<mglPrim> Prm; ///< Primitives (lines, triangles and so on) -- need for export\r
+ std::vector<mglPrim> Sub; ///< InPlot regions {n1=x1,n2=x2,n3=y1,n4=y2,id}\r
+ std::vector<mglText> Ptx; ///< Text labels for mglPrim\r
+ std::vector<mglText> Leg; ///< Text labels for legend\r
+ std::vector<mglTexture> Txt;///< Pointer to textures\r
+};\r
+//-----------------------------------------------------------------------------\r
+/// Class contains all functionality for creating different mathematical plots\r
+class mglCanvas : public mglBase\r
+{\r
+friend struct mglPrim;\r
+public:\r
+using mglBase::Light;\r
+\r
+ mglCanvas(int w=800, int h=600);\r
+ virtual ~mglCanvas();\r
+\r
+ /// Set default parameter for plotting\r
+ void DefaultPlotParam();\r
+\r
+ /// Set angle of view indepently from mglCanvas::Rotate()\r
+ virtual void View(float tetx,float tetz,float tety=0);\r
+ /// Zoom in or zoom out (if Zoom(0, 0, 1, 1)) a part of picture\r
+ virtual void Zoom(float x1, float y1, float x2, float y2);\r
+ /// Restore image after View() and Zoom()\r
+ virtual void Restore() { Bp.clear(); Bp.pf=0; }\r
+\r
+ /// Clear transformation matrix.\r
+ inline void Identity(bool rel=false) { InPlot(0,1,0,1,rel); }\r
+ /// Push transformation matrix into stack\r
+ inline void Push() { stack.push_back(B); }\r
+ /// Set PlotFactor\r
+ inline void SetPlotFactor(float val)\r
+ { if(val<=0) {B.pf=1.55; set(MGL_AUTO_FACTOR);} else {B.pf=val; clr(MGL_AUTO_FACTOR);} }\r
+ /// Get PlotFactor\r
+ inline float GetPlotFactor() { return B.pf; }\r
+ /// Pop transformation matrix from stack\r
+ inline void Pop() { B = stack.back(); stack.pop_back(); }\r
+ /// Clear up the frame\r
+ virtual void Clf(mglColor back=WC);\r
+\r
+ /// Put further plotting in cell of stick rotated on angles tet, phi\r
+ void StickPlot(int num, int i, float tet, float phi);\r
+ /// Put further plotting in some region of whole frame surface.\r
+ void InPlot(float x1,float x2,float y1,float y2,bool rel=true);\r
+ void InPlot(float x1,float x2,float y1,float y2, const char *style);\r
+ /// Add title for current subplot/inplot\r
+ void Title(const char *title,const char *stl="#",float size=-2);\r
+ void Title(const wchar_t *title,const char *stl="#",float size=-2);\r
+ /// Set aspect ratio for further plotting.\r
+ void Aspect(float Ax,float Ay,float Az);\r
+ /// Rotate a further plotting.\r
+ void Rotate(float TetX,float TetZ,float TetY=0);\r
+ /// Rotate a further plotting around vector {x,y,z}.\r
+ void RotateN(float Tet,float x,float y,float z);\r
+ /// Set perspective (in range [0,1)) for plot. Set to zero for switching off.\r
+ void Perspective(float a) { Bp.pf = fabs(a); }\r
+\r
+ /// Set size of frame in pixels. Normally this function is called internaly.\r
+ virtual void SetSize(int w,int h);\r
+ /// Get ratio (float width)/(float height).\r
+ float GetRatio() const;\r
+ /// Get bitmap data prepared for saving to file\r
+ virtual unsigned char **GetRGBLines(long &w, long &h, unsigned char *&f, bool alpha=false);\r
+ /// Get RGB bitmap of current state image.\r
+ virtual const unsigned char *GetBits();\r
+ /// Get RGBA bitmap of current state image.\r
+ const unsigned char *GetRGBA() { Finish(); return G4; }\r
+ /// Get width of the image\r
+ int GetWidth() const { return Width; }\r
+ /// Get height of the image\r
+ int GetHeight() const { return Height; }\r
+ /// Combine plots from 2 canvases. Result will be saved into this.\r
+ void Combine(const mglCanvas *gr);\r
+ /// Send graphical information to node id using MPI\r
+ void MPI_Send(int id);\r
+ /// Receive graphical information from node id using MPI\r
+ void MPI_Recv(int id);\r
+ inline float GetDelay() const { return Delay; }\r
+ inline void SetDelay(float d) { Delay=d; }\r
+\r
+ /// Calculate 3D coordinate {x,y,z} for screen point {xs,ys}\r
+ mglPoint CalcXYZ(int xs, int ys) const;\r
+ /// Calculate screen point {xs,ys} for 3D coordinate {x,y,z}\r
+ void CalcScr(mglPoint p, int *xs, int *ys) const;\r
+ mglPoint CalcScr(mglPoint p) const;\r
+ /// Set object/subplot id\r
+ inline void SetObjId(long id) { ObjId = id; }\r
+ /// Get object id\r
+ inline int GetObjId(long x,long y) const { return OI[x+Width*y]; }\r
+ /// Get subplot id\r
+ int GetSplId(long x,long y) const;\r
+\r
+ /// Create new frame.\r
+ virtual int NewFrame();\r
+ /// Finish frame drawing\r
+ virtual void EndFrame();\r
+ /// Get the number of created frames\r
+ inline int GetNumFrame() const { return CurFrameId; }\r
+ /// Reset frames counter (start it from zero)\r
+ inline void ResetFrames() { CurFrameId=0; DrwDat.clear(); }\r
+\r
+ /// Start write frames to cinema using GIF format\r
+ void StartGIF(const char *fname, int ms=100);\r
+ /// Stop writing cinema using GIF format\r
+ void CloseGIF();\r
+ /// Finish plotting. Normally this function is called internaly.\r
+ virtual void Finish(bool fast=true);\r
+ /// Export points and primitives in file using MGLD format\r
+ bool ExportMGLD(const char *fname, const char *descr=0);\r
+ /// Import points and primitives from file using MGLD format\r
+ bool ImportMGLD(const char *fname, bool add=false);\r
+\r
+ /// Set the transparency type\r
+ inline void SetTranspType(int val)\r
+ { Flag=(Flag&(~3)) + (val&3); SetAxisStl(val==2?"w-":"k-"); }\r
+ /// Set the fog distance or switch it off (if d=0).\r
+ virtual void Fog(float d, float dz=0.25);\r
+ /// Switch on/off the specified light source.\r
+ virtual void Light(int n, bool enable);\r
+ /// Add a light source.\r
+ virtual void AddLight(int n,mglPoint r, mglPoint d, char c='w', float bright=0.5, float ap=0);\r
+ inline void AddLight(int n,mglPoint d, char c='w', float bright=0.5, float ap=0)\r
+ { AddLight(n,mglPoint(NAN),d,c,bright,ap); }\r
+\r
+ /// Set ticks position and text (\n separated). Use n=0 to disable this feature.\r
+ void SetTicksVal(char dir, const char *lbl, bool add=false);\r
+ void SetTicksVal(char dir, HCDT v, const char *lbl, bool add=false);\r
+ void SetTicksVal(char dir, HCDT v, const char **lbl, bool add=false);\r
+ void SetTicksVal(char dir, const wchar_t *lbl, bool add=false);\r
+ void SetTicksVal(char dir, HCDT v, const wchar_t *lbl, bool add=false);\r
+ void SetTicksVal(char dir, HCDT v, const wchar_t **lbl, bool add=false);\r
+ /// Set templates for ticks\r
+ void SetTickTempl(char dir, const wchar_t *t);\r
+ void SetTickTempl(char dir, const char *t);\r
+ /// Set time templates for ticks\r
+ void SetTickTime(char dir, float d=0, const char *t="");\r
+ /// Set the ticks parameters\r
+ void SetTicks(char dir, float d=0, int ns=0, float org=NAN);\r
+ /// Auto adjust ticks\r
+ void AdjustTicks(const char *dir="xyzc", bool force=false);\r
+ /// Tune ticks\r
+ inline void SetTuneTicks(int tune, float pos=1.15)\r
+ { TuneTicks = tune; FactorPos = pos; };\r
+ /// Set ticks styles\r
+ void SetAxisStl(const char *stl="k", const char *tck=0, const char *sub=0);\r
+ /// Set ticks length\r
+ void SetTickLen(float tlen, float stt=1.);\r
+\r
+ /// Draws bounding box outside the plotting volume with color \a c.\r
+ void Box(const char *col=0, bool ticks=true);\r
+ /// Draw axises with ticks in directions determined by string parameter \a dir.\r
+ void Axis(const char *dir="xyzt", const char *stl="");\r
+ /// Draw grid lines perpendicular to direction determined by string parameter \a dir.\r
+ void Grid(const char *dir="xyzt",const char *pen="B-");\r
+ /// Print the label \a text for axis \a dir.\r
+ void Label(char dir, const char *text, float pos=0, float shift=0);\r
+ void Labelw(char dir, const wchar_t *text, float pos=0, float shift=0);\r
+\r
+ /// Print the \a text at arbitrary position of the picture \a x, \a y in range [0,1]x[0,1].\r
+ void Label(float x, float y, const char *text, const char *fnt=0, bool rel=false);\r
+ void Labelw(float x, float y, const wchar_t *text, const char *fnt=0, bool rel=false);\r
+// /// Print the title text for the picture\r
+// void Title(const wchar_t *text,const char *font=0);\r
+// void Title(const char *text,const char *font=0);\r
+\r
+ /// Draw colorbar at edge of axis\r
+ void Colorbar(const char *sch=0);\r
+ void Colorbar(const char *sch, float x, float y, float w, float h);\r
+ /// Draw colorbar at edge of axis for manual colors\r
+ void Colorbar(HCDT v, const char *sch=0);\r
+ void Colorbar(HCDT v, const char *sch, float x, float y, float w, float h);\r
+\r
+ /// Draw legend of accumulated strings at position (x, y) by \a font with \a size\r
+ inline void Legend(float x, float y, const char *font="#", float size=-0.8, float llen=0.1)\r
+ { Legend(Leg,x,y,font,size,llen); }\r
+ /// Draw legend of accumulated strings by \a font with \a size\r
+ inline void Legend(int where=0x3, const char *font="#", float size=-0.8, float llen=0.1)\r
+ { Legend(Leg,(where&1)?1:0,(where&2)?1:0,font,size,llen); }\r
+ /// Draw legend of accumulated strings by \a font with \a size\r
+ inline void Legend(const std::vector<mglText> &leg, int where=3, const char *font="#", float size=-0.8, float llen=0)\r
+ { Legend(leg,(where&1)?1:0,(where&2)?1:0,font,size,llen); }\r
+ /// Draw legend strings \a text at position (x, y) by \a font with \a size\r
+ void Legend(const std::vector<mglText> &leg, float x, float y, const char *font="#", float size=-0.8, float llen=0);\r
+ /// Number of marks in legend sample\r
+ inline void SetLegendMarks(int num=1) { LegendMarks = num>0?num:1; };\r
+\r
+ void StartAutoGroup (const char *);\r
+ void EndGroup();\r
+ /// Retur color for primitive depending lighting\r
+ mglColor GetColor(const mglPrim &p);\r
+\r
+protected:\r
+ float Delay; ///< Delay for animation in seconds\r
+ float *Z; ///< Height for given level in Z-direction\r
+ unsigned char *C; ///< Picture for given level in Z-direction\r
+ int *OI; ///< ObjId arrays\r
+ unsigned char *G4; ///< Final picture in RGBA format. Prepared in Finish().\r
+ unsigned char *G; ///< Final picture in RGB format. Prepared in Finish().\r
+ std::vector<mglDrawDat> DrwDat; ///< Set of ALL drawing data for each frames\r
+#if MGL_HAVE_PTHREAD\r
+ pthread_mutex_t mutexSub, mutexPrm, mutexPtx, mutexStk, mutexGrp;\r
+#endif\r
+\r
+ int LegendMarks; ///< Number of marks in the Legend\r
+ unsigned char BDef[4]; ///< Background color\r
+ mglAxis ax,ay,az,ac;///< Axis parameters\r
+\r
+ int TuneTicks; ///< Draw tuned ticks with extracted common component\r
+ float FactorPos; ///< Position of axis ticks factor (0 at Min, 1 at Max, 1.1 is default)\r
+ float TickLen; ///< Length of tiks (subticks length is sqrt(1+st_t)=1.41... times smaller)\r
+ char AxisStl[32]; ///< Axis line style. Default is "k"\r
+ char TickStl[32]; ///< Tick line style. Default is "k"\r
+ char SubTStl[32]; ///< Subtick line style. Default is "k"\r
+ float st_t; ///< Subtick-to-tick ratio (ls=lt/sqrt(1+st_t)). Default is 1.\r
+\r
+ int CurFrameId; ///< Number of automaticle created frames\r
+ int Width; ///< Width of the image\r
+ int Height; ///< Height of the image\r
+ int Depth; ///< Depth of the image\r
+ mglMatrix Bp; ///< Transformation matrix for View() and Zoom()\r
+ mglMatrix B; ///< Transformation matrix\r
+ mglMatrix B1; ///< Transformation matrix for colorbar\r
+ float inW, inH; ///< Width and height of last InPlot\r
+ mglLight light[10]; ///< Light sources\r
+ float FogDist; ///< Inverse fog distance (fog ~ exp(-FogDist*Z))\r
+ float FogDz; ///< Relative shift of fog\r
+\r
+ /// Auto adjust ticks\r
+ void AdjustTicks(mglAxis &aa, bool ff);\r
+ /// Prepare labels for ticks\r
+ void LabelTicks(mglAxis &aa);\r
+ /// Draw axis\r
+ void DrawAxis(mglAxis &aa, bool text=true, char arr=0,const char *stl="");\r
+ /// Draw axis grid lines\r
+ void DrawGrid(mglAxis &aa);\r
+ /// Update axis ranges\r
+ inline void UpdateAxis()\r
+ { ax.v0=Org.x; ay.v0=Org.y; az.v0=Org.z; ac.v0=Org.c;\r
+ ax.v1=Min.x; ay.v1=Min.y; az.v1=Min.z; ac.v1=Min.c;\r
+ ax.v2=Max.x; ay.v2=Max.y; az.v2=Max.z; ac.v2=Max.c; }\r
+\r
+ /// Clear ZBuffer only\r
+ void ClfZB();\r
+ /// Scale coordinates and cut off some points\r
+ bool ScalePoint(mglPoint &p, mglPoint &n, bool use_nan=true) const;\r
+ void LightScale(); ///< Additionally scale positions of light sources\r
+\r
+ /// Push drawing data (for frames only). NOTE: can be VERY large\r
+ long PushDrwDat();\r
+ /// Get drawing data for i-th frame.\r
+ void GetDrwDat(long i);\r
+\r
+ float GetOrgX(char dir) const; ///< Get Org.x (parse NAN value)\r
+ float GetOrgY(char dir) const; ///< Get Org.y (parse NAN value)\r
+ float GetOrgZ(char dir) const; ///< Get Org.z (parse NAN value)\r
+\r
+ void mark_plot(long p, char type, float size=1); // position in pntC\r
+ void arrow_plot(long p1, long p2, char st); // position in pntC\r
+ void line_plot(long p1, long p2); // position in pntC\r
+ void trig_plot(long p1, long p2, long p3); // position in pntN\r
+ void quad_plot(long p1, long p2, long p3, long p4); // position in pntN\r
+ void Glyph(float x, float y, float f, int style, long icode, float col);\r
+ float text_plot(long p,const wchar_t *text,const char *fnt,float size=-1,float sh=0,float col=-('k'), bool rot=true); // position in pntN\r
+\r
+ void add_prim(mglPrim &a); ///< add primitive to list\r
+ void mark_draw(long p, char type, float size, mglDrawReg *d);\r
+ void arrow_draw(long p1, long p2, char st, float size, mglDrawReg *d);\r
+ virtual void line_draw(long p1, long p2, mglDrawReg *d);\r
+ virtual void trig_draw(long p1, long p2, long p3, bool anorm, mglDrawReg *d);\r
+ virtual void quad_draw(long p1, long p2, long p3, long p4, mglDrawReg *d);\r
+ virtual void pnt_draw(long p, mglDrawReg *d);\r
+ void glyph_draw(const mglPrim *P, mglDrawReg *d);\r
+ bool IsSame(const mglPrim &pr,float wp,mglColor cp,int st);\r
+\r
+ // functions for multi-threading\r
+ void PreparePrim(bool fast);\r
+ void pxl_combine(unsigned long id, unsigned long n, const void *);\r
+ void pxl_memcpy(unsigned long id, unsigned long n, const void *);\r
+ void pxl_backgr(unsigned long id, unsigned long n, const void *);\r
+ void pxl_primdr(unsigned long id, unsigned long n, const void *);\r
+ void pxl_transform(unsigned long id, unsigned long n, const void *);\r
+ void pxl_setz(unsigned long id, unsigned long n, const void *);\r
+ void pxl_setz_adv(unsigned long id, unsigned long n, const void *);\r
+ void pxl_other(unsigned long id, unsigned long n, const void *p);\r
+ /// Put drawing from other mglCanvas (for multithreading, like subplots)\r
+ void PutDrawReg(mglDrawReg *d, const mglCanvas *gr);\r
+ \r
+private:\r
+// float _tetx,_tety,_tetz; // extra angles\r
+ std::vector<mglMatrix> stack; ///< stack for transformation matrixes\r
+ int dr_nx1, dr_nx2, dr_ny1, dr_ny2; // Allowed drawing region\r
+ GifFileType *gif;\r
+ float fscl,ftet; ///< last scale and rotation for glyphs\r
+\r
+ /// Draw generic colorbar\r
+ void colorbar(HCDT v, const float *s, int where, float x, float y, float w, float h);\r
+ /// Draw labels for ticks\r
+ void DrawLabels(mglAxis &aa);\r
+ /// Draw tick\r
+ void tick_draw(mglPoint o, mglPoint d1, mglPoint d2, int f, const char *stl);\r
+ /// Plot point \a p with color \a c\r
+ void pnt_plot(long x,long y,float z,const unsigned char c[4]);\r
+ float FindOptOrg(char dir, int ind) const;\r
+ /// Transform float color and alpha to bits format\r
+ unsigned char* col2int(const mglPnt &p, unsigned char *r);\r
+ /// Combine colors in 2 plane.\r
+ void combine(unsigned char *c1,unsigned char *c2);\r
+ /// Fast drawing of line between 2 points\r
+ void fast_draw(long p1, long p2, mglDrawReg *d);\r
+\r
+ /// Additionally scale points \a p for positioning in image\r
+ void PostScale(mglPoint &p) const;\r
+ /// Scale points \a p for projection to the face number \a nface in image\r
+ long ProjScale(int nface, long p);\r
+ inline void PostScale(mglPoint *p,long n) const { for(long i=0;i<n;i++) PostScale(p[i]); }\r
+\r
+ // functions for glyph drawing\r
+ void glyph_fill(const mglPnt &p, float f, int nt, const short *trig, mglDrawReg *d);\r
+ void glyph_wire(const mglPnt &p, float f, int nl, const short *line, mglDrawReg *d);\r
+ void glyph_line(const mglPnt &p, float f, bool solid, mglDrawReg *d);\r
+};\r
+//-----------------------------------------------------------------------------\r
+struct mglThreadG\r
+{\r
+ mglCanvas *gr; // grapher\r
+ void (mglCanvas::*f)(unsigned long i, unsigned long n, const void *);\r
+ unsigned id; // thread id\r
+ unsigned long n; // total number of iteration\r
+ const void *p; // external parameter\r
+};\r
+/// Start several thread for the task\r
+void mglStartThread(void (mglCanvas::*func)(unsigned long i, unsigned long n), mglCanvas *gr, unsigned long n);\r
+//-----------------------------------------------------------------------------\r
+#endif\r
--- /dev/null
+/***************************************************************************\r
+ * canvas_cf.h is part of Math Graphic Library\r
+ * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
+ * *\r
+ * This program is free software; you can redistribute it and/or modify *\r
+ * it under the terms of the GNU Library General Public License as *\r
+ * published by the Free Software Foundation; either version 3 of the *\r
+ * License, or (at your option) any later version. *\r
+ * *\r
+ * This program is distributed in the hope that it will be useful, *\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
+ * GNU General Public License for more details. *\r
+ * *\r
+ * You should have received a copy of the GNU Library General Public *\r
+ * License along with this program; if not, write to the *\r
+ * Free Software Foundation, Inc., *\r
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
+ ***************************************************************************/\r
+#ifndef MGL_CANVAS_CF_H\r
+#define MGL_CANVAS_CF_H\r
+#include "mgl2/base.h"\r
+/*****************************************************************************/\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+/*****************************************************************************/\r
+HMGL mgl_create_graph(int width, int height);\r
+void mgl_delete_graph(HMGL graph);\r
+void mgl_set_size(HMGL gr, int width, int height);\r
+void mgl_set_def_param(HMGL gr);\r
+void mgl_set_quality(HMGL gr, int qual);\r
+void mgl_combine_gr(HMGL gr, HMGL in);\r
+\r
+void mgl_set_tick_len(HMGL gr, float len, float stt);\r
+void mgl_set_axis_stl(HMGL gr, const char *stl, const char *tck, const char *sub);\r
+void mgl_adjust_ticks(HMGL gr, const char *dir);\r
+void mgl_set_ticks(HMGL gr, char dir, float d, int ns, float org);\r
+void mgl_set_ticks_str(HMGL gr, char dir, const char *lbl, int add);\r
+void mgl_set_ticks_wcs(HMGL gr, char dir, const wchar_t *lbl, int add);\r
+void mgl_set_ticks_val(HMGL gr, char dir, HCDT val, const char *lbl, int add);\r
+void mgl_set_ticks_valw(HMGL gr, char dir, HCDT val, const wchar_t *lbl, int add);\r
+void mgl_tune_ticks(HMGL gr, int tune, float fact_pos);\r
+void mgl_set_tick_templ(HMGL gr, char dir, const char *templ);\r
+void mgl_set_tick_templw(HMGL gr, char dir, const wchar_t *templ);\r
+void mgl_set_ticks_time(HMGL gr, char dir, float d, const char *t);\r
+\r
+void mgl_box(HMGL graph);\r
+void mgl_box_str(HMGL gr, const char *col, int ticks);\r
+void mgl_axis(HMGL gr, const char *dir, const char *stl);\r
+void mgl_axis_grid(HMGL gr, const char *dir,const char *pen);\r
+void mgl_label(HMGL gr, char dir, const char *text);\r
+void mgl_label_ext(HMGL gr, char dir, const char *text, float pos, float shift);\r
+void mgl_labelw_ext(HMGL gr, char dir, const wchar_t *text, float pos, float shift);\r
+\r
+void mgl_colorbar(HMGL gr, const char *sch);\r
+void mgl_colorbar_ext(HMGL gr, const char *sch, float x, float y, float w, float h);\r
+void mgl_colorbar_val(HMGL gr, HCDT dat, const char *sch);\r
+void mgl_colorbar_val_ext(HMGL gr, HCDT dat, const char *sch,float x, float y, float w, float h);\r
+\r
+void mgl_add_legend(HMGL gr, const char *text,const char *style);\r
+void mgl_add_legendw(HMGL gr, const wchar_t *text,const char *style);\r
+void mgl_clear_legend(HMGL graph);\r
+void mgl_legend_pos(HMGL gr, float x, float y, const char *font, float size, float llen);\r
+void mgl_legend(HMGL gr, int where, const char *font, float size, float llen);\r
+void mgl_set_legend_marks(HMGL gr, int num);\r
+\r
+HMEX mgl_create_expr(const char *expr);\r
+void mgl_delete_expr(HMEX ex);\r
+mreal mgl_expr_eval(HMEX ex, mreal x, mreal y,mreal z);\r
+mreal mgl_expr_eval_v(HMEX ex, mreal *var);\r
+mreal mgl_expr_diff(HMEX ex, char dir, mreal x, mreal y,mreal z);\r
+mreal mgl_expr_diff_v(HMEX ex, char dir, mreal *var);\r
+\r
+void mgl_show_image(HMGL gr, const char *viewer, int keep);\r
+void mgl_write_frame(HMGL gr, const char *fname,const char *descr);\r
+void mgl_write_tga(HMGL gr, const char *fname,const char *descr);\r
+void mgl_write_bmp(HMGL gr, const char *fname,const char *descr);\r
+void mgl_write_jpg(HMGL gr, const char *fname,const char *descr);\r
+void mgl_write_png(HMGL gr, const char *fname,const char *descr);\r
+void mgl_write_png_solid(HMGL gr, const char *fname,const char *descr);\r
+void mgl_write_bps(HMGL gr, const char *fname,const char *descr);\r
+void mgl_write_eps(HMGL gr, const char *fname,const char *descr);\r
+void mgl_write_svg(HMGL gr, const char *fname,const char *descr);\r
+void mgl_write_tex(HMGL gr, const char *fname,const char *descr);\r
+void mgl_write_obj(HMGL gr, const char *fname,const char *descr, int use_png);\r
+void mgl_write_stl(HMGL gr, const char *fname,const char *descr);\r
+void mgl_write_off(HMGL gr, const char *fname,const char *descr, int colored);\r
+void mgl_write_xyz(HMGL gr, const char *fname,const char *descr);\r
+//void mgl_write_x3d(HMGL gr, const char *fname,const char *descr);\r
+void mgl_write_wgl(HMGL gr, const char *fname,const char *descr);\r
+void mgl_write_prc(HMGL gr, const char *fname,const char *descr, int make_pdf);\r
+void mgl_write_gif(HMGL gr, const char *fname,const char *descr);\r
+void mgl_start_gif(HMGL gr, const char *fname,int ms);\r
+void mgl_close_gif(HMGL graph);\r
+void mgl_set_plotid(HMGL gr, const char *id);\r
+void mgl_export_mgld(HMGL gr, const char *fname,const char *descr);\r
+void mgl_import_mgld(HMGL gr, const char *fname, int add);\r
+\r
+const unsigned char *mgl_get_rgb(HMGL graph);\r
+const unsigned char *mgl_get_rgba(HMGL graph);\r
+void mgl_set_obj_id(HMGL gr, int id);\r
+int mgl_get_obj_id(HMGL gr, long x, long y);\r
+int mgl_get_spl_id(HMGL gr, long x, long y);\r
+int mgl_get_width(HMGL graph);\r
+int mgl_get_height(HMGL graph);\r
+void mgl_calc_xyz(HMGL gr, int xs, int ys, float *x, float *y, float *z);\r
+void mgl_calc_scr(HMGL gr, float x, float y, float z, int *xs, int *ys);\r
+\r
+int mgl_new_frame(HMGL graph);\r
+void mgl_end_frame(HMGL graph);\r
+int mgl_get_num_frame(HMGL graph);\r
+void mgl_reset_frames(HMGL graph);\r
+\r
+void mgl_set_transp_type(HMGL gr, int type);\r
+void mgl_set_alpha(HMGL gr, int enable);\r
+void mgl_set_fog(HMGL gr, float d, float dz);\r
+void mgl_set_light(HMGL gr, int enable);\r
+void mgl_set_light_n(HMGL gr, int n, int enable);\r
+\r
+void mgl_mat_pop(HMGL gr);\r
+void mgl_mat_push(HMGL gr);\r
+void mgl_clf(HMGL graph);\r
+void mgl_clf_rgb(HMGL gr, float r, float g, float b);\r
+\r
+void mgl_subplot_d(HMGL gr, int nx,int ny,int m,const char *style, float dx, float dy);\r
+void mgl_subplot(HMGL gr, int nx,int ny,int m,const char *style);\r
+void mgl_multiplot(HMGL gr, int nx,int ny,int m,int dx,int dy,const char *style);\r
+void mgl_inplot(HMGL gr, float x1,float x2,float y1,float y2);\r
+void mgl_relplot(HMGL gr, float x1,float x2,float y1,float y2);\r
+void mgl_columnplot(HMGL gr, int num, int ind, float d);\r
+void mgl_gridplot(HMGL gr, int nx, int ny, int m, float d);\r
+void mgl_stickplot(HMGL gr, int num, int ind, float tet, float phi);\r
+void mgl_title(HMGL gr, const char *title, const char *stl, float size);\r
+void mgl_titlew(HMGL gr, const wchar_t *title, const char *stl, float size);\r
+void mgl_set_plotfactor(HMGL gr, float val);\r
+\r
+void mgl_aspect(HMGL gr, float Ax,float Ay,float Az);\r
+void mgl_rotate(HMGL gr, float TetX,float TetZ,float TetY);\r
+void mgl_view(HMGL gr, float TetX,float TetZ,float TetY);\r
+void mgl_zoom(HMGL gr, float x1, float y1, float x2, float y2);\r
+void mgl_rotate_vector(HMGL gr, float Tet,float x,float y,float z);\r
+void mgl_perspective(HMGL gr, float val);\r
+\r
+void mgl_draw_thr(void *);\r
+/*****************************************************************************/\r
+uintptr_t mgl_create_graph_(int *width, int *height);\r
+void mgl_delete_graph_(uintptr_t *graph);\r
+void mgl_set_size_(uintptr_t *graph, int *width, int *height);\r
+void mgl_set_def_param_(uintptr_t *gr);\r
+void mgl_set_quality_(uintptr_t *gr, int *qual);\r
+void mgl_combine_gr_(uintptr_t *gr, uintptr_t *in);\r
+\r
+void mgl_set_tick_len_(uintptr_t *graph, float *len, float *stt);\r
+void mgl_set_axis_stl_(uintptr_t *graph, const char *stl, const char *tck, const char *sub, int,int,int);\r
+\r
+void mgl_adjust_ticks_(uintptr_t *gr, const char *dir, int l);\r
+void mgl_set_ticks_(uintptr_t *gr, char *dir, float *d, int *ns, float *org, int);\r
+void mgl_set_ticks_str_(uintptr_t *gr, const char *dir, const char *lbl, int *add,int,int l);\r
+void mgl_set_ticks_val_(uintptr_t *gr, const char *dir, uintptr_t *val, const char *lbl, int *add,int,int l);\r
+void mgl_tune_ticks_(uintptr_t *gr, int *tune, float *fact_pos);\r
+void mgl_set_tick_templ_(uintptr_t *gr, const char *dir, const char *templ,int,int l);\r
+void mgl_set_ticks_time_(uintptr_t *gr, const char *dir, float *d, const char *t,int,int l);\r
+void mgl_box_(uintptr_t *gr);\r
+void mgl_box_str_(uintptr_t *gr, const char *col, int *ticks, int l);\r
+void mgl_axis_(uintptr_t *gr, const char *dir, const char *stl,int,int);\r
+void mgl_axis_grid_(uintptr_t *gr, const char *dir,const char *pen,int l,int n);\r
+void mgl_label_(uintptr_t *gr, const char *dir, const char *text,int,int l);\r
+void mgl_label_ext_(uintptr_t *gr, const char *dir, const char *text, float *pos, float *shift,int,int l);\r
+/*****************************************************************************/\r
+void mgl_colorbar_(uintptr_t *gr, const char *sch,int l);\r
+void mgl_colorbar_ext_(uintptr_t *gr, const char *sch, float *x, float *y, float *w, float *h, int l);\r
+void mgl_colorbar_val_(uintptr_t *gr, uintptr_t *dat, const char *sch,int l);\r
+void mgl_colorbar_val_ext_(uintptr_t *gr, uintptr_t *dat, const char *sch, float *x, float *y, float *w, float *h, int l);\r
+\r
+void mgl_add_legend_(uintptr_t *gr, const char *text,const char *style,int l,int n);\r
+void mgl_clear_legend_(uintptr_t *gr);\r
+void mgl_legend_pos_(uintptr_t *gr, float *x, float *y, const char *font, float *size, float *llen,int l);\r
+void mgl_legend_(uintptr_t *gr, int *where, const char *font, float *size, float *llen,int l);\r
+void mgl_set_legend_marks_(uintptr_t *gr, int *num);\r
+\r
+uintptr_t mgl_create_expr_(const char *expr, int);\r
+void mgl_delete_expr_(uintptr_t *ex);\r
+float mgl_eval_expr_(uintptr_t *ex, float *x, float *y,float *z);\r
+float mgl_diff_expr_(uintptr_t *ex, const char *dir, float *x, float *y,float *z, int);\r
+\r
+void mgl_show_image_(uintptr_t *graph, const char *viewer, int *keep, int);\r
+void mgl_write_frame_(uintptr_t *graph, const char *fname,const char *descr,int lf,int ld);\r
+void mgl_write_tga_(uintptr_t *graph, const char *fname,const char *descr,int lf,int ld);\r
+void mgl_write_bmp_(uintptr_t *graph, const char *fname,const char *descr,int lf,int ld);\r
+void mgl_write_jpg_(uintptr_t *graph, const char *fname,const char *descr,int lf,int ld);\r
+void mgl_write_png_(uintptr_t *graph, const char *fname,const char *descr,int lf,int ld);\r
+void mgl_write_png_solid_(uintptr_t *graph, const char *fname,const char *descr,int lf,int ld);\r
+void mgl_write_eps_(uintptr_t *graph, const char *fname,const char *descr,int lf,int ld);\r
+void mgl_write_svg_(uintptr_t *graph, const char *fname,const char *descr,int lf,int ld);\r
+void mgl_write_prc_(uintptr_t *graph, const char *fname,const char *descr, int *make_pdf,int lf,int ld);\r
+void mgl_write_gif_(uintptr_t *graph, const char *fname,const char *descr,int lf,int ld);\r
+void mgl_start_gif_(uintptr_t *graph, const char *fname,int *ms,int l);\r
+void mgl_close_gif_(uintptr_t *graph);\r
+void mgl_write_obj_(uintptr_t *graph, const char *fname,const char *descr, int *use_png,int lf,int ld);\r
+void mgl_write_stl_(uintptr_t *graph, const char *fname,const char *descr,int lf,int ld);\r
+void mgl_write_off_(uintptr_t *graph, const char *fname,const char *descr,int *colored,int lf,int ld);\r
+void mgl_write_xyz_(uintptr_t *graph, const char *fname,const char *descr,int lf,int ld);\r
+//void mgl_write_x3d_(uintptr_t *graph, const char *fname,const char *descr,int lf,int ld);\r
+void mgl_write_tex_(uintptr_t *graph, const char *fname,const char *descr,int lf,int ld);\r
+void mgl_write_wgl_(uintptr_t *graph, const char *fname,const char *descr,int lf,int ld);\r
+void mgl_set_plotid_(uintptr_t *gr, const char *id,int l);\r
+void mgl_export_mgld_(uintptr_t *gr, const char *fname,const char *descr,int l,int n);\r
+void mgl_import_mgld_(uintptr_t *gr, const char *fname, int *add, int l);\r
+\r
+const unsigned char *mgl_get_rgb_(uintptr_t *graph);\r
+const unsigned char *mgl_get_rgba_(uintptr_t *graph);\r
+void mgl_set_obj_id_(uintptr_t *graph, int *id);\r
+int mgl_get_obj_id_(uintptr_t *graph, int *x, int *y);\r
+int mgl_get_spl_id_(uintptr_t *graph, int *x, int *y);\r
+int mgl_get_width_(uintptr_t *graph);\r
+int mgl_get_height_(uintptr_t *graph);\r
+void mgl_calc_xyz_(uintptr_t *gr, int *xs, int *ys, float *x, float *y, float *z);\r
+void mgl_calc_scr_(uintptr_t *gr, float *x, float *y, float *z, int *xs, int *ys);\r
+\r
+int mgl_new_frame_(uintptr_t *graph);\r
+void mgl_end_frame_(uintptr_t *graph);\r
+int mgl_get_num_frame_(uintptr_t *graph);\r
+void mgl_reset_frames_(uintptr_t *graph);\r
+\r
+void mgl_set_transp_type_(uintptr_t *graph, int *type);\r
+void mgl_set_alpha_(uintptr_t *graph, int *enable);\r
+void mgl_set_fog_(uintptr_t *graph, float *dist, float *dz);\r
+void mgl_set_light_(uintptr_t *graph, int *enable);\r
+void mgl_set_light_n_(uintptr_t *gr, int *n, int *enable);\r
+void mgl_add_light_(uintptr_t *graph, int *n, float *x, float *y, float *z);\r
+void mgl_add_light(HMGL gr, int n, float x, float y, float z);\r
+void mgl_add_light_ext_(uintptr_t *graph, int *n, float *x, float *y, float *z, char *c, float *br, float *ap, int);\r
+void mgl_add_light_ext(HMGL gr, int n, float x, float y, float z, char c, float br, float ap);\r
+void mgl_add_light_loc_(uintptr_t *graph, int *n, float *x, float *y, float *z, float *dx, float *dy, float *dz, char *c, float *br, float *ap, int);\r
+void mgl_add_light_loc(HMGL gr, int n, float x, float y, float z, float dx, float dy, float dz, char c, float br, float ap);\r
+\r
+void mgl_mat_push_(uintptr_t *gr);\r
+void mgl_mat_pop_(uintptr_t *gr);\r
+void mgl_clf_(uintptr_t *graph);\r
+void mgl_clf_rgb_(uintptr_t *graph, float *r, float *g, float *b);\r
+\r
+void mgl_subplot_(uintptr_t *graph, int *nx,int *ny,int *m);\r
+void mgl_subplot_d_(uintptr_t *graph, int *nx,int *ny,int *m,float *dx,float *dy);\r
+void mgl_subplot_s_(uintptr_t *graph, int *nx,int *ny,int *m, const char *s,int);\r
+void mgl_multiplot_(uintptr_t *graph, int *nx,int *ny,int *m,int *dx,int *dy, const char *s,int);\r
+void mgl_inplot_(uintptr_t *graph, float *x1,float *x2,float *y1,float *y2);\r
+void mgl_relplot_(uintptr_t *graph, float *x1,float *x2,float *y1,float *y2);\r
+void mgl_columnplot_(uintptr_t *graph, int *num, int *i, float *d);\r
+void mgl_gridplot_(uintptr_t *graph, int *nx, int *ny, int *i, float *d);\r
+void mgl_stickplot_(uintptr_t *graph, int *num, int *i, float *tet, float *phi);\r
+void mgl_set_plotfactor_(uintptr_t *graph, float *val);\r
+\r
+void mgl_title_(uintptr_t *gr, const char *title, const char *stl, float *size, int,int);\r
+void mgl_aspect_(uintptr_t *graph, float *Ax,float *Ay,float *Az);\r
+void mgl_rotate_(uintptr_t *graph, float *TetX,float *TetZ,float *TetY);\r
+void mgl_view_(uintptr_t *graph, float *TetX,float *TetZ,float *TetY);\r
+void mgl_zoom_(uintptr_t *graph, float *x1, float *y1, float *x2, float *y2);\r
+void mgl_rotate_vector_(uintptr_t *graph, float *Tet,float *x,float *y,float *z);\r
+void mgl_perspective_(uintptr_t *graph, float val);\r
+/*****************************************************************************/\r
+HMGL mgl_create_graph_qt(int (*draw)(HMGL gr, void *p), const char *title, void *par, void (*load)(void *p));\r
+HMGL mgl_create_graph_fltk(int (*draw)(HMGL gr, void *p), const char *title, void *par, void (*load)(void *p));\r
+void mgl_set_click_func(HMGL gr, void (*func)(void *p));\r
+int mgl_fltk_run();\r
+int mgl_fltk_thr();\r
+int mgl_qt_run();\r
+/*****************************************************************************/\r
+uintptr_t mgl_create_graph_qt_(const char *title, int);\r
+uintptr_t mgl_create_graph_fltk_(const char *title, int);\r
+int mgl_fltk_run_();\r
+int mgl_qt_run_();\r
+/*****************************************************************************/\r
+void mgl_wnd_set_delay(HMGL gr, float dt);\r
+void mgl_setup_window(HMGL gr, int clf_upd, int showpos);\r
+void mgl_wnd_toggle_alpha(HMGL gr);\r
+void mgl_wnd_toggle_light(HMGL gr);\r
+void mgl_wnd_toggle_zoom(HMGL gr);\r
+void mgl_wnd_toggle_rotate(HMGL gr);\r
+void mgl_wnd_toggle_no(HMGL gr);\r
+void mgl_wnd_update(HMGL gr);\r
+void mgl_wnd_reload(HMGL gr);\r
+void mgl_wnd_adjust(HMGL gr);\r
+void mgl_wnd_next_frame(HMGL gr);\r
+void mgl_wnd_prev_frame(HMGL gr);\r
+void mgl_wnd_animation(HMGL gr);\r
+void mgl_get_last_mouse_pos(HMGL gr, float *x, float *y, float *z);\r
+/*****************************************************************************/\r
+void mgl_get_last_mouse_pos_(uintptr_t *gr, float *x, float *y, float *z);\r
+void mgl_wnd_set_delay_(uintptr_t *gr, float *dt);\r
+void mgl_setup_window_(uintptr_t *gr, int *clf_upd, int *showpos);\r
+void mgl_wnd_toggle_alpha_(uintptr_t *gr);\r
+void mgl_wnd_toggle_light_(uintptr_t *gr);\r
+void mgl_wnd_toggle_zoom_(uintptr_t *gr);\r
+void mgl_wnd_toggle_rotate_(uintptr_t *gr);\r
+void mgl_wnd_toggle_no_(uintptr_t *gr);\r
+void mgl_wnd_update_(uintptr_t *gr);\r
+void mgl_wnd_reload_(uintptr_t *gr);\r
+void mgl_wnd_adjust_(uintptr_t *gr);\r
+void mgl_wnd_next_frame_(uintptr_t *gr);\r
+void mgl_wnd_prev_frame_(uintptr_t *gr);\r
+void mgl_wnd_animation_(uintptr_t *gr);\r
+/*****************************************************************************/\r
+void mgl_mpi_send(HMGL gr, int id);\r
+void mgl_mpi_recv(HMGL gr, int id);\r
+void mgl_mpi_send_(uintptr_t *gr, int *id);\r
+void mgl_mpi_recv_(uintptr_t *gr, int *id);\r
+/*****************************************************************************/\r
+HMPR mgl_create_parser();\r
+long mgl_use_parser(HMPR p, int inc);\r
+void mgl_delete_parser(HMPR p);\r
+void mgl_add_param(HMPR p, int id, const char *str);\r
+void mgl_add_paramw(HMPR p, int id, const wchar_t *str);\r
+/*===!!! NOTE !!! You must not delete obtained data arrays !!!===============*/\r
+HMDT mgl_add_var(HMPR p, const char *name);\r
+/*===!!! NOTE !!! You must not delete obtained data arrays !!!===============*/\r
+HMDT mgl_find_var(HMPR p, const char *name);\r
+void mgl_del_var(HMPR p, const char *name);\r
+int mgl_parse(HMGL gr, HMPR p, const char *str, int pos);\r
+int mgl_parsew(HMGL gr, HMPR p, const wchar_t *str, int pos);\r
+void mgl_parse_file(HMGL gr, HMPR p, FILE *fp, int print);\r
+void mgl_parse_text(HMGL gr, HMPR p, const char *str);\r
+void mgl_parsew_text(HMGL gr, HMPR p, const wchar_t *str);\r
+void mgl_restore_once(HMPR p);\r
+void mgl_parser_allow_setsize(HMPR p, int a);\r
+void mgl_parser_stop(HMPR p);\r
+int mgl_cmd_type(HMPR pr, const char *name);\r
+const char *mgl_cmd_desc(HMPR pr, const char *name);\r
+const char *mgl_cmd_frmt(HMPR pr, const char *name);\r
+//int mgl_parser_find_cmdw(HMPR pr, const wchar_t *name);\r
+/*****************************************************************************/\r
+uintptr_t mgl_create_parser_();\r
+long mgl_use_parser_(uintptr_t* , int *inc);\r
+void mgl_delete_parser_(uintptr_t* p);\r
+void mgl_add_param_(uintptr_t* p, int *id, const char *str, int l);\r
+/*===!!! NOTE !!! You must not delete obtained data arrays !!!===============*/\r
+uintptr_t mgl_add_var_(uintptr_t* p, const char *name, int l);\r
+/*===!!! NOTE !!! You must not delete obtained data arrays !!!===============*/\r
+uintptr_t mgl_find_var_(uintptr_t* p, const char *name, int l);\r
+void mgl_del_var_(uintptr_t* p, const char *name, int l);\r
+int mgl_parse_(uintptr_t* gr, uintptr_t* p, const char *str, int *pos, int l);\r
+void mgl_parse_text_(uintptr_t* gr, uintptr_t* p, const char *str, int l);\r
+void mgl_restore_once_(uintptr_t* p);\r
+void mgl_parser_allow_setsize_(uintptr_t* p, int *a);\r
+void mgl_parser_stop_(uintptr_t* p);\r
+int mgl_cmd_type_(uintptr_t* p, const char *name, int l);\r
+/*****************************************************************************/\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+/*****************************************************************************/\r
+#endif\r
+\r
--- /dev/null
+/***************************************************************************\r
+ * window.h is part of Math Graphic Library\r
+ * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
+ * *\r
+ * This program is free software; you can redistribute it and/or modify *\r
+ * it under the terms of the GNU Library General Public License as *\r
+ * published by the Free Software Foundation; either version 3 of the *\r
+ * License, or (at your option) any later version. *\r
+ * *\r
+ * This program is distributed in the hope that it will be useful, *\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
+ * GNU General Public License for more details. *\r
+ * *\r
+ * You should have received a copy of the GNU Library General Public *\r
+ * License along with this program; if not, write to the *\r
+ * Free Software Foundation, Inc., *\r
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
+ ***************************************************************************/\r
+//-----------------------------------------------------------------------------\r
+#ifndef _MGL_CANVAS_WND_H_\r
+#define _MGL_CANVAS_WND_H_\r
+/*****************************************************************************/\r
+#include "mgl2/window.h"\r
+//-----------------------------------------------------------------------------\r
+/// Base class for windows containing MathGL graphics\r
+class mglCanvasWnd : public mglCanvas\r
+{\r
+public:\r
+ mglPoint LastMousePos; ///< Last mouse position\r
+ void (*ClickFunc)(void *par); ///< Callback function on click\r
+\r
+ mglCanvasWnd();\r
+ virtual ~mglCanvasWnd();\r
+\r
+ void SetSize(int w,int h);\r
+ void EndFrame();\r
+ const unsigned char *GetBits();\r
+ inline int GetNumFig() const { return NumFig; }\r
+ inline int GetCurFig() const { return CurFig; }\r
+ void SetCurFig(int c);\r
+ void ClearFrames();\r
+ inline mglPoint GetMousePos() const { return LastMousePos;}\r
+ inline void SetMousePos(mglPoint p) { LastMousePos=p; }\r
+ inline void Setup(bool clf_upd=true, bool showpos=false)\r
+ { set(showpos,MGL_SHOW_POS); set(clf_upd,MGL_CLF_ON_UPD); }\r
+\r
+ virtual void ToggleAlpha()=0; ///< Switch on/off transparency (do not overwrite user settings)\r
+ virtual void ToggleLight()=0; ///< Switch on/off lighting (do not overwrite user settings)\r
+ virtual void ToggleZoom()=0; ///< Switch on/off zooming by mouse\r
+ virtual void ToggleRotate()=0; ///< Switch on/off rotation by mouse\r
+ virtual void ToggleNo()=0; ///< Switch off all zooming and rotation\r
+ virtual void Update()=0; ///< Update picture by calling user drawing function\r
+ virtual void Adjust()=0; ///< Adjust size of bitmap to window size\r
+ virtual void GotoFrame(int d)=0;///< Show arbitrary frame (use relative step)\r
+ virtual void NextFrame() {GotoFrame(+1);} ///< Show next frame (if one)\r
+ virtual void PrevFrame() {GotoFrame(-1);} ///< Show previous frame (if one)\r
+ virtual void Animation()=0; ///< Run slideshow (animation) of frames\r
+ void ReLoad(); ///< Reload user data and update picture\r
+ /// Create a window for plotting based on callback function (can be NULL).\r
+ virtual void Window(int argc, char **argv, int (*draw)(mglBase *gr, void *p),\r
+ const char *title, void *par=NULL,\r
+ void (*reload)(void *p)=NULL, bool maximize=false)=0;\r
+ void SetDrawFunc(int (*draw)(mglBase *gr, void *p), void *par=NULL, void (*reload)(void *p)=NULL);\r
+ \r
+private:\r
+ int CurFig; ///< Current figure in the list.\r
+\r
+ unsigned char *GG; ///< images for all frames (may be too LARGE !!!)\r
+ int NumFig; ///< Number of figures in the list. If 0 then no list and mglCanvas::DrawFunc will called for each drawing.\r
+ void (*LoadFunc)(void *par);\r
+ void *FuncPar; ///< Parameters for drawing function mglCanvas::DrawFunc.\r
+ /// Drawing function for window procedure. It should return the number of frames.\r
+ int (*DrawFunc)(mglBase *gr, void *par);\r
+};\r
+//-----------------------------------------------------------------------------\r
+#endif\r
--- /dev/null
+/***************************************************************************\r
+ * cont.h is part of Math Graphic Library\r
+ * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
+ * *\r
+ * This program is free software; you can redistribute it and/or modify *\r
+ * it under the terms of the GNU Library General Public License as *\r
+ * published by the Free Software Foundation; either version 3 of the *\r
+ * License, or (at your option) any later version. *\r
+ * *\r
+ * This program is distributed in the hope that it will be useful, *\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
+ * GNU General Public License for more details. *\r
+ * *\r
+ * You should have received a copy of the GNU Library General Public *\r
+ * License along with this program; if not, write to the *\r
+ * Free Software Foundation, Inc., *\r
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
+ ***************************************************************************/\r
+#ifndef _MGL_CONT_H_\r
+#define _MGL_CONT_H_\r
+#include "mgl2/base.h"\r
+/*****************************************************************************/\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+/*****************************************************************************/\r
+void mgl_textw_xyz(HMGL gr, HCDT x, HCDT y, HCDT z, const wchar_t *text, const char *font, const char *opt);\r
+void mgl_textw_xy(HMGL gr, HCDT x, HCDT y, const wchar_t *text, const char *font, const char *opt);\r
+void mgl_textw_y(HMGL gr, HCDT y, const wchar_t *text, const char *font, const char *opt);\r
+void mgl_text_xyz(HMGL gr, HCDT x, HCDT y, HCDT z, const char *text, const char *font, const char *opt);\r
+void mgl_text_xy(HMGL gr, HCDT x, HCDT y, const char *text, const char *font, const char *opt);\r
+void mgl_text_y(HMGL gr, HCDT y, const char *text, const char *font, const char *opt);\r
+\r
+void mgl_cont_gen(HMGL gr, float val, HCDT a, HCDT x, HCDT y, HCDT z, const char *stl);\r
+void mgl_contf_gen(HMGL gr, float v1, float v2, HCDT a, HCDT x, HCDT y, HCDT z, const char *stl);\r
+\r
+void mgl_cont_xy_val(HMGL graph, HCDT v, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
+void mgl_cont_val(HMGL graph, HCDT v, HCDT z, const char *sch, const char *opt);\r
+void mgl_cont_xy(HMGL graph, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
+void mgl_cont(HMGL graph, HCDT z, const char *sch, const char *opt);\r
+\r
+void mgl_contf_xy_val(HMGL graph, HCDT v, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
+void mgl_contf_val(HMGL graph, HCDT v, HCDT z, const char *sch, const char *opt);\r
+void mgl_contf_xy(HMGL graph, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
+void mgl_contf(HMGL graph, HCDT z, const char *sch, const char *opt);\r
+\r
+void mgl_contd_xy_val(HMGL graph, HCDT v, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
+void mgl_contd_val(HMGL graph, HCDT v, HCDT z, const char *sch, const char *opt);\r
+void mgl_contd_xy(HMGL graph, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
+void mgl_contd(HMGL graph, HCDT z, const char *sch, const char *opt);\r
+\r
+void mgl_contv_xy_val(HMGL graph, HCDT v, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
+void mgl_contv_val(HMGL graph, HCDT v, HCDT z, const char *sch, const char *opt);\r
+void mgl_contv_xy(HMGL graph, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
+void mgl_contv(HMGL graph, HCDT z, const char *sch, const char *opt);\r
+\r
+void mgl_axial_xy_val(HMGL graph, HCDT v, HCDT x, HCDT y, HCDT a, const char *sch, const char *opt);\r
+void mgl_axial_val(HMGL graph, HCDT v, HCDT a, const char *sch, const char *opt);\r
+void mgl_axial_xy(HMGL graph, HCDT x, HCDT y, HCDT a, const char *sch, const char *opt);\r
+void mgl_axial(HMGL graph, HCDT a, const char *sch, const char *opt);\r
+\r
+void mgl_torus(HMGL graph, HCDT r, HCDT z, const char *col, const char *opt);\r
+\r
+void mgl_grid3_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, HCDT a, const char *stl, float sVal, const char *opt);\r
+void mgl_grid3(HMGL graph, HCDT a, const char *stl, float sVal, const char *opt);\r
+\r
+void mgl_dens3_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, HCDT a, const char *stl, float sVal, const char *opt);\r
+void mgl_dens3(HMGL graph, HCDT a, const char *stl, float sVal, const char *opt);\r
+\r
+void mgl_cont3_xyz_val(HMGL graph, HCDT v, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, float sVal, const char *opt);\r
+void mgl_cont3_val(HMGL graph, HCDT v, HCDT a, const char *sch, float sVal, const char *opt);\r
+void mgl_cont3_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, float sVal, const char *opt);\r
+void mgl_cont3(HMGL graph, HCDT a, const char *sch, float sVal, const char *opt);\r
+\r
+void mgl_contf3_xyz_val(HMGL graph, HCDT v, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, float sVal, const char *opt);\r
+void mgl_contf3_val(HMGL graph, HCDT v, HCDT a, const char *sch, float sVal, const char *opt);\r
+void mgl_contf3_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, float sVal, const char *opt);\r
+void mgl_contf3(HMGL graph, HCDT a, const char *sch, float sVal, const char *opt);\r
+\r
+/*****************************************************************************/\r
+void mgl_text_xyz_(uintptr_t *gr, uintptr_t *x, uintptr_t *y, uintptr_t *z,const char *text,const char *font, const char *opt,int,int l,int n);\r
+void mgl_text_xy_(uintptr_t *gr, uintptr_t *x, uintptr_t *y, const char *text, const char *font, const char *opt,int, int l,int n);\r
+void mgl_text_y_(uintptr_t *gr, uintptr_t *y, const char *text, const char *font, const char *opt,int, int l,int n);\r
+\r
+void mgl_cont_xy_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int,int);\r
+void mgl_cont_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *z, const char *sch, const char *opt,int,int);\r
+void mgl_cont_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int,int);\r
+void mgl_cont_(uintptr_t *graph, uintptr_t *z, const char *sch, const char *opt,int,int);\r
+\r
+void mgl_contf_xy_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int,int);\r
+void mgl_contf_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *z, const char *sch, const char *opt,int,int);\r
+void mgl_contf_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int,int);\r
+void mgl_contf_(uintptr_t *graph, uintptr_t *z, const char *sch, const char *opt,int,int);\r
+\r
+void mgl_contd_xy_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int,int);\r
+void mgl_contd_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *z, const char *sch, const char *opt,int,int);\r
+void mgl_contd_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int,int);\r
+void mgl_contd_(uintptr_t *graph, uintptr_t *z, const char *sch, const char *opt,int,int);\r
+\r
+void mgl_contv_xy_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int,int);\r
+void mgl_contv_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *z, const char *sch, const char *opt,int,int);\r
+void mgl_contv_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int,int);\r
+void mgl_contv_(uintptr_t *graph, uintptr_t *z, const char *sch, const char *opt,int,int);\r
+\r
+void mgl_axial_xy_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *x, uintptr_t *y, uintptr_t *a, const char *sch, const char *opt,int,int);\r
+void mgl_axial_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *a, const char *sch, const char *opt,int,int);\r
+void mgl_axial_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *a, const char *sch, const char *opt,int,int);\r
+void mgl_axial_(uintptr_t *graph, uintptr_t *a, const char *sch, const char *opt,int,int);\r
+\r
+void mgl_torus_(uintptr_t *graph, uintptr_t *r, uintptr_t *z, const char *pen, const char *opt,int,int);\r
+\r
+void mgl_grid3_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *a, const char *sch, float *sVal, const char *opt,int,int);\r
+void mgl_grid3_(uintptr_t *graph, uintptr_t *a, const char *sch, float *sVal, const char *opt,int,int);\r
+\r
+void mgl_dens3_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *a, const char *sch, float *sVal, const char *opt,int,int);\r
+void mgl_dens3_(uintptr_t *graph, uintptr_t *a, const char *sch, float *sVal, const char *opt,int,int);\r
+\r
+void mgl_cont3_xyz_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *a, const char *sch, float *sVal, const char *opt,int,int);\r
+void mgl_cont3_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *a, const char *sch, float *sVal, const char *opt,int,int);\r
+void mgl_cont3_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *a, const char *sch, float *sVal, const char *opt,int,int);\r
+void mgl_cont3_(uintptr_t *graph, uintptr_t *a, const char *sch, float *sVal, const char *opt,int,int);\r
+\r
+void mgl_contf3_xyz_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *a, const char *sch, float *sVal, const char *opt,int,int);\r
+void mgl_contf3_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *a, const char *sch, float *sVal, const char *opt,int,int);\r
+void mgl_contf3_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *a, const char *sch, float *sVal, const char *opt,int,int);\r
+void mgl_contf3_(uintptr_t *graph, uintptr_t *a, const char *sch, float *sVal, const char *opt,int,int);\r
+\r
+/*****************************************************************************/\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+/*****************************************************************************/\r
+#endif\r
--- /dev/null
+/***************************************************************************\r
+ * data.h is part of Math Graphic Library\r
+ * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
+ * *\r
+ * This program is free software; you can redistribute it and/or modify *\r
+ * it under the terms of the GNU Library General Public License as *\r
+ * published by the Free Software Foundation; either version 3 of the *\r
+ * License, or (at your option) any later version. *\r
+ * *\r
+ * This program is distributed in the hope that it will be useful, *\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
+ * GNU General Public License for more details. *\r
+ * *\r
+ * You should have received a copy of the GNU Library General Public *\r
+ * License along with this program; if not, write to the *\r
+ * Free Software Foundation, Inc., *\r
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
+ ***************************************************************************/\r
+#ifndef _MGL_DATA_H_\r
+#define _MGL_DATA_H_\r
+/*****************************************************************************/\r
+#include "mgl2/base.h"\r
+#include "mgl2/data_cf.h"\r
+#ifdef __cplusplus\r
+//-----------------------------------------------------------------------------\r
+#include <vector>\r
+//-----------------------------------------------------------------------------\r
+/// Class for working with data array\r
+class mglData : public mglDataA\r
+{\r
+public:\r
+\r
+ long nx; ///< number of points in 1st dimensions ('x' dimension)\r
+ long ny; ///< number of points in 2nd dimensions ('y' dimension)\r
+ long nz; ///< number of points in 3d dimensions ('z' dimension)\r
+ mreal *a; ///< data array\r
+ char *id; ///< column (or slice) names\r
+ bool link; ///< use external data (i.e. don't free it)\r
+\r
+ /// Initiate by other mglData variable\r
+ inline mglData(const mglData &d) { a=0; mgl_data_set(this,&d); }\r
+ inline mglData(const mglDataA *d) { a=0; mgl_data_set(this, d); }\r
+ inline mglData(bool, mglData *d) // NOTE: Variable d will be deleted!!!\r
+ { if(d) {memcpy((void*)this,(void*)d,sizeof(mglData)); d->id=0; d->link=true; delete d; }\r
+ else { a=0; Create(1); } }\r
+ /// Initiate by flat array\r
+ inline mglData(int size, const float *d) { a=0; Set(d,size); }\r
+ inline mglData(int rows, int cols, const float *d) { a=0; Set(d,cols,rows); }\r
+ inline mglData(int size, const double *d) { a=0; Set(d,size); }\r
+ inline mglData(int rows, int cols, const double *d) { a=0; Set(d,cols,rows); }\r
+ inline mglData(const double *d, int size) { a=0; Set(d,size); }\r
+ inline mglData(const double *d, int rows, int cols) { a=0; Set(d,cols,rows); }\r
+ /// Read data from file\r
+ inline mglData(const char *fname) { a=0; Read(fname); }\r
+ /// Allocate the memory for data array and initialize it zero\r
+ inline mglData(long xx=1,long yy=1,long zz=1) { a=0; Create(xx,yy,zz); }\r
+ /// Delete the array\r
+ virtual ~mglData() { if(id && a) delete []id; if(!link && a) delete []a; }\r
+ inline mreal GetVal(long i, long j=0, long k=0)\r
+ { return mgl_data_get_value(this,i,j,k);}\r
+ inline void SetVal(mreal f, long i, long j=0, long k=0)\r
+ { mgl_data_set_value(this,f,i,j,k); }\r
+ /// Get sizes\r
+ inline long GetNx() const { return nx; }\r
+ inline long GetNy() const { return ny; }\r
+ inline long GetNz() const { return nz; }\r
+\r
+ /// Link external data array (don't delete it at exit)\r
+ inline void Link(mreal *A, long NX, long NY=1, long NZ=1)\r
+ { mgl_data_link(this,A,NX,NY,NZ); }\r
+ inline void Link(mglData *d) { Link(d->a,d->nx,d->ny,d->nz); }\r
+ /// Allocate memory and copy the data from the gsl_vector\r
+ inline void Set(gsl_vector *m) { mgl_data_set_vector(this,m); }\r
+ /// Allocate memory and copy the data from the gsl_matrix\r
+ inline void Set(gsl_matrix *m) { mgl_data_set_matrix(this,m); }\r
+\r
+ /// Allocate memory and copy the data from the (float *) array\r
+ inline void Set(const float *A,long NX,long NY=1,long NZ=1)\r
+ { mgl_data_set_float(this,A,NX,NY,NZ); }\r
+ /// Allocate memory and copy the data from the (double *) array\r
+ inline void Set(const double *A,long NX,long NY=1,long NZ=1)\r
+ { mgl_data_set_double(this,A,NX,NY,NZ); }\r
+ /// Allocate memory and copy the data from the (float **) array\r
+ inline void Set(const float **A,long N1,long N2)\r
+ { mgl_data_set_float2(this,A,N1,N2); }\r
+ /// Allocate memory and copy the data from the (double **) array\r
+ inline void Set(const double **A,long N1,long N2)\r
+ { mgl_data_set_double2(this,A,N1,N2); }\r
+ /// Allocate memory and copy the data from the (float ***) array\r
+ inline void Set(const float ***A,long N1,long N2,long N3)\r
+ { mgl_data_set_float3(this,A,N1,N2,N3); }\r
+ /// Allocate memory and copy the data from the (double ***) array\r
+ inline void Set(const double ***A,long N1,long N2,long N3)\r
+ { mgl_data_set_double3(this,A,N1,N2,N3); }\r
+ /// Allocate memory and scanf the data from the string\r
+ inline void Set(const char *str,long NX,long NY=1,long NZ=1)\r
+ { mgl_data_set_values(this,str,NX,NY,NZ); }\r
+ /// Import data from abstract type\r
+ inline void Set(HCDT dat) { mgl_data_set(this, dat); }\r
+ inline void Set(const mglData &dat) { mgl_data_set(this, &dat); }\r
+ /// Allocate memory and copy data from std::vector<T>\r
+ inline void Set(const std::vector<int> &d)\r
+ { if(d.size()<1) return;\r
+ Create(d.size()); for(long i=0;i<nx;i++) a[i] = d[i]; }\r
+ inline void Set(const std::vector<float> &d)\r
+ { if(d.size()<1) return;\r
+ Create(d.size()); for(long i=0;i<nx;i++) a[i] = d[i]; }\r
+ inline void Set(const std::vector<double> &d)\r
+ { if(d.size()<1) return;\r
+ Create(d.size()); for(long i=0;i<nx;i++) a[i] = d[i]; }\r
+\r
+ /// Create or recreate the array with specified size and fill it by zero\r
+ inline void Create(long mx,long my=1,long mz=1)\r
+ { mgl_data_create(this,mx,my,mz); }\r
+ /// Rearange data dimensions\r
+ inline void Rearrange(long mx, long my=0, long mz=0)\r
+ { mgl_data_rearrange(this,mx,my,mz); }\r
+ /// Transpose dimensions of the data (generalization of Transpose)\r
+ inline void Transpose(const char *dim="yx")\r
+ { mgl_data_transpose(this,dim); }\r
+ /// Extend data dimensions\r
+ inline void Extend(long n1, long n2=0)\r
+ { mgl_data_extend(this,n1,n2); }\r
+ /// Reduce size of the data\r
+ inline void Squeeze(long rx,long ry=1,long rz=1,bool smooth=false)\r
+ { mgl_data_squeeze(this,rx,ry,rz,smooth); }\r
+ /// Crop the data\r
+ inline void Crop(long n1, long n2,char dir='x')\r
+ { mgl_data_crop(this,n1,n2,dir); }\r
+ /// Insert data\r
+ inline void Insert(char dir, long at=0, long num=1)\r
+ { mgl_data_insert(this,dir,at,num); }\r
+ /// Delete data\r
+ inline void Delete(char dir, long at=0, long num=1)\r
+ { mgl_data_delete(this,dir,at,num); }\r
+\r
+ /// Modify the data by specified formula\r
+ inline void Modify(const char *eq,long dim=0)\r
+ { mgl_data_modify(this, eq, dim); }\r
+ /// Modify the data by specified formula\r
+ inline void Modify(const char *eq,const mglData &vdat, const mglData &wdat)\r
+ { mgl_data_modify_vw(this,eq,&vdat,&wdat); }\r
+ /// Modify the data by specified formula\r
+ inline void Modify(const char *eq,const mglData &vdat)\r
+ { mgl_data_modify_vw(this,eq,&vdat,0); }\r
+ /// Modify the data by specified formula assuming x,y,z in range [r1,r2]\r
+ inline void Fill(mglBase *gr, const char *eq, const char *opt="")\r
+ { mgl_data_fill_eq(gr,this,eq,0,0,opt); }\r
+ inline void Fill(mglBase *gr, const char *eq, const mglData &vdat, const char *opt="")\r
+ { mgl_data_fill_eq(gr,this,eq,&vdat,0,opt); }\r
+ inline void Fill(mglBase *gr, const char *eq, const mglData &vdat, const mglData &wdat,const char *opt="")\r
+ { mgl_data_fill_eq(gr,this,eq,&vdat,&wdat,opt); }\r
+ /// Eqidistantly fill the data to range [x1,x2] in direction \a dir\r
+ inline void Fill(mreal x1,mreal x2=NaN,char dir='x')\r
+ { return mgl_data_fill(this,x1,x2,dir); }\r
+ /// Put value to data element(s)\r
+ inline void Put(mreal val, long i=-1, long j=-1, long k=-1)\r
+ { mgl_data_put_val(this,val,i,j,k); }\r
+ /// Put array to data element(s)\r
+ inline void Put(const mglData &dat, long i=-1, long j=-1, long k=-1)\r
+ { mgl_data_put_dat(this,&dat,i,j,k); }\r
+ /// Set names for columns (slices)\r
+ inline void SetColumnId(const char *ids)\r
+ { mgl_data_set_id(this,ids); }\r
+ /// Make new id\r
+ inline void NewId()\r
+ { delete []id; id=new char[nx]; memset(id,0,nx*sizeof(char)); }\r
+\r
+ /// Read data from tab-separated text file with auto determining size\r
+ inline bool Read(const char *fname)\r
+ { return mgl_data_read(this,fname); }\r
+ /// Read data from text file with specifeid size\r
+ inline bool Read(const char *fname,long mx,long my=1,long mz=1)\r
+ { return mgl_data_read_dim(this,fname,mx,my,mz); }\r
+ /// Save whole data array (for ns=-1) or only ns-th slice to text file\r
+ inline void Save(const char *fname,long ns=-1) const\r
+ { mgl_data_save(this,fname,ns); }\r
+ /// Export data array (for ns=-1) or only ns-th slice to PNG file according color scheme\r
+ inline void Export(const char *fname,const char *scheme,mreal v1=0,mreal v2=0,long ns=-1) const\r
+ { mgl_data_export(this,fname,scheme,v1,v2,ns); }\r
+ /// Import data array from PNG file according color scheme\r
+ inline void Import(const char *fname,const char *scheme,mreal v1=0,mreal v2=1)\r
+ { mgl_data_import(this,fname,scheme,v1,v2); }\r
+ /// Read data from tab-separated text files with auto determining size which filenames are result of sprintf(fname,templ,t) where t=from:step:to\r
+ inline bool ReadRange(const char *templ, double from, double to, double step=1, bool as_slice=false)\r
+ { return mgl_data_read_range(this,templ,from,to,step,as_slice); }\r
+ /// Read data from tab-separated text files with auto determining size which filenames are satisfied to template (like "t_*.dat")\r
+ inline bool ReadAll(const char *templ, bool as_slice=false)\r
+ { return mgl_data_read_all(this, templ, as_slice); }\r
+ /// Read data from text file with size specified at beginning of the file\r
+ inline bool ReadMat(const char *fname, long dim=2)\r
+ { return mgl_data_read_mat(this,fname,dim); }\r
+ /// Read data array from HDF file (parse HDF4 and HDF5 files)\r
+ inline int ReadHDF(const char *fname,const char *data)\r
+ { return mgl_data_read_hdf(this,fname,data); }\r
+ /// Save data to HDF file\r
+ inline void SaveHDF(const char *fname,const char *data,bool rewrite=false) const\r
+ { mgl_data_save_hdf(this,fname,data,rewrite); }\r
+ /// Put HDF data names into buf as '\t' separated.\r
+ inline int DatasHDF(const char *fname, char *buf, long size) const\r
+ { return mgl_datas_hdf(fname,buf,size); }\r
+\r
+ /// Get column (or slice) of the data filled by formulas of named columns\r
+ inline mglData Column(const char *eq) const\r
+ { return mglData(true,mgl_data_column(this,eq)); }\r
+ /// Get momentum (1D-array) of data along direction 'dir'. String looks like "x1" for median in x-direction, "x2" for width in x-dir and so on.\r
+ inline mglData Momentum(char dir, const char *how) const\r
+ { return mglData(true,mgl_data_momentum(this,dir,how)); }\r
+ /// Get sub-array of the data with given fixed indexes\r
+ inline mglData SubData(long xx,long yy=-1,long zz=-1) const\r
+ { return mglData(true,mgl_data_subdata(this,xx,yy,zz)); }\r
+ inline mglData SubData(const mglData &xx, const mglData &yy, const mglData &zz) const\r
+ { return mglData(true,mgl_data_subdata_ext(this,&xx,&yy,&zz)); }\r
+ /// Get trace of the data array\r
+ inline mglData Trace() const\r
+ { return mglData(true,mgl_data_trace(this)); }\r
+ /// Create n-th points distribution of this data values in range [v1, v2]\r
+ mglData Hist(long n,mreal v1=0,mreal v2=1, long nsub=0) const\r
+ { return mglData(true,mgl_data_hist(this,n,v1,v2,nsub)); }\r
+ /// Create n-th points distribution of this data values in range [v1, v2] with weight \a w\r
+ mglData Hist(const mglData &w, long n,mreal v1=0,mreal v2=1, long nsub=0) const\r
+ { return mglData(true,mgl_data_hist_w(this,&w,n,v1,v2,nsub)); }\r
+ /// Get array which is result of summation in given direction or directions\r
+ inline mglData Sum(const char *dir) const\r
+ { return mglData(true,mgl_data_sum(this,dir)); }\r
+ /// Get array which is result of maximal values in given direction or directions\r
+ inline mglData Max(const char *dir) const\r
+ { return mglData(true,mgl_data_max_dir(this,dir)); }\r
+ /// Get array which is result of minimal values in given direction or directions\r
+ inline mglData Min(const char *dir) const\r
+ { return mglData(true,mgl_data_min_dir(this,dir)); }\r
+ /// Get the data which is direct multiplication (like, d[i,j] = this[i]*a[j] and so on)\r
+ inline mglData Combine(const mglData &dat) const\r
+ { return mglData(true,mgl_data_combine(this,&dat)); }\r
+ /// Resize the data to new size of box [x1,x2]*[y1,y2]*[z1,z2]\r
+ inline mglData Resize(long mx,long my=1,long mz=1, mreal x1=0,mreal x2=1, mreal y1=0,mreal y2=1, mreal z1=0,mreal z2=1) const\r
+ { return mglData(true,mgl_data_resize_box(this,mx,my,mz,x1,x2,y1,y2,z1,z2)); }\r
+ /// Get array which values is result of interpolation this for coordinates from other arrays\r
+ inline mglData Evaluate(const mglData &idat, bool norm=true) const\r
+ { return mglData(true,mgl_data_evaluate(this,&idat,0,0,norm)); }\r
+ inline mglData Evaluate(const mglData &idat, const mglData &jdat, bool norm=true) const\r
+ { return mglData(true,mgl_data_evaluate(this,&idat,&jdat,0,norm)); }\r
+ inline mglData Evaluate(const mglData &idat, const mglData &jdat, const mglData &kdat, bool norm=true) const\r
+ { return mglData(true,mgl_data_evaluate(this,&idat,&jdat,&kdat,norm)); }\r
+\r
+ /// Cumulative summation the data in given direction or directions\r
+ inline void CumSum(const char *dir) { mgl_data_cumsum(this,dir); }\r
+ /// Integrate (cumulative summation) the data in given direction or directions\r
+ inline void Integral(const char *dir) { mgl_data_integral(this,dir); }\r
+ /// Differentiate the data in given direction or directions\r
+ inline void Diff(const char *dir) { mgl_data_diff(this,dir); }\r
+ /// Differentiate the parametrically specified data along direction v1 with v2=const\r
+ inline void Diff(const mglData &v1, const mglData &v2)\r
+ { mgl_data_diff_par(this,&v1,&v2,0); }\r
+ /// Differentiate the parametrically specified data along direction v1 with v2,v3=const\r
+ inline void Diff(const mglData &v1, const mglData &v2, const mglData &v3)\r
+ { mgl_data_diff_par(this,&v1,&v2,&v3); }\r
+ /// Double-differentiate (like laplace operator) the data in given direction\r
+ inline void Diff2(const char *dir) { mgl_data_diff2(this,dir); }\r
+\r
+ /// Swap left and right part of the data in given direction (useful for fourier spectrums)\r
+ inline void Swap(const char *dir) { mgl_data_swap(this,dir); }\r
+ /// Roll data along direction \a dir by \a num slices\r
+ inline void Roll(char dir, long num) { mgl_data_roll(this,dir,num); }\r
+ /// Mirror the data in given direction (useful for fourier spectrums)\r
+ inline void Mirror(const char *dir) { mgl_data_mirror(this,dir); }\r
+ /// Sort rows (or slices) by values of specified column\r
+ inline void Sort(long idx, long idy=-1) { mgl_data_sort(this,idx,idy); }\r
+\r
+ /// Set as the data envelop\r
+ inline void Envelop(char dir='x')\r
+ { mgl_data_envelop(this,dir); }\r
+ /// Remove phase jump\r
+ inline void Sew(const char *dirs="xyz", mreal da=2*Pi)\r
+ { mgl_data_sew(this,dirs,da); }\r
+ /// Smooth the data on specified direction or directions\r
+ inline void Smooth(const char *dirs="xyz",mreal delta=0)\r
+ { mgl_data_smooth(this,dirs,delta); }\r
+ /// Normalize the data to range [v1,v2]\r
+ inline void Norm(mreal v1=0,mreal v2=1,bool sym=false,long dim=0)\r
+ { mgl_data_norm(this,v1,v2,sym,dim); }\r
+ /// Normalize the data to range [v1,v2] slice by slice\r
+ inline void NormSl(mreal v1=0,mreal v2=1,char dir='z',bool keep_en=true,bool sym=false)\r
+ { mgl_data_norm_slice(this,v1,v2,dir,keep_en,sym); }\r
+\r
+ /// Hankel transform\r
+ inline void Hankel(const char *dir) { mgl_data_hankel(this,dir); }\r
+ /// Sin-Fourier transform\r
+ inline void SinFFT(const char *dir) { mgl_data_sinfft(this,dir); }\r
+ /// Cos-Fourier transform\r
+ inline void CosFFT(const char *dir) { mgl_data_cosfft(this,dir); }\r
+ /// Fill data by 'x'/'k' samples for Hankel ('h') or Fourier ('f') transform\r
+ inline void FillSample(const char *how)\r
+ { mgl_data_fill_sample(this,how); }\r
+\r
+ /// Interpolate by qubic splain the data to given point x=[0...nx-1], y=[0...ny-1], z=[0...nz-1]\r
+ inline mreal Spline(mreal x,mreal y=0,mreal z=0) const\r
+ { return mgl_data_spline(this, x,y,z); }\r
+ /// Interpolate by qubic splain the data to given point \a x,\a y,\a z which normalized in range [0, 1]\r
+ inline mreal Spline1(mreal x,mreal y=0,mreal z=0) const\r
+ { return mgl_data_spline(this, x*(nx-1),y*(ny-1),z*(nz-1)); }\r
+ /// Interpolate by linear function the data to given point x=[0...nx-1], y=[0...ny-1], z=[0...nz-1]\r
+ inline mreal Linear(mreal x,mreal y=0,mreal z=0) const\r
+ { return mgl_data_linear(this,x,y,z); }\r
+ /// Interpolate by line the data to given point \a x,\a y,\a z which normalized in range [0, 1]\r
+ inline mreal Linear1(mreal x,mreal y=0,mreal z=0) const\r
+ { return mgl_data_linear(this,x*(nx-1),y*(ny-1),z*(nz-1)); }\r
+\r
+ /// Print information about the data (sizes and momentum) to string\r
+ inline const char *PrintInfo() const { return mgl_data_info(this); }\r
+ /// Print information about the data (sizes and momentum) to FILE (for example, stdout)\r
+ inline void PrintInfo(FILE *fp) const\r
+ { if(fp) { fprintf(fp,"%s",mgl_data_info(this)); fflush(fp); } }\r
+ /// Get maximal value of the data\r
+ inline float Maximal() const { return mgl_data_max(this); }\r
+ /// Get minimal value of the data\r
+ inline float Minimal() const { return mgl_data_min(this); }\r
+ /// Get maximal value of the data and its position\r
+ inline mreal Maximal(long &i,long &j,long &k) const\r
+ { return mgl_data_max_int(this,&i,&j,&k); }\r
+ /// Get minimal value of the data and its position\r
+ inline mreal Minimal(long &i,long &j,long &k) const\r
+ { return mgl_data_min_int(this,&i,&j,&k); }\r
+ /// Get maximal value of the data and its approximated position\r
+ inline mreal Maximal(mreal &x,mreal &y,mreal &z) const\r
+ { return mgl_data_max_real(this,&x,&y,&z); }\r
+ /// Get minimal value of the data and its approximated position\r
+ inline mreal Minimal(mreal &x,mreal &y,mreal &z) const\r
+ { return mgl_data_min_real(this,&x,&y,&z); }\r
+ /// Get "energy" and find first (median) and second (width) momentums of data\r
+ inline mreal Momentum(char dir,mreal &m,mreal &w) const\r
+ { return mgl_data_momentum_val(this,dir,&m,&w,0,0); }\r
+ /// Get "energy and find 4 momentums of data: median, width, skewness, kurtosis\r
+ inline mreal Momentum(char dir,mreal &m,mreal &w,mreal &s,mreal &k) const\r
+ { return mgl_data_momentum_val(this,dir,&m,&w,&s,&k); }\r
+ /// Find position (after specified in i,j,k) of first nonzero value of formula\r
+ inline mreal Find(const char *cond, long &i, long &j, long &k) const\r
+ { return mgl_data_first(this,cond,&i,&j,&k); }\r
+ /// Find position (before specified in i,j,k) of last nonzero value of formula\r
+ inline mreal Last(const char *cond, long &i, long &j, long &k) const\r
+ { return mgl_data_last(this,cond,&i,&j,&k); }\r
+ /// Find position of first in direction 'dir' nonzero value of formula\r
+ inline long Find(const char *cond, char dir, long i=0, long j=0, long k=0) const\r
+ { return mgl_data_find(this,cond,dir,i,j,k); }\r
+ /// Find if any nonzero value of formula\r
+ inline bool FindAny(const char *cond) const\r
+ { return mgl_data_find_any(this,cond); }\r
+\r
+ /// Copy data from other mglData variable\r
+ inline mglData &operator=(const mglData &d)\r
+ { if(this!=&d) Set(d.a,d.nx,d.ny,d.nz); return *this; }\r
+ inline mreal operator=(mreal val)\r
+ { for(long i=0;i<nx*ny*nz;i++) a[i]=val; return val; }\r
+ /// Multiplicate the data by other one for each element\r
+ inline void operator*=(const mglData &d) { mgl_data_mul_dat(this,&d); }\r
+ /// Divide the data by other one for each element\r
+ inline void operator/=(const mglData &d) { mgl_data_div_dat(this,&d); }\r
+ /// Add the other data\r
+ inline void operator+=(const mglData &d) { mgl_data_add_dat(this,&d); }\r
+ /// Substract the other data\r
+ inline void operator-=(const mglData &d) { mgl_data_sub_dat(this,&d); }\r
+ /// Multiplicate each element by the number\r
+ inline void operator*=(mreal d) { mgl_data_mul_num(this,d); }\r
+ /// Divide each element by the number\r
+ inline void operator/=(mreal d) { mgl_data_div_num(this,d); }\r
+ /// Add the number\r
+ inline void operator+=(mreal d) { mgl_data_add_num(this,d); }\r
+ /// Substract the number\r
+ inline void operator-=(mreal d) { mgl_data_sub_num(this,d); }\r
+#ifndef SWIG\r
+ /// Direct access to the data cell\r
+ inline mreal &operator[](long i) { return a[i]; }\r
+ // NOTE see 13.10 for operator(), operator[] -- m.b. I should add it ???\r
+#endif\r
+protected:\r
+ /// Get the value in given cell of the data without border checking\r
+ inline mreal v(long i,long j=0,long k=0) const\r
+#ifdef DEBUG\r
+ { if(i<0 || j<0 || k<0 || i>=nx || j>=ny || k>=nz) printf("Wrong index in mglData");\r
+ return a[i+nx*(j+ny*k)]; }\r
+#else\r
+ { return a[i+nx*(j+ny*k)]; }\r
+#endif\r
+ inline mreal vthr(long i) const { return a[i]; }\r
+ // add for speeding up !!!\r
+ inline mreal dvx(long i,long j=0,long k=0) const\r
+ { register long i0=i+nx*(j+ny*k);\r
+ return i>0? (i<nx-1? (a[i0+1]-a[i0-1])/2:a[i0]-a[i0-1]) : a[i0+1]-a[i0]; }\r
+ inline mreal dvy(long i,long j=0,long k=0) const\r
+ { register long i0=i+nx*(j+ny*k);\r
+ return j>0? (j<ny-1? (a[i0+nx]-a[i0-nx])/2:a[i0]-a[i0-nx]) : a[i0+nx]-a[i0];}\r
+ inline mreal dvz(long i,long j=0,long k=0) const\r
+ { register long i0=i+nx*(j+ny*k), n=nx*ny;\r
+ return k>0? (k<nz-1? (a[i0+n]-a[i0-n])/2:a[i0]-a[i0-n]) : a[i0+n]-a[i0]; }\r
+};\r
+//-----------------------------------------------------------------------------\r
+#ifndef SWIG\r
+inline mglData operator*(const mglData &b, const mglData &d)\r
+{ mglData a(b); a*=d; return a; }\r
+inline mglData operator*(mreal b, const mglData &d)\r
+{ mglData a(d); a*=b; return a; }\r
+inline mglData operator*(const mglData &d, mreal b)\r
+{ mglData a(d); a*=b; return a; }\r
+inline mglData operator-(const mglData &b, const mglData &d)\r
+{ mglData a(b); a-=d; return a; }\r
+inline mglData operator-(mreal b, const mglData &d)\r
+{ mglData a(d); a-=b; return a; }\r
+inline mglData operator-(const mglData &d, mreal b)\r
+{ mglData a(d); a-=b; return a; }\r
+inline mglData operator+(const mglData &b, const mglData &d)\r
+{ mglData a(b); a+=d; return a; }\r
+inline mglData operator+(mreal b, const mglData &d)\r
+{ mglData a(d); a+=b; return a; }\r
+inline mglData operator+(const mglData &d, mreal b)\r
+{ mglData a(d); a+=b; return a; }\r
+inline mglData operator/(const mglData &b, const mglData &d)\r
+{ mglData a(b); a/=d; return a; }\r
+inline mglData operator/(const mglData &d, mreal b)\r
+{ mglData a(d); a/=b; return a; }\r
+inline bool operator==(const mglData &b, const mglData &d)\r
+{ if(b.nx!=d.nx || b.ny!=d.ny || b.ny!=d.ny) return false;\r
+ return !memcmp(b.a,d.a,b.nx*b.ny*b.nz*sizeof(mreal)); }\r
+#endif\r
+//-----------------------------------------------------------------------------\r
+#ifndef SWIG\r
+mreal mglLinear(const mreal *a, long nx, long ny, long nz, mreal x, mreal y, mreal z);\r
+mreal mglSpline3(const mreal *a, long nx, long ny, long nz, mreal x, mreal y, mreal z,mreal *dx=0, mreal *dy=0, mreal *dz=0);\r
+#endif\r
+//-----------------------------------------------------------------------------\r
+/// Integral data transformation (like Fourier 'f' or 'i', Hankel 'h' or None 'n') for amplitude and phase\r
+inline mglData mglTransformA(const mglDataA &am, const mglDataA &ph, const char *tr)\r
+{ return mgl_transform_a(&am,&ph,tr); }\r
+/// Integral data transformation (like Fourier 'f' or 'i', Hankel 'h' or None 'n') for real and imaginary parts\r
+inline mglData mglTransform(const mglDataA &re, const mglDataA &im, const char *tr)\r
+{ return mgl_transform(&re,&im,tr); }\r
+/// Apply Fourier transform for the data and save result into it\r
+inline void mglFourier(mglData &re, mglData &im, const char *dir)\r
+{ mgl_data_fourier(&re,&im,dir); }\r
+/// Short time Fourier analysis for real and imaginary parts. Output is amplitude of partial Fourier (result will have size {dn, floor(nx/dn), ny} for dir='x'\r
+inline mglData mglSTFA(const mglDataA &re, const mglDataA &im, long dn, char dir='x')\r
+{ return mglData(true, mgl_data_stfa(&re,&im,dn,dir)); }\r
+//-----------------------------------------------------------------------------\r
+/// Saves result of PDE solving (|u|^2) for "Hamiltonian" \a ham with initial conditions \a ini\r
+inline mglData mglPDE(mglBase *gr, const char *ham, const mglData &ini_re, const mglData &ini_im, mreal dz=0.1, mreal k0=100,const char *opt="")\r
+{ return mglData(true, mgl_pde_solve(gr,ham, &ini_re, &ini_im, dz, k0,opt)); }\r
+/// Saves result of PDE solving for "Hamiltonian" \a ham with initial conditions \a ini along a curve \a ray (must have nx>=7 - x,y,z,px,py,pz,tau or nx=5 - x,y,px,py,tau)\r
+inline mglData mglQO2d(const char *ham, const mglData &ini_re, const mglData &ini_im, const mglData &ray, mreal r=1, mreal k0=100)\r
+{ return mglData(true, mgl_qo2d_solve(ham, &ini_re, &ini_im, &ray, r, k0, 0, 0)); }\r
+inline mglData mglQO2d(const char *ham, const mglData &ini_re, const mglData &ini_im, const mglData &ray, mglData &xx, mglData &yy, mreal r=1, mreal k0=100)\r
+{ return mglData(true, mgl_qo2d_solve(ham, &ini_re, &ini_im, &ray, r, k0, &xx, &yy)); }\r
+/// Prepares ray data for mglQO_PDE with starting point \a r0, \a p0\r
+inline mglData mglRay(const char *ham, mglPoint r0, mglPoint p0, mreal dt=0.1, mreal tmax=10)\r
+{ return mglData(true, mgl_ray_trace(ham, r0.x, r0.y, r0.z, p0.x, p0.y, p0.z, dt, tmax)); }\r
+/// Calculate Jacobian determinant for D{x(u,v), y(u,v)} = dx/du*dy/dv-dx/dv*dy/du\r
+inline mglData mglJacobian(const mglData &x, const mglData &y)\r
+{ return mglData(true, mgl_jacobian_2d(&x, &y)); }\r
+/// Calculate Jacobian determinant for D{x(u,v,w), y(u,v,w), z(u,v,w)}\r
+inline mglData mglJacobian(const mglData &x, const mglData &y, const mglData &z)\r
+{ return mglData(true, mgl_jacobian_3d(&x, &y, &z)); }\r
+/// Do something like Delone triangulation\r
+inline mglData mglTriangulation(const mglData &x, const mglData &y, const mglData &z, float er=0)\r
+{ return mglData(true,mgl_triangulation_3d(&x,&y,&z,er)); }\r
+inline mglData mglTriangulation(const mglData &x, const mglData &y, float er=0)\r
+{ return mglData(true,mgl_triangulation_2d(&x,&y,er)); }\r
+//-----------------------------------------------------------------------------\r
+#endif\r
+#endif\r
--- /dev/null
+/***************************************************************************\r
+ * data_cf.h is part of Math Graphic Library\r
+ * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
+ * *\r
+ * This program is free software; you can redistribute it and/or modify *\r
+ * it under the terms of the GNU Library General Public License as *\r
+ * published by the Free Software Foundation; either version 3 of the *\r
+ * License, or (at your option) any later version. *\r
+ * *\r
+ * This program is distributed in the hope that it will be useful, *\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
+ * GNU General Public License for more details. *\r
+ * *\r
+ * You should have received a copy of the GNU Library General Public *\r
+ * License along with this program; if not, write to the *\r
+ * Free Software Foundation, Inc., *\r
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
+ ***************************************************************************/\r
+#ifndef _MGL_DATA_CF_H_\r
+#define _MGL_DATA_CF_H_\r
+/*****************************************************************************/\r
+#include "mgl2/base.h"\r
+/*****************************************************************************/\r
+#if MGL_HAVE_GSL\r
+#include <gsl/gsl_vector.h>\r
+#include <gsl/gsl_matrix.h>\r
+#else\r
+struct gsl_vector;\r
+struct gsl_matrix;\r
+#endif\r
+/*****************************************************************************/\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+/*****************************************************************************/\r
+void mgl_srnd(long seed);\r
+double mgl_rnd();\r
+double mgl_ipow(double x,int n);\r
+/*****************************************************************************/\r
+HMDT mgl_create_data();\r
+HMDT mgl_create_data_size(long nx, long ny, long nz);\r
+HMDT mgl_create_data_file(const char *fname);\r
+void mgl_delete_data(HMDT dat);\r
+const char *mgl_data_info(HCDT dat);\r
+/*****************************************************************************/\r
+uintptr_t mgl_create_data_();\r
+uintptr_t mgl_create_data_size_(int *nx, int *ny, int *nz);\r
+uintptr_t mgl_create_data_file_(const char *fname, int len);\r
+void mgl_delete_data_(uintptr_t *dat);\r
+/*****************************************************************************/\r
+/* Data creation functions */\r
+/*****************************************************************************/\r
+void mgl_data_rearrange(HMDT dat, long mx,long my,long mz);\r
+void mgl_data_link(HMDT dat, mreal *A,long mx,long my,long mz);\r
+void mgl_data_set_float(HMDT dat, const float *A,long mx,long my,long mz);\r
+void mgl_data_set_double(HMDT dat, const double *A,long mx,long my,long mz);\r
+void mgl_data_set_float2(HMDT d, const float **A,long N1,long N2);\r
+void mgl_data_set_double2(HMDT d, const double **A,long N1,long N2);\r
+void mgl_data_set_float3(HMDT d, const float ***A,long N1,long N2,long N3);\r
+void mgl_data_set_double3(HMDT d, const double ***A,long N1,long N2,long N3);\r
+void mgl_data_set(HMDT dat, HCDT a);\r
+void mgl_data_set_vector(HMDT dat, gsl_vector *v);\r
+void mgl_data_set_matrix(HMDT dat, gsl_matrix *m);\r
+void mgl_data_set_value(HMDT dat, float v, long i, long j, long k);\r
+float mgl_data_get_value(HCDT dat, long i, long j, long k);\r
+void mgl_data_set_values(HMDT dat, const char *val, long nx, long ny, long nz);\r
+\r
+int mgl_data_read_hdf(HMDT d,const char *fname,const char *data);\r
+void mgl_data_save_hdf(HCDT d,const char *fname,const char *data,int rewrite);\r
+int mgl_datas_hdf(const char *fname, char *buf, long size);\r
+int mgl_data_read(HMDT dat, const char *fname);\r
+int mgl_data_read_mat(HMDT dat, const char *fname, long dim);\r
+int mgl_data_read_dim(HMDT dat, const char *fname,long mx,long my,long mz);\r
+int mgl_data_read_range(HMDT d, const char *templ, double from, double to, double step, int as_slice);\r
+int mgl_data_read_all(HMDT dat, const char *templ, int as_slice);\r
+void mgl_data_save(HCDT dat, const char *fname,long ns);\r
+void mgl_data_export(HCDT dat, const char *fname, const char *scheme,float v1,float v2,long ns);\r
+void mgl_data_import(HMDT dat, const char *fname, const char *scheme,float v1,float v2);\r
+\r
+void mgl_data_create(HMDT dat, long nx,long ny,long nz);\r
+void mgl_data_transpose(HMDT dat, const char *dim);\r
+void mgl_data_norm(HMDT dat, float v1,float v2,long sym,long dim);\r
+void mgl_data_norm_slice(HMDT dat, float v1,float v2,char dir,long keep_en,long sym);\r
+HMDT mgl_data_subdata(HCDT dat, long xx,long yy,long zz);\r
+HMDT mgl_data_subdata_ext(HCDT dat, HCDT xx, HCDT yy, HCDT zz);\r
+HMDT mgl_data_column(HCDT dat, const char *eq);\r
+void mgl_data_set_id(HMDT d, const char *id);\r
+void mgl_data_fill(HMDT dat, float x1,float x2,char dir);\r
+void mgl_data_fill_eq(HMGL gr, HMDT dat, const char *eq, HCDT vdat, HCDT wdat,const char *opt);\r
+void mgl_data_put_val(HMDT dat, mreal val, long i, long j, long k);\r
+void mgl_data_put_dat(HMDT dat, HCDT val, long i, long j, long k);\r
+void mgl_data_modify(HMDT dat, const char *eq,long dim);\r
+void mgl_data_modify_vw(HMDT dat, const char *eq,HCDT vdat,HCDT wdat);\r
+void mgl_data_squeeze(HMDT dat, long rx,long ry,long rz,long smooth);\r
+float mgl_data_max(HCDT dat);\r
+float mgl_data_min(HCDT dat);\r
+mreal *mgl_data_value(HMDT dat, long i,long j,long k);\r
+mreal *mgl_data_data(HMDT dat);\r
+\r
+float mgl_data_first(HCDT dat, const char *cond, long *i, long *j, long *k);\r
+float mgl_data_last(HCDT dat, const char *cond, long *i, long *j, long *k);\r
+long mgl_data_find(HCDT dat, const char *cond, char dir, long i, long j, long k);\r
+int mgl_data_find_any(HCDT dat, const char *cond);\r
+float mgl_data_max_int(HCDT dat, long *i, long *j, long *k);\r
+float mgl_data_max_real(HCDT dat, mreal *x, mreal *y, mreal *z);\r
+float mgl_data_min_int(HCDT dat, long *i, long *j, long *k);\r
+float mgl_data_min_real(HCDT dat, mreal *x, mreal *y, mreal *z);\r
+float mgl_data_momentum_val(HCDT d, char dir, mreal *m, mreal *w, mreal *s, mreal *k);\r
+\r
+HMDT mgl_data_combine(HCDT dat1, HCDT dat2);\r
+void mgl_data_extend(HMDT dat, long n1, long n2);\r
+void mgl_data_insert(HMDT dat, char dir, long at, long num);\r
+void mgl_data_delete(HMDT dat, char dir, long at, long num);\r
+/*****************************************************************************/\r
+/* Data manipulation functions */\r
+/*****************************************************************************/\r
+void mgl_data_smooth(HMDT d, const char *dirs, float delta);\r
+HMDT mgl_data_sum(HCDT dat, const char *dir);\r
+HMDT mgl_data_max_dir(HCDT dat, const char *dir);\r
+HMDT mgl_data_min_dir(HCDT dat, const char *dir);\r
+void mgl_data_cumsum(HMDT dat, const char *dir);\r
+void mgl_data_integral(HMDT dat, const char *dir);\r
+void mgl_data_diff(HMDT dat, const char *dir);\r
+void mgl_data_diff_par(HMDT dat, HCDT v1, HCDT v2, HCDT v3);\r
+void mgl_data_diff2(HMDT dat, const char *dir);\r
+void mgl_data_swap(HMDT dat, const char *dir);\r
+void mgl_data_roll(HMDT dat, char dir, long num);\r
+void mgl_data_mirror(HMDT dat, const char *dir);\r
+void mgl_data_sort(HMDT dat, long idx, long idy);\r
+\r
+void mgl_data_hankel(HMDT dat, const char *dir);\r
+void mgl_data_sinfft(HMDT dat, const char *dir);\r
+void mgl_data_cosfft(HMDT dat, const char *dir);\r
+void mgl_data_fill_sample(HMDT dat, const char *how);\r
+\r
+float mgl_data_spline(HCDT dat, float x,float y,float z);\r
+float mgl_data_linear(HCDT dat, float x,float y,float z);\r
+HMDT mgl_data_trace(HCDT d);\r
+HMDT mgl_data_resize(HCDT dat, long mx,long my,long mz);\r
+HMDT mgl_data_resize_box(HCDT dat, long mx,long my,long mz,float x1,float x2,float y1,float y2,float z1,float z2);\r
+HMDT mgl_data_hist(HCDT dat, long n, float v1, float v2, long nsub);\r
+HMDT mgl_data_hist_w(HCDT dat, HCDT weight, long n, float v1, float v2, long nsub);\r
+HMDT mgl_data_momentum(HCDT dat, char dir, const char *how);\r
+HMDT mgl_data_evaluate(HCDT dat, HCDT idat, HCDT jdat, HCDT kdat, int norm);\r
+void mgl_data_envelop(HMDT dat, char dir);\r
+void mgl_data_sew(HMDT dat, const char *dirs, float da);\r
+void mgl_data_crop(HMDT dat, long n1, long n2, char dir);\r
+/*****************************************************************************/\r
+/* Data operations */\r
+/*****************************************************************************/\r
+void mgl_data_mul_dat(HMDT dat, HCDT d);\r
+void mgl_data_div_dat(HMDT dat, HCDT d);\r
+void mgl_data_add_dat(HMDT dat, HCDT d);\r
+void mgl_data_sub_dat(HMDT dat, HCDT d);\r
+void mgl_data_mul_num(HMDT dat, float d);\r
+void mgl_data_div_num(HMDT dat, float d);\r
+void mgl_data_add_num(HMDT dat, float d);\r
+void mgl_data_sub_num(HMDT dat, float d);\r
+/*****************************************************************************/\r
+HMDT mgl_pde_solve(HMGL gr, const char *ham, HCDT ini_re, HCDT ini_im, float dz, float k0,const char *opt);\r
+HMDT mgl_qo2d_solve(const char *ham, HCDT ini_re, HCDT ini_im, HCDT ray, float r, float k0, HMDT xx, HMDT yy);\r
+HMDT mgl_ray_trace(const char *ham, float x0, float y0, float z0, float px, float py, float pz, float dt, float tmax);\r
+HMDT mgl_jacobian_2d(HCDT x, HCDT y);\r
+HMDT mgl_jacobian_3d(HCDT x, HCDT y, HCDT z);\r
+HMDT mgl_transform_a(HCDT am, HCDT ph, const char *tr);\r
+HMDT mgl_transform(HCDT re, HCDT im, const char *tr);\r
+void mgl_data_fourier(HMDT re, HMDT im, const char *dir);\r
+HMDT mgl_data_stfa(HCDT re, HCDT im, long dn, char dir);\r
+\r
+HMDT mgl_triangulation_3d(HCDT x, HCDT y, HCDT z, float er);\r
+HMDT mgl_triangulation_2d(HCDT x, HCDT y, float er);\r
+/*****************************************************************************/\r
+/* Data creation functions */\r
+/*****************************************************************************/\r
+void mgl_data_rearrange_(uintptr_t *dat, int *mx, int *my, int *mz);\r
+void mgl_data_set_float_(uintptr_t *dat, const float *A,int *NX,int *NY,int *NZ);\r
+void mgl_data_set_double_(uintptr_t *dat, const double *A,int *NX,int *NY,int *NZ);\r
+void mgl_data_set_float1_(uintptr_t *d, const float *A,int *N1);\r
+void mgl_data_set_double1_(uintptr_t *d, const double *A,int *N1);\r
+void mgl_data_set_float2_(uintptr_t *d, const float *A,int *N1,int *N2);\r
+void mgl_data_set_double2_(uintptr_t *d, const double *A,int *N1,int *N2);\r
+void mgl_data_set_float3_(uintptr_t *d, const float *A,int *N1,int *N2,int *N3);\r
+void mgl_data_set_double3_(uintptr_t *d, const double *A,int *N1,int *N2,int *N3);\r
+void mgl_data_set_(uintptr_t *dat, uintptr_t *a);\r
+\r
+void mgl_data_set_value_(uintptr_t *d, float *v, int *i, int *j, int *k);\r
+void mgl_data_set_values_(uintptr_t *d, const char *val, int *nx, int *ny, int *nz, int l);\r
+float mgl_data_get_value_(uintptr_t *d, int *i, int *j, int *k);\r
+int mgl_data_read_(uintptr_t *d, const char *fname,int l);\r
+int mgl_data_read_mat_(uintptr_t *dat, const char *fname, int *dim, int);\r
+int mgl_data_read_dim_(uintptr_t *dat, const char *fname,int *mx,int *my,int *mz,int);\r
+void mgl_data_save_(uintptr_t *dat, const char *fname,int *ns,int);\r
+void mgl_data_export_(uintptr_t *dat, const char *fname, const char *scheme,float *v1,float *v2,int *ns,int,int);\r
+void mgl_data_import_(uintptr_t *dat, const char *fname, const char *scheme,float *v1,float *v2,int,int);\r
+void mgl_data_create_(uintptr_t *dat, int *nx,int *ny,int *nz);\r
+void mgl_data_transpose_(uintptr_t *dat, const char *dim,int);\r
+void mgl_data_norm_(uintptr_t *dat, float *v1,float *v2,int *sym,int *dim);\r
+void mgl_data_norm_slice_(uintptr_t *dat, float *v1,float *v2,char *dir,int *keep_en,int *sym,int l);\r
+uintptr_t mgl_data_subdata_(uintptr_t *dat, int *xx,int *yy,int *zz);\r
+uintptr_t mgl_data_subdata_ext_(uintptr_t *dat, uintptr_t *xx,uintptr_t *yy,uintptr_t *zz);\r
+uintptr_t mgl_data_column_(uintptr_t *dat, const char *eq,int l);\r
+void mgl_data_set_id_(uintptr_t *dat, const char *id,int l);\r
+void mgl_data_fill_(uintptr_t *dat, float *x1,float *x2,const char *dir,int);\r
+void mgl_data_fill_eq_(uintptr_t *gr, uintptr_t *dat, const char *eq, uintptr_t *vdat, uintptr_t *wdat,const char *opt, int, int);\r
+void mgl_data_put_val_(uintptr_t *dat, float *val, int *i, int *j, int *k);\r
+void mgl_data_put_dat_(uintptr_t *dat, uintptr_t *val, int *i, int *j, int *k);\r
+void mgl_data_modify_(uintptr_t *dat, const char *eq,int *dim,int);\r
+void mgl_data_modify_vw_(uintptr_t *dat, const char *eq, uintptr_t *vdat, uintptr_t *wdat,int);\r
+void mgl_data_squeeze_(uintptr_t *dat, int *rx,int *ry,int *rz,int *smooth);\r
+float mgl_data_max_(uintptr_t *dat);\r
+float mgl_data_min_(uintptr_t *dat);\r
+\r
+float mgl_data_first_(uintptr_t *dat, const char *cond, int *i, int *j, int *k, int);\r
+float mgl_data_last_(uintptr_t *dat, const char *cond, int *i, int *j, int *k, int);\r
+int mgl_data_find_(uintptr_t *dat, const char *cond, char *dir, int *i, int *j, int *k, int,int);\r
+int mgl_data_find_any_(uintptr_t *dat, const char *cond, int);\r
+float mgl_data_max_int_(uintptr_t *dat, int *i, int *j, int *k);\r
+float mgl_data_max_real_(uintptr_t *dat, float *x, float *y, float *z);\r
+float mgl_data_min_int_(uintptr_t *dat, int *i, int *j, int *k);\r
+float mgl_data_min_real_(uintptr_t *dat, float *x, float *y, float *z);\r
+float mgl_data_momentum_val_(uintptr_t *dat, char *dir, float *m, float *w, float *s, float *k,int);\r
+\r
+uintptr_t mgl_data_combine_(uintptr_t *dat1, uintptr_t *dat2);\r
+void mgl_data_extend_(uintptr_t *dat, int *n1, int *n2);\r
+void mgl_data_insert_(uintptr_t *dat, const char *dir, int *at, int *num, int);\r
+void mgl_data_delete_(uintptr_t *dat, const char *dir, int *at, int *num, int);\r
+/*****************************************************************************/\r
+/* Data manipulation functions */\r
+/*****************************************************************************/\r
+void mgl_data_smooth_(uintptr_t *dat, const char *dirs, float *delta,int);\r
+uintptr_t mgl_data_sum_(uintptr_t *dat, const char *dir,int);\r
+uintptr_t mgl_data_max_dir_(uintptr_t *dat, const char *dir,int);\r
+uintptr_t mgl_data_min_dir_(uintptr_t *dat, const char *dir,int);\r
+void mgl_data_cumsum_(uintptr_t *dat, const char *dir,int);\r
+void mgl_data_integral_(uintptr_t *dat, const char *dir,int);\r
+void mgl_data_diff_(uintptr_t *dat, const char *dir,int);\r
+void mgl_data_diff_par_(uintptr_t *dat, uintptr_t *v1, uintptr_t *v2, uintptr_t *v3);\r
+void mgl_data_diff2_(uintptr_t *dat, const char *dir,int);\r
+void mgl_data_swap_(uintptr_t *dat, const char *dir,int);\r
+void mgl_data_roll_(uintptr_t *dat, const char *dir, int *num, int);\r
+void mgl_data_mirror_(uintptr_t *dat, const char *dir,int);\r
+void mgl_data_sort_(uintptr_t *dat, int *idx, int *idy);\r
+\r
+void mgl_data_hankel_(uintptr_t *dat, const char *dir,int);\r
+void mgl_data_sinfft_(uintptr_t *dat, const char *dir,int);\r
+void mgl_data_cosfft_(uintptr_t *dat, const char *dir,int);\r
+void mgl_data_fill_sample_(uintptr_t *dat, const char *how,int);\r
+\r
+float mgl_data_spline_(uintptr_t *dat, float *x,float *y,float *z);\r
+float mgl_data_linear_(uintptr_t *dat, float *x,float *y,float *z);\r
+uintptr_t mgl_data_trace_(uintptr_t *d);\r
+uintptr_t mgl_data_resize_(uintptr_t *dat, int *mx,int *my,int *mz);\r
+uintptr_t mgl_data_resize_box_(uintptr_t *dat, int *mx,int *my,int *mz,float *x1,float *x2,float *y1,float *y2,float *z1,float *z2);\r
+uintptr_t mgl_data_momentum_(uintptr_t *dat, char *dir, const char *how, int,int);\r
+uintptr_t mgl_data_hist_(uintptr_t *dat, int *n, float *v1, float *v2, int *nsub);\r
+uintptr_t mgl_data_hist_w_(uintptr_t *dat, uintptr_t *weight, int *n, float *v1, float *v2, int *nsub);\r
+uintptr_t mgl_data_evaluate_(uintptr_t *dat, uintptr_t *idat, uintptr_t *jdat, uintptr_t *kdat, int *norm);\r
+void mgl_data_envelop_(uintptr_t *dat, const char *dir, int);\r
+void mgl_data_sew_(uintptr_t *dat, const char *dirs, float *da, int);\r
+void mgl_data_crop_(uintptr_t *dat, int *n1, int *n2, const char *dir,int);\r
+/*****************************************************************************/\r
+/* Data operations */\r
+/*****************************************************************************/\r
+void mgl_data_mul_dat_(uintptr_t *dat, uintptr_t *d);\r
+void mgl_data_div_dat_(uintptr_t *dat, uintptr_t *d);\r
+void mgl_data_add_dat_(uintptr_t *dat, uintptr_t *d);\r
+void mgl_data_sub_dat_(uintptr_t *dat, uintptr_t *d);\r
+void mgl_data_mul_num_(uintptr_t *dat, float *d);\r
+void mgl_data_div_num_(uintptr_t *dat, float *d);\r
+void mgl_data_add_num_(uintptr_t *dat, float *d);\r
+void mgl_data_sub_num_(uintptr_t *dat, float *d);\r
+/*****************************************************************************/\r
+/* Nonlinear fitting */\r
+/*****************************************************************************/\r
+uintptr_t mgl_pde_solve_(uintptr_t* gr, const char *ham, uintptr_t* ini_re, uintptr_t* ini_im, float *dz, float *k0,const char *opt,int,int);\r
+uintptr_t mgl_qo2d_solve_(const char *ham, uintptr_t* ini_re, uintptr_t* ini_im, uintptr_t* ray, float *r, float *k0, uintptr_t* xx, uintptr_t* yy, int);\r
+uintptr_t mgl_ray_trace_(const char *ham, float *x0, float *y0, float *z0, float *px, float *py, float *pz, float *dt, float *tmax,int);\r
+uintptr_t mgl_jacobian_2d_(uintptr_t* x, uintptr_t* y);\r
+uintptr_t mgl_jacobian_3d_(uintptr_t* x, uintptr_t* y, uintptr_t* z);\r
+\r
+uintptr_t mgl_transform_a_(uintptr_t *am, uintptr_t *ph, const char *tr, int);\r
+uintptr_t mgl_transform_(uintptr_t *re, uintptr_t *im, const char *tr, int);\r
+void mgl_data_fourier_(uintptr_t *re, uintptr_t *im, const char *dir, int l);\r
+uintptr_t mgl_data_stfa_(uintptr_t *re, uintptr_t *im, int *dn, char *dir, int);\r
+\r
+uintptr_t mgl_triangulation_3d_(uintptr_t *x, uintptr_t *y, uintptr_t *z, float *er);\r
+uintptr_t mgl_triangulation_2d_(uintptr_t *x, uintptr_t *y, float *er);\r
+/*****************************************************************************/\r
+int mgl_data_read_hdf_(uintptr_t *d, const char *fname, const char *data,int l,int n);\r
+void mgl_data_link_(uintptr_t *d, float *A, int *nx,int *ny,int *nz);\r
+void mgl_data_save_hdf_(uintptr_t *d, const char *fname, const char *data, int *rewrite,int l,int n);\r
+int mgl_data_read_range_(uintptr_t *d, const char *fname, double *from, double *to, double *step, int *as_slice,int l);\r
+int mgl_data_read_all_(uintptr_t *d, const char *fname, int *as_slice,int l);\r
+/*****************************************************************************/\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+#endif\r
--- /dev/null
+/***************************************************************************\r
+ * define.h is part of Math Graphic Library\r
+ * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
+ * *\r
+ * This program is free software; you can redistribute it and/or modify *\r
+ * it under the terms of the GNU Library General Public License as *\r
+ * published by the Free Software Foundation; either version 3 of the *\r
+ * License, or (at your option) any later version. *\r
+ * *\r
+ * This program is distributed in the hope that it will be useful, *\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
+ * GNU General Public License for more details. *\r
+ * *\r
+ * You should have received a copy of the GNU Library General Public *\r
+ * License along with this program; if not, write to the *\r
+ * Free Software Foundation, Inc., *\r
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
+ ***************************************************************************/\r
+#ifndef _MGL_DEFINE_H_\r
+#define _MGL_DEFINE_H_\r
+//-----------------------------------------------------------------------------\r
+#ifdef WIN32 //_MSC_VER needs this before math.h\r
+#define _USE_MATH_DEFINES\r
+#endif\r
+\r
+#include <math.h>\r
+#include <stdlib.h>\r
+#include <string.h>\r
+\r
+#define MGL_VER2 0.0\r
+\r
+//#ifdef WIN32\r
+#ifdef _MSC_VER\r
+#define hypot _hypot\r
+#define getcwd _getcwd\r
+#define isfinite _finite\r
+#define chdir _chdir // BORLAND has chdir\r
+#include <float.h>\r
+\r
+const unsigned long mgl_nan[2] = {0xffffffff, 0x7fffffff};\r
+#define NANd (*(double*)mgl_nan)\r
+#define NANf (*(float*)&(mgl_nan[1]))\r
+#if MGL_USE_DOUBLE\r
+#define NAN NANd\r
+#else\r
+#define NAN NANd\r
+#endif\r
+#endif\r
+\r
+#ifndef M_PI\r
+#define M_PI 3.14159265358979323846 /* pi */\r
+#endif\r
+//-----------------------------------------------------------------------------\r
+#ifdef WIN32\r
+#define mglprintf _snwprintf\r
+#else\r
+#define mglprintf swprintf\r
+#endif\r
+//#define FLT_EPS 1.1920928955078125e-07\r
+#define MGL_FLT_EPS (1.+1e-05)\r
+//-----------------------------------------------------------------------------\r
+#include "mgl2/config.h"\r
+//-----------------------------------------------------------------------------\r
+#if MGL_USE_DOUBLE\r
+typedef double mreal;\r
+#else\r
+typedef float mreal;\r
+#endif\r
+//-----------------------------------------------------------------------------\r
+#ifndef MGL_CMAP_COLOR\r
+#define MGL_CMAP_COLOR 32\r
+#endif\r
+//-----------------------------------------------------------------------------\r
+#ifndef MGL_STACK_ENTRY\r
+#define MGL_STACK_ENTRY 10\r
+#endif\r
+//-----------------------------------------------------------------------------\r
+#ifndef MGL_DEF_VIEWER\r
+#define MGL_DEF_VIEWER "evince"\r
+#endif\r
+//-----------------------------------------------------------------------------\r
+#ifndef MGL_FONT_PATH\r
+#ifdef WIN32\r
+#define MGL_FONT_PATH "." // path to fonts\r
+#else\r
+#define MGL_FONT_PATH "/usr/local/share/mathgl/fonts" // path to fonts\r
+#endif\r
+#endif\r
+//-----------------------------------------------------------------------------\r
+#define mgl_min(a,b) (((a)>(b)) ? (b) : (a))\r
+#define mgl_max(a,b) (((a)>(b)) ? (a) : (b))\r
+#define mgl_isnan(a) ((a)!=(a))\r
+//-----------------------------------------------------------------------------\r
+#define SMOOTH_NONE 0\r
+#define SMOOTH_LINE_3 1\r
+#define SMOOTH_LINE_5 2\r
+#define SMOOTH_QUAD_5 3\r
+//-----------------------------------------------------------------------------\r
+#define MGL_HIST_IN 0\r
+#define MGL_HIST_SUM 1\r
+#define MGL_HIST_UP 2\r
+#define MGL_HIST_DOWN 3\r
+//-----------------------------------------------------------------------------\r
+enum{ // types of predefined curvelinear coordinate systems\r
+ mglCartesian = 0, // no transformation\r
+ mglPolar,\r
+ mglSpherical,\r
+ mglParabolic,\r
+ mglParaboloidal,\r
+ mglOblate,\r
+ mglProlate,\r
+ mglElliptic,\r
+ mglToroidal,\r
+ mglBispherical,\r
+ mglBipolar,\r
+ mglLogLog,\r
+ mglLogX,\r
+ mglLogY\r
+};\r
+//-----------------------------------------------------------------------------\r
+// types of drawing\r
+#define MGL_DRAW_WIRE 0 // fastest, no faces\r
+#define MGL_DRAW_FAST 1 // fast, no color interpolation\r
+#define MGL_DRAW_NORM 2 // high quality, slower\r
+#define MGL_DRAW_LMEM 4 // low memory usage (direct to pixel)\r
+//-----------------------------------------------------------------------------\r
+enum{ // Codes for warnings/messages\r
+ mglWarnNone = 0,// Everything OK\r
+ mglWarnDim, // Data dimension(s) is incompatible\r
+ mglWarnLow, // Data dimension(s) is too small\r
+ mglWarnNeg, // Minimal data value is negative\r
+ mglWarnFile, // No file or wrong data dimensions\r
+ mglWarnMem, // Not enough memory\r
+ mglWarnZero, // Data values are zero\r
+ mglWarnLeg, // No legend entries\r
+ mglWarnSlc, // Slice value is out of range\r
+ mglWarnCnt, // Number of contours is zero or negative\r
+ mglWarnOpen, // Couldn't open file\r
+ mglWarnLId, // Light: ID is out of range\r
+ mglWarnSize, // Setsize: size(s) is zero or negative\r
+ mglWarnFmt, // Format is not supported for that build\r
+ mglWarnTern, // Axis ranges are incompatible\r
+ mglWarnNull, // Pointer is NULL\r
+ mglWarnSpc, // Not enough space for plot\r
+ mglWarnEnd // Maximal number of warnings (must be last)\r
+};\r
+//-----------------------------------------------------------------------------\r
+#ifndef MGL_DEF_PAL\r
+#define MGL_DEF_PAL "bgrcmyhlnqeupH" // default palette\r
+#endif\r
+#define MGL_COLORS "kwrgbcymhWRGBCYMHlenpquLENPQU"\r
+//-----------------------------------------------------------------------------\r
+#define MGL_TRANSP_NORM 0x000000\r
+#define MGL_TRANSP_GLASS 0x000001\r
+#define MGL_TRANSP_LAMP 0x000002\r
+#define MGL_ENABLE_CUT 0x000004 ///< Flag which determines how points outside bounding box are drown.\r
+#define MGL_ENABLE_RTEXT 0x000008 ///< Use text rotation along axis\r
+#define MGL_AUTO_FACTOR 0x000010 ///< Enable autochange PlotFactor\r
+#define MGL_ENABLE_ALPHA 0x000020 ///< Flag that Alpha is used\r
+#define MGL_ENABLE_LIGHT 0x000040 ///< Flag of using lightning\r
+#define MGL_TICKS_ROTATE 0x000080 ///< Allow ticks rotation\r
+#define MGL_TICKS_SKIP 0x000100 ///< Allow ticks rotation\r
+// flags for internal use only\r
+#define MGL_DISABLE_SCALE 0x000200 ///< Temporary flag for disable scaling (used for axis)\r
+#define MGL_FINISHED 0x000400 ///< Flag that final picture (i.e. mglCanvas::G) is ready\r
+//#define MGL_AUTO_CLF 0x000800 ///< Clear canvas between drawing\r
+#define MGL_SHOW_POS 0x001000 ///< Switch to show or not mouse click position\r
+#define MGL_CLF_ON_UPD 0x002000 ///< Clear plot before Update()\r
+//#define MGL_HIGHLIGHT 0x004000 ///< Highlight plot\r
+#define MGL_DIFFUSIVE 0x008000 ///< Use diffusive light instead of specular\r
+#define MGL_USEDRWDAT 0x010000 ///< Use DrwDat to remember all data of frames\r
+#define MGL_REDUCEACC 0x020000 ///< Reduce accuracy of points (to reduc size of output files)\r
+//-----------------------------------------------------------------------------\r
+//#define mgl_realloc(T,o,no,nn) {T *_tmp = new T[nn]; memcpy(_tmp,o,(no)*sizeof(T)); delete []o; o=_tmp;}\r
+//-----------------------------------------------------------------------------\r
+#ifdef __cplusplus\r
+//-----------------------------------------------------------------------------\r
+struct mglThreadD\r
+{\r
+ mreal *a; // float* array with parameters or results\r
+ const mreal *b,*c,*d,*e; // float* arrays with parameters\r
+ const long *p; // long* array with parameters\r
+ void *v; // pointer to data/grapher\r
+ int id; // thread id\r
+ long n; // total number of iteration\r
+ char *s;\r
+};\r
+/// Start several thread for the task\r
+void mglStartThread(void *(*func)(void *), void (*post)(mglThreadD *,mreal *), long n,\r
+ mreal *a=0, const mreal *b=0, const mreal *c=0, const long *p=0,\r
+ void *v=0, const mreal *d=0, const mreal *e=0, char *s=0);\r
+extern int mglNumThr; ///< Number of thread for plotting and data handling\r
+//-----------------------------------------------------------------------------\r
+extern "C" {\r
+#endif\r
+/** Set number of thread for plotting and data handling*/\r
+void mgl_set_num_thr(int n);\r
+void mgl_test_txt(const char *str, ...);\r
+void mgl_set_test_mode(int enable);\r
+/** Duplicate string (returned pointer must be free() after usage) */\r
+char *mgl_strdup(const char *s);\r
+wchar_t *mgl_wcsdup(const wchar_t *s);\r
+/** Remove spaces at begining and at the end of the string */\r
+void mgl_strtrim(char *str);\r
+void mgl_wcstrim(wchar_t *str);\r
+/** Change register to lowercase (only for ANSI symbols) */\r
+void mgl_strlwr(char *str);\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+#if MGL_HAVE_PTHREAD\r
+#include <pthread.h>\r
+#define MGL_PUSH(a,v,m) {pthread_mutex_lock(&m); a.push_back(v); pthread_mutex_unlock(&m);}\r
+#else\r
+#define MGL_PUSH(a,v,m) a.push_back(v);\r
+#endif\r
+//-----------------------------------------------------------------------------\r
+#endif\r
+//-----------------------------------------------------------------------------\r
--- /dev/null
+/***************************************************************************\r
+ * eval.h is part of Math Graphic Library\r
+ * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
+ * *\r
+ * This program is free software; you can redistribute it and/or modify *\r
+ * it under the terms of the GNU Library General Public License as *\r
+ * published by the Free Software Foundation; either version 3 of the *\r
+ * License, or (at your option) any later version. *\r
+ * *\r
+ * This program is distributed in the hope that it will be useful, *\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
+ * GNU General Public License for more details. *\r
+ * *\r
+ * You should have received a copy of the GNU Library General Public *\r
+ * License along with this program; if not, write to the *\r
+ * Free Software Foundation, Inc., *\r
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
+ ***************************************************************************/\r
+//---------------------------------------------------------------------------\r
+#ifndef _MGL_EVAL_H_\r
+#define _MGL_EVAL_H_\r
+//---------------------------------------------------------------------------\r
+#include <math.h>\r
+#include "mgl2/define.h"\r
+/// types of errors\r
+#define MGL_ERR_LOG 1\r
+#define MGL_ERR_ARC 2\r
+#define MGL_ERR_SQRT 3\r
+/// size of \a var array\r
+const int MGL_VS = 'z'-'a'+1;\r
+//---------------------------------------------------------------------------\r
+/// Class for evaluating formula specified by the string\r
+class mglFormula // îáúåêò äëÿ ââîäà è âû÷èñëåíèÿ ôîðìóë\r
+{\r
+public:\r
+ /// Evaluates the formula for 'x','r'=\a x, 'y','n'=\a y, 'z','t'=\a z, 'u'=\a u\r
+ mreal Calc(mreal x,mreal y=0,mreal z=0,mreal u=0) const;\r
+ /// Evaluates the formula for 'x, y, z, u, v, w'\r
+ mreal Calc(mreal x,mreal y,mreal z,mreal u,mreal v,mreal w) const;\r
+ /// Evaluates the formula for variables \a var\r
+ mreal Calc(const mreal var[MGL_VS]) const;\r
+ /// Evaluates the formula for 'x','r'=\a x, 'y','n'=\a y, 'z','t'=\a z, 'u'=\a u\r
+ mreal CalcD(char diff, mreal x,mreal y=0,mreal z=0,mreal u=0) const;\r
+ /// Evaluates the formula for 'x, y, z, u, v, w'\r
+ mreal CalcD(char diff, mreal x,mreal y,mreal z,mreal u,mreal v,mreal w) const;\r
+ /// Evaluates the derivates of the formula for variables \a var respect to variable \a diff\r
+ mreal CalcD(const mreal var[MGL_VS], char diff) const;\r
+ /// Return error code\r
+ int GetError() const;\r
+ /// Parse the formula \a str and create formula-tree\r
+ mglFormula(const char *str);\r
+ /// Clean up formula-tree\r
+ ~mglFormula();\r
+protected:\r
+ mreal CalcIn(const mreal *a1) const;\r
+ mreal CalcDIn(int id, const mreal *a1) const;\r
+ mglFormula *Left,*Right; // first and second argument of the function\r
+ int Kod; // the function ID\r
+ mreal Res; // the number or the variable ID\r
+ static int Error;\r
+};\r
+//---------------------------------------------------------------------------\r
+#endif\r
--- /dev/null
+/***************************************************************************\r
+ * evalc.h is part of Math Graphic Library\r
+ * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
+ * *\r
+ * This program is free software; you can redistribute it and/or modify *\r
+ * it under the terms of the GNU Library General Public License as *\r
+ * published by the Free Software Foundation; either version 3 of the *\r
+ * License, or (at your option) any later version. *\r
+ * *\r
+ * This program is distributed in the hope that it will be useful, *\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
+ * GNU General Public License for more details. *\r
+ * *\r
+ * You should have received a copy of the GNU Library General Public *\r
+ * License along with this program; if not, write to the *\r
+ * Free Software Foundation, Inc., *\r
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
+ ***************************************************************************/\r
+//---------------------------------------------------------------------------\r
+#ifndef _MGL_EVALC_H_\r
+#define _MGL_EVALC_H_\r
+//---------------------------------------------------------------------------\r
+#include <complex>\r
+#ifndef dual\r
+#define dual std::complex<double> ///< short name for complex numbers\r
+#endif\r
+#include "mgl2/eval.h"\r
+//---------------------------------------------------------------------------\r
+/// Class for evaluating formula specified by the string\r
+class mglFormulaC // ������ ��� ����� � ���������� ������\r
+{\r
+public:\r
+ /// Evaluates the formula for 'x','r'=\a x, 'y','n'=\a y, 'z','t'=\a z, 'u'=\a u\r
+ dual Calc(dual x,dual y=0,dual z=0,dual u=0) const;\r
+ /// Evaluates the formula for 'x, y, z, u, v, w'\r
+ dual Calc(dual x,dual y,dual z,dual u,dual v,dual w) const;\r
+ /// Evaluates the formula for variables \a var\r
+ dual Calc(const dual var[MGL_VS]) const;\r
+ /// Return error code\r
+ int GetError() const;\r
+ /// Parse the formula \a str and create formula-tree\r
+ mglFormulaC(const char *str);\r
+ /// Clean up formula-tree\r
+ virtual ~mglFormulaC();\r
+protected:\r
+ dual CalcIn(const dual *a1) const;\r
+ mglFormulaC *Left,*Right; // first and second argument of the function\r
+ int Kod; // the function ID\r
+ dual Res; // the number or the variable ID\r
+ static int Error;\r
+};\r
+//---------------------------------------------------------------------------\r
+#endif\r
--- /dev/null
+/***************************************************************************\r
+ * fit.h is part of Math Graphic Library\r
+ * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
+ * *\r
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Library General Public License as *
+ * published by the Free Software Foundation; either version 3 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef _MGL_FIT_H_\r
+#define _MGL_FIT_H_
+#include "mgl2/base.h"\r
+/*****************************************************************************/\r
+#ifdef __cplusplus
+extern "C" {\r
+#endif\r
+/*****************************************************************************/
+extern int mglFitPnts; ///< Number of output points in fitting
+extern char mglFitRes[1024]; ///< Last fitted formula\r
+HMDT mgl_fit_1(HMGL gr, HCDT y, const char *eq, const char *var, HMDT ini, const char *opt);\r
+HMDT mgl_fit_2(HMGL gr, HCDT z, const char *eq, const char *var, HMDT ini, const char *opt);\r
+HMDT mgl_fit_3(HMGL gr, HCDT a, const char *eq, const char *var, HMDT ini, const char *opt);\r
+HMDT mgl_fit_xy(HMGL gr, HCDT x, HCDT y, const char *eq, const char *var, HMDT ini, const char *opt);\r
+HMDT mgl_fit_xyz(HMGL gr, HCDT x, HCDT y, HCDT z, const char *eq, const char *var, HMDT ini, const char *opt);\r
+HMDT mgl_fit_xyza(HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *eq, const char *var, HMDT ini, const char *opt);\r
+HMDT mgl_fit_ys(HMGL gr, HCDT y, HCDT s, const char *eq, const char *var, HMDT ini, const char *opt);\r
+HMDT mgl_fit_xys(HMGL gr, HCDT x, HCDT y, HCDT s, const char *eq, const char *var, HMDT ini, const char *opt);\r
+HMDT mgl_fit_xyzs(HMGL gr, HCDT x, HCDT y, HCDT z, HCDT s, const char *eq, const char *var, HMDT ini, const char *opt);\r
+HMDT mgl_fit_xyzas(HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, HCDT s, const char *eq, const char *var, HMDT ini, const char *opt);\r
+\r
+const char *mgl_get_fit(HMGL gr);\r
+
+HMDT mgl_hist_x(HMGL gr, HCDT x, HCDT a, const char *opt);\r
+HMDT mgl_hist_xy(HMGL gr, HCDT x, HCDT y, HCDT a, const char *opt);\r
+HMDT mgl_hist_xyz(HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *opt);\r
+
+/*****************************************************************************/\r
+uintptr_t mgl_fit_1_(uintptr_t* gr, uintptr_t* y, const char *eq, const char *var, uintptr_t *ini, const char *opt,int, int l, int n);\r
+uintptr_t mgl_fit_2_(uintptr_t* gr, uintptr_t* z, const char *eq, const char *var, uintptr_t *ini, const char *opt,int, int l, int n);\r
+uintptr_t mgl_fit_3_(uintptr_t* gr, uintptr_t* a, const char *eq, const char *var, uintptr_t *ini, const char *opt,int, int l, int n);\r
+uintptr_t mgl_fit_xy_(uintptr_t* gr, uintptr_t* x, uintptr_t* y, const char *eq, const char *var, uintptr_t *ini, const char *opt,int, int l, int n);\r
+uintptr_t mgl_fit_xyz_(uintptr_t* gr, uintptr_t* x, uintptr_t* y, uintptr_t* z, const char *eq, const char *var, uintptr_t *ini, const char *opt,int, int l, int n);\r
+uintptr_t mgl_fit_xyza_(uintptr_t* gr, uintptr_t* x, uintptr_t* y, uintptr_t* z, uintptr_t* a, const char *eq, const char *var, uintptr_t *ini, const char *opt,int, int l, int n);\r
+uintptr_t mgl_fit_ys_(uintptr_t* gr, uintptr_t* y, uintptr_t* ss, const char *eq, const char *var, uintptr_t *ini, const char *opt,int, int l, int n);\r
+uintptr_t mgl_fit_xys_(uintptr_t* gr, uintptr_t* x, uintptr_t* y, uintptr_t* ss, const char *eq, const char *var, uintptr_t *ini, const char *opt,int, int l, int n);\r
+uintptr_t mgl_fit_xyzs_(uintptr_t* gr, uintptr_t* x, uintptr_t* y, uintptr_t* z, uintptr_t* ss, const char *eq, const char *var, uintptr_t *ini, const char *opt,int, int l, int n);\r
+uintptr_t mgl_fit_xyzas_(uintptr_t* gr, uintptr_t* x, uintptr_t* y, uintptr_t* z, uintptr_t* a, uintptr_t* ss, const char *eq, const char *var, uintptr_t *ini, const char *opt,int, int l, int n);\r
+
+uintptr_t mgl_hist_x_(uintptr_t* gr, uintptr_t* x, uintptr_t* a, const char *opt,int);
+uintptr_t mgl_hist_xy_(uintptr_t* gr, uintptr_t* x, uintptr_t* y, uintptr_t* a, const char *opt,int);
+uintptr_t mgl_hist_xyz_(uintptr_t* gr, uintptr_t* x, uintptr_t* y, uintptr_t* z, uintptr_t* a, const char *opt,int);
+/*****************************************************************************/\r
+#ifdef __cplusplus\r
+}\r
+#endif
+/*****************************************************************************/\r
+#endif
--- /dev/null
+/***************************************************************************\r
+ * window.h is part of Math Graphic Library\r
+ * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
+ * *\r
+ * This program is free software; you can redistribute it and/or modify *\r
+ * it under the terms of the GNU Library General Public License as *\r
+ * published by the Free Software Foundation; either version 3 of the *\r
+ * License, or (at your option) any later version. *\r
+ * *\r
+ * This program is distributed in the hope that it will be useful, *\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
+ * GNU General Public License for more details. *\r
+ * *\r
+ * You should have received a copy of the GNU Library General Public *\r
+ * License along with this program; if not, write to the *\r
+ * Free Software Foundation, Inc., *\r
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
+ ***************************************************************************/\r
+//-----------------------------------------------------------------------------\r
+#ifndef _MGL_FLTK_H_\r
+#define _MGL_FLTK_H_\r
+/*****************************************************************************/\r
+#ifdef __cplusplus\r
+#include "mgl2/canvas_wnd.h"\r
+#if MGL_HAVE_FLTK\r
+//-----------------------------------------------------------------------------\r
+#ifdef __MWERKS__\r
+# define FL_DLL\r
+#endif\r
+\r
+#include <FL/Fl.H>\r
+#include <Fl/Fl_Window.H>\r
+#include <Fl/Fl_Scroll.H>\r
+#include <FL/Fl_Button.H>\r
+#include <FL/Fl_Counter.H>\r
+#include <FL/Fl_Menu_Bar.H>\r
+//-----------------------------------------------------------------------------\r
+/// Class is FLTK widget which display MathGL graphics\r
+class Fl_MathGL : public Fl_Widget\r
+{\r
+public:\r
+ Fl_Valuator *tet_val; ///< pointer to external tet-angle validator\r
+ Fl_Valuator *phi_val; ///< pointer to external phi-angle validator\r
+\r
+ Fl_MathGL(int x, int y, int w, int h, char *label=0);\r
+ ~Fl_MathGL();\r
+\r
+ /// Update (redraw) plot\r
+ virtual void update();\r
+ /// Set angles for additional plot rotation\r
+ inline void set_angle(float t, float p){ tet = t; phi = p; }\r
+ /// Set bitwise flags for general state (1-Alpha, 2-Light)\r
+ inline void set_flag(int f) { flag = f; }\r
+ /// Set flags for handling mouse\r
+ void set_graph(mglCanvas *gr); ///< Set grapher object\r
+ inline void set_graph(mglGraph *Gr)\r
+ { set_graph(dynamic_cast<mglCanvas *>(Gr->Self())); }\r
+ /// Get pointer to grapher\r
+ inline HMGL get_graph() { return gr; }\r
+ /// Set drawing functions and its parameter\r
+ inline void set_draw(int (*func)(mglBase *gr, void *par), void *par=0)\r
+ { draw_func = func; draw_par = par; }\r
+ inline void set_draw(mglDraw *dr)\r
+ { set_draw(mgl_draw_class,(void*)dr); }\r
+ inline void set_draw(int (*dr)(mglGraph *gr))\r
+ { set_draw(mgl_draw_graph,(void*)dr); }\r
+ void set_state(bool z, bool r) { zoom = z; rotate = r; }\r
+ /// Set zoom in/out region\r
+ inline void set_zoom(mreal X1, mreal Y1, mreal X2, mreal Y2)\r
+ { x1 = X1; x2 = X2; y1 = Y1; y2 = Y2; update(); };\r
+ /// Get zoom region\r
+ inline void get_zoom(mreal *X1, mreal *Y1, mreal *X2, mreal *Y2)\r
+ { *X1 = x1; *X2 = x2; *Y1 = y1; *Y2 = y2; };\r
+ /// Set popup menu pointer\r
+ inline void set_popup(const Fl_Menu_Item *pmenu, Fl_Widget *wdg, void *v)\r
+ { popup = pmenu; wpar = wdg; vpar = v; }\r
+ inline void zoom_region(float xx1,float xx2,float yy1, float yy2)\r
+ { x1=xx1; y1=yy1; x2=xx2; y2=yy2; }\r
+ \r
+protected:\r
+ mglCanvas *gr; ///< pointer to grapher\r
+ void *draw_par; ///< Parameters for drawing function mglCanvasWnd::DrawFunc.\r
+ /// Drawing function for window procedure. It should return the number of frames.\r
+ int (*draw_func)(mglBase *gr, void *par);\r
+\r
+ const Fl_Menu_Item *popup; ///< pointer to popup menu items\r
+ Fl_Widget *wpar; ///< widget for popup menu\r
+ void *vpar; ///< parameter for popup menu\r
+ float tet,phi; ///< rotation angles\r
+ bool rotate; ///< flag for handle mouse\r
+ bool zoom; ///< flag for zoom by mouse\r
+ bool wire;\r
+ float x1,x2,y1,y2; ///< zoom region\r
+ int flag; ///< bitwise flag for general state (1-Alpha, 2-Light)\r
+ int x0,y0,xe,ye; ///< mouse position\r
+ char pos[128];\r
+\r
+ virtual void draw(); ///< quick drawing function\r
+ int handle(int code); ///< handle mouse events\r
+ void resize(int x, int y, int w, int h); ///< resize control\r
+};\r
+//-----------------------------------------------------------------------------\r
+class Fl_MGLView : public Fl_Window\r
+{\r
+public:\r
+ Fl_MathGL *FMGL; ///< Control which draw graphics\r
+ Fl_Scroll *scroll;\r
+ Fl_Menu_Bar *menu;\r
+\r
+ void *par; ///< Parameter for handling animation\r
+ void (*next)(void*); ///< Callback function for next frame\r
+ void (*prev)(void*); ///< Callback function for prev frame\r
+ float (*delay)(void*); ///< Callback function for delay\r
+ void (*reload)(void*); ///< Callback function for reloading\r
+\r
+ void toggle_alpha() { toggle(alpha, alpha_bt, "Graphics/Alpha"); }\r
+ void toggle_light() { toggle(light, light_bt, "Graphics/Light"); }\r
+ void toggle_sshow() { toggle(sshow, anim_bt, "Graphics/Slideshow"); }\r
+ void toggle_wire() { toggle(wire, wire_bt, "Graphics/Wire"); }\r
+ void toggle_zoom() { toggle(zoom, zoom_bt); }\r
+ void toggle_rotate(){ toggle(rotate, rotate_bt); }\r
+ void setoff_zoom() { setoff(zoom,zoom_bt); }\r
+ void setoff_rotate(){ setoff(rotate, rotate_bt); }\r
+ bool is_sshow() { return sshow; }\r
+\r
+ Fl_MGLView(int x, int y, int w, int h, char *label=0);\r
+ ~Fl_MGLView();\r
+ void update(); ///< Update picture by calling user drawing function\r
+protected:\r
+ Fl_Button *alpha_bt, *light_bt, *rotate_bt, *anim_bt, *zoom_bt, *wire_bt;\r
+// Fl_Counter *tet, *phi;\r
+\r
+ int wire, alpha, light; ///< Current states of wire, alpha, light switches (toggle buttons)\r
+ int sshow, rotate, zoom;///< Current states of slideshow, rotate, zoom switches (toggle buttons)\r
+\r
+ void toggle(int &val, Fl_Button *b, const char *txt=NULL);\r
+ void setoff(int &val, Fl_Button *b, const char *txt=NULL);\r
+};\r
+//-----------------------------------------------------------------------------\r
+/// Class allows the window creation for displaying plot bitmap with the help of FLTK library\r
+/** NOTE!!! All frames are saved in memory. So animation with many frames require a lot memory and CPU time (for example, for mouse rotation).*/\r
+class mglCanvasFL : public mglCanvasWnd\r
+{\r
+public:\r
+using mglCanvasWnd::Window;\r
+ Fl_Window *Wnd; ///< Pointer to window\r
+ Fl_MGLView *mgl; ///< Pointer to MGL widget with buttons\r
+\r
+ mglCanvasFL();\r
+ ~mglCanvasFL();\r
+\r
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Ñëóæåáíûå ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r
+ /// Create a window for plotting. Now implemeted only for GLUT.\r
+ void Window(int argc, char **argv, int (*draw)(mglBase *gr, void *p), const char *title,\r
+ void *par=NULL, void (*reload)(void *p)=NULL, bool maximize=false);\r
+ /// Switch on/off transparency (do not overwrite switches in user drawing function)\r
+ void ToggleAlpha();\r
+ /// Switch on/off lighting (do not overwrite switches in user drawing function)\r
+ void ToggleLight();\r
+ void ToggleRotate(); ///< Switch on/off rotation by mouse\r
+ void ToggleZoom(); ///< Switch on/off zooming by mouse\r
+ void ToggleNo(); ///< Switch off all zooming and rotation\r
+ void Update(); ///< Update picture by calling user drawing function\r
+ void Adjust(); ///< Adjust size of bitmap to window size\r
+ void GotoFrame(int d); ///< Show arbitrary frame (use relative step)\r
+ void Animation(); ///< Run animation (I'm too lasy to change it)\r
+};\r
+//-----------------------------------------------------------------------------\r
+void mgl_ask_fltk(const wchar_t *quest, wchar_t *res);\r
+//-----------------------------------------------------------------------------\r
+#else\r
+#error "Please enable FLTK support"\r
+#endif\r
+#endif\r
+#endif\r
--- /dev/null
+/***************************************************************************\r
+ * font.h is part of Math Graphic Library\r
+ * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
+ * *\r
+ * This program is free software; you can redistribute it and/or modify *\r
+ * it under the terms of the GNU Library General Public License as *\r
+ * published by the Free Software Foundation; either version 3 of the *\r
+ * License, or (at your option) any later version. *\r
+ * *\r
+ * This program is distributed in the hope that it will be useful, *\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
+ * GNU General Public License for more details. *\r
+ * *\r
+ * You should have received a copy of the GNU Library General Public *\r
+ * License along with this program; if not, write to the *\r
+ * Free Software Foundation, Inc., *\r
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
+ ***************************************************************************/\r
+//-----------------------------------------------------------------------------\r
+#ifndef _MGL_FONT_H_\r
+#define _MGL_FONT_H_\r
+\r
+#include <stdio.h>\r
+#include "mgl2/define.h"\r
+//-----------------------------------------------------------------------------\r
+#define MGL_FONT_BOLD 0x01000000 // This value is used binary\r
+#define MGL_FONT_ITAL 0x02000000 // This value is used binary\r
+#define MGL_FONT_BOLD_ITAL 0x03000000\r
+#define MGL_FONT_WIRE 0x04000000\r
+#define MGL_FONT_OLINE 0x08000000 // This value is used binary\r
+#define MGL_FONT_ULINE 0x10000000\r
+#define MGL_FONT_ZEROW 0x20000000 // internal codes\r
+#define MGL_FONT_UPPER 0x40000000\r
+#define MGL_FONT_LOWER 0x80000000\r
+#define MGL_FONT_ROMAN 0xfcffffff\r
+#define MGL_FONT_MASK 0x00ffffff\r
+#define MGL_COLOR_MASK 0xffffff00\r
+#define MGL_FONT_STYLE 0x3f000000\r
+//-----------------------------------------------------------------------------\r
+#ifdef WIN32 // a man ask to use built-in font under Windows\r
+#define MGL_DEF_FONT_NAME 0\r
+#else\r
+#define MGL_DEF_FONT_NAME "STIX"\r
+#endif\r
+//-----------------------------------------------------------------------------\r
+struct mglTeXsymb { unsigned kod; const wchar_t *tex; };\r
+/// Get font color, style and align for internal parser\r
+char mglGetStyle(const char *how, int *font, int *align=0);\r
+class mglBase;\r
+//-----------------------------------------------------------------------------\r
+/// Class for incapsulating font plotting procedures\r
+class mglFont\r
+{\r
+public:\r
+ mglBase *gr; ///< mglBase class used for drawing characters\r
+ mglFont(const char *name=0, const char *path=0);\r
+ ~mglFont();\r
+ bool parse; ///< Parse LaTeX symbols\r
+\r
+ /// Load font data to memory. Normally used by constructor.\r
+ bool Load(const char *base, const char *path=0);\r
+ /// Free memory\r
+ void Clear();\r
+ /// Copy data from other font\r
+ void Copy(mglFont *);\r
+ /// Restore default font\r
+ void Restore();\r
+ /// Return true if font is loaded\r
+ inline bool Ready() const { return numg!=0; };\r
+\r
+ /// Get height of text\r
+ float Height(int font) const;\r
+ /// Get height of text\r
+ float Height(const char *how) const;\r
+ /// Print text string for font specified by string\r
+ float Puts(const char *str,const char *how,float col) const;\r
+ /// Get width of text string for font specified by string\r
+ float Width(const char *str,const char *how) const;\r
+ /// Print text string for font specified by string\r
+ float Puts(const wchar_t *str,const char *how,float col) const;\r
+ /// Get width of text string for font specified by string\r
+ float Width(const wchar_t *str,const char *how) const;\r
+\r
+ /// Return number of glyphs\r
+ inline unsigned GetNumGlyph() const { return numg; };\r
+ /// Return some of pointers\r
+ inline const short *GetTr(int s, long j) const { return Buf+tr[s][j]; };\r
+ inline const short *GetLn(int s, long j) const { return Buf+ln[s][j]; };\r
+ inline int GetNt(int s, long j) const { return numt[s][j]; };\r
+ inline int GetNl(int s, long j) const { return numl[s][j]; };\r
+ inline float GetFact(int s) const { return fact[s]; };\r
+protected:\r
+ wchar_t *id; ///< Unicode ID for glyph\r
+ unsigned *tr[4]; ///< Shift of glyph description by triangles (for solid font)\r
+ unsigned *ln[4]; ///< Shift of glyph description by lines (for wire font)\r
+ short *numt[4]; ///< Number of triangles in glyph description (for solid font)\r
+ short *numl[4]; ///< Number of lines in glyph description (for wire font)\r
+ short *width[4]; ///< Width of glyph for wire font\r
+ float fact[4]; ///< Divider for width of glyph\r
+ unsigned numg; ///< Number of glyphs\r
+ short *Buf; ///< Buffer for glyph descriptions\r
+ long numb; ///< Buffer size\r
+\r
+ /// Print text string for font specified by integer constant\r
+ float Puts(const wchar_t *str,int font,int align, float col) const;\r
+ /// Get width of text string for font specified by integer constant\r
+ float Width(const wchar_t *str,int font=0) const;\r
+ /// Replace TeX symbols by its UTF code and add font styles\r
+ void Convert(const wchar_t *str, unsigned *res) const;\r
+\r
+ /// Draw string recursively\r
+ /* x,y - position, f - factor, style: 0x1 - italic, 0x2 - bold, 0x4 - overline, 0x8 - underline, 0x10 - empty (not draw) */\r
+ float Puts(const unsigned *str, float x,float y,float f,int style,float col) const;\r
+ /// Parse LaTeX command\r
+ unsigned Parse(const wchar_t *s) const;\r
+ /// Get internal code for symbol\r
+ long Internal(unsigned s) const;\r
+\r
+ /// Get symbol for character \a ch with given \a font style\r
+ unsigned Symbol(char ch) const;\r
+private:\r
+ float get_ptr(long &i,unsigned *str, unsigned **b1, unsigned **b2,float &w1,float &w2, float f1, float f2, int st) const;\r
+ bool read_data(const char *fname, float *ff, short *wdt, short *numl, unsigned *posl, short *numt, unsigned *post, unsigned &cur);\r
+ void main_copy();\r
+ bool read_main(const char *fname, unsigned &cur);\r
+ void mem_alloc();\r
+ bool read_def(unsigned &cur);\r
+ void draw_ouline(int st, float x, float y, float f, float g, float ww, float ccol) const;\r
+};\r
+//-----------------------------------------------------------------------------\r
+#endif\r
+//-----------------------------------------------------------------------------\r
--- /dev/null
+/***************************************************************************\r
+ * mgl_glut.h is part of Math Graphic Library\r
+ * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
+ * *\r
+ * This program is free software; you can redistribute it and/or modify *\r
+ * it under the terms of the GNU Library General Public License as *\r
+ * published by the Free Software Foundation; either version 3 of the *\r
+ * License, or (at your option) any later version. *\r
+ * *\r
+ * This program is distributed in the hope that it will be useful, *\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
+ * GNU General Public License for more details. *\r
+ * *\r
+ * You should have received a copy of the GNU Library General Public *\r
+ * License along with this program; if not, write to the *\r
+ * Free Software Foundation, Inc., *\r
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
+ ***************************************************************************/\r
+//-----------------------------------------------------------------------------\r
+#ifndef _MGL_GLUT_H_\r
+#define _MGL_GLUT_H_\r
+#ifdef __cplusplus\r
+#include "mgl2/opengl.h"\r
+#include "mgl2/window.h"\r
+//-----------------------------------------------------------------------------\r
+extern "C" {\r
+#endif\r
+/*****************************************************************************/\r
+void _mgl_key_up(unsigned char ch,int ,int );\r
+HMGL mgl_create_graph_glut(int (*draw)(HMGL gr, void *p), const char *title, void *par, void (*load)(void *p));\r
+/*****************************************************************************/\r
+#ifdef __cplusplus\r
+}\r
+/// Class allows the window creation under OpenGL with the help of GLUT library\r
+class mglCanvasGLUT : public mglCanvasGL\r
+{\r
+friend void _mgl_display();\r
+friend void _mgl_key_up(unsigned char ch,int ,int );\r
+friend void _mgl_timer(int);\r
+public:\r
+ float Delay; ///< Delay for animation in seconds\r
+ bool AutoClf; ///< Clear canvas between drawing\r
+\r
+ mglCanvasGLUT();\r
+ mglCanvasGLUT(int (*draw)(mglGraph *gr, void *p), const char *title, void *par=NULL,\r
+ void (*reload)(int next, void *p)=NULL, bool maximize=false);\r
+ virtual ~mglCanvasGLUT();\r
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ��������� ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r
+ /// Create a window for plotting. Now implemeted only for GLUT.\r
+ void Window(int argc, char **argv, int (*draw)(mglBase *gr, void *p),\r
+ const char *title,void *par=NULL,\r
+ void (*reload)(void *p)=NULL, bool maximize=false);\r
+ void Window(int argc, char **argv, int (*draw)(mglGraph *gr),\r
+ const char *title, bool maximize=false)\r
+ { Window(argc,argv,mgl_draw_graph,title,(void*)draw,0,maximize); }\r
+ /// Create a window for plotting based on class mglDraw.\r
+ void Window(int argc, char **argv, const char *title, mglDraw *draw, bool maximize=false)\r
+ { Window(argc, argv, mgl_draw_class, title, draw, mgl_reload_class, maximize); }\r
+ /// Switch on/off transparency (do not overwrite switches in user drawing function)\r
+ void ToggleAlpha() { _mgl_key_up('r',0,0); }\r
+ /// Switch on/off lighting (do not overwrite switches in user drawing function)\r
+ void ToggleLight() { _mgl_key_up('f',0,0); }\r
+ void ToggleNo() { _mgl_key_up('n',0,0); } ///< Switch off all zooming and rotation\r
+ void Update() { _mgl_key_up(' ',0,0); } ///< Update picture by calling user drawing function\r
+ void ReLoad(bool o) { _mgl_key_up(o?']':'[',0,0); } ///< Reload user data and update picture\r
+ void NextFrame() { _mgl_key_up('.',0,0); } ///< Show next frame (if one)\r
+ void PrevFrame() { _mgl_key_up(',',0,0); } ///< Show previous frame (if one)\r
+ void Animation() { _mgl_key_up('m',0,0); } ///< Run slideshow (animation) of frames\r
+private:\r
+ void (*LoadFunc)(void *par);\r
+ void *FuncPar; ///< Parameters for drawing function mglCanvas::DrawFunc.\r
+ /// Drawing function for window procedure. It should return the number of frames.\r
+ int (*DrawFunc)(mglBase *gr, void *par);\r
+ int NumFig; ///< Number of figures in the list. If 0 then no list and mglCanvas::DrawFunc will called for each drawing.\r
+ int curr_fig; ///< Current figure in the list.\r
+ int tt; ///< Temporal variable\r
+};\r
+//-----------------------------------------------------------------------------\r
+class mglGLUT: public mglGraph\r
+{\r
+public:\r
+ mglGLUT(int (*draw)(HMGL gr, void *p), const char *title="MathGL", void *par=0, void (*load)(void *p)=0) : mglGraph(-1)\r
+ { gr = mgl_create_graph_glut(draw,title,par,load); }\r
+ mglGLUT(int (*draw)(mglGraph *gr), const char *title="MathGL") : mglGraph(-1)\r
+ { gr = mgl_create_graph_glut(mgl_draw_graph,title,(void*)draw,0); }\r
+ mglGLUT(mglDraw *dr=0, const char *title="MathGL") : mglGraph(-1)\r
+ { mgl_create_graph_glut(mgl_draw_class,title,dr,0); }\r
+};\r
+//-----------------------------------------------------------------------------\r
+#endif\r
+#endif\r
--- /dev/null
+/***************************************************************************\r
+ * mgl.h is part of Math Graphic Library\r
+ * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
+ * *\r
+ * This program is free software; you can redistribute it and/or modify *\r
+ * it under the terms of the GNU General Public License as published by *\r
+ * the Free Software Foundation; either version 2 of the License, or *\r
+ * (at your option) any later version. *\r
+ * *\r
+ * This program is distributed in the hope that it will be useful, *\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
+ * GNU General Public License for more details. *\r
+ * *\r
+ * You should have received a copy of the GNU General Public License *\r
+ * along with this program; if not, write to the *\r
+ * Free Software Foundation, Inc., *\r
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
+ ***************************************************************************/\r
+#ifndef _MGL_H_\r
+#define _MGL_H_\r
+\r
+#include "mgl2/define.h"\r
+#include "mgl2/mgl_cf.h"\r
+#include "mgl2/data.h"\r
+#ifndef NO_OPENGL\r
+#include "mgl2/opengl.h"\r
+#endif\r
+//-----------------------------------------------------------------------------\r
+/// Wrapper class for all graphics\r
+class mglGraph\r
+{\r
+protected:\r
+ HMGL gr;\r
+public:\r
+ inline mglGraph(int kind=0, int width=600, int height=400)\r
+ {\r
+ if(kind==-1) gr=NULL;\r
+#ifndef NO_OPENGL\r
+ else if(kind==1) gr=mgl_create_graph_gl();\r
+#endif\r
+// else if(kind==2) gr=mgl_create_graph_idtf();\r
+ else gr=mgl_create_graph(width, height);\r
+ }\r
+ inline mglGraph(const mglGraph &graph)\r
+ { gr = graph.gr; mgl_use_graph(gr,1); }\r
+ inline mglGraph(HMGL graph)\r
+ { gr = graph; mgl_use_graph(gr,1); }\r
+ virtual ~mglGraph()\r
+ { if(mgl_use_graph(gr,-1)<1) mgl_delete_graph(gr); }\r
+ /// Get pointer to internal mglCanvas object\r
+ inline HMGL Self() { return gr; }\r
+ /// Set default parameter for plotting\r
+ inline void DefaultPlotParam() { mgl_set_def_param(gr); }\r
+ /// Set name of plot for saving filename\r
+ inline void SetPlotId(const char *id) { mgl_set_plotid(gr,id); }\r
+\r
+ /// Set the transparency on/off.\r
+ inline void Alpha(bool enable) { mgl_set_alpha(gr, enable); }\r
+ /// Set default value of alpha-channel\r
+ inline void SetAlphaDef(float alpha) { mgl_set_alpha_default(gr, alpha); }\r
+ /// Set the transparency type (0 - usual, 1 - glass, 2 - lamp)\r
+ inline void SetTranspType(int type) { mgl_set_transp_type(gr, type);}\r
+\r
+ /// Set the using of light on/off.\r
+ inline void Light(bool enable) { mgl_set_light(gr, enable); }\r
+ /// Switch on/off the specified light source.\r
+ inline void Light(int n,bool enable) { mgl_set_light_n(gr, n, enable); }\r
+ /// Use diffusive light (only for local light sources)\r
+ inline void SetDifLight(bool dif) { mgl_set_light_dif(gr, dif); }\r
+ /// Add a light source.\r
+ inline void AddLight(int n, mglPoint p, char col='w', float bright=0.5, float ap=0)\r
+ { mgl_add_light_ext(gr, n, p.x, p.y, p.z, col, bright, ap); }\r
+ inline void AddLight(int n, mglPoint r, mglPoint p, char col='w', float bright=0.5, float ap=0)\r
+ { mgl_add_light_loc(gr, n, r.x, r.y, r.z, p.x, p.y, p.z, col, bright, ap); }\r
+ /// Set ambient light brightness\r
+ inline void SetAmbient(float i) { mgl_set_ambbr(gr, i); }\r
+ /// Set the fog distance or switch it off (if d=0).\r
+ inline void Fog(float d, float dz=0.25) { mgl_set_fog(gr, d, dz); }\r
+\r
+ /// Set relative width of rectangles in Bars, Barh, BoxPlot\r
+ inline void SetBarWidth(float width) { mgl_set_bar_width(gr, width); }\r
+ /// Set size of marks\r
+ inline void SetMarkSize(float size) { mgl_set_mark_size(gr, size); }\r
+ /// Set size of arrows\r
+ inline void SetArrowSize(float size) { mgl_set_arrow_size(gr, size); }\r
+ /// Set number of mesh lines\r
+ inline void SetMeshNum(int num) { mgl_set_meshnum(gr, num); }\r
+\r
+ /// Set cutting for points outside of bounding box\r
+ inline void SetCut(bool cut) { mgl_set_cut(gr, cut); }\r
+ /// Set additional cutting box\r
+ inline void SetCutBox(mglPoint p1, mglPoint p2)\r
+ { mgl_set_cut_box(gr, p1.x, p1.y, p1.z, p2.x, p2.y, p2.z); }\r
+ /// Set the cutting off condition (formula)\r
+ inline void CutOff(const char *EqC) { mgl_set_cutoff(gr, EqC); }\r
+\r
+ /// Set default font size\r
+ inline void SetFontSize(float size) { mgl_set_font_size(gr, size); }\r
+ /// Set default font style and color\r
+ inline void SetFontDef(const char *fnt) { mgl_set_font_def(gr, fnt); }\r
+ /// Set FontSize by size in pt and picture DPI (default is 16 pt for dpi=72)\r
+ virtual void SetFontSizePT(float pt, int dpi=72){ SetFontSize(pt*27.f/dpi); }\r
+ /// Set FontSize by size in centimeters and picture DPI (default is 0.56 cm = 16 pt)\r
+ inline void SetFontSizeCM(float cm, int dpi=72) { SetFontSizePT(cm*28.45f,dpi); }\r
+ /// Set FontSize by size in inch and picture DPI (default is 0.22 in = 16 pt)\r
+ inline void SetFontSizeIN(float in, int dpi=72) { SetFontSizePT(in*72.27f,dpi); }\r
+ /// Load font from file\r
+ inline void LoadFont(const char *name, const char *path=NULL)\r
+ { mgl_load_font(gr, name, path); }\r
+ /// Copy font from another mglGraph instance\r
+ inline void CopyFont(mglGraph *GR) { mgl_copy_font(gr, GR->Self());}\r
+ /// Restore font\r
+ inline void RestoreFont() { mgl_restore_font(gr); }\r
+ /// Set to use or not text rotation\r
+ inline void SetRotatedText(bool rotated) { mgl_set_rotated_text(gr, rotated); }\r
+\r
+ /// Set default palette\r
+ inline void SetPalette(const char *colors) { mgl_set_palette(gr, colors); }\r
+ /// Set default color scheme\r
+ inline void SetDefScheme(const char *sch) { mgl_set_def_sch(gr, sch); }\r
+\r
+ /// Get last warning code\r
+ inline int GetWarn() { return mgl_get_warn(gr);}\r
+ /// Set warning code ant fill message\r
+ inline void SetWarn(int code, const char *info="") { mgl_set_warn(gr,code,info); }\r
+ /// Set buffer for warning messages\r
+ inline const char *Message() { return mgl_get_mess(gr); }\r
+\r
+ /// Set range in direction dir as [v1, v2]\r
+ inline void SetRange(char dir, float v1, float v2)\r
+ { mgl_set_range_val(gr, dir, v1, v2); }\r
+ /// Set range in direction dir as minimal and maximal values of data a\r
+ inline void SetRange(char dir, const mglDataA &dat, bool add=false)\r
+ { mgl_set_range_dat(gr, dir, &dat, add); }\r
+ /// Set values of mglGraph::Min and mglGraph::Max as minimal and maximal values of datas\r
+ inline void SetRanges(const mglData &xx, const mglData &yy, const mglData &zz, const mglData &cc)\r
+ { mgl_set_range_dat(gr,'x',&xx,0); mgl_set_range_dat(gr,'y',&yy,0);\r
+ mgl_set_range_dat(gr,'z',&zz,0); mgl_set_range_dat(gr,'c',&cc,0); }\r
+ /// Set values of mglGraph::Min and mglGraph::Max as minimal and maximal values of datas\r
+ inline void SetRanges(const mglData &xx, const mglData &yy, const mglData &zz)\r
+ { mgl_set_range_dat(gr,'x',&xx,0); mgl_set_range_dat(gr,'y',&yy,0);\r
+ mgl_set_range_dat(gr,'z',&zz,0); mgl_set_range_dat(gr,'c',&zz,0); }\r
+ /// Set values of mglGraph::Min and mglGraph::Max as minimal and maximal values of datas\r
+ inline void SetRanges(const mglData &xx, const mglData &yy)\r
+ { mgl_set_range_dat(gr,'x',&xx,0); mgl_set_range_dat(gr,'y',&yy,0); }\r
+ /// Set values of mglGraph::Min and mglGraph::Max\r
+ inline void SetRanges(float x1, float x2, float y1, float y2, float z1=0, float z2=0)\r
+ { mgl_set_ranges(gr, x1, x2, y1, y2, z1, z2); }\r
+ /// Set values of mglGraph::Min and mglGraph::Max\r
+ inline void SetRanges(mglPoint p1, mglPoint p2)\r
+ { mgl_set_ranges(gr, p1.x, p2.x, p1.y, p2.y, p1.z, p2.z); }\r
+ /// Set axis origin\r
+ inline void SetOrigin(mglPoint p)\r
+ { mgl_set_origin(gr, p.x, p.y, p.z); }\r
+ inline void SetOrigin(float x0, float y0, float z0=NaN)\r
+ { mgl_set_origin(gr, x0, y0, z0); }\r
+\r
+ /// Set the transformation formulas for coordinate\r
+ inline void SetFunc(const char *EqX, const char *EqY, const char *EqZ=NULL, const char *EqA=NULL)\r
+ { mgl_set_func(gr, EqX, EqY, EqZ, EqA); }\r
+ /// Set one of predefined transformation rule\r
+ inline void SetCoor(int how) { mgl_set_coor(gr, how); }\r
+ /// Set to draw Ternary axis (triangle like axis, grid and so on)\r
+ inline void Ternary(int val) { mgl_set_ternary(gr, val); }\r
+\r
+ /// Set to use or not tick labels rotation\r
+ inline void SetTickRotate(bool val) { mgl_set_tick_rotate(gr,val); }\r
+ /// Set to use or not tick labels skipping\r
+ inline void SetTickSkip(bool val) { mgl_set_tick_skip(gr,val); }\r
+ /// Set tick length\r
+ inline void SetTickLen(float len, float stt=1)\r
+ { mgl_set_tick_len(gr, len, stt); }\r
+ /// Set axis and ticks style\r
+ inline void SetAxisStl(const char *stl="k", const char *tck=0, const char *sub=0)\r
+ { mgl_set_axis_stl(gr, stl, tck, sub); }\r
+\r
+ /// Set time templates for ticks\r
+ inline void SetTicksTime(char dir, float d=0, const char *t="")\r
+ { mgl_set_ticks_time(gr,dir,d,t); }\r
+ /// Set ticks text (\n separated). Use "" to disable this feature.\r
+ inline void SetTicksVal(char dir, const char *lbl, bool add=false)\r
+ { mgl_set_ticks_str(gr,dir,lbl,add); }\r
+ inline void SetTicksVal(char dir, const wchar_t *lbl, bool add=false)\r
+ { mgl_set_ticks_wcs(gr,dir,lbl,add); }\r
+ /// Set ticks position and text (\n separated). Use "" to disable this feature.\r
+ inline void SetTicksVal(char dir, const mglDataA &v, const char *lbl, bool add=false)\r
+ { mgl_set_ticks_val(gr,dir,&v,lbl,add); }\r
+ inline void SetTicksVal(char dir, const mglDataA &v, const wchar_t *lbl, bool add=false)\r
+ { mgl_set_ticks_valw(gr,dir,&v,lbl,add); }\r
+ /// Set the ticks parameters\r
+ inline void SetTicks(char dir, float d=0, int ns=0, float org=NaN)\r
+ { mgl_set_ticks(gr, dir, d, ns, org); }\r
+ /// Auto adjust ticks\r
+ inline void Adjust(const char *dir="xyzc")\r
+ { mgl_adjust_ticks(gr, dir); }\r
+ /// Set templates for ticks\r
+ inline void SetTickTempl(char dir, const char *t)\r
+ { mgl_set_tick_templ(gr,dir,t); }\r
+ inline void SetTickTempl(char dir, const wchar_t *t)\r
+ { mgl_set_tick_templw(gr,dir,t); }\r
+ /// Tune ticks\r
+ inline void SetTuneTicks(int tune, float fact_pos=1.15)\r
+ { mgl_tune_ticks(gr, tune, fact_pos); }\r
+\r
+ /// Put further plotting in some region of whole frame surface.\r
+ inline void SubPlot(int nx,int ny,int m,const char *style="<>_^", float dx=0, float dy=0)\r
+ { mgl_subplot_d(gr, nx, ny, m, style, dx, dy); }\r
+ /// Like SubPlot bot "join" several cells\r
+ inline void MultiPlot(int nx,int ny,int m, int dx, int dy, const char *style="<>_^")\r
+ { mgl_multiplot(gr, nx, ny, m, dx, dy, style); }\r
+ /// Put further plotting in some region of whole frame surface.\r
+ inline void InPlot(float x1,float x2,float y1,float y2, bool rel=true)\r
+ { if(rel) mgl_relplot(gr, x1, x2, y1, y2);\r
+ else mgl_inplot(gr, x1, x2, y1, y2); }\r
+ /// Put further plotting in column cell of previous subplot\r
+ inline void ColumnPlot(int num, int ind, float d=0)\r
+ { mgl_columnplot(gr,num,ind,d); }\r
+ /// Put further plotting in matrix cell of previous subplot\r
+ inline void GridPlot(int nx, int ny, int ind, float d=0)\r
+ { mgl_gridplot(gr,nx,ny,ind,d); }\r
+ /// Put further plotting in cell of stick rotated on angles tet, phi\r
+ inline void StickPlot(int num, int i, float tet, float phi)\r
+ { mgl_stickplot(gr,num,i,tet,phi); }\r
+\r
+ /// Set PlotFactor\r
+ inline void SetPlotFactor(float val)\r
+ { mgl_set_plotfactor(gr,val); }\r
+ /// Push transformation matrix into stack\r
+ inline void Push() { mgl_mat_push(gr); }\r
+ /// Pop transformation matrix from stack\r
+ inline void Pop() { mgl_mat_pop(gr); }\r
+ \r
+ /// Add title for current subplot/inplot\r
+ inline void Title(const char *title,const char *stl="",float size=-2)\r
+ { mgl_title(gr,title,stl,size); }\r
+ inline void Title(const wchar_t *title,const char *stl="",float size=-2)\r
+ { mgl_titlew(gr,title,stl,size); }\r
+ /// Set aspect ratio for further plotting.\r
+ inline void Aspect(float Ax,float Ay,float Az=1)\r
+ { mgl_aspect(gr, Ax, Ay, Az); }\r
+ /// Rotate a further plotting.\r
+ inline void Rotate(float TetX,float TetZ=0,float TetY=0)\r
+ { mgl_rotate(gr, TetX, TetZ, TetY); }\r
+ /// Rotate a further plotting around vector {x,y,z}.\r
+ inline void RotateN(float Tet,float x,float y,float z)\r
+ { mgl_rotate_vector(gr, Tet, x, y, z); }\r
+ /// Set perspective (in range [0,1)) for plot. Set to zero for switching off.\r
+ inline void Perspective(float val)\r
+ { mgl_perspective(gr, val); }\r
+ /// Set angle of view independently from Rotate().\r
+ inline void View(float TetX,float TetZ=0,float TetY=0)\r
+ { mgl_view(gr, TetX, TetZ, TetY); }\r
+ /// Zoom in or zoom out (if Zoom(0, 0, 1, 1)) a part of picture\r
+ inline void Zoom(float x1, float y1, float x2, float y2)\r
+ { mgl_zoom(gr, x1, y1, x2, y2); }\r
+\r
+ /// Set size of frame in pixels. Normally this function is called internaly.\r
+ inline void SetSize(int width, int height) { mgl_set_size(gr, width, height); }\r
+ /// Set plot quality\r
+ inline void SetQuality(int qual=MGL_DRAW_NORM) { mgl_set_quality(gr, qual); }\r
+ /// Start group of objects\r
+ inline void StartGroup(const char *name) { mgl_start_group(gr, name); }\r
+ /// End group of objects\r
+ inline void EndGroup() { mgl_end_group(gr); }\r
+ /// Highlight next group\r
+ inline void Highlight(int id) { mgl_highlight(gr, id); }\r
+\r
+ /// Show currently produced image\r
+ inline void ShowImage(const char *viewer, bool keep=0)\r
+ { mgl_show_image(gr, viewer, keep); }\r
+ /// Write the frame in file (depending extension, write current frame if fname is empty)\r
+ inline void WriteFrame(const char *fname=0,const char *descr="")\r
+ { mgl_write_frame(gr, fname, descr); }\r
+ /// Write the frame in file using JPEG format\r
+ inline void WriteJPEG(const char *fname,const char *descr="")\r
+ { mgl_write_jpg(gr, fname, descr); }\r
+ /// Write the frame in file using PNG format with transparency\r
+ inline void WritePNG(const char *fname,const char *descr="", bool alpha=true)\r
+ { if(alpha) mgl_write_png(gr, fname, descr);\r
+ else mgl_write_png_solid(gr, fname, descr); }\r
+ /// Write the frame in file using BMP format\r
+ inline void WriteBMP(const char *fname,const char *descr="")\r
+ { mgl_write_bmp(gr, fname, descr); }\r
+ /// Write the frame in file using BMP format\r
+ inline void WriteTGA(const char *fname,const char *descr="")\r
+ { mgl_write_tga(gr, fname, descr); }\r
+ /// Write the frame in file using PostScript format\r
+ inline void WriteEPS(const char *fname,const char *descr="")\r
+ { mgl_write_eps(gr, fname, descr); }\r
+ /// Write the frame in file using PostScript format\r
+ inline void WriteTEX(const char *fname,const char *descr="")\r
+ { mgl_write_tex(gr, fname, descr); }\r
+ /// Write the frame in file using PostScript format as bitmap\r
+ inline void WriteBPS(const char *fname,const char *descr="")\r
+ { mgl_write_bps(gr, fname, descr); }\r
+ /// Write the frame in file using SVG format\r
+ inline void WriteSVG(const char *fname,const char *descr="")\r
+ { mgl_write_svg(gr, fname, descr); }\r
+ /// Write the frame in file using GIF format (only for current frame!)\r
+ inline void WriteGIF(const char *fname,const char *descr="")\r
+ { mgl_write_gif(gr, fname, descr); }\r
+\r
+ /// Write the frame in file using OBJ format\r
+ inline void WriteOBJ(const char *fname,const char *descr="",bool use_png=true)\r
+ { mgl_write_obj(gr, fname, descr, use_png); }\r
+ /// Write the frame in file using XYZ format\r
+ inline void WriteXYZ(const char *fname,const char *descr="")\r
+ { mgl_write_xyz(gr, fname, descr); }\r
+ /// Write the frame in file using STL format (faces only)\r
+ inline void WriteSTL(const char *fname,const char *descr="")\r
+ { mgl_write_stl(gr, fname, descr); }\r
+ /// Write the frame in file using OFF format\r
+ inline void WriteOFF(const char *fname,const char *descr="", bool colored=false)\r
+ { mgl_write_off(gr, fname, descr,colored); }\r
+// /// Write the frame in file using X3D format\r
+// inline void WriteX3D(const char *fname,const char *descr="")\r
+// { mgl_write_x3d(gr, fname, descr); }\r
+ /// Write the frame in file using PRC format\r
+ inline void WritePRC(const char *fname,const char *descr="",bool make_pdf=true)\r
+ { mgl_write_prc(gr, fname, descr, make_pdf); }\r
+\r
+ /// Create new frame.\r
+ inline void NewFrame() { mgl_new_frame(gr); }\r
+ /// Finish frame drawing\r
+ inline void EndFrame() { mgl_end_frame(gr); }\r
+ /// Get the number of created frames\r
+ inline int GetNumFrame() { return mgl_get_num_frame(gr); }\r
+ /// Reset frames counter (start it from zero)\r
+ inline void ResetFrames() { mgl_reset_frames(gr); }\r
+ /// Start write frames to cinema using GIF format\r
+ inline void StartGIF(const char *fname, int ms=100)\r
+ { mgl_start_gif(gr, fname,ms); }\r
+ /// Stop writing cinema using GIF format\r
+ inline void CloseGIF() { mgl_close_gif(gr); }\r
+ /// Export points and primitives in file using MGLD format\r
+ inline void ExportMGLD(const char *fname, const char *descr=0)\r
+ { mgl_export_mgld(gr, fname, descr); }\r
+ /// Import points and primitives from file using MGLD format\r
+ inline void ImportMGLD(const char *fname, bool add=false)\r
+ { mgl_import_mgld(gr, fname, add); }\r
+\r
+ /// Copy RGB values into array which is allocated by user\r
+ inline void GetRGB(char *imgdata, int imglen)\r
+ {\r
+ long w=mgl_get_width(gr), h=mgl_get_height(gr);\r
+ if(imglen>=3*w*h) memcpy(imgdata, mgl_get_rgb(gr),3*w*h);\r
+ }\r
+ inline const unsigned char *GetRGB() { return mgl_get_rgb(gr); }\r
+ /// Copy RGBA values into array which is allocated by user\r
+ inline void GetRGBA(char *imgdata, int imglen)\r
+ {\r
+ long w=mgl_get_width(gr), h=mgl_get_height(gr);\r
+ if(imglen>=4*w*h) memcpy(imgdata, mgl_get_rgba(gr),4*w*h);\r
+ }\r
+ inline const unsigned char *GetRGBA() { return mgl_get_rgba(gr); }\r
+ /// Copy BGRN values into array which is allocated by user\r
+ inline void GetBGRN(unsigned char *imgdata, int imglen)\r
+ {\r
+ long w=mgl_get_width(gr), h=mgl_get_height(gr), i;\r
+ const unsigned char *buf=mgl_get_rgb(gr);\r
+ if(imglen>=4*w*h) for(i=0;i<w*h;i++)\r
+ {\r
+ imgdata[4*i] = buf[3*i+2];\r
+ imgdata[4*i+1] = buf[3*i+1];\r
+ imgdata[4*i+2] = buf[3*i];\r
+ imgdata[4*i+3] = 255;\r
+ }\r
+ }\r
+ /// Get width of the image\r
+ inline int GetWidth() { return mgl_get_width(gr); }\r
+ /// Get height of the image\r
+ inline int GetHeight() { return mgl_get_height(gr);}\r
+ /// Calculate 3D coordinate {x,y,z} for screen point {xs,ys}\r
+ inline mglPoint CalcXYZ(int xs, int ys)\r
+ {\r
+ float x,y,z;\r
+ mgl_calc_xyz(gr,xs,ys,&x,&y,&z);\r
+ return mglPoint(x,y,z);\r
+ }\r
+ /// Calculate screen point {xs,ys} for 3D coordinate {x,y,z}\r
+ inline mglPoint CalcScr(mglPoint p)\r
+ {\r
+ int xs,ys;\r
+ mgl_calc_scr(gr,p.x,p.y,p.z,&xs,&ys);\r
+ return mglPoint(xs,ys);\r
+ }\r
+ /// Set object/subplot id\r
+ inline void SetObjId(int id) { mgl_set_obj_id(gr,id); }\r
+ /// Get object id\r
+ inline int GetObjId(long x,long y) { return mgl_get_obj_id(gr,x,y); }\r
+ /// Get subplot id\r
+ inline int GetSplId(long x,long y) { return mgl_get_spl_id(gr,x,y); }\r
+\r
+ /// Combine plots from 2 canvases. Result will be saved into this\r
+ inline void Combine(const mglGraph *g) { mgl_combine_gr(gr,g->gr); }\r
+ /// Send graphical information to node id using MPI\r
+ inline void MPI_Send(int id) { mgl_mpi_send(gr,id); }\r
+ /// Receive graphical information from node id using MPI\r
+ inline void MPI_Recv(int id) { mgl_mpi_recv(gr,id); }\r
+\r
+ /// Clear up the frame\r
+ inline void Clf(float r, float g, float b) { mgl_clf_rgb(gr, r, g, b); }\r
+ inline void Clf() { mgl_clf(gr); }\r
+ /// Draws the point (ball) at position {x,y,z} with color c\r
+ inline void Ball(mglPoint p, char c)\r
+ { char s[3]={'.',c,0}; mgl_mark(gr, p.x, p.y, p.z, s); }\r
+ /// Draws the mark at position p\r
+ inline void Mark(mglPoint p, const char *mark)\r
+ { mgl_mark(gr, p.x, p.y, p.z, mark); }\r
+ /// Draws the line between points by specified pen\r
+ inline void Line(mglPoint p1, mglPoint p2, const char *pen="B",int n=2)\r
+ { mgl_line(gr, p1.x, p1.y, p1.z, p2.x, p2.y, p2.z, pen, n); }\r
+ /// Draws the spline curve between points by specified pen\r
+ inline void Curve(mglPoint p1, mglPoint d1, mglPoint p2, mglPoint d2, const char *pen="B", int n=100)\r
+ { mgl_curve(gr, p1.x, p1.y, p1.z, d1.x, d1.y, d1.z, p2.x, p2.y, p2.z, d2.x, d2.y, d2.z, pen, n); }\r
+ /// Draws the 3d error box e for point p\r
+ inline void Error(mglPoint p, mglPoint e, const char *pen="k")\r
+ { mgl_error_box(gr, p.x, p.y, p.z, e.x, e.y, e.z, pen); }\r
+\r
+ /// Draws the face between points with color stl (include interpolation up to 4 colors).\r
+ inline void Face(mglPoint p1, mglPoint p2, mglPoint p3, mglPoint p4, const char *stl="r")\r
+ { mgl_face(gr, p1.x, p1.y, p1.z, p2.x, p2.y, p2.z, p3.x, p3.y, p3.z, p4.x, p4.y, p4.z, stl); }\r
+ /// Draws the face in y-z plane at point p with color stl (include interpolation up to 4 colors).\r
+ inline void FaceX(mglPoint p, float wy, float wz, const char *stl="w", float dx=0, float dy=0)\r
+ { mgl_facex(gr, p.x, p.y, p.z, wy, wz, stl, dx, dy); }\r
+ /// Draws the face in x-z plane at point p with color stl (include interpolation up to 4 colors).\r
+ inline void FaceY(mglPoint p, float wx, float wz, const char *stl="w", float dx=0, float dy=0)\r
+ { mgl_facey(gr, p.x, p.y, p.z, wx, wz, stl, dx, dy); }\r
+ /// Draws the face in x-y plane at point p with color stl (include interpolation up to 4 colors).\r
+ inline void FaceZ(mglPoint p, float wx, float wy, const char *stl="w", float dx=0, float dy=0)\r
+ { mgl_facez(gr, p.x, p.y, p.z, wx, wy, stl, dx, dy); }\r
+ /// Draws the drop at point p in direction d with color col and radius r\r
+ inline void Drop(mglPoint p, mglPoint d, float r, const char *col="r", float shift=1, float ap=1)\r
+ { mgl_drop(gr, p.x, p.y, p.z, d.x, d.y, d.z, r, col, shift, ap); }\r
+ /// Draws the sphere at point p with color col and radius r\r
+ inline void Sphere(mglPoint p, float r, const char *col="r")\r
+ { mgl_sphere(gr, p.x, p.y, p.z, r, col); }\r
+ /// Draws the cone between points p1,p2 with radius r1,r2 with style stl\r
+ inline void Cone(mglPoint p1, mglPoint p2, float r1, float r2=-1, const char *stl="r@")\r
+ { mgl_cone(gr, p1.x, p1.y, p1.z, p2.x, p2.y, p2.z,r1,r2,stl); }\r
+ /// Draws the ellipse between points p1,p2 with color stl and width r\r
+ inline void Ellipse(mglPoint p1, mglPoint p2, float r, const char *stl="r")\r
+ { mgl_ellipse(gr, p1.x, p1.y, p1.z, p2.x, p2.y, p2.z, r,stl); }\r
+ /// Draws the circle at point p with color stl and radius r\r
+ inline void Circle(mglPoint p, float r, const char *stl="r")\r
+ { mgl_ellipse(gr, p.x, p.y, p.z, p.x, p.y, p.z, r,stl); }\r
+ /// Draws the rhomb between points p1,p2 with color stl and width r\r
+ inline void Rhomb(mglPoint p1, mglPoint p2, float r, const char *stl="r")\r
+ { mgl_rhomb(gr, p1.x, p1.y, p1.z, p2.x, p2.y, p2.z, r,stl); }\r
+\r
+ /// Print text in position p with specified font\r
+ inline void Putsw(mglPoint p,const wchar_t *text,const char *font=":C",float size=-1)\r
+ { mgl_putsw(gr, p.x, p.y, p.z, text, font, size); }\r
+ inline void Puts(mglPoint p,const char *text,const char *font=":C",float size=-1)\r
+ { mgl_puts(gr, p.x, p.y, p.z, text, font, size); }\r
+ inline void Putsw(float x, float y,const wchar_t *text,const char *font=":AC",float size=-1)\r
+ { mgl_putsw(gr, x, y, 0, text, font, size); }\r
+ inline void Puts(float x, float y,const char *text,const char *font=":AC",float size=-1)\r
+ { mgl_puts(gr, x, y, 0, text, font, size); }\r
+ /// Print text in position p along direction d with specified font\r
+ inline void Putsw(mglPoint p, mglPoint d, const wchar_t *text, const char *font=":L", float size=-1)\r
+ { mgl_putsw_dir(gr, p.x, p.y, p.z, d.x, d.y, d.z, text, font, size); }\r
+ inline void Puts(mglPoint p, mglPoint d, const char *text, const char *font=":L", float size=-1)\r
+ { mgl_puts_dir(gr, p.x, p.y, p.z, d.x, d.y, d.z, text, font, size); }\r
+\r
+ /// Print text along the curve\r
+ inline void Text(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *text, const char *font="", const char *opt="")\r
+ { mgl_text_xyz(gr, &x, &y, &z, text, font, opt); }\r
+ inline void Text(const mglDataA &x, const mglDataA &y, const char *text, const char *font="", const char *opt="")\r
+ { mgl_text_xy(gr, &x, &y, text, font, opt); }\r
+ inline void Text(const mglDataA &y, const char *text, const char *font="", const char *opt="")\r
+ { mgl_text_y(gr, &y, text, font, opt); }\r
+ inline void Text(const mglDataA &x, const mglDataA &y, const mglDataA &z, const wchar_t *text, const char *font="", const char *opt="")\r
+ { mgl_textw_xyz(gr, &x, &y, &z, text, font, opt); }\r
+ inline void Text(const mglDataA &x, const mglDataA &y, const wchar_t *text, const char *font="", const char *opt="")\r
+ { mgl_textw_xy(gr, &x, &y, text, font, opt); }\r
+ inline void Text(const mglDataA &y, const wchar_t *text, const char *font="", const char *opt="")\r
+ { mgl_textw_y(gr, &y, text, font, opt); }\r
+\r
+ /// Draws bounding box outside the plotting volume with color \a c.\r
+ inline void Box(const char *col="", bool ticks=true)\r
+ { mgl_box_str(gr, col, ticks); }\r
+ /// Draw axises with ticks in directions determined by string parameter \a dir.\r
+ inline void Axis(const char *dir="xyzt", const char *stl="")\r
+ { mgl_axis(gr, dir,stl); }\r
+ /// Draw grid lines perpendicular to direction determined by string parameter \a dir.\r
+ inline void Grid(const char *dir="xyzt",const char *pen="B")\r
+ { mgl_axis_grid(gr, dir, pen); }\r
+ /// Print the label \a text for axis \a dir.\r
+ inline void Label(char dir, const char *text, float pos=+1, float shift=0)\r
+ { mgl_label_ext(gr, dir, text, pos, shift); }\r
+ inline void Label(char dir, const wchar_t *text, float pos=+1, float shift=0)\r
+ { mgl_labelw_ext(gr, dir, text, pos, shift); }\r
+\r
+ /// Draw colorbar at edge of axis\r
+ inline void Colorbar(const char *sch="")\r
+ { mgl_colorbar(gr, sch); }\r
+ inline void Colorbar(const char *sch,float x,float y,float w=1,float h=1)\r
+ { mgl_colorbar_ext(gr, sch, x,y,w,h); }\r
+ /// Draw colorbar with manual colors at edge of axis\r
+ inline void Colorbar(const mglDataA &val, const char *sch="")\r
+ { mgl_colorbar_val(gr, &val, sch); }\r
+ inline void Colorbar(const mglDataA &val, const char *sch,float x,float y,float w=1,float h=1)\r
+ { mgl_colorbar_val_ext(gr, &val, sch, x,y,w,h); }\r
+\r
+ /// Add string to legend\r
+ inline void AddLegend(const char *text,const char *style)\r
+ { mgl_add_legend(gr, text, style); }\r
+ inline void AddLegend(const wchar_t *text,const char *style)\r
+ { mgl_add_legendw(gr, text, style); }\r
+ /// Clear saved legend string\r
+ inline void ClearLegend()\r
+ { mgl_clear_legend(gr); }\r
+ /// Draw legend of accumulated strings at position {x,y}\r
+ inline void Legend(float x, float y, const char *font="#", float size=-0.8, float llen=0)\r
+ { mgl_legend_pos(gr, x, y, font, size, llen); }\r
+ /// Draw legend of accumulated strings\r
+ inline void Legend(int where=3, const char *font="#", float size=-0.8, float llen=0)\r
+ { mgl_legend(gr, where, font, size, llen); }\r
+ /// Set number of marks in legend sample\r
+ inline void SetLegendMarks(int num) { mgl_set_legend_marks(gr, num); }\r
+\r
+ /// Draw usual curve {x,y,z}\r
+ inline void Plot(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *pen="", const char *opt="")\r
+ { mgl_plot_xyz(gr, &x, &y, &z, pen, opt); }\r
+ inline void Plot(const mglDataA &x, const mglDataA &y, const char *pen="", const char *opt="")\r
+ { mgl_plot_xy(gr, &x, &y, pen,opt); }\r
+ inline void Plot(const mglDataA &y, const char *pen="", const char *opt="")\r
+ { mgl_plot(gr, &y, pen,opt); }\r
+ /// Draw tape(s) which rotates as (bi-)normales of curve {x,y,z}\r
+ inline void Tape(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *pen="", const char *opt="")\r
+ { mgl_tape_xyz(gr, &x, &y, &z, pen, opt); }\r
+ inline void Tape(const mglDataA &x, const mglDataA &y, const char *pen="", const char *opt="")\r
+ { mgl_tape_xy(gr, &x, &y, pen,opt); }\r
+ inline void Tape(const mglDataA &y, const char *pen="", const char *opt="")\r
+ { mgl_tape(gr, &y, pen,opt); }\r
+ /// Draw radar chart (plot in curved coordinates)\r
+ inline void Radar(const mglDataA &a, const char *pen="", const char *opt="")\r
+ { mgl_radar(gr, &a, pen, opt); }\r
+ /// Draw stairs for points in arrays {x,y,z}\r
+ inline void Step(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *pen="", const char *opt="")\r
+ { mgl_step_xyz(gr, &x, &y, &z, pen, opt); }\r
+ inline void Step(const mglDataA &x, const mglDataA &y, const char *pen="", const char *opt="")\r
+ { mgl_step_xy(gr, &x, &y, pen, opt); }\r
+ inline void Step(const mglDataA &y, const char *pen="", const char *opt="")\r
+ { mgl_step(gr, &y, pen, opt); }\r
+ /// Draw curve {x,y,z} which is colored by c (like tension plot)\r
+ inline void Tens(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const char *pen="", const char *opt="")\r
+ { mgl_tens_xyz(gr, &x, &y, &z, &c, pen, opt); }\r
+ inline void Tens(const mglDataA &x, const mglDataA &y, const mglDataA &c, const char *pen="", const char *opt="")\r
+ { mgl_tens_xy(gr, &x, &y, &c, pen, opt); }\r
+ inline void Tens(const mglDataA &y, const mglDataA &c, const char *pen="", const char *opt="")\r
+ { mgl_tens(gr, &y, &c, pen, opt); }\r
+ /// Fill area between curve {x,y,z} and axis plane\r
+ inline void Area(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *pen="", const char *opt="")\r
+ { mgl_area_xyz(gr, &x, &y, &z, pen, opt); }\r
+ inline void Area(const mglDataA &x, const mglDataA &y, const char *pen="", const char *opt="")\r
+ { mgl_area_xy(gr, &x, &y, pen, opt); }\r
+ inline void Area(const mglDataA &y, const char *pen="", const char *opt="")\r
+ { mgl_area(gr, &y, pen, opt); }\r
+ /// Fill area between curves y1 and y2 specified parametrically\r
+ inline void Region(const mglDataA &y1, const mglDataA &y2, const char *pen="", const char *opt="")\r
+ { mgl_region(gr, &y1, &y2, pen, opt); }\r
+ inline void Region(const mglDataA &x, const mglDataA &y1, const mglDataA &y2, const char *pen="", const char *opt="")\r
+ { mgl_region_xy(gr, &x, &y1, &y2, pen, opt); }\r
+ /// Draw vertical lines from points {x,y,z} to axis plane\r
+ inline void Stem(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *pen="", const char *opt="")\r
+ { mgl_stem_xyz(gr, &x, &y, &z, pen, opt); }\r
+ inline void Stem(const mglDataA &x, const mglDataA &y, const char *pen="", const char *opt="")\r
+ { mgl_stem_xy(gr, &x, &y, pen, opt); }\r
+ inline void Stem(const mglDataA &y, const char *pen="", const char *opt="")\r
+ { mgl_stem(gr, &y, pen, opt); }\r
+\r
+ /// Draw vertical bars from points {x,y,z} to axis plane\r
+ inline void Bars(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *pen="", const char *opt="")\r
+ { mgl_bars_xyz(gr, &x, &y, &z, pen, opt); }\r
+ inline void Bars(const mglDataA &x, const mglDataA &y, const char *pen="", const char *opt="")\r
+ { mgl_bars_xy(gr, &x, &y, pen, opt); }\r
+ inline void Bars(const mglDataA &y, const char *pen="", const char *opt="")\r
+ { mgl_bars(gr, &y, pen, opt); }\r
+ /// Draw horizontal bars from points {x,y} to axis plane\r
+ inline void Barh(const mglDataA &y, const mglDataA &v, const char *pen="", const char *opt="")\r
+ { mgl_barh_yx(gr, &y, &v, pen, opt); }\r
+ inline void Barh(const mglDataA &v, const char *pen="", const char *opt="")\r
+ { mgl_barh(gr, &v, pen, opt); }\r
+ /// Draw chart for data a\r
+ inline void Chart(const mglDataA &a, const char *colors="", const char *opt="")\r
+ { mgl_chart(gr, &a, colors,opt); }\r
+ /// Draw box-plot (special 5-value plot used in statistic)\r
+ inline void BoxPlot(const mglDataA &x, const mglDataA &y, const char *pen="", const char *opt="")\r
+ { mgl_boxplot_xy(gr, &x, &y, pen,opt); }\r
+ inline void BoxPlot(const mglDataA &y, const char *pen="", const char *opt="")\r
+ { mgl_boxplot(gr, &y, pen,opt); }\r
+ /// Draw candle plot\r
+ inline void Candle(const mglDataA &x, const mglDataA &v1, const mglDataA &v2, const mglDataA &y1, const mglDataA &y2, const char *pen="", const char *opt="")\r
+ { mgl_candle_xyv(gr, &x, &v1, &v2, &y1, &y2, pen, opt); }\r
+ inline void Candle(const mglDataA &v1, const mglDataA &v2, const mglDataA &y1, const mglDataA &y2, const char *pen="", const char *opt="")\r
+ { mgl_candle_yv(gr, &v1, &v2, &y1, &y2, pen, opt); }\r
+ inline void Candle(const mglDataA &v1, const mglDataA &v2, const char *pen="", const char *opt="")\r
+ { mgl_candle_yv(gr, &v1, &v2, NULL, NULL, pen, opt); }\r
+ inline void Candle(const mglDataA &y, const mglDataA &y1, const mglDataA &y2, const char *pen="", const char *opt="")\r
+ { mgl_candle(gr, &y, &y1, &y2, pen, opt); }\r
+ inline void Candle(const mglDataA &y, const char *pen="", const char *opt="")\r
+ { mgl_candle(gr, &y, NULL, NULL, pen, opt); }\r
+ /// Draw cones from points {x,y,z} to axis plane\r
+ inline void Cones(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *pen="@", const char *opt="")\r
+ { mgl_cones_xyz(gr, &x, &y, &z, pen, opt); }\r
+ inline void Cones(const mglDataA &x, const mglDataA &z, const char *pen="@", const char *opt="")\r
+ { mgl_cones_xz(gr, &x, &z, pen, opt); }\r
+ inline void Cones(const mglDataA &z, const char *pen="@", const char *opt="")\r
+ { mgl_cones(gr, &z, pen, opt); }\r
+\r
+ /// Draw error boxes {ex,ey} at points {x,y}\r
+ inline void Error(const mglDataA &y, const mglDataA &ey, const char *pen="", const char *opt="")\r
+ { mgl_error(gr, &y, &ey, pen, opt); }\r
+ inline void Error(const mglDataA &x, const mglDataA &y, const mglDataA &ey, const char *pen="", const char *opt="")\r
+ { mgl_error_xy(gr, &x, &y, &ey, pen, opt); }\r
+ inline void Error(const mglDataA &x, const mglDataA &y, const mglDataA &ex, const mglDataA &ey, const char *pen="", const char *opt="")\r
+ { mgl_error_exy(gr, &x, &y, &ex, &ey, pen, opt); }\r
+ /// Draw marks with size r at points {x,y,z}\r
+ inline void Mark(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &r, const char *pen, const char *opt="")\r
+ { mgl_mark_xyz(gr, &x, &y, &z, &r, pen, opt); }\r
+ inline void Mark(const mglDataA &x, const mglDataA &y, const mglDataA &r, const char *pen, const char *opt="")\r
+ { mgl_mark_xy(gr, &x, &y, &r, pen, opt); }\r
+ inline void Mark(const mglDataA &y, const mglDataA &r, const char *pen, const char *opt="")\r
+ { mgl_mark_y(gr, &y, &r, pen, opt); }\r
+ /// Draw textual marks with size r at points {x,y,z}\r
+ inline void TextMark(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &r, const char *text, const char *fnt="", const char *opt="")\r
+ { mgl_textmark_xyzr(gr, &x, &y, &z, &r, text, fnt, opt); }\r
+ inline void TextMark(const mglDataA &x, const mglDataA &y, const mglDataA &r, const char *text, const char *fnt="", const char *opt="")\r
+ { mgl_textmark_xyr(gr, &x, &y, &r, text, fnt, opt); }\r
+ inline void TextMark(const mglDataA &y, const mglDataA &r, const char *text, const char *fnt="", const char *opt="")\r
+ { mgl_textmark_yr(gr, &y, &r, text, fnt, opt); }\r
+ inline void TextMark(const mglDataA &y, const char *text, const char *fnt="", const char *opt="")\r
+ { mgl_textmark(gr, &y, text, fnt, opt); }\r
+ inline void TextMark(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &r, const wchar_t *text, const char *fnt="", const char *opt="")\r
+ { mgl_textmarkw_xyzr(gr, &x, &y, &z, &r, text, fnt, opt); }\r
+ inline void TextMark(const mglDataA &x, const mglDataA &y, const mglDataA &r, const wchar_t *text, const char *fnt="", const char *opt="")\r
+ { mgl_textmarkw_xyr(gr, &x, &y, &r, text, fnt, opt); }\r
+ inline void TextMark(const mglDataA &y, const mglDataA &r, const wchar_t *text, const char *fnt="", const char *opt="")\r
+ { mgl_textmarkw_yr(gr, &y, &r, text, fnt, opt); }\r
+ inline void TextMark(const mglDataA &y, const wchar_t *text, const char *fnt="", const char *opt="")\r
+ { mgl_textmarkw(gr, &y, text, fnt, opt); }\r
+\r
+ /// Draw labels for points coordinate(s) at points {x,y,z}\r
+ inline void Label(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *text, const char *fnt="", const char *opt="")\r
+ { mgl_label_xyz(gr, &x, &y, &z, text, fnt, opt); }\r
+ inline void Label(const mglDataA &x, const mglDataA &y, const char *text, const char *fnt="", const char *opt="")\r
+ { mgl_label_xy(gr, &x, &y, text, fnt, opt); }\r
+ inline void Label(const mglDataA &y, const char *text, const char *fnt="", const char *opt="")\r
+ { mgl_label_y(gr, &y, text, fnt, opt); }\r
+ inline void Label(const mglDataA &x, const mglDataA &y, const mglDataA &z, const wchar_t *text, const char *fnt="", const char *opt="")\r
+ { mgl_labelw_xyz(gr, &x, &y, &z, text, fnt, opt); }\r
+ inline void Label(const mglDataA &x, const mglDataA &y, const wchar_t *text, const char *fnt="", const char *opt="")\r
+ { mgl_labelw_xy(gr, &x, &y, text, fnt, opt); }\r
+ inline void Label(const mglDataA &y, const wchar_t *text, const char *fnt="", const char *opt="")\r
+ { mgl_labelw_y(gr, &y, text, fnt, opt); }\r
+\r
+ /// Draw tube with radius r for points in arrays {x,y,z}\r
+ inline void Tube(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &r, const char *pen="", const char *opt="")\r
+ { mgl_tube_xyzr(gr, &x, &y, &z, &r, pen, opt); }\r
+ inline void Tube(const mglDataA &x, const mglDataA &y, const mglDataA &z, float r, const char *pen="", const char *opt="")\r
+ { mgl_tube_xyz(gr, &x, &y, &z, r, pen, opt); }\r
+ inline void Tube(const mglDataA &x, const mglDataA &y, const mglDataA &r, const char *pen="", const char *opt="")\r
+ { mgl_tube_xyr(gr, &x, &y, &r, pen, opt); }\r
+ inline void Tube(const mglDataA &x, const mglDataA &y, float r, const char *pen="", const char *opt="")\r
+ { mgl_tube_xy(gr, &x, &y, r, pen, opt); }\r
+ inline void Tube(const mglDataA &y, const mglDataA &r, const char *pen="", const char *opt="")\r
+ { mgl_tube_r(gr, &y, &r, pen, opt); }\r
+ inline void Tube(const mglDataA &y, float r, const char *pen="", const char *opt="")\r
+ { mgl_tube(gr, &y, r, pen, opt); }\r
+ /// Draw surface of curve {r,z} rotatation around axis\r
+ inline void Torus(const mglDataA &r, const mglDataA &z, const char *pen="", const char *opt="")\r
+ { mgl_torus(gr, &r, &z, pen,opt); }\r
+\r
+ /// Draw mesh lines for 2d data specified parametrically\r
+ inline void Mesh(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *stl="", const char *opt="")\r
+ { mgl_mesh_xy(gr, &x, &y, &z, stl, opt); }\r
+ inline void Mesh(const mglDataA &z, const char *stl="", const char *opt="")\r
+ { mgl_mesh(gr, &z, stl, opt); }\r
+ /// Draw mesh lines for 2d data specified parametrically\r
+ inline void Fall(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *stl="", const char *opt="")\r
+ { mgl_fall_xy(gr, &x, &y, &z, stl, opt); }\r
+ inline void Fall(const mglDataA &z, const char *stl="", const char *opt="")\r
+ { mgl_fall(gr, &z, stl, opt); }\r
+ /// Draw belts for 2d data specified parametrically\r
+ inline void Belt(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *stl="", const char *opt="")\r
+ { mgl_belt_xy(gr, &x, &y, &z, stl, opt); }\r
+ inline void Belt(const mglDataA &z, const char *stl="", const char *opt="")\r
+ { mgl_belt(gr, &z, stl, opt); }\r
+ /// Draw surface for 2d data specified parametrically with color proportional to z\r
+ inline void Surf(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *stl="", const char *opt="")\r
+ { mgl_surf_xy(gr, &x, &y, &z, stl, opt); }\r
+ inline void Surf(const mglDataA &z, const char *stl="", const char *opt="")\r
+ { mgl_surf(gr, &z, stl, opt); }\r
+ /// Draw grid lines for density plot of 2d data specified parametrically\r
+ inline void Grid(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *stl="", const char *opt="")\r
+ { mgl_grid_xy(gr, &x, &y, &z, stl, opt); }\r
+ inline void Grid(const mglDataA &z, const char *stl="", const char *opt="")\r
+ { mgl_grid(gr, &z, stl, opt); }\r
+ /// Draw vertical tiles for 2d data specified parametrically\r
+ inline void Tile(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *stl="", const char *opt="")\r
+ { mgl_tile_xy(gr, &x, &y, &z, stl, opt); }\r
+ inline void Tile(const mglDataA &z, const char *stl="", const char *opt="")\r
+ { mgl_tile(gr, &z, stl, opt); }\r
+ /// Draw density plot for 2d data specified parametrically\r
+ inline void Dens(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *stl="", const char *opt="")\r
+ { mgl_dens_xy(gr, &x, &y, &z, stl, opt); }\r
+ inline void Dens(const mglDataA &z, const char *stl="", const char *opt="")\r
+ { mgl_dens(gr, &z, stl, opt); }\r
+ /// Draw vertical boxes for 2d data specified parametrically\r
+ inline void Boxs(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *stl="", const char *opt="")\r
+ { mgl_boxs_xy(gr, &x, &y, &z, stl, opt); }\r
+ inline void Boxs(const mglDataA &z, const char *stl="", const char *opt="")\r
+ { mgl_boxs(gr, &z, stl, opt); }\r
+\r
+ /// Draw contour lines for 2d data specified parametrically\r
+ inline void Cont(const mglDataA &v, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")\r
+ { mgl_cont_xy_val(gr, &v, &x, &y, &z, sch, opt); }\r
+ inline void Cont(const mglDataA &v, const mglDataA &z, const char *sch="", const char *opt="")\r
+ { mgl_cont_val(gr, &v, &z, sch, opt); }\r
+ inline void Cont(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")\r
+ { mgl_cont_xy(gr, &x, &y, &z, sch, opt); }\r
+ inline void Cont(const mglDataA &z, const char *sch="", const char *opt="")\r
+ { mgl_cont(gr, &z, sch, opt); }\r
+ /// Draw solid contours for 2d data specified parametrically\r
+ inline void ContF(const mglDataA &v, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")\r
+ { mgl_contf_xy_val(gr, &v, &x, &y, &z, sch, opt); }\r
+ inline void ContF(const mglDataA &v, const mglDataA &z, const char *sch="", const char *opt="")\r
+ { mgl_contf_val(gr, &v, &z, sch, opt); }\r
+ inline void ContF(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")\r
+ { mgl_contf_xy(gr, &x, &y, &z, sch, opt); }\r
+ inline void ContF(const mglDataA &z, const char *sch="", const char *opt="")\r
+ { mgl_contf(gr, &z, sch, opt); }\r
+ /// Draw solid contours for 2d data specified parametrically with manual colors\r
+ inline void ContD(const mglDataA &v, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")\r
+ { mgl_contd_xy_val(gr, &v, &x, &y, &z, sch, opt); }\r
+ inline void ContD(const mglDataA &v, const mglDataA &z, const char *sch="", const char *opt="")\r
+ { mgl_contd_val(gr, &v, &z, sch, opt); }\r
+ inline void ContD(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")\r
+ { mgl_contd_xy(gr, &x, &y, &z, sch, opt); }\r
+ inline void ContD(const mglDataA &z, const char *sch="", const char *opt="")\r
+ { mgl_contd(gr, &z, sch, opt); }\r
+ /// Draw contour lines for 2d data specified parametrically\r
+ inline void ContV(const mglDataA &v, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")\r
+ { mgl_contv_xy_val(gr, &v, &x, &y, &z, sch, opt); }\r
+ inline void ContV(const mglDataA &v, const mglDataA &z, const char *sch="", const char *opt="")\r
+ { mgl_contv_val(gr, &v, &z, sch, opt); }\r
+ inline void ContV(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")\r
+ { mgl_contv_xy(gr, &x, &y, &z, sch, opt); }\r
+ inline void ContV(const mglDataA &z, const char *sch="", const char *opt="")\r
+ { mgl_contv(gr, &z, sch, opt); }\r
+ /// Draw axial-symmetric isosurfaces for 2d data specified parametrically\r
+ inline void Axial(const mglDataA &v, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")\r
+ { mgl_axial_xy_val(gr, &v, &x, &y, &z, sch,opt); }\r
+ inline void Axial(const mglDataA &v, const mglDataA &z, const char *sch="", const char *opt="")\r
+ { mgl_axial_val(gr, &v, &z, sch, opt); }\r
+ inline void Axial(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")\r
+ { mgl_axial_xy(gr, &x, &y, &z, sch, opt); }\r
+ inline void Axial(const mglDataA &z, const char *sch="", const char *opt="")\r
+ { mgl_axial(gr, &z, sch, opt); }\r
+\r
+ /// Draw grid lines for density plot at slice for 3d data specified parametrically\r
+ inline void Grid3(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *stl="", float sVal=-1, const char *opt="")\r
+ { mgl_grid3_xyz(gr, &x, &y, &z, &a, stl, sVal, opt); }\r
+ inline void Grid3(const mglDataA &a, const char *stl="", float sVal=-1, const char *opt="")\r
+ { mgl_grid3(gr, &a, stl, sVal, opt); }\r
+ /// Draw density plot at slice for 3d data specified parametrically\r
+ inline void Dens3(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *stl="", float sVal=-1, const char *opt="")\r
+ { mgl_dens3_xyz(gr, &x, &y, &z, &a, stl, sVal, opt); }\r
+ inline void Dens3(const mglDataA &a, const char *stl="", float sVal=-1, const char *opt="")\r
+ { mgl_dens3(gr, &a, stl, sVal, opt); }\r
+\r
+ /// Draw isosurface(s) for 3d data specified parametrically\r
+ inline void Surf3(float Val, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *stl="", const char *opt="")\r
+ { mgl_surf3_xyz_val(gr, Val, &x, &y, &z, &a, stl, opt); }\r
+ inline void Surf3(float Val, const mglDataA &a, const char *stl="", const char *opt="")\r
+ { mgl_surf3_val(gr, Val, &a, stl, opt); }\r
+ inline void Surf3(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *stl="", const char *opt="")\r
+ { mgl_surf3_xyz(gr, &x, &y, &z, &a, stl, opt); }\r
+ inline void Surf3(const mglDataA &a, const char *stl="", const char *opt="")\r
+ { mgl_surf3(gr, &a, stl, opt); }\r
+\r
+ /// Draw a semi-transparent cloud for 3d data\r
+ inline void Cloud(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *stl="", const char *opt="")\r
+ { mgl_cloud_xyz(gr, &x, &y, &z, &a, stl, opt); }\r
+ inline void Cloud(const mglDataA &a, const char *stl="", const char *opt="")\r
+ { mgl_cloud(gr, &a, stl, opt); }\r
+\r
+ /// Draw contour lines at slice for 3d data specified parametrically\r
+ inline void Cont3(const mglDataA &v, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", float sVal=-1, const char *opt="")\r
+ { mgl_cont3_xyz_val(gr, &v, &x, &y, &z, &a, sch, sVal, opt); }\r
+ inline void Cont3(const mglDataA &v, const mglDataA &a, const char *sch="", float sVal=-1, const char *opt="")\r
+ { mgl_cont3_val(gr, &v, &a, sch, sVal, opt); }\r
+ inline void Cont3(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", float sVal=-1, const char *opt="")\r
+ { mgl_cont3_xyz(gr, &x, &y, &z, &a, sch, sVal, opt); }\r
+ inline void Cont3(const mglDataA &a, const char *sch="", float sVal=-1, const char *opt="")\r
+ { mgl_cont3(gr, &a, sch, sVal, opt); }\r
+\r
+ /// Draw solid contours at slice for 3d data specified parametrically\r
+ inline void ContF3(const mglDataA &v, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", float sVal=-1, const char *opt="")\r
+ { mgl_contf3_xyz_val(gr, &v, &x, &y, &z, &a, sch, sVal, opt); }\r
+ inline void ContF3(const mglDataA &v, const mglDataA &a, const char *sch="", float sVal=-1, const char *opt="")\r
+ { mgl_contf3_val(gr, &v, &a, sch, sVal, opt); }\r
+ inline void ContF3(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", float sVal=-1, const char *opt="")\r
+ { mgl_contf3_xyz(gr, &x, &y, &z, &a, sch, sVal, opt); }\r
+ inline void ContF3(const mglDataA &a, const char *sch="", float sVal=-1, const char *opt="")\r
+ { mgl_contf3(gr, &a, sch, sVal, opt); }\r
+\r
+ /// Draw several isosurfaces for 3d beam in curvilinear coordinates\r
+ inline void Beam(const mglDataA &tr, const mglDataA &g1, const mglDataA &g2, const mglDataA &a, float r, const char *stl=0, int flag=0, int num=3)\r
+ { mgl_beam(gr, &tr,&g1,&g2,&a,r,stl,flag,num); }\r
+ inline void Beam(float val, const mglDataA &tr, const mglDataA &g1, const mglDataA &g2, const mglDataA &a, float r, const char *stl=NULL, int flag=0)\r
+ { mgl_beam_val(gr,val,&tr,&g1,&g2,&a,r,stl,flag); }\r
+\r
+ /// Draw vertical tiles with variable size for 2d data specified parametrically\r
+ inline void TileS(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &r, const char *stl="", const char *opt="")\r
+ { mgl_tiles_xy(gr, &x, &y, &z, &r, stl, opt); }\r
+ inline void TileS(const mglDataA &z, const mglDataA &r, const char *stl="", const char *opt="")\r
+ { mgl_tiles(gr, &z, &r, stl, opt); }\r
+ /// Draw surface for 2d data specified parametrically with color proportional to c\r
+ inline void SurfC(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")\r
+ { mgl_surfc_xy(gr, &x, &y, &z, &c, sch,opt); }\r
+ inline void SurfC(const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")\r
+ { mgl_surfc(gr, &z, &c, sch,opt); }\r
+ /// Draw surface for 2d data specified parametrically with alpha proportional to c\r
+ inline void SurfA(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")\r
+ { mgl_surfa_xy(gr, &x, &y, &z, &c, sch,opt); }\r
+ inline void SurfA(const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")\r
+ { mgl_surfa(gr, &z, &c, sch,opt); }\r
+ /// Color map of matrix a to matrix b, both matrix can parametrically depend on coordinates\r
+ inline void Map(const mglDataA &x, const mglDataA &y, const mglDataA &a, const mglDataA &b, const char *sch="", const char *opt="")\r
+ { mgl_map_xy(gr, &x, &y, &a, &b, sch, opt); }\r
+ inline void Map(const mglDataA &a, const mglDataA &b, const char *sch="", const char *opt="")\r
+ { mgl_map(gr, &a, &b, sch, opt); }\r
+ /// Draw density plot for spectra-gramm specified parametrically\r
+ inline void STFA(const mglDataA &x, const mglDataA &y, const mglDataA &re, const mglDataA &im, int dn, const char *sch="", const char *opt="")\r
+ { mgl_stfa_xy(gr, &x, &y, &re, &im, dn, sch, opt); }\r
+ inline void STFA(const mglDataA &re, const mglDataA &im, int dn, const char *sch="", const char *opt="")\r
+ { mgl_stfa(gr, &re, &im, dn, sch, opt); }\r
+\r
+ /// Draw isosurface(s) for 3d data specified parametrically with alpha proportional to b\r
+ inline void Surf3A(float Val, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const mglDataA &b, const char *stl="", const char *opt="")\r
+ { mgl_surf3a_xyz_val(gr, Val, &x, &y, &z, &a, &b, stl, opt); }\r
+ inline void Surf3A(float Val, const mglDataA &a, const mglDataA &b, const char *stl="", const char *opt="")\r
+ { mgl_surf3a_val(gr, Val, &a, &b, stl, opt); }\r
+ inline void Surf3A(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const mglDataA &b, const char *stl="", const char *opt="")\r
+ { mgl_surf3a_xyz(gr, &x, &y, &z, &a, &b, stl, opt); }\r
+ inline void Surf3A(const mglDataA &a, const mglDataA &b, const char *stl="", const char *opt="")\r
+ { mgl_surf3a(gr, &a, &b, stl, opt); }\r
+ /// Draw isosurface(s) for 3d data specified parametrically with color proportional to b\r
+ inline void Surf3C(float Val, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const mglDataA &b, const char *stl="", const char *opt="")\r
+ { mgl_surf3c_xyz_val(gr, Val, &x, &y, &z, &a, &b, stl,opt); }\r
+ inline void Surf3C(float Val, const mglDataA &a, const mglDataA &b, const char *stl="", const char *opt="")\r
+ { mgl_surf3c_val(gr, Val, &a, &b, stl, opt); }\r
+ inline void Surf3C(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const mglDataA &b, const char *stl="", const char *opt="")\r
+ { mgl_surf3c_xyz(gr, &x, &y, &z, &a, &b, stl, opt); }\r
+ inline void Surf3C(const mglDataA &a, const mglDataA &b, const char *stl="", const char *opt="")\r
+ { mgl_surf3c(gr, &a, &b, stl, opt); }\r
+\r
+ /// Plot dew drops for vector field {ax,ay} parametrically depended on coordinate {x,y}\r
+ inline void Dew(const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")\r
+ { mgl_dew_xy(gr, &x, &y, &ax, &ay, sch, opt); }\r
+ inline void Dew(const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")\r
+ { mgl_dew_2d(gr, &ax, &ay, sch, opt); }\r
+ /// Plot vectors at position {x,y,z} along {ax,ay,az} with length/color proportional to |a|\r
+ inline void Traj(const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")\r
+ { mgl_traj_xy(gr, &x, &y, &ax, &ay, sch, opt); }\r
+ inline void Traj(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")\r
+ { mgl_traj_xyz(gr, &x, &y, &z, &ax, &ay, &az, sch, opt); }\r
+ /// Plot vector field {ax,ay,ay} parametrically depended on coordinate {x,y,z} with length/color proportional to |a|\r
+ inline void Vect(const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")\r
+ { mgl_vect_xy(gr, &x, &y, &ax, &ay, sch, opt); }\r
+ inline void Vect(const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")\r
+ { mgl_vect_2d(gr, &ax, &ay, sch, opt); }\r
+ inline void Vect(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")\r
+ { mgl_vect_xyz(gr, &x, &y, &z, &ax, &ay, &az, sch, opt); }\r
+ inline void Vect(const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")\r
+ { mgl_vect_3d(gr, &ax, &ay, &az, sch, opt); }\r
+\r
+ /// Plot flows for vector field {ax,ay,ay} parametrically depended on coordinate {x,y,z} with color proportional to |a|\r
+ inline void Flow(const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")\r
+ { mgl_flow_xy(gr, &x, &y, &ax, &ay, sch, opt); }\r
+ inline void Flow(const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")\r
+ { mgl_flow_2d(gr, &ax, &ay, sch, opt); }\r
+ inline void Flow(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")\r
+ { mgl_flow_xyz(gr, &x, &y, &z, &ax, &ay, &az, sch, opt); }\r
+ inline void Flow(const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")\r
+ { mgl_flow_3d(gr, &ax, &ay, &az, sch, opt); }\r
+ /// Plot flow from point p for vector field {ax,ay,ay} parametrically depended on coordinate {x,y,z} with color proportional to |a|\r
+ inline void FlowP(mglPoint p, const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")\r
+ { mgl_flowp_xy(gr, p.x, p.y, p.z, &x, &y, &ax, &ay, sch, opt); }\r
+ inline void FlowP(mglPoint p, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")\r
+ { mgl_flowp_2d(gr, p.x, p.y, p.z, &ax, &ay, sch, opt); }\r
+ inline void FlowP(mglPoint p, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")\r
+ { mgl_flowp_xyz(gr, p.x, p.y, p.z, &x, &y, &z, &ax, &ay, &az, sch, opt); }\r
+ inline void FlowP(mglPoint p, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")\r
+ { mgl_flowp_3d(gr, p.x, p.y, p.z, &ax, &ay, &az, sch, opt); }\r
+\r
+ /// Plot flows for gradient of scalar field phi parametrically depended on coordinate {x,y,z}\r
+ inline void Grad(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &phi, const char *sch="", const char *opt="")\r
+ { mgl_grad_xyz(gr,&x,&y,&z,&phi,sch,opt); }\r
+ inline void Grad(const mglDataA &x, const mglDataA &y, const mglDataA &phi, const char *sch="", const char *opt="")\r
+ { mgl_grad_xy(gr,&x,&y,&phi,sch,opt); }\r
+ inline void Grad(const mglDataA &phi, const char *sch="", const char *opt="")\r
+ { mgl_grad(gr,&phi,sch,opt); }\r
+\r
+ /// Plot flow pipes for vector field {ax,ay,ay} parametrically depended on coordinate {x,y,z} with color proportional to |a|\r
+ inline void Pipe(const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", float r0=0.05, const char *opt="")\r
+ { mgl_pipe_xy(gr, &x, &y, &ax, &ay, sch, r0, opt); }\r
+ inline void Pipe(const mglDataA &ax, const mglDataA &ay, const char *sch="", float r0=0.05, const char *opt="")\r
+ { mgl_pipe_2d(gr, &ax, &ay, sch, r0, opt); }\r
+ inline void Pipe(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", float r0=0.05, const char *opt="")\r
+ { mgl_pipe_xyz(gr, &x, &y, &z, &ax, &ay, &az, sch, r0, opt); }\r
+ inline void Pipe(const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", float r0=0.05, const char *opt="")\r
+ { mgl_pipe_3d(gr, &ax, &ay, &az, sch, r0, opt); }\r
+\r
+ /// Draw density plot for data at x = sVal\r
+ inline void DensX(const mglDataA &a, const char *stl="", float sVal=NaN, const char *opt="")\r
+ { mgl_dens_x(gr, &a, stl, sVal, opt); }\r
+ /// Draw density plot for data at y = sVal\r
+ inline void DensY(const mglDataA &a, const char *stl="", float sVal=NaN, const char *opt="")\r
+ { mgl_dens_y(gr, &a, stl, sVal, opt); }\r
+ /// Draw density plot for data at z = sVal\r
+ inline void DensZ(const mglDataA &a, const char *stl="", float sVal=NaN, const char *opt="")\r
+ { mgl_dens_z(gr, &a, stl, sVal, opt); }\r
+ /// Draw contour plots for data at x = sVal\r
+ inline void ContX(const mglDataA &a, const char *stl="", float sVal=NaN, const char *opt="")\r
+ { mgl_cont_x(gr, &a, stl, sVal, opt); }\r
+ inline void ContX(const mglDataA &v, const mglDataA &a, const char *stl="", float sVal=NaN, const char *opt="")\r
+ { mgl_cont_x_val(gr, &v, &a, stl, sVal, opt); }\r
+ /// Draw contour plots for data at y = sVal\r
+ inline void ContY(const mglDataA &a, const char *stl="", float sVal=NaN, const char *opt="")\r
+ { mgl_cont_y(gr, &a, stl, sVal, opt); }\r
+ inline void ContY(const mglDataA &v, const mglDataA &a, const char *stl="", float sVal=NaN, const char *opt="")\r
+ { mgl_cont_y_val(gr, &v, &a, stl, sVal, opt); }\r
+ /// Draw contour plots for data at z = sVal\r
+ inline void ContZ(const mglDataA &a, const char *stl="", float sVal=NaN, const char *opt="")\r
+ { mgl_cont_z(gr, &a, stl, sVal, opt); }\r
+ inline void ContZ(const mglDataA &v, const mglDataA &a, const char *stl="", float sVal=NaN, const char *opt="")\r
+ { mgl_cont_z_val(gr, &v, &a, stl, sVal, opt); }\r
+ /// Draw solid contour plots for data at x = sVal\r
+ inline void ContFX(const mglDataA &a, const char *stl="", float sVal=NaN, const char *opt="")\r
+ { mgl_contf_x(gr, &a, stl, sVal, opt); }\r
+ inline void ContFX(const mglDataA &v, const mglDataA &a, const char *stl="", float sVal=NaN, const char *opt="")\r
+ { mgl_contf_x_val(gr, &v, &a, stl, sVal, opt); }\r
+ /// Draw solid contour plots for data at y = sVal\r
+ inline void ContFY(const mglDataA &a, const char *stl="", float sVal=NaN, const char *opt="")\r
+ { mgl_contf_y(gr, &a, stl, sVal, opt); }\r
+ inline void ContFY(const mglDataA &v, const mglDataA &a, const char *stl="", float sVal=NaN, const char *opt="")\r
+ { mgl_contf_y_val(gr, &v, &a, stl, sVal, opt); }\r
+ /// Draw solid contour plots for data at z = sVal\r
+ inline void ContFZ(const mglDataA &a, const char *stl="", float sVal=NaN, const char *opt="")\r
+ { mgl_contf_z(gr, &a, stl, sVal, opt); }\r
+ inline void ContFZ(const mglDataA &v, const mglDataA &a, const char *stl="", float sVal=NaN, const char *opt="")\r
+ { mgl_contf_z_val(gr, &v, &a, stl, sVal, opt); }\r
+\r
+ /// Draw curve for formula with x in range [Min.x, Max.x]\r
+ inline void FPlot(const char *fy, const char *stl="", const char *opt="")\r
+ { mgl_fplot(gr, fy, stl, opt); }\r
+ /// Draw curve for formulas parametrically depended on t in range [0,1]\r
+ inline void FPlot(const char *fx, const char *fy, const char *fz, const char *stl, const char *opt="")\r
+ { mgl_fplot_xyz(gr, fx, fy, fz, stl, opt); }\r
+ /// Draw surface by formula with x,y in range [Min, Max]\r
+ inline void FSurf(const char *fz, const char *stl="", const char *opt="")\r
+ { mgl_fsurf(gr, fz, stl, opt); }\r
+ /// Draw surface by formulas parametrically depended on u,v in range [0,1]\r
+ inline void FSurf(const char *fx, const char *fy, const char *fz, const char *stl, const char *opt="")\r
+ { mgl_fsurf_xyz(gr, fx, fy, fz, stl, opt); }\r
+\r
+ /// Draw triangle mesh for points in arrays {x,y,z} with specified color c.\r
+ inline void TriPlot(const mglDataA &nums, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")\r
+ { mgl_triplot_xyzc(gr, &nums, &x, &y, &z, &c, sch, opt); }\r
+ inline void TriPlot(const mglDataA &nums, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")\r
+ { mgl_triplot_xyz(gr, &nums, &x, &y, &z, sch, opt); }\r
+ inline void TriPlot(const mglDataA &nums, const mglDataA &x, const mglDataA &y, const char *sch="", const char *opt="")\r
+ { mgl_triplot_xy(gr, &nums, &x, &y, sch, opt); }\r
+ /// Draw quad mesh for points in arrays {x,y,z} with specified color c.\r
+ inline void QuadPlot(const mglDataA &nums, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")\r
+ { mgl_quadplot_xyzc(gr, &nums, &x, &y, &z, &c, sch, opt); }\r
+ inline void QuadPlot(const mglDataA &nums, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")\r
+ { mgl_quadplot_xyz(gr, &nums, &x, &y, &z, sch, opt); }\r
+ inline void QuadPlot(const mglDataA &nums, const mglDataA &x, const mglDataA &y, const char *sch="", const char *opt="")\r
+ { mgl_quadplot_xy(gr, &nums, &x, &y, sch, opt); }\r
+\r
+ /// Draw contour lines for triangle mesh for points in arrays {x,y,z}.\r
+ inline void TriCont(const mglDataA &nums, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")\r
+ { mgl_tricont_xyc(gr, &nums, &x, &y, &z, sch, opt); }\r
+ inline void TriContV(const mglDataA &v, const mglDataA &nums, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")\r
+ { mgl_tricont_xycv(gr, &v, &nums, &x, &y, &z, sch, opt); }\r
+ inline void TriCont(const mglDataA &nums, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", const char *opt="")\r
+ { mgl_tricont_xyzc(gr, &nums, &x, &y, &z, &a, sch, opt); }\r
+ inline void TriContV(const mglDataA &v, const mglDataA &nums, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", const char *opt="")\r
+ { mgl_tricont_xyzcv(gr, &v, &nums, &x, &y, &z, &a, sch, opt); }\r
+\r
+ /// Draw dots in points {x,y,z}.\r
+ inline void Dots(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")\r
+ { mgl_dots(gr, &x, &y, &z, sch, opt); }\r
+ /// Draw semitransparent dots in points {x,y,z}.\r
+ inline void Dots(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", const char *opt="")\r
+ { mgl_dots_a(gr, &x, &y, &z, &a, sch, opt); }\r
+ /// Draw surface reconstructed for points in arrays {x,y,z}.\r
+ inline void Crust(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")\r
+ { mgl_crust(gr, &x, &y, &z, sch, opt); }\r
+\r
+ /// Fit data along x-direction for each data row. Return array with values for found formula.\r
+ inline mglData Fit(const mglDataA &y, const char *eq, const char *var, const char *opt="")\r
+ { return mglData(true,mgl_fit_1(gr, &y, eq,var,0, opt)); }\r
+ inline mglData Fit(const mglDataA &y, const char *eq, const char *var, mglData &ini, const char *opt="")\r
+ { return mglData(true,mgl_fit_1(gr, &y, eq, var, &ini, opt)); }\r
+ /// Fit data along x-, y-directions for each data slice. Return array with values for found formula.\r
+ inline mglData Fit2(const mglDataA &z, const char *eq, const char *var, const char *opt="")\r
+ { return mglData(true,mgl_fit_2(gr, &z, eq, var,0, opt)); }\r
+ inline mglData Fit2(const mglDataA &z, const char *eq, const char *var, mglData &ini, const char *opt="")\r
+ { return mglData(true,mgl_fit_2(gr, &z, eq, var, &ini, opt)); }\r
+ /// Fit data along along all directions. Return array with values for found formula.\r
+ inline mglData Fit3(const mglDataA &a, const char *eq, const char *var, const char *opt="")\r
+ { return mglData(true,mgl_fit_3(gr, &a, eq, var,0, opt)); }\r
+ inline mglData Fit3(const mglDataA &a, const char *eq, const char *var, mglData &ini, const char *opt="")\r
+ { return mglData(true,mgl_fit_3(gr, &a, eq, var, &ini, opt)); }\r
+ /// Fit data along x-direction for each data row. Return array with values for found formula.\r
+ inline mglData Fit(const mglDataA &x, const mglDataA &y, const char *eq, const char *var, const char *opt="")\r
+ { return mglData(true,mgl_fit_xy(gr, &x, &y, eq, var,0, opt)); }\r
+ inline mglData Fit(const mglDataA &x, const mglDataA &y, const char *eq, const char *var, mglData &ini, const char *opt="")\r
+ { return mglData(true,mgl_fit_xy(gr, &x, &y, eq, var, &ini, opt)); }\r
+ /// Fit data along x-, y-directions for each data slice. Return array with values for found formula.\r
+ inline mglData Fit(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *eq, const char *var, const char *opt="")\r
+ { return mglData(true,mgl_fit_xyz(gr, &x, &y, &z, eq, var,0, opt)); }\r
+ inline mglData Fit(const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *eq, const char *var, mglData &ini, const char *opt="")\r
+ { return mglData(true,mgl_fit_xyz(gr, &x, &y, &z, eq, var, &ini, opt)); }\r
+ /// Fit data along along all directions. Return array with values for found formula.\r
+ inline mglData Fit(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *eq, const char *var, const char *opt="")\r
+ { return mglData(true,mgl_fit_xyza(gr, &x, &y, &z, &a, eq, var,0, opt)); }\r
+ inline mglData Fit(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *eq, const char *var, mglData &ini, const char *opt="")\r
+ { return mglData(true,mgl_fit_xyza(gr, &x, &y, &z, &a, eq,var, &ini, opt)); }\r
+ /// Fit data with dispersion s along x-direction for each data row. Return array with values for found formula.\r
+ inline mglData FitS(const mglDataA &y, const mglDataA &s, const char *eq, const char *var, const char *opt="")\r
+ { return mglData(true,mgl_fit_ys(gr, &y, &s, eq, var,0, opt)); }\r
+ inline mglData FitS(const mglDataA &y, const mglDataA &s, const char *eq, const char *var, mglData &ini, const char *opt="")\r
+ { return mglData(true,mgl_fit_ys(gr, &y, &s, eq, var, &ini, opt)); }\r
+ inline mglData FitS(const mglDataA &x, const mglDataA &y, const mglDataA &s, const char *eq, const char *var, const char *opt="")\r
+ { return mglData(true,mgl_fit_xys(gr, &x, &y, &s, eq, var,0, opt)); }\r
+ inline mglData FitS(const mglDataA &x, const mglDataA &y, const mglDataA &s, const char *eq, const char *var, mglData &ini, const char *opt="")\r
+ { return mglData(true,mgl_fit_xys(gr, &x, &y, &s, eq, var, &ini, opt)); }\r
+ /// Fit data with dispersion s along x-, y-directions for each data slice. Return array with values for found formula.\r
+ inline mglData FitS(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &s, const char *eq, const char *var, const char *opt="")\r
+ { return mglData(true,mgl_fit_xyzs(gr, &x, &y, &z, &s, eq, var,0, opt)); }\r
+ inline mglData FitS(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &s, const char *eq, const char *var, mglData &ini, const char *opt="")\r
+ { return mglData(true,mgl_fit_xyzs(gr, &x, &y, &z, &s, eq, var, &ini, opt)); }\r
+ /// Fit data with dispersion s along all directions. Return array with values for found formula.\r
+ inline mglData FitS(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const mglDataA &s, const char *eq, const char *var, const char *opt="")\r
+ { return mglData(true,mgl_fit_xyzas(gr, &x, &y, &z, &a, &s, eq, var,0, opt)); }\r
+ inline mglData FitS(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const mglDataA &s, const char *eq, const char *var, mglData &ini, const char *opt="")\r
+ { return mglData(true,mgl_fit_xyzas(gr, &x, &y, &z, &a, &s, eq, var, &ini, opt)); }\r
+ /// Print fitted last formula (with coefficients)\r
+ inline void PutsFit(mglPoint p, const char *prefix=0, const char *font=0, float size=-1)\r
+ { mgl_puts_fit(gr, p.x, p.y, p.z, prefix, font, size); }\r
+ /// Get last fitted formula\r
+ inline const char *GetFit()\r
+ { return mgl_get_fit(gr); }\r
+\r
+ /// Solve PDE with x,y,z in range [Min, Max]\r
+ inline mglData PDE(const char *ham, const mglDataA &ini_re, const mglDataA &ini_im, float dz=0.1, float k0=100, const char *opt="")\r
+ { return mglData(true,mgl_pde_solve(gr,ham,&ini_re,&ini_im,dz,k0, opt)); }\r
+ /// Fill data by formula with x,y,z in range [Min, Max]\r
+ inline void Fill(mglData &u, const char *eq, const char *opt="")\r
+ { mgl_data_fill_eq(gr, &u, eq, 0, 0, opt); }\r
+ inline void Fill(mglData &u, const char *eq, const mglDataA &v, const char *opt="")\r
+ { mgl_data_fill_eq(gr, &u, eq, &v, 0, opt); }\r
+ inline void Fill(mglData &u, const char *eq, const mglDataA &v, const mglDataA &w, const char *opt="")\r
+ { mgl_data_fill_eq(gr, &u, eq, &v, &w, opt); }\r
+\r
+ /// Make histogram (distribution) of data. This function do not plot data.\r
+ inline mglData Hist(const mglDataA &x, const mglDataA &a, const char *opt="")\r
+ { return mglData(true, mgl_hist_x(gr, &x, &a, opt)); }\r
+ inline mglData Hist(const mglDataA &x, const mglDataA &y, const mglDataA &a, const char *opt="")\r
+ { return mglData(true, mgl_hist_xy(gr, &x, &y, &a, opt)); }\r
+ inline mglData Hist(const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *opt="")\r
+ { return mglData(true, mgl_hist_xyz(gr, &x, &y, &z, &a, opt)); }\r
+\r
+ inline void Compression(bool){} // NOTE: Add later -- IDTF\r
+ inline void VertexColor(bool){} // NOTE: Add later -- IDTF\r
+ inline void DoubleSided(bool){} // NOTE: Add later -- IDTF\r
+ inline void TextureColor(bool){} // NOTE: Add later -- IDTF\r
+};\r
+//-----------------------------------------------------------------------------\r
+/// Callback function for asking user a question. Result shouldn't exceed 1024.\r
+extern void (*mgl_ask_func)(const wchar_t *quest, wchar_t *res);\r
+//-----------------------------------------------------------------------------\r
+/// Wrapper class for MGL parsing\r
+class mglParse\r
+{\r
+ HMPR pr;\r
+public:\r
+ mglParse(HMPR p) { pr = p; mgl_use_parser(pr,1); }\r
+ mglParse(mglParse &p) { pr = p.pr; mgl_use_parser(pr,1); }\r
+ mglParse(bool setsize=false)\r
+ { pr=mgl_create_parser(); mgl_parser_allow_setsize(pr, setsize); }\r
+ ~mglParse() { if(mgl_use_parser(pr,-1)<1) mgl_delete_parser(pr); }\r
+ inline HMPR Self() { return pr; }\r
+ inline int Parse(mglGraph *gr, const char *str, int pos)\r
+ { return mgl_parse(gr->Self(), pr, str, pos); }\r
+ inline int Parse(mglGraph *gr, const wchar_t *str, int pos)\r
+ { return mgl_parsew(gr->Self(), pr, str, pos); }\r
+ inline void Execute(mglGraph *gr, const char *str)\r
+ { mgl_parse_text(gr->Self(), pr, str); }\r
+ inline void Execute(mglGraph *gr, const wchar_t *str)\r
+ { mgl_parsew_text(gr->Self(), pr, str); }\r
+ inline void Execute(mglGraph *gr, FILE *fp, bool print=false)\r
+ { mgl_parse_file(gr->Self(), pr, fp, print); }\r
+ inline int CmdType(const char *name)\r
+ { return mgl_cmd_type(pr, name); }\r
+ inline const char *CmdFormat(const char *name)\r
+ { return mgl_cmd_frmt(pr, name); }\r
+ inline const char *CmdDesc(const char *name)\r
+ { return mgl_cmd_desc(pr, name); }\r
+\r
+ inline void AddParam(int id, const char *str) { mgl_add_param(pr, id, str); }\r
+ inline void AddParam(int id, const wchar_t *str){ mgl_add_paramw(pr, id, str); }\r
+ inline void RestoreOnce() { mgl_restore_once(pr); }\r
+ inline void AllowSetSize(bool allow) { mgl_parser_allow_setsize(pr, allow); }\r
+\r
+ /*===!!! NOTE !!! You must not delete obtained data arrays !!!===============*/\r
+ inline mglData *AddVar(const char *name) { return mgl_add_var(pr, name); }\r
+ /*===!!! NOTE !!! You must not delete obtained data arrays !!!===============*/\r
+ inline mglData *FindVar(const char *name) { return mgl_find_var(pr, name); }\r
+ inline void DeleteVar(const char *name) { mgl_del_var(pr, name); }\r
+ inline void Stop() { mgl_parser_stop(pr); }\r
+};\r
+//-----------------------------------------------------------------------------\r
+/// Wrapper class expression evaluating\r
+class mglExpr\r
+{\r
+ HMEX ex;\r
+public:\r
+ mglExpr(const char *expr) { ex = mgl_create_expr(expr); }\r
+ ~mglExpr() { mgl_delete_expr(ex); }\r
+ inline mreal Eval(mreal x, mreal y=0, mreal z=0)\r
+ { return mgl_expr_eval(ex,x,y,z); }\r
+ inline mreal Diff(char dir, mreal x, mreal y=0, mreal z=0)\r
+ { return mgl_expr_diff(ex,dir, x,y,z); }\r
+#ifndef SWIG\r
+ inline mreal Eval(mreal var[26])\r
+ { return mgl_expr_eval_v(ex,var); }\r
+ inline mreal Diff(char dir, mreal var[26])\r
+ { return mgl_expr_diff_v(ex,dir, var); }\r
+#endif\r
+};\r
+//-----------------------------------------------------------------------------\r
+#endif\r
--- /dev/null
+/***************************************************************************\r
+ * mgl_cf.cpp is part of Math Graphic Library\r
+ * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
+ * *\r
+ * This program is free software; you can redistribute it and/or modify *\r
+ * it under the terms of the GNU Library General Public License as *\r
+ * published by the Free Software Foundation; either version 3 of the *\r
+ * License, or (at your option) any later version. *\r
+ * *\r
+ * This program is distributed in the hope that it will be useful, *\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
+ * GNU General Public License for more details. *\r
+ * *\r
+ * You should have received a copy of the GNU Library General Public *\r
+ * License along with this program; if not, write to the *\r
+ * Free Software Foundation, Inc., *\r
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
+ ***************************************************************************/\r
+#ifndef _MGL_CF_H_\r
+#define _MGL_CF_H_\r
+/*****************************************************************************/\r
+#include "mgl2/base_cf.h"\r
+#include "mgl2/data_cf.h"\r
+#include "mgl2/cont.h"\r
+#include "mgl2/fit.h"\r
+#include "mgl2/plot.h"\r
+#include "mgl2/surf.h"\r
+#include "mgl2/volume.h"\r
+#include "mgl2/vect.h"\r
+#include "mgl2/prim.h"\r
+#include "mgl2/other.h"\r
+#include "mgl2/canvas_cf.h"\r
+#include "mgl2/addon.h"\r
+/*****************************************************************************/\r
+#endif\r
--- /dev/null
+/***************************************************************************\r
+ * opengl.h is part of Math Graphic Library\r
+ * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
+ * *\r
+ * This program is free software; you can redistribute it and/or modify *\r
+ * it under the terms of the GNU Library General Public License as *\r
+ * published by the Free Software Foundation; either version 3 of the *\r
+ * License, or (at your option) any later version. *\r
+ * *\r
+ * This program is distributed in the hope that it will be useful, *\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
+ * GNU General Public License for more details. *\r
+ * *\r
+ * You should have received a copy of the GNU Library General Public *\r
+ * License along with this program; if not, write to the *\r
+ * Free Software Foundation, Inc., *\r
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
+ ***************************************************************************/\r
+#ifndef MGL_CANVAS_GL_H\r
+#define MGL_CANVAS_GL_H\r
+/*****************************************************************************/\r
+#ifdef __cplusplus\r
+#include "mgl2/canvas.h"\r
+\r
+class mglCanvasGL : public mglCanvas\r
+{\r
+public:\r
+ mglCanvasGL();\r
+ ~mglCanvasGL();\r
+\r
+ void SetQuality(int =0) { Quality=2; }\r
+ void Finish(bool fast=true);\r
+ void SetSize(int ,int ) {}\r
+ void View(float tetX,float tetY,float tetZ);\r
+ int NewFrame();\r
+ void EndFrame();\r
+\r
+ bool Alpha(bool enable);\r
+ void Fog(float d, float dz=0.25);\r
+ bool Light(bool enable);\r
+ void Light(int n, bool enable);\r
+ void AddLight(int n,mglPoint r,mglPoint d, char c='w', float bright=0.5, float ap=0);\r
+ void Clf(mglColor Back=WC);\r
+\r
+protected:\r
+ void line_draw(long p1, long p2, mglDrawReg *d);\r
+ void trig_draw(long p1, long p2, long p3, bool anorm, mglDrawReg *d);\r
+ void quad_draw(long p1, long p2, long p3, long p4, mglDrawReg *d);\r
+ void pnt_draw(long p, mglDrawReg *d);\r
+\r
+ unsigned char **GetRGBLines(long &w, long &h, unsigned char *&f, bool solid=true);\r
+ void LightScale();\r
+ void set_pen(unsigned style,float width);\r
+};\r
+extern "C" {\r
+#endif\r
+/*****************************************************************************/\r
+HMGL mgl_create_graph_gl();\r
+/*****************************************************************************/\r
+uintptr_t mgl_create_graph_gl_();\r
+/*****************************************************************************/\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+/*****************************************************************************/\r
+#endif\r
+\r
--- /dev/null
+/***************************************************************************\r
+ * other.h is part of Math Graphic Library\r
+ * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
+ * *\r
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Library General Public License as *
+ * published by the Free Software Foundation; either version 3 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef _MGL_OTHER_H_\r
+#define _MGL_OTHER_H_
+#include "mgl2/base.h"\r
+/*****************************************************************************/\r
+#ifdef __cplusplus
+extern "C" {\r
+#endif\r
+/*****************************************************************************/\r
+void mgl_triplot_xyzc(HMGL gr, HCDT nums, HCDT x, HCDT y, HCDT z, HCDT c, const char *sch, const char *opt);\r
+void mgl_triplot_xyz(HMGL gr, HCDT nums, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
+void mgl_triplot_xy(HMGL gr, HCDT nums, HCDT x, HCDT y, const char *sch, const char *opt);\r
+
+void mgl_quadplot_xyzc(HMGL gr, HCDT nums, HCDT x, HCDT y, HCDT z, HCDT c, const char *sch, const char *opt);\r
+void mgl_quadplot_xyz(HMGL gr, HCDT nums, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
+void mgl_quadplot_xy(HMGL gr, HCDT nums, HCDT x, HCDT y, const char *sch, const char *opt);\r
+
+void mgl_tricont_xyzcv(HMGL gr, HCDT v, HCDT nums, HCDT x, HCDT y, HCDT z, HCDT c, const char *sch, const char *opt);\r
+void mgl_tricont_xycv(HMGL gr, HCDT v, HCDT nums, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
+void mgl_tricont_xyzc(HMGL gr, HCDT nums, HCDT x, HCDT y, HCDT z, HCDT c, const char *sch, const char *opt);\r
+void mgl_tricont_xyc(HMGL gr, HCDT nums, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
+
+void mgl_dots(HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
+void mgl_dots_a(HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, const char *opt);\r
+
+void mgl_crust(HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
+
+void mgl_dens_x(HMGL graph, HCDT a, const char *stl, float sVal, const char *opt);\r
+void mgl_dens_y(HMGL graph, HCDT a, const char *stl, float sVal, const char *opt);\r
+void mgl_dens_z(HMGL graph, HCDT a, const char *stl, float sVal, const char *opt);
+\r
+void mgl_cont_x(HMGL graph, HCDT a, const char *stl, float sVal, const char *opt);\r
+void mgl_cont_y(HMGL graph, HCDT a, const char *stl, float sVal, const char *opt);\r
+void mgl_cont_z(HMGL graph, HCDT a, const char *stl, float sVal, const char *opt);
+\r
+void mgl_cont_x_val(HMGL graph, HCDT v, HCDT a, const char *stl, float sVal, const char *opt);\r
+void mgl_cont_y_val(HMGL graph, HCDT v, HCDT a, const char *stl, float sVal, const char *opt);\r
+void mgl_cont_z_val(HMGL graph, HCDT v, HCDT a, const char *stl, float sVal, const char *opt);
+\r
+void mgl_contf_x(HMGL graph, HCDT a, const char *stl, float sVal, const char *opt);\r
+void mgl_contf_y(HMGL graph, HCDT a, const char *stl, float sVal, const char *opt);\r
+void mgl_contf_z(HMGL graph, HCDT a, const char *stl, float sVal, const char *opt);
+\r
+void mgl_contf_x_val(HMGL graph, HCDT v, HCDT a, const char *stl, float sVal, const char *opt);\r
+void mgl_contf_y_val(HMGL graph, HCDT v, HCDT a, const char *stl, float sVal, const char *opt);\r
+void mgl_contf_z_val(HMGL graph, HCDT v, HCDT a, const char *stl, float sVal, const char *opt);\r
+
+/*****************************************************************************/\r
+\r
+void mgl_triplot_xyzc_(uintptr_t *gr, uintptr_t *nums, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *c, const char *sch, const char *opt,int,int);\r
+void mgl_triplot_xyz_(uintptr_t *gr, uintptr_t *nums, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int,int);\r
+void mgl_triplot_xy_(uintptr_t *gr, uintptr_t *nums, uintptr_t *x, uintptr_t *y, const char *sch, const char *opt,int,int);\r
+void mgl_quadplot_xyzc_(uintptr_t *gr, uintptr_t *nums, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *c, const char *sch, const char *opt,int,int);\r
+void mgl_quadplot_xyz_(uintptr_t *gr, uintptr_t *nums, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int,int);\r
+void mgl_quadplot_xy_(uintptr_t *gr, uintptr_t *nums, uintptr_t *x, uintptr_t *y, const char *sch, const char *opt,int,int);\r
+
+void mgl_tricont_xyzcv_(uintptr_t *gr, uintptr_t *v, uintptr_t *nums, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *c, const char *sch, const char *opt,int,int);\r
+void mgl_tricont_xycv_(uintptr_t *gr, uintptr_t *v, uintptr_t *nums, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int,int);\r
+void mgl_tricont_xyzc_(uintptr_t *gr, uintptr_t *nums, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *c, const char *sch, const char *opt,int, int);\r
+void mgl_tricont_xyc_(uintptr_t *gr, uintptr_t *nums, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int, int);\r
+
+void mgl_dots_(uintptr_t *gr, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int,int);\r
+void mgl_dots_a_(uintptr_t *gr, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *a, const char *sch, const char *opt,int,int);\r
+void mgl_dots_tr_(uintptr_t *gr, uintptr_t *tr, const char *sch, const char *opt,int,int);\r
+void mgl_crust_(uintptr_t *gr, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int,int);\r
+void mgl_crust_tr_(uintptr_t *gr, uintptr_t *tr, const char *sch, const char *opt,int,int);\r
+
+void mgl_dens_x_(uintptr_t *graph, uintptr_t *a, const char *stl, float *sVal, const char *opt,int,int);\r
+void mgl_dens_y_(uintptr_t *graph, uintptr_t *a, const char *stl, float *sVal, const char *opt,int,int);\r
+void mgl_dens_z_(uintptr_t *graph, uintptr_t *a, const char *stl, float *sVal, const char *opt,int,int);\r
+void mgl_cont_x_(uintptr_t *graph, uintptr_t *a, const char *stl, float *sVal, const char *opt,int,int);\r
+void mgl_cont_y_(uintptr_t *graph, uintptr_t *a, const char *stl, float *sVal, const char *opt,int,int);\r
+void mgl_cont_z_(uintptr_t *graph, uintptr_t *a, const char *stl, float *sVal, const char *opt,int,int);\r
+void mgl_cont_x_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *a, const char *stl, float *sVal, const char *opt,int,int);\r
+void mgl_cont_y_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *a, const char *stl, float *sVal, const char *opt,int,int);\r
+void mgl_cont_z_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *a, const char *stl, float *sVal, const char *opt,int,int);\r
+void mgl_contf_x_(uintptr_t *graph, uintptr_t *a, const char *stl, float *sVal, const char *opt,int,int);\r
+void mgl_contf_y_(uintptr_t *graph, uintptr_t *a, const char *stl, float *sVal, const char *opt,int,int);\r
+void mgl_contf_z_(uintptr_t *graph, uintptr_t *a, const char *stl, float *sVal, const char *opt,int,int);\r
+void mgl_contf_x_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *a, const char *stl, float *sVal, const char *opt,int,int);\r
+void mgl_contf_y_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *a, const char *stl, float *sVal, const char *opt,int,int);\r
+void mgl_contf_z_val_(uintptr_t *graph, uintptr_t *v, uintptr_t *a, const char *stl, float *sVal, const char *opt,int,int);\r
+
+/*****************************************************************************/\r
+#ifdef __cplusplus\r
+}\r
+#endif
+/*****************************************************************************/\r
+#endif
--- /dev/null
+/***************************************************************************\r
+ * parser.h is part of Math Graphic Library\r
+ * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
+ * *\r
+ * This program is free software; you can redistribute it and/or modify *\r
+ * it under the terms of the GNU Library General Public License as *\r
+ * published by the Free Software Foundation; either version 3 of the *\r
+ * License, or (at your option) any later version. *\r
+ * *\r
+ * This program is distributed in the hope that it will be useful, *\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
+ * GNU General Public License for more details. *\r
+ * *\r
+ * You should have received a copy of the GNU Library General Public *\r
+ * License along with this program; if not, write to the *\r
+ * Free Software Foundation, Inc., *\r
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
+ ***************************************************************************/\r
+#ifndef _MGL_PARSER_H_\r
+#define _MGL_PARSER_H_\r
+\r
+#ifdef __cplusplus\r
+#include "mgl2/mgl.h"\r
+#include <string>\r
+//-----------------------------------------------------------------------------\r
+/// Structure for the command argument.\r
+struct mglArg\r
+{\r
+ int type; ///< Type of argument {0-data,1-string,2-number}\r
+ mglData *d; ///< Pointer to data (used if type==0)\r
+ std::wstring w; ///< String with parameters\r
+ std::string s; ///< String with parameters\r
+ mreal v; ///< Numerical value (used if type==2)\r
+ mglArg() { type=-1; d=0; v=0; };\r
+};\r
+//-----------------------------------------------------------------------------\r
+/// Structure for MGL command\r
+struct mglCommand\r
+{\r
+ const char *name; ///< Name of command\r
+ const char *desc; ///< Short command description (can be NULL)\r
+ const char *form; ///< Format of command arguments (can be NULL)\r
+ /// Function for executing (plotting)\r
+ int (*exec)(mglGraph *gr, long n, mglArg *a, int k[10], const char *opt);\r
+ /// Function for exporting in C++ (can be NULL)\r
+ void (*save)(wchar_t out[1024], long n, mglArg *a, int k[10], const char *opt);\r
+ int type; ///< Type of command: 0 - data plot, 1 - other plot, 2 - setup, 3 - data handle, 4 - data create, 5 - subplot, 6 - program\r
+};\r
+extern mglCommand mgls_base_cmd[];\r
+//-----------------------------------------------------------------------------\r
+/// Structure for the mglData handling (see mglParse class).\r
+struct mglVar\r
+{\r
+ mglData d; ///< Data itself\r
+ std::wstring s; ///< Data name\r
+ void *o; ///< Pointer to external object\r
+ mglVar *next; ///< Pointer to next instance in list\r
+ mglVar *prev; ///< Pointer to prev instance in list\r
+ bool temp; ///< This temporar variable\r
+ void (*func)(void *); ///< Callback function for destroying\r
+\r
+ mglVar() { o=0; next=prev=0; func=0; temp=false; };\r
+ ~mglVar();\r
+ /// Move variable after \a var and copy \a func from \a var (if \a func is 0)\r
+ void MoveAfter(mglVar *var);\r
+};\r
+//-----------------------------------------------------------------------------\r
+/// Structure for the number handling (see mglParse class).\r
+struct mglNum\r
+{\r
+ mreal d; ///< Number itself\r
+ std::wstring s; ///< Number name\r
+ mglNum *next; ///< Pointer to next instance in list\r
+ mglNum *prev; ///< Pointer to prev instance in list\r
+ mglNum() { d=0; next=prev=0; };\r
+ ~mglNum();\r
+ /// Move variable after \a var and copy \a func from \a var (if \a func is 0)\r
+ void MoveAfter(mglNum *var);\r
+};\r
+//-----------------------------------------------------------------------------\r
+/// Structure for function name and position.\r
+struct mglFunc\r
+{\r
+ long pos;\r
+ int narg;\r
+ std::wstring func;\r
+ mglFunc *next;\r
+ mglFunc(long p, const wchar_t *f, mglFunc *prev=0);\r
+ ~mglFunc() { if(next) delete next; };\r
+};\r
+//-----------------------------------------------------------------------------\r
+/// Structure for stack of functions and its arguments.\r
+struct mglFnStack\r
+{\r
+ long pos;\r
+ wchar_t *par[9];\r
+};\r
+//-----------------------------------------------------------------------------\r
+/// Function for asking question in console mode\r
+void mgl_ask_gets(const wchar_t *quest, wchar_t *res);\r
+//-----------------------------------------------------------------------------\r
+/// Structure for the command argument (see mglGraph::Exec()).\r
+class mglParser\r
+{\r
+friend void mgl_export(wchar_t *out, const wchar_t *in, int type);\r
+public:\r
+ mglVar *DataList; ///< List with data and its names\r
+ mglNum *NumList; ///< List with numbers and its names\r
+ bool AllowSetSize; ///< Allow using setsize command\r
+ bool Stop; ///< Stop command was. Flag prevent further execution\r
+ mglCommand *Cmd; ///< Table of MGL commands (can be changed by user). It MUST be sorted by 'name'!!!\r
+ wchar_t *op1, *op2; ///< Buffer for options (are used if out!=NULL)\r
+ long InUse; ///< Smart pointer (number of users)\r
+\r
+ mglParser(bool setsize=false);\r
+ ~mglParser();\r
+ /// Find the command by the keyword name\r
+ mglCommand *FindCommand(const char *name);\r
+ mglCommand *FindCommand(const wchar_t *name);\r
+ /// Parse and execute the string of MGL script\r
+ inline int Parse(HMGL gr, const char *str, long pos=0)\r
+ { mglGraph GR(gr); return Parse(&GR,str,pos); }\r
+ int Parse(mglGraph *gr, const char *str, long pos=0);\r
+ /// Parse and execute the unicode string of MGL script\r
+ inline int Parse(HMGL gr, const wchar_t *str, long pos=0)\r
+ { mglGraph GR(gr); return Parse(&GR,str,pos); }\r
+ int Parse(mglGraph *gr, const wchar_t *str, long pos=0);\r
+ /// Parse, execute and export it in C++ code the string of MGL script\r
+ inline int Export(wchar_t cpp_out[1024], HMGL gr, const wchar_t *str)\r
+ { mglGraph GR(gr); return Export(cpp_out,&GR,str); }\r
+ int Export(wchar_t cpp_out[1024], mglGraph *gr, const wchar_t *str);\r
+ /// Execute MGL script file \a fname\r
+ inline void Execute(HMGL gr, FILE *fp, bool print=false)\r
+ { mglGraph GR(gr); Execute(&GR,fp,print); }\r
+ void Execute(mglGraph *gr, FILE *fp, bool print=false);\r
+ /// Execute MGL script from array of lines\r
+ inline void Execute(HMGL gr, int num, const wchar_t **text)\r
+ { mglGraph GR(gr); Execute(&GR,num,text); }\r
+ void Execute(mglGraph *gr, int num, const wchar_t **text);\r
+ /// Execute MGL script text with '\n' separated lines\r
+ inline void Execute(HMGL gr, const wchar_t *text)\r
+ { mglGraph GR(gr); Execute(&GR,text); }\r
+ void Execute(mglGraph *gr, const wchar_t *text);\r
+ /// Execute MGL script text with '\n' separated lines\r
+ inline void Execute(HMGL gr, const char *text)\r
+ { mglGraph GR(gr); Execute(&GR,text); }\r
+ void Execute(mglGraph *gr, const char *text);\r
+ /// Scan for functions (use NULL for reset)\r
+ void ScanFunc(const wchar_t *line);\r
+ /// Check if name is function and return its address (or 0 if no)\r
+ long IsFunc(const wchar_t *name, int *narg=0);\r
+ /// Find variable or return 0 if absent\r
+ mglVar *FindVar(const char *name);\r
+ /// Find variable or return 0 if absent\r
+ mglVar *FindVar(const wchar_t *name);\r
+ /// Find variable or create it if absent\r
+ mglVar *AddVar(const char *name);\r
+ /// Find variable or create it if absent\r
+ mglVar *AddVar(const wchar_t *name);\r
+ /// Find number or return 0 if absent\r
+ mglNum *FindNum(const char *name);\r
+ /// Find number or return 0 if absent\r
+ mglNum *FindNum(const wchar_t *name);\r
+ /// Find number or create it if absent\r
+ mglNum *AddNum(const char *name);\r
+ /// Find number or create it if absent\r
+ mglNum *AddNum(const wchar_t *name);\r
+ /// Add string for parameter $1, ..., $9\r
+ bool AddParam(int n, const char *str, bool isstr=true);\r
+ /// Add unicode string for parameter $1, ..., $9\r
+ bool AddParam(int n, const wchar_t *str, bool isstr=true);\r
+ /// Add new MGL command(s) (last command MUST HAVE name[0]=0 !!!)\r
+ void AddCommand(mglCommand *cmd, int num=0);\r
+ /// Restore Once flag\r
+ inline void RestoreOnce() { Once = true; };\r
+ /// Delete variable\r
+ void DeleteVar(mglVar *v);\r
+ /// Delete variable by its name\r
+ void DeleteVar(const char *name);\r
+ /// Delete variable by its name\r
+ void DeleteVar(const wchar_t *name);\r
+private:\r
+ long parlen; ///< Length of parameter strings\r
+ wchar_t *par[40]; ///< Parameter for substituting instead of $1, ..., $9\r
+ wchar_t *out; ///< Buffer for writing C++ code (if not NULL)\r
+ wchar_t leg[128]; ///< Buffer for legend\r
+ bool Once; ///< Flag for command which should be executed only once\r
+ bool Skip; ///< Flag that commands should be skiped (inside 'once' block)\r
+ int if_stack[40]; ///< Stack for if-else-endif commands\r
+ int if_pos; ///< position in if_stack\r
+ mglFunc *func; ///< function names and position\r
+ mglFnStack *fn_stack; ///< function calls stack\r
+ int fn_pos; ///< position in function stack\r
+ int fn_num; ///< size of function stack\r
+ int if_for[40]; ///< position in if_stack for for-cycle start\r
+ mglData *fval; ///< Values for for-cycle. Note that nx - number of elements, ny - next element, nz - address (or string number) of first cycle command\r
+ int for_stack[40]; ///< The order of for-variables\r
+ int for_addr; ///< Flag for saving address in variable (for_addr-1)\r
+ bool for_br; ///< Break is switched on (skip all comands until 'next')\r
+\r
+ /// Parse command\r
+ int Exec(mglGraph *gr, const wchar_t *com, long n, mglArg *a, const wchar_t *var, const wchar_t *opt);\r
+ /// Fill arguments \a a from strings\r
+ void FillArg(mglGraph *gr, int n, wchar_t **arg, mglArg *a);\r
+ /// PreExecute stage -- parse some commands and create variables\r
+ int PreExec(mglGraph *gr, long n, wchar_t **arg, mglArg *a);\r
+ /// Execute program-flow control commands\r
+ int FlowExec(mglGraph *gr, const wchar_t *com, long n, mglArg *a);\r
+ /// Parse and execute the unicode string of MGL script\r
+ int ParseDat(mglGraph *gr, const wchar_t *str, mglData &res);\r
+ /// Parse $N arguments\r
+ void PutArg(const wchar_t *string, wchar_t *str, bool def);\r
+ /// In skip mode\r
+ bool inline ifskip() { return (if_pos>0 && !(if_stack[if_pos-1]&1)); };\r
+ bool inline skip() { return (Skip || ifskip() || for_br); };\r
+};\r
+//-----------------------------------------------------------------------------\r
+#endif\r
+#endif\r
--- /dev/null
+/***************************************************************************\r
+ * plot.h is part of Math Graphic Library\r
+ * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
+ * *\r
+ * This program is free software; you can redistribute it and/or modify *\r
+ * it under the terms of the GNU Library General Public License as *\r
+ * published by the Free Software Foundation; either version 3 of the *\r
+ * License, or (at your option) any later version. *\r
+ * *\r
+ * This program is distributed in the hope that it will be useful, *\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
+ * GNU General Public License for more details. *\r
+ * *\r
+ * You should have received a copy of the GNU Library General Public *\r
+ * License along with this program; if not, write to the *\r
+ * Free Software Foundation, Inc., *\r
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
+ ***************************************************************************/\r
+#ifndef _MGL_1D_H_\r
+#define _MGL_1D_H_\r
+#include "mgl2/base.h"\r
+/*****************************************************************************/\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+/*****************************************************************************/\r
+void mgl_fplot(HMGL gr, const char *eqY, const char *pen, const char *opt);\r
+void mgl_fplot_xyz(HMGL gr, const char *eqX, const char *eqY, const char *eqZ, const char *pen, const char *opt);\r
+void mgl_fplot_(uintptr_t *gr, const char *fy, const char *stl, const char *opt, int ly, int ls, int lo);\r
+void mgl_fplot_xyz_(uintptr_t *gr, const char *fx, const char *fy, const char *fz, const char *stl, const char *opt, int lx, int ly, int lz, int ls, int lo);\r
+/*****************************************************************************/\r
+void mgl_radar(HMGL graph, HCDT a, const char *pen, const char *opt);\r
+void mgl_radar_(uintptr_t *gr, uintptr_t *a, const char *pen, const char *opt, int l,int lo);\r
+/*****************************************************************************/\r
+void mgl_plot_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, const char *pen, const char *opt);\r
+void mgl_plot_xy(HMGL graph, HCDT x, HCDT y, const char *pen, const char *opt);\r
+void mgl_plot(HMGL graph, HCDT y, const char *pen, const char *opt);\r
+void mgl_plot_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *pen, const char *opt,int,int);\r
+void mgl_plot_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, const char *pen, const char *opt,int,int);\r
+void mgl_plot_(uintptr_t *graph, uintptr_t *y, const char *pen, const char *opt,int,int);\r
+/*****************************************************************************/\r
+void mgl_tens_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, HCDT c, const char *pen, const char *opt);\r
+void mgl_tens_xy(HMGL graph, HCDT x, HCDT y, HCDT c, const char *pen, const char *opt);\r
+void mgl_tens(HMGL graph, HCDT y, HCDT c, const char *pen, const char *opt);\r
+void mgl_tens_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *c, const char *pen, const char *opt,int,int);\r
+void mgl_tens_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *c, const char *pen, const char *opt,int,int);\r
+void mgl_tens_(uintptr_t *graph, uintptr_t *y, uintptr_t *c, const char *pen, const char *opt,int,int);\r
+/*****************************************************************************/\r
+void mgl_tape_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, const char *pen, const char *opt);\r
+void mgl_tape_xy(HMGL graph, HCDT x, HCDT y, const char *pen, const char *opt);\r
+void mgl_tape(HMGL graph, HCDT y, const char *pen, const char *opt);\r
+void mgl_tape_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *pen, const char *opt,int,int);\r
+void mgl_tape_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, const char *pen, const char *opt,int,int);\r
+void mgl_tape_(uintptr_t *graph, uintptr_t *y, const char *pen, const char *opt,int,int);\r
+/*****************************************************************************/\r
+void mgl_boxplot_xy(HMGL graph, HCDT x, HCDT a, const char *pen, const char *opt);\r
+void mgl_boxplot(HMGL graph, HCDT a, const char *pen, const char *opt);\r
+/*****************************************************************************/\r
+void mgl_area_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, const char *pen, const char *opt);\r
+void mgl_area_xy(HMGL graph, HCDT x, HCDT y, const char *pen, const char *opt);\r
+void mgl_area(HMGL graph, HCDT y, const char *pen, const char *opt);\r
+/*****************************************************************************/\r
+void mgl_region_xy(HMGL graph, HCDT x, HCDT y1, HCDT y2, const char *pen, const char *opt);\r
+void mgl_region(HMGL graph, HCDT y1, HCDT y2, const char *pen, const char *opt);\r
+/*****************************************************************************/\r
+void mgl_stem_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, const char *pen, const char *opt);\r
+void mgl_stem_xy(HMGL graph, HCDT x, HCDT y, const char *pen, const char *opt);\r
+void mgl_stem(HMGL graph, HCDT y, const char *pen, const char *opt);\r
+/*****************************************************************************/\r
+void mgl_step_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, const char *pen, const char *opt);\r
+void mgl_step_xy(HMGL graph, HCDT x, HCDT y, const char *pen, const char *opt);\r
+void mgl_step(HMGL graph, HCDT y, const char *pen, const char *opt);\r
+/*****************************************************************************/\r
+void mgl_bars_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, const char *pen, const char *opt);\r
+void mgl_bars_xy(HMGL graph, HCDT x, HCDT y, const char *pen, const char *opt);\r
+void mgl_bars(HMGL graph, HCDT y, const char *pen, const char *opt);\r
+/*****************************************************************************/\r
+void mgl_barh_yx(HMGL graph, HCDT y, HCDT v, const char *pen, const char *opt);\r
+void mgl_barh(HMGL graph, HCDT v, const char *pen, const char *opt);\r
+/*****************************************************************************/\r
+void mgl_chart(HMGL graph, HCDT a, const char *col, const char *opt);\r
+/*****************************************************************************/\r
+void mgl_error_exy(HMGL graph, HCDT x, HCDT y, HCDT ex, HCDT ey, const char *pen, const char *opt);\r
+void mgl_error_xy(HMGL graph, HCDT x, HCDT y, HCDT ey, const char *pen, const char *opt);\r
+void mgl_error(HMGL graph, HCDT y, HCDT ey, const char *pen, const char *opt);\r
+/*****************************************************************************/\r
+void mgl_mark_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, HCDT r, const char *pen, const char *opt);\r
+void mgl_mark_xy(HMGL graph, HCDT x, HCDT y, HCDT r, const char *pen, const char *opt);\r
+void mgl_mark_y(HMGL graph, HCDT y, HCDT r, const char *pen, const char *opt);\r
+/*****************************************************************************/\r
+void mgl_tube_xyzr(HMGL graph, HCDT x, HCDT y, HCDT z, HCDT r, const char *pen, const char *opt);\r
+void mgl_tube_xyr(HMGL graph, HCDT x, HCDT y, HCDT r, const char *pen, const char *opt);\r
+void mgl_tube_r(HMGL graph, HCDT y, HCDT r, const char *pen, const char *opt);\r
+void mgl_tube_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, float r, const char *pen, const char *opt);\r
+void mgl_tube_xy(HMGL graph, HCDT x, HCDT y, float r, const char *penl, const char *opt);\r
+void mgl_tube(HMGL graph, HCDT y, float r, const char *pen, const char *opt);\r
+/*****************************************************************************/\r
+void mgl_candle_xyv(HMGL gr, HCDT x, HCDT v1, HCDT v2, HCDT y1, HCDT y2, const char *pen, const char *opt);\r
+void mgl_candle_yv(HMGL gr, HCDT v1, HCDT v2, HCDT y1, HCDT y2, const char *pen, const char *opt);\r
+void mgl_candle(HMGL gr, HCDT v, HCDT y1, HCDT y2, const char *pen, const char *opt);\r
+/*****************************************************************************/\r
+void mgl_boxplot_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, const char *pen, const char *opt,int,int);\r
+void mgl_boxplot_(uintptr_t *graph, uintptr_t *y, const char *pen, const char *opt,int,int);\r
+void mgl_area_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *pen, const char *opt,int,int);\r
+void mgl_area_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, const char *pen, const char *opt,int,int);\r
+void mgl_area_s_(uintptr_t *graph, uintptr_t *y, const char *pen, const char *opt,int,int);\r
+void mgl_area_(uintptr_t *graph, uintptr_t *y, const char *pen, const char *opt,int,int);\r
+void mgl_region_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y1, uintptr_t *y2, const char *pen, const char *opt,int, int);\r
+void mgl_region_(uintptr_t *graph, uintptr_t *y1, uintptr_t *y2, const char *pen, const char *opt,int, int);\r
+void mgl_stem_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *pen, const char *opt,int,int);\r
+void mgl_stem_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, const char *pen, const char *opt,int,int);\r
+void mgl_stem_(uintptr_t *graph, uintptr_t *y, const char *pen, const char *opt,int,int);\r
+void mgl_step_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *pen, const char *opt,int,int);\r
+void mgl_step_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, const char *pen, const char *opt,int,int);\r
+void mgl_step_(uintptr_t *graph, uintptr_t *y, const char *pen, const char *opt,int,int);\r
+void mgl_bars_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *pen, const char *opt,int,int);\r
+void mgl_bars_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, const char *pen, const char *opt,int,int);\r
+void mgl_bars_(uintptr_t *graph, uintptr_t *y, const char *pen, const char *opt,int,int);\r
+void mgl_barh_yx_(uintptr_t *graph, uintptr_t *y, uintptr_t *v, const char *pen, const char *opt,int,int);\r
+void mgl_barh_(uintptr_t *graph, uintptr_t *v, const char *pen, const char *opt,int,int);\r
+void mgl_chart_(uintptr_t *graph, uintptr_t *a, const char *col, const char *opt,int,int);\r
+void mgl_error_(uintptr_t *graph, uintptr_t *y, uintptr_t *ey, const char *pen, const char *opt,int,int);\r
+void mgl_error_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *ey, const char *pen, const char *opt,int,int);\r
+void mgl_error_exy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *ex, uintptr_t *ey, const char *pen, const char *opt,int,int);\r
+void mgl_mark_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *r, const char *pen, const char *opt,int,int);\r
+void mgl_mark_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *r, const char *pen, const char *opt,int,int);\r
+void mgl_mark_y_(uintptr_t *graph, uintptr_t *y, uintptr_t *r, const char *pen, const char *opt,int,int);\r
+void mgl_tube_xyzr_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *r, const char *pen, const char *opt,int,int);\r
+void mgl_tube_xyr_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *r, const char *pen, const char *opt,int,int);\r
+void mgl_tube_r_(uintptr_t *graph, uintptr_t *y, uintptr_t *r, const char *pen, const char *opt,int,int);\r
+void mgl_tube_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, float *r, const char *pen, const char *opt,int,int);\r
+void mgl_tube_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, float *r, const char *pen, const char *opt,int,int);\r
+void mgl_tube_(uintptr_t *graph, uintptr_t *y, float *r, const char *pen, const char *opt,int,int);\r
+void mgl_candle_xyv_(uintptr_t *gr, uintptr_t *x, uintptr_t *v1, uintptr_t *v2, uintptr_t *y1, uintptr_t *y2, const char *pen, const char *opt,int,int);\r
+void mgl_candle_yv_(uintptr_t *gr, uintptr_t *v1, uintptr_t *v2, uintptr_t *y1, uintptr_t *y2, const char *pen, const char *opt,int,int);\r
+void mgl_candle_(uintptr_t *gr, uintptr_t *y, uintptr_t *y1, uintptr_t *y2, const char *pen, const char *opt,int,int);\r
+/*****************************************************************************/\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+/*****************************************************************************/\r
+#endif\r
--- /dev/null
+/***************************************************************************\r
+ * prim.h is part of Math Graphic Library\r
+ * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
+ * *\r
+ * This program is free software; you can redistribute it and/or modify *\r
+ * it under the terms of the GNU Library General Public License as *\r
+ * published by the Free Software Foundation; either version 3 of the *\r
+ * License, or (at your option) any later version. *\r
+ * *\r
+ * This program is distributed in the hope that it will be useful, *\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
+ * GNU General Public License for more details. *\r
+ * *\r
+ * You should have received a copy of the GNU Library General Public *\r
+ * License along with this program; if not, write to the *\r
+ * Free Software Foundation, Inc., *\r
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
+ ***************************************************************************/\r
+#ifndef _MGL_PRIM_H_\r
+#define _MGL_PRIM_H_\r
+#include "mgl2/base.h"\r
+/*****************************************************************************/\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+/*****************************************************************************/\r
+void mgl_mark(HMGL gr, float x,float y,float z,const char *mark);\r
+void mgl_ball(HMGL gr, float x,float y,float z);\r
+/*****************************************************************************/\r
+void mgl_line(HMGL gr, float x1, float y1, float z1, float x2, float y2, float z2, const char *pen,int n);\r
+void mgl_curve(HMGL gr, float x1, float y1, float z1, float dx1, float dy1, float dz1, float x2, float y2, float z2, float dx2, float dy2, float dz2, const char *pen,int n);\r
+/*****************************************************************************/\r
+void mgl_error_box(HMGL gr, float x, float y, float z, float ex, float ey, float ez, const char *pen);\r
+/*****************************************************************************/\r
+void mgl_face(HMGL gr, float x0, float y0, float z0, float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, const char *stl);\r
+void mgl_facex(HMGL gr, float x0, float y0, float z0, float wy, float wz, const char *stl, float dx, float dy);\r
+void mgl_facey(HMGL gr, float x0, float y0, float z0, float wx, float wz, const char *stl, float dx, float dy);\r
+void mgl_facez(HMGL gr, float x0, float y0, float z0, float wx, float wy, const char *stl, float dx, float dy);\r
+/*****************************************************************************/\r
+void mgl_sphere(HMGL gr, float x, float y, float z, float r, const char *stl);\r
+void mgl_drop(HMGL gr, float x1, float y1, float z1, float x2, float y2, float z2, float r, const char *stl, float shift, float ap);\r
+void mgl_cone(HMGL gr, float x1, float y1, float z1, float x2, float y2, float z2, float r1, float r2, const char *stl);\r
+void mgl_ellipse(HMGL gr, float x1, float y1, float z1, float x2, float y2, float z2, float r, const char *stl);\r
+void mgl_rhomb(HMGL gr, float x1, float y1, float z1, float x2, float y2, float z2, float r, const char *stl);\r
+/*****************************************************************************/\r
+void mgl_cones_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, const char *pen, const char *opt);\r
+void mgl_cones_xz(HMGL graph, HCDT x, HCDT z, const char *pen, const char *opt);\r
+void mgl_cones(HMGL graph, HCDT z, const char *pen, const char *opt);\r
+/*****************************************************************************/\r
+void mgl_dew_xy(HMGL gr, HCDT x, HCDT y, HCDT ax, HCDT ay, const char *sch, const char *opt);\r
+void mgl_dew_2d(HMGL gr, HCDT ax, HCDT ay, const char *sch, const char *optl);\r
+/*****************************************************************************/\r
+void mgl_puts(HMGL graph, float x, float y, float z,const char *text, const char *font, float size);\r
+void mgl_putsw(HMGL graph, float x, float y, float z,const wchar_t *text, const char *font, float size);\r
+/*****************************************************************************/\r
+void mgl_puts_dir(HMGL graph, float x, float y, float z, float dx, float dy, float dz, const char *text, const char *font, float size);\r
+void mgl_putsw_dir(HMGL graph, float x, float y, float z, float dx, float dy, float dz, const wchar_t *text, const char *font, float size);\r
+/*****************************************************************************/\r
+void mgl_textmark_xyzr(HMGL graph, HCDT x, HCDT y, HCDT z, HCDT r, const char *text, const char *fnt, const char *opt);\r
+void mgl_textmark_xyr(HMGL graph, HCDT x, HCDT y, HCDT r, const char *text, const char *fnt, const char *opt);\r
+void mgl_textmark_yr(HMGL graph, HCDT y, HCDT r, const char *text, const char *fnt, const char *opt);\r
+void mgl_textmark(HMGL graph, HCDT y, const char *text, const char *fnt, const char *opt);\r
+void mgl_textmarkw_xyzr(HMGL graph, HCDT x, HCDT y, HCDT z, HCDT r, const wchar_t *text, const char *fnt, const char *opt);\r
+void mgl_textmarkw_xyr(HMGL graph, HCDT x, HCDT y, HCDT r, const wchar_t *text, const char *fnt, const char *opt);\r
+void mgl_textmarkw_yr(HMGL graph, HCDT y, HCDT r, const wchar_t *text, const char *fnt, const char *opt);\r
+void mgl_textmarkw(HMGL graph, HCDT y, const wchar_t *text, const char *fnt, const char *opt);\r
+/*****************************************************************************/\r
+void mgl_puts_fit(HMGL gr, float x, float y, float z, const char *prefix, const char *font, float size);\r
+/*****************************************************************************/\r
+void mgl_label_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, const char *text, const char *fnt, const char *opt);\r
+void mgl_labelw_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, const wchar_t *text, const char *fnt, const char *opt);\r
+void mgl_label_xy(HMGL graph, HCDT x, HCDT y, const char *text, const char *fnt, const char *opt);\r
+void mgl_labelw_xy(HMGL graph, HCDT x, HCDT y, const wchar_t *text, const char *fnt, const char *opt);\r
+void mgl_label_y(HMGL graph, HCDT y, const char *text, const char *fnt, const char *opt);\r
+void mgl_labelw_y(HMGL graph, HCDT y, const wchar_t *text, const char *fnt, const char *opt);\r
+/*****************************************************************************/\r
+/*****************************************************************************/\r
+void mgl_mark_(uintptr_t *gr, float *x,float *y,float *z,const char *mark,int);\r
+void mgl_ball_(uintptr_t *gr, float *x,float *y,float *z);\r
+/*****************************************************************************/\r
+void mgl_line_(uintptr_t *gr, float *x1, float *y1, float *z1, float *x2, float *y2, float *z2, const char *pen,int *n,int);\r
+void mgl_curve_(uintptr_t* gr, float *x1, float *y1, float *z1, float *dx1, float *dy1, float *dz1, float *x2, float *y2, float *z2, float *dx2, float *dy2, float *dz2, const char *pen,int *n, int l);\r
+/*****************************************************************************/\r
+void mgl_error_box_(uintptr_t* gr, float *x, float *y, float *z, float *ex, float *ey, float *ez, const char *pen, int);\r
+/*****************************************************************************/\r
+void mgl_face_(uintptr_t* gr, float *x0, float *y0, float *z0, float *x1, float *y1, float *z1, float *x2, float *y2, float *z2, float *x3, float *y3, float *z3, const char *stl, int);\r
+void mgl_facex_(uintptr_t* gr, float *x0, float *y0, float *z0, float *wy, float *wz, const char *stl, float *dx, float *dy, int l);\r
+void mgl_facey_(uintptr_t* gr, float *x0, float *y0, float *z0, float *wx, float *wz, const char *stl, float *dx, float *dy, int l);\r
+void mgl_facez_(uintptr_t* gr, float *x0, float *y0, float *z0, float *wx, float *wy, const char *stl, float *dx, float *dy, int l);\r
+/*****************************************************************************/\r
+void mgl_sphere_(uintptr_t* gr, float *x, float *y, float *z, float *r, const char *stl, int);\r
+void mgl_drop_(uintptr_t* gr, float *x1, float *y1, float *z1, float *x2, float *y2, float *z2, float *r, const char *stl, float *shift, float *ap, int);\r
+void mgl_cone_(uintptr_t* gr, float *x1, float *y1, float *z1, float *x2, float *y2, float *z2, float *r1, float *r2, const char *stl, int);\r
+void mgl_ellipse_(uintptr_t* gr, float *x1, float *y1, float *z1, float *x2, float *y2, float *z2, float *r, const char *stl, int);\r
+void mgl_rhomb_(uintptr_t* gr, float *x1, float *y1, float *z1, float *x2, float *y2, float *z2, float *r, const char *stl, int);\r
+/*****************************************************************************/\r
+void mgl_cones_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *pen, const char *opt,int,int);\r
+void mgl_coners_xz_(uintptr_t *graph, uintptr_t *x, uintptr_t *z, const char *pen, const char *opt,int,int);\r
+void mgl_cones_(uintptr_t *graph, uintptr_t *z, const char *pen, const char *opt,int,int);\r
+/*****************************************************************************/\r
+void mgl_puts_(uintptr_t *graph, float *x, float *y, float *z,const char *text, const char *font, float *size, int, int);\r
+void mgl_puts_dir_(uintptr_t *graph, float *x, float *y, float *z, float *dx, float *dy, float *dz, const char *text, const char *font, float *size, int, int);\r
+/*****************************************************************************/\r
+void mgl_textmark_xyzr_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *r, const char *text, const char *fnt, const char *opt,int,int,int);\r
+void mgl_textmark_xyr_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *r, const char *text, const char *fnt, const char *opt,int,int,int);\r
+void mgl_textmark_yr_(uintptr_t *graph, uintptr_t *y, uintptr_t *r, const char *text, const char *fnt, const char *opt,int,int,int);\r
+void mgl_textmark_(uintptr_t *graph, uintptr_t *y, const char *text, const char *fnt, const char *opt,int,int,int);\r
+/*****************************************************************************/\r
+void mgl_puts_fit_(uintptr_t* gr, float *x, float *y, float *z, const char *prefix, const char *font, float *size, int l, int n);\r
+/*****************************************************************************/\r
+void mgl_label_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *text, const char *fnt, const char *opt,int,int,int);\r
+void mgl_label_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, const char *text, const char *fnt, const char *opt,int,int,int);\r
+void mgl_label_y_(uintptr_t *graph, uintptr_t *y, const char *text, const char *fnt, const char *opt,int,int,int);\r
+/*****************************************************************************/\r
+void mgl_dew_xy_(uintptr_t *gr, uintptr_t *x, uintptr_t *y, uintptr_t *ax, uintptr_t *ay, const char *sch, const char *opt,int,int);\r
+void mgl_dew_2d_(uintptr_t *gr, uintptr_t *ax, uintptr_t *ay, const char *sch, const char *opt,int,int l);\r
+/*****************************************************************************/\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+/*****************************************************************************/\r
+#endif\r
--- /dev/null
+/***************************************************************************\r
+ * window.h is part of Math Graphic Library\r
+ * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
+ * *\r
+ * This program is free software; you can redistribute it and/or modify *\r
+ * it under the terms of the GNU Library General Public License as *\r
+ * published by the Free Software Foundation; either version 3 of the *\r
+ * License, or (at your option) any later version. *\r
+ * *\r
+ * This program is distributed in the hope that it will be useful, *\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
+ * GNU General Public License for more details. *\r
+ * *\r
+ * You should have received a copy of the GNU Library General Public *\r
+ * License along with this program; if not, write to the *\r
+ * Free Software Foundation, Inc., *\r
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
+ ***************************************************************************/\r
+#ifndef _MGL_QT_H_\r
+#define _MGL_QT_H_\r
+/*****************************************************************************/\r
+#ifdef __cplusplus\r
+//-----------------------------------------------------------------------------\r
+#include "mgl2/canvas_wnd.h"\r
+#if MGL_HAVE_QT\r
+#include <QtGui/QWidget>\r
+#include <QtGui/QPixmap>\r
+//-----------------------------------------------------------------------------\r
+class QTextEdit;\r
+class QMenu;\r
+class QMainWindow;\r
+class QScrollArea;\r
+class QSpinBox;\r
+class QTimer;\r
+//-----------------------------------------------------------------------------\r
+/// Class is Qt widget which display MathGL graphics\r
+class QMathGL : public QWidget\r
+{\r
+ Q_OBJECT\r
+public:\r
+ QString appName; ///< Application name for message boxes\r
+ bool autoResize; ///< Allow auto resizing (default is false)\r
+\r
+ QMathGL(QWidget *parent = 0, Qt::WindowFlags f = 0);\r
+ ~QMathGL();\r
+ double getRatio() { return double(gr->GetWidth())/gr->GetHeight(); };\r
+ void setPopup(QMenu *p) { popup = p; }; ///< Set popup menu pointer\r
+ void setSize(int w, int h); ///< Set window/picture sizes\r
+ void setGraph(mglCanvas *GR) ///< Set grapher object\r
+ { if(gr) { delete gr; gr=GR; } }\r
+ inline void setGraph(mglGraph *GR)\r
+ { setGraph(dynamic_cast<mglCanvas *>(GR->Self())); }\r
+ inline HMGL getGraph() { return gr; }\r
+ /// Set drawing functions and its parameter\r
+ inline void setDraw(int (*func)(mglBase *gr, void *par), void *par=0)\r
+ { draw_func = func; draw_par = par; }\r
+ inline void setDraw(mglDraw *dr)\r
+ { draw = dr; }\r
+ inline void setDraw(int (*draw)(mglGraph *gr))\r
+ { setDraw(mgl_draw_graph,(void*)draw); }\r
+ inline void zoomRegion(float xx1,float xx2,float yy1, float yy2)\r
+ { x1=xx1; y1=yy1; x2=xx2; y2=yy2; }\r
+\r
+ int getPer() {return int(per);}; ///< Get perspective value\r
+ int getPhi() {return int(phi);}; ///< Get Phi-angle value\r
+ int getTet() {return int(tet);}; ///< Get Theta-angle value\r
+ bool getAlpha() {return alpha;}; ///< Get transparency state\r
+ bool getLight() {return light;}; ///< Get lightning state\r
+ bool getZoom() {return zoom;}; ///< Get mouse zooming state\r
+ bool getRotate(){return rotate;}; ///< Get mouse rotation state\r
+\r
+public slots:\r
+ void refresh();\r
+ void update(); ///< Update picture\r
+ void copy(); ///< copy graphics to clipboard\r
+ void copyClickCoor(); ///< copy click coordinates to clipboard\r
+ void print(); ///< Print plot\r
+ void stop(); ///< Stop execution\r
+ void setPer(int p); ///< Set perspective value\r
+ void setPhi(int p); ///< Set Phi-angle value\r
+ void setTet(int t); ///< Set Theta-angle value\r
+ void setAlpha(bool a); ///< Switch on/off transparency\r
+ void setLight(bool l); ///< Switch on/off lightning\r
+ void setGrid(bool r); ///< Switch on/off grid drawing\r
+ void imgSize(int w, int h); ///< Set image size\r
+\r
+ void setZoom(bool z); ///< Switch on/off mouse zooming\r
+ void setRotate(bool r); ///< Switch on/off mouse rotation\r
+ void zoomIn(); ///< Zoom in graphics\r
+ void zoomOut(); ///< Zoom out graphics\r
+ void restore(); ///< Restore zoom and rotation to default values\r
+ // void reload(); ///< Reload data and execute script\r
+ void shiftLeft(); ///< Shift graphics to left direction\r
+ void shiftRight(); ///< Shift graphics to right direction\r
+ void shiftUp(); ///< Shift graphics to up direction\r
+ void shiftDown(); ///< Shift graphics to down direction\r
+\r
+ void exportPNG(QString fname=""); ///< export to PNG file\r
+ void exportPNGs(QString fname=""); ///< export to PNG file (no transparency)\r
+ void exportGIF(QString fname=""); ///< export to GIF file\r
+ void exportJPG(QString fname=""); ///< export to JPEG file\r
+ void exportBPS(QString fname=""); ///< export to bitmap EPS file\r
+ void exportEPS(QString fname=""); ///< export to vector EPS file\r
+ void exportSVG(QString fname=""); ///< export to SVG file\r
+ void exportTEX(QString fname=""); ///< export to SVG file\r
+ void exportTGA(QString fname=""); ///< export to TGA file\r
+\r
+ void exportXYZ(QString fname=""); ///< export to XYZ file\r
+ void exportOBJ(QString fname=""); ///< export to OBJ file\r
+ void exportSTL(QString fname=""); ///< export to STL file\r
+ void exportOFF(QString fname=""); ///< export to OFF file\r
+// void exportX3D(QString fname=""); ///< export to XYZ file\r
+ void exportPRC(QString fname=""); ///< export to PRC file\r
+ void setMGLFont(QString path); ///< restore/load font for graphics\r
+\r
+ void adjust(); ///< Adjust plot size to fill entire window\r
+ void nextSlide(); ///< Show next slide\r
+ void prevSlide(); ///< Show previous slide\r
+ void animation(bool st=true); ///< Start animation\r
+ void about(); ///< Show about information\r
+ void aboutQt(); ///< Show information about Qt version\r
+signals:\r
+ void gridChanged(int); ///< Grid drawing changed (by mouse or by toolbar)\r
+ void phiChanged(int); ///< Phi angle changed (by mouse or by toolbar)\r
+ void tetChanged(int); ///< Tet angle changed (by mouse or by toolbar)\r
+ void perChanged(int); ///< Perspective changed (by mouse or by toolbar)\r
+ void alphaChanged(bool); ///< Transparency changed (by toolbar)\r
+ void lightChanged(bool); ///< Lighting changed (by toolbar)\r
+ void zoomChanged(bool); ///< Zooming changed (by toolbar)\r
+ void rotateChanged(bool); ///< Rotation changed (by toolbar)\r
+ void mouseClick(float,float,float); ///< Position of mouse click\r
+ void frameChanged(int); ///< Need another frame to show\r
+ void showWarn(QString); ///< Show warnings\r
+ void posChanged(QString message); ///< user click to show mouse position\r
+ void objChanged(int objId); ///< User double-click to select object/line\r
+ void refreshData();\r
+\r
+protected:\r
+ void paintEvent(QPaintEvent *);\r
+ void resizeEvent(QResizeEvent *);\r
+ void mousePressEvent(QMouseEvent *);\r
+ void mouseReleaseEvent(QMouseEvent *);\r
+ void mouseMoveEvent(QMouseEvent *);\r
+\r
+ mglCanvas *gr; ///< Built-in mglCanvasQT-er instance (used by default)\r
+ void *draw_par; ///< Parameters for drawing function mglCanvasWnd::DrawFunc.\r
+ /// Drawing function for window procedure. It should return the number of frames.\r
+ int (*draw_func)(mglBase *gr, void *par);\r
+ mglDraw *draw; ///< Class for drawing -- need to call directly due to inheritance mechanism\r
+ QString mousePos; ///< Last mouse position\r
+ QPixmap pic; ///< Pixmap for drawing (changed by update)\r
+ double tet, phi; ///< Rotation angles\r
+ double per; ///< Value of perspective ( must be in [0,1) )\r
+ bool alpha; ///< Transparency state\r
+ bool light; ///< Lightning state\r
+ bool zoom; ///< Mouse zoom state\r
+ bool grid; ///< Grid drawing state\r
+ bool rotate; ///< Mouse rotation state\r
+ float x1,x2,y1,y2; ///< Zoom in region\r
+ bool showMessage; ///< Flag for showing messages (enabled by each execute())\r
+ QMenu *popup; ///< Pointer to pop-up menu\r
+ QTimer *timer; ///< Timer for animation\r
+private:\r
+ int x0, y0, xe, ye; ///< Temporary variables for mouse\r
+ uchar *grBuf;\r
+};\r
+//-----------------------------------------------------------------------------\r
+/// Base class for windows containing MathGL graphics\r
+class mglCanvasQT : public mglCanvasWnd\r
+{\r
+public:\r
+using mglCanvasWnd::Window;\r
+ int sshow; ///< Current state of animation switch (toggle button)\r
+ QMathGL *QMGL; ///< Control which draw graphics\r
+ QMainWindow *Wnd; ///< Pointer to window\r
+\r
+ mglCanvasQT();\r
+\r
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Ñëóæåáíûå ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r
+ /// Create a window for plotting. Now implemeted only for GLUT.\r
+ void Window(int argc, char **argv, int (*draw)(mglBase *gr, void *p),const char *title,\r
+ void *par=NULL, void (*reload)(void *p)=NULL, bool maximize=false);\r
+ /// Switch on/off transparency (do not overwrite switches in user drawing function)\r
+ void ToggleAlpha();\r
+ /// Switch on/off lighting (do not overwrite switches in user drawing function)\r
+ void ToggleLight();\r
+ void ToggleRotate();///< Switch on/off rotation by mouse\r
+ void ToggleZoom(); ///< Switch on/off zooming by mouse\r
+ void ToggleNo(); ///< Switch off all zooming and rotation\r
+ void Update(); ///< Update picture by calling user drawing function\r
+ void Adjust(); ///< Adjust size of bitmap to window size\r
+ void GotoFrame(int d); ///< Show arbitrary frame (use relative step)\r
+ void Animation(); ///< Run slideshow (animation) of frames\r
+\r
+protected:\r
+ QScrollArea *scroll; ///< Scrolling area\r
+ QMenu *popup; ///< Popup menu\r
+ QSpinBox *tet, *phi; ///< Spin box for angles\r
+};\r
+//-----------------------------------------------------------------------------\r
+/// Class for drawing the MGL script\r
+struct mglDrawScript : public mglDraw\r
+{\r
+ HMPR par; ///< Parser to be used\r
+ QString text; ///< Script to be drawn\r
+ long line; ///< Line which will be highlited\r
+ mglDrawScript(HMPR p) { par=p; line=-1; }\r
+ int Draw(mglGraph *gr)\r
+ { gr->Highlight(line+1); mgl_parse_text(gr->Self(),par,text.toAscii()); return 0; }\r
+};\r
+//-----------------------------------------------------------------------------\r
+/// Convert bitmap from mglCanvasWnd to QPixmap\r
+void mglConvertFromGraph(QPixmap &pic, mglCanvas *gr, uchar **buf);\r
+/// Make menu, toolbars and return popup menu for MainWindow\r
+QMenu *mglMakeMenu(QMainWindow *Wnd, QMathGL *QMGL, QSpinBox *tet, QSpinBox *phi);\r
+//-----------------------------------------------------------------------------\r
+void mgl_ask_qt(const wchar_t *quest, wchar_t *res);\r
+//-----------------------------------------------------------------------------\r
+#else\r
+#error "Please enable Qt support"\r
+#endif\r
+#endif\r
+#endif\r
--- /dev/null
+/***************************************************************************\r
+ * surf.h is part of Math Graphic Library\r
+ * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
+ * *\r
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Library General Public License as *
+ * published by the Free Software Foundation; either version 3 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef _MGL_SURF_H_\r
+#define _MGL_SURF_H_
+#include "mgl2/base.h"\r
+/*****************************************************************************/\r
+#ifdef __cplusplus
+extern "C" {\r
+#endif\r
+/*****************************************************************************/\r
+void mgl_fsurf(HMGL graph, const char *fz, const char *stl, const char *opt);\r
+void mgl_fsurf_xyz(HMGL graph, const char *fx, const char *fy, const char *fz, const char *stl, const char *opt);\r
+void mgl_grid_xy(HMGL graph, HCDT x, HCDT y, HCDT z, const char *stl, const char *opt);\r
+void mgl_grid(HMGL graph, HCDT a,const char *stl, const char *opt);\r
+void mgl_mesh_xy(HMGL graph, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
+void mgl_mesh(HMGL graph, HCDT z, const char *sch, const char *opt);\r
+void mgl_fall_xy(HMGL graph, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
+void mgl_fall(HMGL graph, HCDT z, const char *sch, const char *opt);\r
+void mgl_belt_xy(HMGL graph, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
+void mgl_belt(HMGL graph, HCDT z, const char *sch, const char *opt);\r
+void mgl_surf_xy(HMGL graph, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
+void mgl_surf(HMGL graph, HCDT z, const char *sch, const char *opt);\r
+void mgl_dens_xy(HMGL graph, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
+void mgl_dens(HMGL graph, HCDT z, const char *sch, const char *opt);\r
+void mgl_boxs_xy(HMGL graph, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
+void mgl_boxs(HMGL graph, HCDT z, const char *sch, const char *opt);\r
+void mgl_tile_xy(HMGL graph, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt);\r
+void mgl_tile(HMGL graph, HCDT z, const char *sch, const char *opt);\r
+void mgl_tiles_xy(HMGL graph, HCDT x, HCDT y, HCDT z, HCDT r, const char *sch, const char *opt);\r
+void mgl_tiles(HMGL graph, HCDT z, HCDT r, const char *sch, const char *opt);\r
+void mgl_surfc_xy(HMGL graph, HCDT x, HCDT y, HCDT z, HCDT c, const char *sch, const char *opt);\r
+void mgl_surfc(HMGL graph, HCDT z, HCDT c, const char *sch, const char *opt);\r
+void mgl_surfa_xy(HMGL graph, HCDT x, HCDT y, HCDT z, HCDT c, const char *sch, const char *opt);\r
+void mgl_surfa(HMGL graph, HCDT z, HCDT c, const char *sch, const char *opt);\r
+void mgl_stfa_xy(HMGL graph, HCDT x, HCDT y, HCDT re, HCDT im, int dn, const char *sch, const char *opt);\r
+void mgl_stfa(HMGL graph, HCDT re, HCDT im, int dn, const char *sch, const char *opt);\r
+void mgl_map_xy(HMGL graph, HCDT x, HCDT y, HCDT a, HCDT b, const char *sch, const char *opt);\r
+void mgl_map(HMGL graph, HCDT a, HCDT b, const char *sch, const char *opt);\r
+/*****************************************************************************/\r
+void mgl_fsurf_(uintptr_t *graph, const char *fz, const char *stl, const char *opt,int,int,int);\r
+void mgl_fsurf_xyz_(uintptr_t *graph, const char *fx, const char *fy, const char *fz, const char *stl, const char *opt, int, int, int, int, int);
+void mgl_grid_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *stl, const char *opt,int,int);\r
+void mgl_grid_(uintptr_t *graph, uintptr_t *a,const char *stl, const char *opt,int,int);\r
+void mgl_mesh_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int,int);\r
+void mgl_mesh_(uintptr_t *graph, uintptr_t *z, const char *sch, const char *opt,int,int);\r
+void mgl_fall_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int,int);\r
+void mgl_fall_(uintptr_t *graph, uintptr_t *z, const char *sch, const char *opt,int,int);\r
+void mgl_belt_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int,int);\r
+void mgl_belt_(uintptr_t *graph, uintptr_t *z, const char *sch, const char *opt,int,int);\r
+void mgl_surf_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int,int);\r
+void mgl_surf_(uintptr_t *graph, uintptr_t *z, const char *sch, const char *opt,int,int);\r
+void mgl_dens_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int,int);\r
+void mgl_dens_(uintptr_t *graph, uintptr_t *z, const char *sch, const char *opt,int,int);\r
+void mgl_boxs_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, const char *sch, const char *opt,int,int);\r
+void mgl_boxs_(uintptr_t *graph, uintptr_t *z, const char *sch, const char *opt,int,int);\r
+void mgl_tile_xy_(uintptr_t *gr, uintptr_t *x, uintptr_t *y, uintptr_t *a, const char *sch, const char *opt,int,int);
+void mgl_tile_(uintptr_t *graph, uintptr_t *z, const char *sch, const char *opt,int,int);\r
+void mgl_tiles_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *c, const char *sch, const char *opt,int,int);\r
+void mgl_tiles_(uintptr_t *graph, uintptr_t *z, uintptr_t *r, const char *sch, const char *opt,int,int);\r
+void mgl_surfc_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *c, const char *sch, const char *opt,int,int);\r
+void mgl_surfc_(uintptr_t *graph, uintptr_t *z, uintptr_t *c, const char *sch, const char *opt,int,int);\r
+void mgl_surfa_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *c, const char *sch, const char *opt,int,int);\r
+void mgl_surfa_(uintptr_t *graph, uintptr_t *z, uintptr_t *c, const char *sch, const char *opt,int,int);\r
+void mgl_stfa_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *re, uintptr_t *im, int *dn, const char *sch, const char *opt,int, int);\r
+void mgl_stfa_(uintptr_t *graph, uintptr_t *re, uintptr_t *im, int *dn, const char *sch, const char *opt,int, int);\r
+void mgl_map_xy_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *a, uintptr_t *b, const char *sch, const char *opt,int,int);\r
+void mgl_map_(uintptr_t *graph, uintptr_t *a, uintptr_t *b, const char *sch, const char *opt,int,int);\r
+/*****************************************************************************/\r
+#ifdef __cplusplus\r
+}\r
+#endif
+/*****************************************************************************/\r
+#endif
--- /dev/null
+/***************************************************************************
+ * type.h is part of Math Graphic Library
+ * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Library General Public License as *
+ * published by the Free Software Foundation; either version 3 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef _MGL_TYPE_H_
+#define _MGL_TYPE_H_
+#include <math.h>
+#ifndef _MSC_VER
+#include <stdint.h>
+#endif
+#include "mgl2/define.h"
+//-----------------------------------------------------------------------------
+const mreal Pi = M_PI;
+const mreal NaN = NAN;
+//-----------------------------------------------------------------------------
+/// Class for incapsulating point in space
+struct mglPoint
+{
+ float x,y,z,c;
+ mglPoint(float X=0,float Y=0,float Z=0,float C=0){x=X;y=Y;z=Z;c=C;}
+ inline bool IsNAN() { return (x!=x || y!=y || z!=z || c!=c); }
+ inline float val(int i) { return (i<2 ? (i==0 ? x:y) : (i==2 ? z:c)); }
+ inline float norm() { return sqrt(x*x+y*y+z*z); }
+ inline void Normalize() { float v=norm(); x/=v; y/=v; z/=v; }
+
+ inline void operator+=(const mglPoint &a) { x+=a.x; y+=a.y; z+=a.z; c+=a.c; }
+ inline void operator-=(const mglPoint &a) { x-=a.x; y-=a.y; z-=a.z; c-=a.c; }
+ inline void operator+=(float a) { x+=a; y+=a; z+=a; }
+ inline void operator-=(float a) { x-=a; y-=a; z-=a; }
+ inline void operator*=(float a) { x*=a; y*=a; z*=a; }
+ inline void operator/=(float a) { x/=a; y/=a; z/=a; }
+};
+#ifndef SWIG
+inline mglPoint operator+(const mglPoint &a, const mglPoint &b)
+{ return mglPoint(a.x+b.x, a.y+b.y, a.z+b.z, a.c+b.c); }
+inline mglPoint operator-(const mglPoint &a, const mglPoint &b)
+{ return mglPoint(a.x-b.x, a.y-b.y, a.z-b.z, a.c-b.c); }
+inline mglPoint operator-(const mglPoint &a)
+{ return mglPoint(-a.x, -a.y, -a.z, -a.c); }
+inline mglPoint operator*(float b, const mglPoint &a)
+{ return mglPoint(a.x*b, a.y*b, a.z*b); }
+inline mglPoint operator*(const mglPoint &a, float b)
+{ return mglPoint(a.x*b, a.y*b, a.z*b); }
+inline mglPoint operator/(const mglPoint &a, float b)
+{ return mglPoint(a.x/b, a.y/b, a.z/b); }
+inline float operator*(const mglPoint &a, const mglPoint &b)
+{ return a.x*b.x+a.y*b.y+a.z*b.z; }
+inline mglPoint operator/(const mglPoint &a, const mglPoint &b)
+{ return mglPoint(a.x*b.x, a.y*b.y, a.z*b.z); }
+inline mglPoint operator&(const mglPoint &a, const mglPoint &b)
+{ return a - b*((a*b)/(b*b)); }
+inline mglPoint operator|(const mglPoint &a, const mglPoint &b)
+{ return b*((a*b)/(b*b)); }
+inline mglPoint operator^(const mglPoint &a, const mglPoint &b)
+{ return mglPoint(a.y*b.z-a.z*b.y, a.z*b.x-a.x*b.z, a.x*b.y-a.y*b.x); }
+inline mglPoint operator!(const mglPoint &a)
+{ float f=hypot(a.x,a.y); return f==0?mglPoint(0,1,0):mglPoint(-a.y/f, a.x/f, 0); }
+inline bool operator==(const mglPoint &a, const mglPoint &b)
+{ return !memcmp(&a, &b, sizeof(mglPoint)); }
+inline bool operator!=(const mglPoint &a, const mglPoint &b)
+{ return memcmp(&a, &b, sizeof(mglPoint)); }
+inline float mgl_norm(const mglPoint &p)
+{ return sqrt(p.x*p.x+p.y*p.y+p.z*p.z); }
+#endif
+//-----------------------------------------------------------------------------
+/// Class for incapsulating color
+struct mglColor
+{
+ float r; ///< Red component of color
+ float g; ///< Green component of color
+ float b; ///< Blue component of color
+ float a; ///< Alpha component of color
+
+ /// Constructor for RGB components manualy
+ mglColor(float R,float G,float B, float A=1){ r=R; g=G; b=B; a=A; }
+ /// Constructor set color from character id
+ mglColor(char c='k', float bright=1) { Set(c,bright); }
+ /// Set color as Red, Green, Blue values
+ void Set(float R,float G,float B,float A=1) { r=R; g=G; b=B; a=A; }
+ /// Set color as Red, Green, Blue values
+ void Set(mglColor c, float bright=1);
+ /// Check if color is valid
+ inline bool Valid()
+ { return (r>=0 && r<=1 && g>=0 && g<=1 && b>=0 && b<=1 && a>=0 && a<=1); }
+ /// Get maximal spectral component
+ inline float Norm()
+ { return r>g ? r : (g>b ? g : b); }
+ inline float NormS()
+ { return r*r+g*g+b*b; }
+ /// Set color from symbolic id
+ void Set(char p, float bright=1);
+ /// Copy color from other one
+ inline bool operator==(const mglColor &c)
+ { return (r==c.r && g==c.g && b==c.b && a==c.a); }
+ inline bool operator!=(const mglColor &c)
+ { return (r!=c.r || g!=c.g || b!=c.b || a!=c.a); }
+ // transparency still the same
+ inline void operator*=(float v) { r*=v; g*=v; b*=v; }
+ inline void operator+=(const mglColor &c) { r+=c.r; g+=c.g; b+=c.b; }
+ inline void operator-=(const mglColor &c) { r-=c.r; g-=c.g; b-=c.b; }
+};
+#ifndef SWIG
+inline mglColor operator+(const mglColor &a, const mglColor &b)
+{ return mglColor(a.r+b.r, a.g+b.g, a.b+b.b, a.a+b.a); }
+inline mglColor operator-(const mglColor &a, const mglColor &b)
+{ return mglColor(a.r-b.r, a.g-b.g, a.b-b.b, a.a-b.a); }
+inline mglColor operator*(const mglColor &a, float b)
+{ return mglColor(a.r*b, a.g*b, a.b*b, a.a*b); }
+inline mglColor operator*(float b, const mglColor &a)
+{ return mglColor(a.r*b, a.g*b, a.b*b, a.a*b); }
+inline mglColor operator/(const mglColor &a, float b)
+{ return mglColor(a.r/b, a.g/b, a.b/b, a.a/b); }
+inline mglColor operator!(const mglColor &a)
+{ return mglColor(1-a.r, 1-a.g, 1-a.b, a.a); }
+#endif
+//-----------------------------------------------------------------------------
+#endif
\ No newline at end of file
--- /dev/null
+/***************************************************************************\r
+ * vect.h is part of Math Graphic Library\r
+ * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
+ * *\r
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Library General Public License as *
+ * published by the Free Software Foundation; either version 3 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef _MGL_VECT_H_\r
+#define _MGL_VECT_H_
+#include "mgl2/base.h"\r
+/*****************************************************************************/\r
+#ifdef __cplusplus
+extern "C" {\r
+#endif\r
+/*****************************************************************************/\r
+void mgl_traj_xy(HMGL gr, HCDT x, HCDT y, HCDT ax, HCDT ay, const char *sch, const char *opt);\r
+void mgl_traj_xyz(HMGL gr, HCDT x, HCDT y, HCDT z, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt);\r
+
+void mgl_vect_xy(HMGL gr, HCDT x, HCDT y, HCDT ax, HCDT ay, const char *sch, const char *opt);\r
+void mgl_vect_2d(HMGL gr, HCDT ax, HCDT ay, const char *sch, const char *opt);\r
+void mgl_vect_xyz(HMGL gr, HCDT x, HCDT y, HCDT z, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt);\r
+void mgl_vect_3d(HMGL gr, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt);\r
+
+void mgl_flow_xy(HMGL gr, HCDT x, HCDT y, HCDT ax, HCDT ay, const char *sch, const char *opt);\r
+void mgl_flow_2d(HMGL gr, HCDT ax, HCDT ay, const char *sch, const char *opt);\r
+void mgl_flow_xyz(HMGL gr, HCDT x, HCDT y, HCDT z, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt);\r
+void mgl_flow_3d(HMGL gr, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt);\r
+\r
+void mgl_flowp_xy(HMGL gr, float x0, float y0, float z0, HCDT x, HCDT y, HCDT ax, HCDT ay, const char *sch, const char *opt);\r
+void mgl_flowp_2d(HMGL gr, float x0, float y0, float z0, HCDT ax, HCDT ay, const char *sch, const char *opt);\r
+void mgl_flowp_xyz(HMGL gr, float x0, float y0, float z0, HCDT x, HCDT y, HCDT z, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt);\r
+void mgl_flowp_3d(HMGL gr, float x0, float y0, float z0, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt);\r
+\r
+void mgl_pipe_xy(HMGL gr, HCDT x, HCDT y, HCDT ax, HCDT ay, const char *sch, float r0, const char *opt);\r
+void mgl_pipe_2d(HMGL gr, HCDT ax, HCDT ay, const char *sch, float r0, const char *opt);\r
+void mgl_pipe_xyz(HMGL gr, HCDT x, HCDT y, HCDT z, HCDT ax, HCDT ay, HCDT az, const char *sch, float r0, const char *opt);\r
+void mgl_pipe_3d(HMGL gr, HCDT ax, HCDT ay, HCDT az, const char *sch, float r0, const char *opt);\r
+
+void mgl_grad_xyz(HMGL gr, HCDT x, HCDT y, HCDT z, HCDT ph, const char *sch, const char *opt);\r
+void mgl_grad_xy(HMGL gr, HCDT x, HCDT y, HCDT ph, const char *sch, const char *opt);\r
+void mgl_grad(HMGL gr, HCDT ph, const char *sch, const char *opt);\r
+
+/*****************************************************************************/\r
+void mgl_traj_xy_(uintptr_t *gr, uintptr_t *x, uintptr_t *y, uintptr_t *ax, uintptr_t *ay, const char *sch, const char *opt,int,int);\r
+void mgl_traj_xyz_(uintptr_t *gr, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *ax, uintptr_t *ay, uintptr_t *az, const char *sch, const char *opt,int,int);\r
+
+void mgl_vect_xy_(uintptr_t *gr, uintptr_t *x, uintptr_t *y, uintptr_t *ax, uintptr_t *ay, const char *sch, const char *opt,int,int);\r
+void mgl_vect_2d_(uintptr_t *gr, uintptr_t *ax, uintptr_t *ay, const char *sch, const char *opt,int,int);\r
+void mgl_vect_xyz_(uintptr_t *gr, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *ax, uintptr_t *ay, uintptr_t *az, const char *sch, const char *opt,int,int);\r
+void mgl_vect_3d_(uintptr_t *gr, uintptr_t *ax, uintptr_t *ay, uintptr_t *az, const char *sch, const char *opt,int,int);\r
+
+void mgl_flow_xy_(uintptr_t *gr, uintptr_t *x, uintptr_t *y, uintptr_t *ax, uintptr_t *ay, const char *sch, const char *opt,int,int);\r
+void mgl_flow_2d_(uintptr_t *gr, uintptr_t *ax, uintptr_t *ay, const char *sch, const char *opt,int,int);\r
+void mgl_flow_xyz_(uintptr_t *gr, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *ax, uintptr_t *ay, uintptr_t *az, const char *sch, const char *opt,int,int);\r
+void mgl_flow_3d_(uintptr_t *gr, uintptr_t *ax, uintptr_t *ay, uintptr_t *az, const char *sch, const char *opt,int,int);\r
+\r
+void mgl_flowp_xy_(uintptr_t *gr, float *x0, float *y0, float *z0, uintptr_t *x, uintptr_t *y, uintptr_t *ax, uintptr_t *ay, const char *sch, const char *opt,int, int);\r
+void mgl_flowp_2d_(uintptr_t *gr, float *x0, float *y0, float *z0, uintptr_t *ax, uintptr_t *ay, const char *sch, const char *opt,int, int);\r
+void mgl_flowp_xyz_(uintptr_t *gr, float *x0, float *y0, float *z0, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *ax, uintptr_t *ay, uintptr_t *az, const char *sch, const char *opt,int, int);\r
+void mgl_flowp_3d_(uintptr_t *gr, float *x0, float *y0, float *z0, uintptr_t *ax, uintptr_t *ay, uintptr_t *az, const char *sch, const char *opt,int,int);\r
+\r
+void mgl_pipe_xy_(uintptr_t *gr, uintptr_t *x, uintptr_t *y, uintptr_t *ax, uintptr_t *ay, const char *sch, float *r0, const char *opt,int,int);\r
+void mgl_pipe_2d_(uintptr_t *gr, uintptr_t *ax, uintptr_t *ay, const char *sch, float *r0, const char *opt,int,int);\r
+void mgl_pipe_xyz_(uintptr_t *gr, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *ax, uintptr_t *ay, uintptr_t *az, const char *sch, float *r0, const char *opt,int,int);\r
+void mgl_pipe_3d_(uintptr_t *gr, uintptr_t *ax, uintptr_t *ay, uintptr_t *az, const char *sch, float *r0, const char *opt,int,int);\r
+
+void mgl_grad_xyz_(uintptr_t *gr, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *ph, const char *sch, const char *opt,int, int);\r
+void mgl_grad_xy_(uintptr_t *gr, uintptr_t *x, uintptr_t *y, uintptr_t *ph, const char *sch, const char *opt,int,int);\r
+void mgl_grad_(uintptr_t *gr, uintptr_t *ph, const char *sch, const char *opt,int,int);\r
+
+/*****************************************************************************/\r
+#ifdef __cplusplus\r
+}\r
+#endif
+/*****************************************************************************/\r
+#endif
--- /dev/null
+/***************************************************************************\r
+ * volume.h is part of Math Graphic Library\r
+ * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
+ * *\r
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Library General Public License as *
+ * published by the Free Software Foundation; either version 3 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef _MGL_VOL_H_\r
+#define _MGL_VOL_H_
+#include "mgl2/base.h"\r
+/*****************************************************************************/\r
+#ifdef __cplusplus
+extern "C" {\r
+#endif\r
+/*****************************************************************************/\r
+void mgl_surf3_xyz_val(HMGL graph, float Val, HCDT x, HCDT y, HCDT z, HCDT a, const char *stl, const char *opt);\r
+void mgl_surf3_val(HMGL graph, float Val, HCDT a, const char *stl, const char *opt);\r
+void mgl_surf3_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, HCDT a, const char *stl, const char *opt);\r
+void mgl_surf3(HMGL graph, HCDT a, const char *stl, const char *opt);\r
+
+void mgl_surf3a_xyz_val(HMGL graph, float Val, HCDT x, HCDT y, HCDT z, HCDT a, HCDT b, const char *stl, const char *opt);\r
+void mgl_surf3a_val(HMGL graph, float Val, HCDT a, HCDT b, const char *stl, const char *opt);\r
+void mgl_surf3a_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, HCDT a, HCDT b, const char *stl, const char *opt);\r
+void mgl_surf3a(HMGL graph, HCDT a, HCDT b, const char *stl, const char *opt);\r
+
+void mgl_surf3c_xyz_val(HMGL graph, float Val, HCDT x, HCDT y, HCDT z, HCDT a, HCDT b, const char *stl, const char *opt);\r
+void mgl_surf3c_val(HMGL graph, float Val, HCDT a, HCDT b, const char *stl, const char *opt);\r
+void mgl_surf3c_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, HCDT a, HCDT b, const char *stl, const char *opt);\r
+void mgl_surf3c(HMGL graph, HCDT a, HCDT b, const char *stl, const char *opt);\r
+
+// NOTE: now style '.' draws dots instead of faces
+void mgl_cloud_xyz(HMGL graph, HCDT x, HCDT y, HCDT z, HCDT a, const char *stl, const char *opt);\r
+void mgl_cloud(HMGL graph, HCDT a, const char *stl, const char *opt);\r
+
+void mgl_beam_val(HMGL graph, float Val, HCDT tr, HCDT g1, HCDT g2, HCDT a, float r, const char *stl, int norm);\r
+void mgl_beam(HMGL graph, HCDT tr, HCDT g1, HCDT g2, HCDT a, float r, const char *stl, int norm, int num);\r
+
+/*****************************************************************************/\r
+void mgl_surf3_xyz_val_(uintptr_t *graph, float *Val, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *a, const char *stl, const char *opt,int,int);\r
+void mgl_surf3_val_(uintptr_t *graph, float *Val, uintptr_t *a, const char *stl, const char *opt,int,int);\r
+void mgl_surf3_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *a, const char *stl, const char *opt,int,int);\r
+void mgl_surf3_(uintptr_t *graph, uintptr_t *a, const char *stl, const char *opt,int,int);\r
+
+void mgl_surf3a_xyz_val_(uintptr_t *graph, float *Val, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *a, uintptr_t *b, const char *stl, const char *opt,int,int);\r
+void mgl_surf3a_val_(uintptr_t *graph, float *Val, uintptr_t *a, uintptr_t *b, const char *stl, const char *opt,int,int);\r
+void mgl_surf3a_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *a, uintptr_t *b, const char *stl, const char *opt,int,int);\r
+void mgl_surf3a_(uintptr_t *graph, uintptr_t *a, uintptr_t *b, const char *stl, const char *opt,int,int);\r
+
+void mgl_surf3c_xyz_val_(uintptr_t *graph, float *Val, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *a, uintptr_t *b, const char *stl, const char *opt,int,int);\r
+void mgl_surf3c_val_(uintptr_t *graph, float *Val, uintptr_t *a, uintptr_t *b, const char *stl, const char *opt,int,int);\r
+void mgl_surf3c_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *a, uintptr_t *b, const char *stl, const char *opt,int,int);\r
+void mgl_surf3c_(uintptr_t *graph, uintptr_t *a, uintptr_t *b, const char *stl, const char *opt,int,int);\r
+
+void mgl_cloudp_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *a, const char *stl, const char *opt,int,int);\r
+void mgl_cloudp_(uintptr_t *graph, uintptr_t *a, const char *stl, const char *opt,int,int);\r
+void mgl_cloud_xyz_(uintptr_t *graph, uintptr_t *x, uintptr_t *y, uintptr_t *z, uintptr_t *a, const char *stl, const char *opt,int,int);\r
+void mgl_cloud_(uintptr_t *graph, uintptr_t *a, const char *stl, const char *opt,int,int);\r
+
+void mgl_beam_val_(uintptr_t *gr, float *val, uintptr_t *tr, uintptr_t *g1, uintptr_t *g2, uintptr_t *a, float *r, const char *sch, int *norm,int l);\r
+void mgl_beam_(uintptr_t *gr, uintptr_t *tr, uintptr_t *g1, uintptr_t *g2, uintptr_t *a, float *r, const char *sch, int *norm, int *num,int l);\r
+
+/*****************************************************************************/\r
+#ifdef __cplusplus\r
+}\r
+#endif
+/*****************************************************************************/\r
+#endif
--- /dev/null
+/***************************************************************************\r
+ * window.h is part of Math Graphic Library\r
+ * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru> *\r
+ * *\r
+ * This program is free software; you can redistribute it and/or modify *\r
+ * it under the terms of the GNU Library General Public License as *\r
+ * published by the Free Software Foundation; either version 3 of the *\r
+ * License, or (at your option) any later version. *\r
+ * *\r
+ * This program is distributed in the hope that it will be useful, *\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
+ * GNU General Public License for more details. *\r
+ * *\r
+ * You should have received a copy of the GNU Library General Public *\r
+ * License along with this program; if not, write to the *\r
+ * Free Software Foundation, Inc., *\r
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
+ ***************************************************************************/\r
+//-----------------------------------------------------------------------------\r
+#ifndef _MGL_WINDOW_H_\r
+#define _MGL_WINDOW_H_\r
+/*****************************************************************************/\r
+#include "mgl2/mgl.h"\r
+//-----------------------------------------------------------------------------\r
+/// Class for drawing in windows (like, mglCanvasFL, mglCanvasQT and so on)\r
+/// Make inherited class and redefine Draw() function if you don't want to use function pointers.\r
+struct mglDraw\r
+{\r
+ virtual int Draw(mglGraph *)=0; ///< Function for drawing\r
+ virtual void Reload() {} ///< Function for reloading data\r
+ virtual void Click() {} ///< Callback function on mouse click\r
+#if MGL_HAVE_PTHREAD\r
+ pthread_t thr;\r
+ bool running;\r
+ mglDraw() { running=false; }\r
+ virtual void Calc() {} ///< Function for calculations\r
+ inline void Run() ///< Run calculations in other thread\r
+ { mgl_draw_thr(this); }\r
+#endif\r
+};\r
+typedef int (*draw_func)(mglGraph *gr);\r
+int mgl_draw_graph(mglBase *gr, void *p);\r
+// NOTE: mgl_draw_class() and mgl_draw_load() use mglWindow* only. Don't use it with inherited classes\r
+int mgl_draw_class(mglBase *gr, void *p);\r
+void mgl_click_class(void *p);\r
+void mgl_reload_class(void *p);\r
+//-----------------------------------------------------------------------------\r
+#if MGL_HAVE_QT\r
+#define MGL_WND_KIND 1\r
+#else\r
+#define MGL_WND_KIND 0\r
+#endif\r
+/// Wrapper class for windows displaying graphics\r
+class mglWindow : public mglGraph\r
+{\r
+friend int mgl_draw_class(mglBase *gr, void *p);\r
+friend void mgl_click_class(void *p);\r
+friend void mgl_reload_class(void *p);\r
+protected:\r
+ mglDraw *dr;\r
+ int wnd; ///< Type of window\r
+public:\r
+ mglWindow(const char *title="MathGL") : mglGraph(-1)\r
+ { wnd=0; dr=0; gr = mgl_create_graph_fltk(0,title,0,0); }\r
+ inline int RunThr() ///< Run main loop for event handling in separate thread (for FLTK only)\r
+ { return wnd==0 ? mgl_fltk_thr():0; }\r
+#ifndef SWIG\r
+ mglWindow(int (*draw)(HMGL gr, void *p), const char *title="MathGL", void *par=NULL, int kind=MGL_WND_KIND, void (*load)(void *p)=0) : mglGraph(-1)\r
+ {\r
+ wnd=kind; dr=0;\r
+ if(wnd==1) gr = mgl_create_graph_qt(draw,title,par,load);\r
+ else gr = mgl_create_graph_fltk(draw,title,par,load);\r
+ }\r
+ mglWindow(int (*draw)(mglGraph *gr), const char *title="MathGL", int kind=MGL_WND_KIND) : mglGraph(-1)\r
+ {\r
+ wnd=kind; dr=0;\r
+ if(wnd==1) gr = mgl_create_graph_qt(mgl_draw_graph,title,(void*)draw,0);\r
+ else gr = mgl_create_graph_fltk(mgl_draw_graph,title,(void*)draw,0);\r
+ }\r
+ mglWindow(mglDraw *draw, const char *title="MathGL", int kind=MGL_WND_KIND) : mglGraph(-1)\r
+ {\r
+ wnd=kind; dr=draw;\r
+ if(wnd==1) gr = mgl_create_graph_qt(mgl_draw_class,title,this,mgl_reload_class);\r
+ else gr = mgl_create_graph_fltk(mgl_draw_class,title,this,mgl_reload_class);\r
+ mgl_set_click_func(gr, mgl_click_class);\r
+ }\r
+ inline int Run() ///< Run main loop for event handling\r
+ { return (wnd==1)? mgl_qt_run() : mgl_fltk_run(); }\r
+#endif\r
+\r
+ inline void ToggleAlpha() ///< Switch on/off transparency (do not overwrite user settings)\r
+ { mgl_wnd_toggle_alpha(gr); }\r
+ inline void ToggleLight() ///< Switch on/off lighting (do not overwrite user settings)\r
+ { mgl_wnd_toggle_light(gr); }\r
+ inline void ToggleZoom() ///< Switch on/off zooming by mouse\r
+ { mgl_wnd_toggle_zoom(gr); }\r
+ inline void ToggleRotate() ///< Switch on/off rotation by mouse\r
+ { mgl_wnd_toggle_rotate(gr); }\r
+ inline void ToggleNo() ///< Switch off all zooming and rotation\r
+ { mgl_wnd_toggle_no(gr); }\r
+ inline void Update() ///< Update picture by calling user drawing function\r
+ { mgl_wnd_update(gr); }\r
+ inline void ReLoad() ///< Reload user data and update picture\r
+ { mgl_wnd_reload(gr); }\r
+ inline void Adjust() ///< Adjust size of bitmap to window size\r
+ { mgl_wnd_adjust(gr); }\r
+ inline void NextFrame() ///< Show next frame (if one)\r
+ { mgl_wnd_next_frame(gr); }\r
+ inline void PrevFrame() ///< Show previous frame (if one)\r
+ { mgl_wnd_prev_frame(gr); }\r
+ inline void Animation() ///< Run slideshow (animation) of frames\r
+ { mgl_wnd_animation(gr); }\r
+ void SetClickFunc(void (*func)(void *p))\r
+ { if(!dr) mgl_set_click_func(gr,func); }\r
+\r
+ inline void SetDelay(float dt) ///< Delay for animation in seconds\r
+ { mgl_wnd_set_delay(gr, dt); }\r
+ inline void Setup(bool clf_upd=true, bool showpos=false)\r
+ { mgl_setup_window(gr, clf_upd, showpos); }\r
+ inline mglPoint LastMousePos() ///< Last mouse position\r
+ { mglPoint p; mgl_get_last_mouse_pos(gr,&p.x,&p.y,&p.z); return p; }\r
+};\r
+//-----------------------------------------------------------------------------\r
+#endif\r
-if(MGL_HAVE_PYTHON)
- configure_file(${MathGL_SOURCE_DIR}/lang/mgl.i.in ${MathGL_BINARY_DIR}/lang/mgl.i COPYONLY)
- configure_file(${MathGL_SOURCE_DIR}/lang/numpy.i.in ${MathGL_BINARY_DIR}/lang/numpy.i COPYONLY)
- SET(dep_libs mgl)
-# if(MGL_HAVE_FLTK)
- get_property(path_to_mglwnd TARGET mgl-wnd PROPERTY LOCATION)
- file(TO_NATIVE_PATH ${path_to_mglwnd} MGL_LIB_WND)
- SET(dep_libs ${dep_libs} mgl-wnd)
-# endif(MGL_HAVE_FLTK)
- get_property(path_to_mgl TARGET mgl PROPERTY LOCATION)
- file(TO_NATIVE_PATH ${path_to_mgl} MGL_LIB)
- file(TO_NATIVE_PATH ${MathGL_BINARY_DIR}/lang/mgl.i MGL_I)
- file(TO_NATIVE_PATH ${MathGL_SOURCE_DIR}/include SRC_INC)
- file(TO_NATIVE_PATH ${MathGL_BINARY_DIR}/include BIN_INC)
- configure_file(${MathGL_SOURCE_DIR}/lang/setup.py.in ${MathGL_BINARY_DIR}/lang/setup.py)
-# file(COPY ${CMAKE_SOURCE_DIR}/lang/mgl.i ${CMAKE_SOURCE_DIR}/lang/numpy.i DESTINATION ${CMAKE_BINARY_DIR}/lang)
-# INCLUDE(${SWIG_USE_FILE})
-# INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
-# INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
-# SET(CMAKE_SWIG_FLAGS "-c++")
-# SET_SOURCE_FILES_PROPERTIES(mgl.i PROPERTIES CPLUSPLUS ON)
-# SWIG_ADD_MODULE(mathgl python mgl.i ../include/mgl/type.h ../include/mgl/data.h ../include/mgl/mgl.h)
-# SWIG_LINK_LIBRARIES(mathgl ${PYTHON_LIBRARIES})
+set(src_dep
+${CMAKE_BINARY_DIR}/lang/mgl.i
+${CMAKE_BINARY_DIR}/lang/numpy.i
+)
+set(src_imp_dep
+${CMAKE_SOURCE_DIR}/include/mgl2/type.h
+${CMAKE_SOURCE_DIR}/include/mgl2/data.h
+${CMAKE_SOURCE_DIR}/include/mgl2/mgl.h
+${CMAKE_SOURCE_DIR}/include/mgl2/window.h
+)
+configure_file(${MathGL_SOURCE_DIR}/lang/mgl.i.in ${MathGL_BINARY_DIR}/lang/mgl.i COPYONLY)
+configure_file(${MathGL_SOURCE_DIR}/lang/numpy.i.in ${MathGL_BINARY_DIR}/lang/numpy.i COPYONLY)
+file(TO_NATIVE_PATH ${MathGL_BINARY_DIR}/lang/mgl.i MGL_I)
+file(TO_NATIVE_PATH ${MathGL_SOURCE_DIR}/include SRC_INC)
+file(TO_NATIVE_PATH ${MathGL_BINARY_DIR}/include BIN_INC)
-# add_custom_command(OUTPUT mgl_python.cpp mathgl.py
-# COMMAND ${SWIG_EXECUTABLE} -python -c++ -I${CMAKE_SOURCE_DIR}/include -o mgl_python.cpp ${CMAKE_SOURCE_DIR}/lang/mgl.i
-# MAIN_DEPENDENCY mgl.i
-# IMPLICIT_DEPENDS CXX ../include/mgl/type.h ../include/mgl/data.h ../include/mgl/mgl.h
-# )
+file(TO_NATIVE_PATH ${MathGL_BINARY_DIR}/src MGL_LINK_DIR)
+file(TO_NATIVE_PATH ${MathGL_BINARY_DIR}/widgets MGL_WND_LINK_DIR)
+
+get_directory_property(DEF_LIST COMPILE_DEFINITIONS)
+foreach(def_i ${DEF_LIST})
+ if(MGL_DEF)
+ set(MGL_DEF ${MGL_DEF} -D${def_i})
+ else(MGL_DEF)
+ set(MGL_DEF -D${def_i})
+ endif(MGL_DEF)
+endforeach()
+SET(dep_libs mgl-wnd mgl)
+if(MGL_HAVE_PYTHON)
+ configure_file(${MathGL_SOURCE_DIR}/lang/setup.py.in ${MathGL_BINARY_DIR}/lang/setup.py)
add_custom_command(OUTPUT _mathgl.so mathgl.py
- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_BINARY_DIR}/lang/setup.py build
- DEPENDS ${dep_libs} ${CMAKE_BINARY_DIR}/lang/mgl.i ${CMAKE_BINARY_DIR}/lang/numpy.i
- IMPLICIT_DEPENDS CXX ${CMAKE_SOURCE_DIR}/include/mgl/type.h ${CMAKE_SOURCE_DIR}/include/mgl/data.h ${CMAKE_SOURCE_DIR}/include/mgl/mgl.h ${CMAKE_SOURCE_DIR}/include/mgl/window.h
- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/lang
- )
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_BINARY_DIR}/lang/setup.py
+ build build_ext
+ --include-dirs='${BIN_INC}:${SRC_INC}'
+# --library-dirs='$<TARGET_LINKER_FILE_DIR:mgl>:$<TARGET_LINKER_FILE_DIR:mgl-wnd>' #commented out for compatibilty reason with old cmake
+ --library-dirs='${MGL_LINK_DIR}:${MGL_WND_LINK_DIR}'
+# --libraries='mgl-wnd'
+ --swig ${SWIG_EXECUTABLE}
+ --swig-opts='-c++ -threads -I${BIN_INC} -I${SRC_INC} ${MGL_DEF}'
+ DEPENDS ${dep_libs} ${src_dep}
+ IMPLICIT_DEPENDS CXX ${src_imp_dep}
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/lang
+ )
add_custom_target(mgl_python_module ALL DEPENDS _mathgl.so mathgl.py)
install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_BINARY_DIR}/lang/setup.py install --prefix=${CMAKE_INSTALL_PREFIX} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/lang )")
- set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "setup.py;mgl_wrap.cpp;build;mathgl.pyc")
+ set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "mgl_wrap.cpp;build;mathgl.pyc")
endif(MGL_HAVE_PYTHON)
+
+if(MGL_HAVE_OCTAVE)
+ execute_process(COMMAND ${oct_prog} -p CANONICAL_HOST_TYPE
+ OUTPUT_VARIABLE oct_host
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ execute_process(COMMAND ${oct_prog} -p API_VERSION
+ OUTPUT_VARIABLE oct_api
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ execute_process(COMMAND ${oct_prog} -p OCTINCLUDEDIR
+ OUTPUT_VARIABLE oct_inc
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+message(STATUS "${oct_prog} ${oct_host} ${oct_api}")
+ set(oct_arch ${oct_host}-${oct_api})
+ set(pkg_name mathgl)
+ file(MAKE_DIRECTORY ${MathGL_BINARY_DIR}/lang/${pkg_name}/inst/${oct_arch})
+
+ configure_file(${MathGL_SOURCE_DIR}/COPYING ${MathGL_BINARY_DIR}/lang/${pkg_name} COPYONLY)
+ configure_file(${MathGL_SOURCE_DIR}/lang/DESCRIPTION ${MathGL_BINARY_DIR}/lang/${pkg_name} COPYONLY)
+ configure_file(${MathGL_SOURCE_DIR}/lang/INDEX ${MathGL_BINARY_DIR}/lang/${pkg_name} COPYONLY)
+ configure_file(${MathGL_SOURCE_DIR}/lang/PKG_ADD_template ${MathGL_BINARY_DIR}/lang/${pkg_name}/PKG_ADD COPYONLY)
+
+ add_custom_command(OUTPUT mgl_octave.cpp
+ COMMAND ${SWIG_EXECUTABLE} -octave -c++ ${MGL_DEF}
+ -I${BIN_INC} -I${SRC_INC}
+ -o mgl_octave.cpp ${MGL_I}
+ DEPENDS ${src_dep}
+ IMPLICIT_DEPENDS CXX ${src_imp_dep}
+ )
+# -L$<TARGET_LINKER_FILE_DIR:mgl> #commented out for compatibilty reason with old cmake
+# -L$<TARGET_LINKER_FILE_DIR:mgl-wnd> #commented out for compatibilty reason with old cmake
+ add_custom_command(OUTPUT ${pkg_name}/inst/${oct_arch}/mathgl.oct
+ COMMAND ${oct_mk} ${MGL_DEF}
+ -I${oct_inc} -I${BIN_INC} -I${SRC_INC}
+ -L${MGL_LINK_DIR}
+ -L${MGL_WND_LINK_DIR}
+ -lmgl-wnd -lmgl
+ -o ${pkg_name}/inst/${oct_arch}/mathgl.oct mgl_octave.cpp
+ DEPENDS ${dep_libs} ${src_dep} mgl_octave.cpp
+ IMPLICIT_DEPENDS CXX ${src_imp_dep}
+ )
+ add_custom_command(OUTPUT mathgl.tar.gz
+ COMMAND ${oct_tar} cpzvf mathgl.tar.gz ${pkg_name}
+ DEPENDS ${pkg_name}/inst/${oct_arch}/mathgl.oct
+ )
+ add_custom_target(mgl_octave_module ALL DEPENDS mathgl.tar.gz)
+endif(MGL_HAVE_OCTAVE)
+++ /dev/null
-AM_CXXFLAGS += -I$(top_srcdir)/include -I$(top_builddir)/include
-
-CLEANFILES =
-BUILT_SOURCES =
-
-if USE_PYTHON
-python_PYTHON = mathgl.py
-pyexec_LTLIBRARIES = _mathgl.la
-_mathgl_la_SOURCES = mgl_python.cpp
-_mathgl_la_CXXFLAGS = $(PYTHON_HEADERS) $(AM_CXXFLAGS)
-_mathgl_la_LIBADD = $(top_builddir)/src/libmgl.la
-#_mathgl_la_LIBADD = $(top_builddir)/widgets/libmgl-qt.la
-_mathgl_la_LDFLAGS = -avoid-version -module
-
-CLEANFILES += mgl_python.cpp mathgl.py
-BUILT_SOURCES += mathgl.py mgl_python.cpp
-
-mgl_python.cpp mathgl.py: $(srcdir)/mgl.i $(top_srcdir)/include/mgl/data.h $(top_srcdir)/include/mgl/mgl.h
- swig -python -c++ -I$(top_srcdir)/include -I$(top_builddir)/include -o mgl_python.cpp $(srcdir)/mgl.i
-#mathgl.py: $(top_srcdir)/lang/mgl.i $(top_srcdir)/include/mgl/mgl_c.h $(top_srcdir)/include/mgl/mgl_w.h
-# swig -python -c++ -I$(top_srcdir)/include -o mgl_python.cpp $(top_srcdir)/lang/mgl.i
-endif
-
-
-if USE_OCTAVE
-
-CLEANFILES += mgl_octave.cpp mathgl.oct mathgl.tar.gz
-
-PKG_NAME = mathgl
-PKG_OCT_FILES = mathgl.oct
-PKG_OTHER_FILES = $(top_srcdir)/COPYING $(srcdir)/DESCRIPTION $(srcdir)/INDEX $(srcdir)/PKG_ADD_template
-octavedir=$(pkgdatadir)/octave
-dist_octave_DATA = mathgl.tar.gz
-mathgl.tar.gz: $(PKG_OCT_FILES) $(PKG_OTHER_FILES)
- mkdir -p $(PKG_NAME)
- mkdir -p $(PKG_NAME)/inst/$(OCTAVE_ARCH)
- cp -rf $(PKG_OTHER_FILES) $(PKG_NAME)
- mv $(PKG_NAME)/PKG_ADD_template $(PKG_NAME)/PKG_ADD
- cp -rf $(PKG_OCT_FILES) $(PKG_NAME)/inst/$(OCTAVE_ARCH)
- tar cpzvf $@ $(PKG_NAME)
- rm -rf $(PKG_NAME)
-
-MY_MKOCTFILE=$(CXX) -O0 -g -shared $(OCTAVE_INCFLAGS)
-
-mgl_octave.cpp: $(srcdir)/mgl.i $(top_srcdir)/include/mgl/data.h $(top_srcdir)/include/mgl/mgl.h
- swig -octave -c++ -I$(top_srcdir)/include -I$(top_builddir)/include -o mgl_octave.cpp $(srcdir)/mgl.i
-mathgl.oct: mgl_octave.cpp
- $(MY_MKOCTFILE) -o $@ $^ -fPIC -I$(top_srcdir)/include -I$(top_builddir)/include -L$(top_builddir)/src/.libs/ -lmgl
-endif
-
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
+
%module mathgl
#ifdef SWIGOCTAVE
%feature("autodoc", 1);
%{
#define SWIG_FILE_WITH_INIT
-//#include "mgl/config.h"
-#include "mgl/type.h"
-#include "mgl/data.h"
-#include "mgl/mgl.h"
-#include "mgl/window.h"
+//#include "mgl2/config.h"
+#include "mgl2/type.h"
+#include "mgl2/data.h"
+#include "mgl2/mgl.h"
+#include "mgl2/window.h"
%}
#if MGL_USE_DOUBLE
%apply (int DIM1, int DIM2, int DIM3, double* IN_ARRAY3) {(int rows, int cols, int slc, const double* d)};
#endif
-//%include "mgl/config.h"
-%include "mgl/type.h"
-%include "mgl/data.h"
-%include "mgl/mgl.h"
-%include "mgl/window.h"
+//%include "mgl2/config.h"
+%include "mgl2/type.h"
+%include "mgl2/data.h"
+%include "mgl2/mgl.h"
+%include "mgl2/window.h"
%extend mglData
{
float __getitem__( int i) { return self->GetVal(i); };
from distutils.core import setup, Extension
import os
-try:
- source_dir="${SRC_INC}"
- binary_dir="${BIN_INC}"
- mgl_i="${MGL_I}"
- mgl_lib="${MGL_LIB}"
- mgl_lib_wnd="${MGL_LIB_WND}"
-except KeyError:
- source_dir="."
- binary_dir="."
-# mgl_dir="src/.libs/libmgl.so"
+mgl_i="${MGL_I}"
+dep_libs="${dep_libs}"
+d_l=[]
+for i in dep_libs.split(';'):
+ d_l.append(i)
+def_list="${DEF_LIST}"
+defs=[]
+for i in def_list.split(';'):
+ k=i.split('=')
+ if len(k)==1: defs.append((i,None))
+ else: defs.append((k[0],k[1]))
mgl_module = Extension('_mathgl',
- sources=[mgl_i],
- include_dirs=[binary_dir, source_dir],
- swig_opts=[
-# "-outdir %s/lang" % binary_dir,
- '-c++',
- '-threads',
- "-I%s" % binary_dir,
- "-I%s" % source_dir],
- extra_objects=[mgl_lib,mgl_lib_wnd]
- )
+ sources=[mgl_i],
+ define_macros=defs,
+ libraries=d_l
+)
setup (
name = "mathgl",
+++ /dev/null
-INCLUDES = -I$(top_builddir)/src -I$(top_builddir)/
-
-bin_PROGRAMS = udav
-
-udav_SOURCES = \
-animate.cpp editor.cpp grid.cpp mathgl.cpp setup.cpp \
-data.cpp main.cpp option.cpp table.cpp help.cpp
-
-udav_LDADD = $(MGL_LIBS) $(FLTK_LIBS)
-udav_CPPFLAGS = -O2 -DDOC_DIR=\"$(docdir)/\"
#include <stdio.h>
#include <stdlib.h>
-/*
-#ifdef _MSC_VER
-#define _USE_MATH_DEFINES
-#include <float.h>
-const unsigned long mgl_nan[2] = {0xffffffff, 0x7fffffff};
-#define NANd (*(double*)mgl_nan)
-#define NANf (*(float*)&(mgl_nan[1]))
-#define NAN NANf
-#define isnan _isnan
-#define isfinite _finite
-#define copysignf _copysign
-#define chdir _chdir
-#endif
-*/
-
#include <math.h>
#include "udav.h"
//-----------------------------------------------------------------------------
fl_push_clip(X+3, Y+3, W-6, H-6);
fl_font(FL_HELVETICA, 14);
fl_color(FL_BLACK);
- if(isnan(data[C+nx*R])) strcpy(s,"nan");
+ if(mgl_isnan(data[C+nx*R])) strcpy(s,"nan");
else sprintf(s,"%g",data[C+nx*R]);
fl_draw(s, X+3, Y+3, W-6, H-6, FL_ALIGN_RIGHT);
break;
find_cell(CONTEXT_CELL, R, C, XX, YY, WW, HH);
input->resize(XX,YY,WW,HH);
char s[32];
- if(isnan(data[C+nx*R])) strcpy(s,"nan");
+ if(mgl_isnan(data[C+nx*R])) strcpy(s,"nan");
else sprintf(s,"%g",data[C+nx*R]);
input->value(s); input->show();
input->take_focus();
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
*/\r
#include <stdio.h>\r
-#include "mgl/mgl.h"\r
+#include "mgl2/mgl.h"\r
#include "udav.h"\r
//-----------------------------------------------------------------------------\r
#include "xpm/alpha.xpm"\r
* along with this program; if not, write to the Free Software\r
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
*/\r
-#include <mgl/mgl.h>\r
+#include "mgl2/mgl.h"\r
#include <string.h>\r
#include <FL/Fl_Tabs.H>\r
#include <FL/Fl_Round_Button.H>\r
#define UDAV_THIN_UP_BOX FL_GTK_THIN_UP_BOX\r
#endif\r
//-----------------------------------------------------------------------------\r
-#include "mgl/parser.h"\r
-#include "mgl/fltk.h"\r
+#include "mgl2/parser.h"\r
+#include "mgl2/fltk.h"\r
//-----------------------------------------------------------------------------\r
extern mglParse *Parse;\r
extern Fl_Menu_Item colors[];\r
)
set(mgl_hdr
-../include/mgl/base_cf.h ../include/mgl/fit.h ../include/mgl/plot.h
-../include/mgl/base.h ../include/mgl/prim.h ../include/mgl/canvas_cf.h
-../include/mgl/font.h ../include/mgl/canvas.h ../include/mgl/surf.h
-../include/mgl/mgl_cf.h ../include/mgl/type.h ${MathGL_BINARY_DIR}/include/mgl/config.h
-../include/mgl/cont.h ../include/mgl/mgl.h ../include/mgl/vect.h
-../include/mgl/data.h ../include/mgl/volume.h ../include/mgl/data_cf.h
-../include/mgl/define.h ../include/mgl/other.h ../include/mgl/eval.h
-../include/mgl/parser.h ../include/mgl/addon.h ../include/mgl/evalc.h )
+../include/mgl2/base_cf.h ../include/mgl2/fit.h ../include/mgl2/plot.h
+../include/mgl2/base.h ../include/mgl2/prim.h ../include/mgl2/canvas_cf.h
+../include/mgl2/font.h ../include/mgl2/canvas.h ../include/mgl2/surf.h
+../include/mgl2/mgl_cf.h ../include/mgl2/type.h ${MathGL_BINARY_DIR}/include/mgl2/config.h
+../include/mgl2/cont.h ../include/mgl2/mgl.h ../include/mgl2/vect.h
+../include/mgl2/data.h ../include/mgl2/volume.h ../include/mgl2/data_cf.h
+../include/mgl2/define.h ../include/mgl2/other.h ../include/mgl2/eval.h
+../include/mgl2/parser.h ../include/mgl2/addon.h ../include/mgl2/evalc.h )
set(prc_src
prc/PRCbitStream.cc prc/PRCdouble.cc prc/oPRCFile.cc prc/writePRC.cc prc.cpp
if(MGL_HAVE_OPENGL)
set(mgl_src ${mgl_src} opengl.cpp )
- set(mgl_hdr ${mgl_hdr} ../include/mgl/opengl.h )
+ set(mgl_hdr ${mgl_hdr} ../include/mgl2/opengl.h )
endif(MGL_HAVE_OPENGL)
add_library(mgl SHARED ${mgl_src} ${mgl_hdr})
target_link_libraries(mgl ${U3D_LIB})
target_link_libraries(mgl-static ${U3D_LIB})
include_directories(${U3D_INCLUDE_DIR})
- if(MGL_HAVE_PDF)
- include_directories(${HPDF_INCLUDE_DIR})
- target_link_libraries(mgl ${HPDF_LIB})
- endif(MGL_HAVE_PDF)
endif(MGL_HAVE_U3D)
+if(MGL_HAVE_PDF)
+ include_directories(${HPDF_INCLUDE_DIR})
+ target_link_libraries(mgl ${HPDF_LIB})
+endif(MGL_HAVE_PDF)
+
if(MGL_HAVE_PTHREAD)
target_link_libraries(mgl ${CMAKE_THREAD_LIBS_INIT})
endif(MGL_HAVE_PTHREAD)
+++ /dev/null
-AM_CXXFLAGS += -I$(top_srcdir)/include -I$(top_builddir)/include
-
-lib_LTLIBRARIES = libmgl.la
-
-
-libmgl_la_LIBADD = $(PNG_LIBS) $(GL_LIBS)
-libmgl_la_LDFLAGS = -no-undefined -version-info $(MGL_CURRENT):$(MGL_REVISION):$(MGL_AGE)
-
-libmgl_la_CXXFLAGS = \
- -DMOD_LIB_DIR=\"$(libdir)/mgl/\" $(HDF5_FLAGS) $(HDF4_FLAGS) $(JPEG_FLAGS) \
- $(PNG_FLAGS) $(FLTK_FLAGS) $(ADDON_FLAGS) $(AM_CXXFLAGS) $(PTHREAD_FLAGS)
-
-if USE_PTHREAD
-libmgl_la_LIBADD += $(PTHREAD_LIBS)
-endif
-
-if USE_GSL
-libmgl_la_LIBADD += $(GSL_LIBS)
-endif
-
-if USE_HDF4
-libmgl_la_LIBADD += $(HDF4_LIBS)
-endif
-
-if USE_HDF5
-libmgl_la_LIBADD += $(HDF5_LIBS)
-endif
-
-if USE_JPEG
-libmgl_la_LIBADD += $(JPEG_LIBS)
-endif
-
-if USE_U3D
-libmgl_la_LIBADD += $(U3D_LIBS)
-endif
-
-libmgl_la_SOURCES = \
-addon.cpp axis.cpp base_cf.cpp base.cpp canvas_cf.cpp canvas.cpp cont.cpp crust.cpp \
-data.cpp data_io.cpp data_new.cpp data_op.cpp data_png.cpp def_font.cpp export_2d.cpp \
-export_3d.cpp eval.cpp evalp.cpp exec.cpp export.cpp fit.cpp font.cpp other.cpp evalc.cpp \
-parser.cpp pde.cpp pixel.cpp plot.cpp prim.cpp surf.cpp tex_table.cpp vect.cpp volume.cpp \
-opengl.cpp
-
-#if USE_OPENGL
-#libmgl_la_SOURCES += opengl.cpp
-#libmgl_la_LIBADD +=
-#endif
\ No newline at end of file
#include <unistd.h>
#endif
#include <string.h>
-#include "mgl/addon.h"
-#include "mgl/data.h"
+#include "mgl2/addon.h"
+#include "mgl2/data.h"
//---------------------------------------------------------------------------
void mgl_strcls(char *str)
{
#include <wchar.h>
#include <ctype.h>
#include <stdlib.h>
-#include "mgl/data.h"
-#include "mgl/canvas.h"
-#include "mgl/prim.h"
+#include "mgl2/data.h"
+#include "mgl2/canvas.h"
+#include "mgl2/prim.h"
//-----------------------------------------------------------------------------
#define islog(a, b) (((a)>0 && (b)>10*(a)) || ((b)<0 && (a)<10*(b)))
#define sign(a) ((a)<0 ? -1:1)
if(aa.ch=='z') aa.v0 = aa.org.z;
wchar_t buf[64];
- float v, v0 = isnan(aa.o) ? aa.v0 : aa.o, v1;
+ float v, v0 = mgl_isnan(aa.o) ? aa.v0 : aa.o, v1;
if(aa.v2>aa.v1)
{ v1 = aa.v2; v0 = v0 - aa.dv*floor((v0-aa.v1)/aa.dv+1e-3); }
else
if((TuneTicks&1)==0 && kind==2) kind=0;
if((TuneTicks&2)==0 && kind!=2) kind=0;
- v0 = isnan(aa.o) ? aa.v0 : aa.o;
+ v0 = mgl_isnan(aa.o) ? aa.v0 : aa.o;
if(aa.v2>aa.v1)
{ v1 = aa.v2; v0 = v0 - aa.dv*floor((v0-aa.v1)/aa.dv+1e-3); }
else
}
k2 = aa.txt.size();
- float v, u, v0 = isnan(aa.o) ? aa.v0 : aa.o;
+ float v, u, v0 = mgl_isnan(aa.o) ? aa.v0 : aa.o;
if(k2>0) for(i=0;i<k2;i++)
{
v = aa.txt[i].val; u = fabs(v);
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
***************************************************************************/\r
#include <stdlib.h>\r
-#include "mgl/base.h"\r
-#include "mgl/define.h"\r
+#include "mgl2/base.h"\r
+#include "mgl2/define.h"\r
//-----------------------------------------------------------------------------\r
char *mgl_strdup(const char *s)\r
{\r
long mglBase::AddPnt(mglPoint p, float c, mglPoint n, float a, int scl)\r
{\r
if(scl>0) ScalePoint(p,n,!(scl&2));\r
- if(isnan(p.x)) return -1;\r
+ if(mgl_isnan(p.x)) return -1;\r
a = (a>=0 && a<=1) ? a : AlphaDef;\r
c = (c>=0) ? c:CDef;\r
\r
txt.GetC(c,a,q); // RGBA color\r
\r
if(!get(MGL_ENABLE_ALPHA)) { q.a=1; if(txt.Smooth!=2) q.ta=1; }\r
+ if(q.ta<0.005) q.ta = 0.005; // bypass OpenGL/OBJ/PRC bug\r
if(scl&8 && scl>0) q.a=a; // bypass palette for enabling alpha in Error()\r
if(!get(MGL_ENABLE_LIGHT) && !(scl&4)) q.u=q.v=NAN;\r
MGL_PUSH(Pnt,q,mutexPnt); return Pnt.size()-1;\r
{\r
if(from<0) return -1;\r
mglPnt p=Pnt[from];\r
- if(!isnan(c)) { p.c=c; p.t=0; Txt[long(c)].GetC(c,0,p); }\r
+ if(!mgl_isnan(c)) { p.c=c; p.t=0; Txt[long(c)].GetC(c,0,p); }\r
MGL_PUSH(Pnt,p,mutexPnt); return Pnt.size()-1;\r
}\r
//-----------------------------------------------------------------------------\r
bool mglBase::ScalePoint(mglPoint &p, mglPoint &n, bool use_nan) const\r
{\r
float &x=p.x, &y=p.y, &z=p.z;\r
- if(isnan(x) || isnan(y) || isnan(z)) { x=NAN; return false; }\r
+ if(mgl_isnan(x) || mgl_isnan(y) || mgl_isnan(z)) { x=NAN; return false; }\r
float x1,y1,z1,x2,y2,z2;\r
x1 = x>0?x*MGL_FLT_EPS:x/MGL_FLT_EPS; x2 = x<0?x*MGL_FLT_EPS:x/MGL_FLT_EPS;\r
y1 = y>0?y*MGL_FLT_EPS:y/MGL_FLT_EPS; y2 = y<0?y*MGL_FLT_EPS:y/MGL_FLT_EPS;\r
if(fx) { x1 = fx->Calc(x,y,z); n.x *= fx->CalcD('x',x,y,z); }\r
if(fy) { y1 = fy->Calc(x,y,z); n.y *= fy->CalcD('y',x,y,z); }\r
if(fz) { z1 = fz->Calc(x,y,z); n.z *= fz->CalcD('z',x,y,z); }\r
- if(isnan(x1) || isnan(y1) || isnan(z1)) { x=NAN; return false; }\r
+ if(mgl_isnan(x1) || mgl_isnan(y1) || mgl_isnan(z1)) { x=NAN; return false; }\r
\r
x = (2*x1 - FMin.x - FMax.x)/(FMax.x - FMin.x);\r
y = (2*y1 - FMin.y - FMax.y)/(FMax.y - FMin.y);\r
else { Min.c=Min.z;Max.c=Max.z;}\r
// if(AutoOrg)\r
{\r
- if(Org.x<Min.x && !isnan(Org.x)) Org.x = Min.x;\r
- if(Org.x>Max.x && !isnan(Org.x)) Org.x = Max.x;\r
- if(Org.y<Min.y && !isnan(Org.y)) Org.y = Min.y;\r
- if(Org.y>Max.y && !isnan(Org.y)) Org.y = Max.y;\r
- if(Org.z<Min.z && !isnan(Org.z)) Org.z = Min.z;\r
- if(Org.z>Max.z && !isnan(Org.z)) Org.z = Max.z;\r
+ if(Org.x<Min.x && !mgl_isnan(Org.x)) Org.x = Min.x;\r
+ if(Org.x>Max.x && !mgl_isnan(Org.x)) Org.x = Max.x;\r
+ if(Org.y<Min.y && !mgl_isnan(Org.y)) Org.y = Min.y;\r
+ if(Org.y>Max.y && !mgl_isnan(Org.y)) Org.y = Max.y;\r
+ if(Org.z<Min.z && !mgl_isnan(Org.z)) Org.z = Min.z;\r
+ if(Org.z>Max.z && !mgl_isnan(Org.z)) Org.z = Max.z;\r
}\r
CutMin = mglPoint(0,0,0); CutMax = mglPoint(0,0,0);\r
RecalcBorder();\r
Min.c = v1<Max.c ? v1:Max.c;\r
Max.c = v2>dv ? v2:dv;\r
}\r
- if(Org.c<Min.c && !isnan(Org.c)) Org.c = Min.c;\r
- if(Org.c>Max.c && !isnan(Org.c)) Org.c = Max.c;\r
+ if(Org.c<Min.c && !mgl_isnan(Org.c)) Org.c = Min.c;\r
+ if(Org.c>Max.c && !mgl_isnan(Org.c)) Org.c = Max.c;\r
RecalcCRange();\r
}\r
//-----------------------------------------------------------------------------\r
Min.x = v1<Max.x ? v1:Max.x;\r
Max.x = v2>dv ? v2:dv;\r
}\r
- if(Org.x<Min.x && !isnan(Org.x)) Org.x = Min.x;\r
- if(Org.x>Max.x && !isnan(Org.x)) Org.x = Max.x;\r
+ if(Org.x<Min.x && !mgl_isnan(Org.x)) Org.x = Min.x;\r
+ if(Org.x>Max.x && !mgl_isnan(Org.x)) Org.x = Max.x;\r
RecalcBorder();\r
}\r
//-----------------------------------------------------------------------------\r
Min.y = v1<Max.y ? v1:Max.y;\r
Max.y = v2>dv ? v2:dv;\r
}\r
- if(Org.y<Min.y && !isnan(Org.y)) Org.y = Min.y;\r
- if(Org.y>Max.y && !isnan(Org.y)) Org.y = Max.y;\r
+ if(Org.y<Min.y && !mgl_isnan(Org.y)) Org.y = Min.y;\r
+ if(Org.y>Max.y && !mgl_isnan(Org.y)) Org.y = Max.y;\r
RecalcBorder();\r
}\r
//-----------------------------------------------------------------------------\r
Min.z = v1<Max.z ? v1:Max.z;\r
Max.z = v2>dv ? v2:dv;\r
}\r
- if(Org.z<Min.z && !isnan(Org.z)) Org.z = Min.z;\r
- if(Org.z>Max.z && !isnan(Org.z)) Org.z = Max.z;\r
+ if(Org.z<Min.z && !mgl_isnan(Org.z)) Org.z = Min.z;\r
+ if(Org.z>Max.z && !mgl_isnan(Org.z)) Org.z = Max.z;\r
RecalcBorder();\r
}\r
//-----------------------------------------------------------------------------\r
//-----------------------------------------------------------------------------\r
// Colors ids\r
//-----------------------------------------------------------------------------\r
-mglColorID mglColorIds[] = {{'k', mglColor(0,0,0)},\r
+mglColorID mglColorIds[31] = {{'k', mglColor(0,0,0)},\r
{'r', mglColor(1,0,0)}, {'R', mglColor(0.5,0,0)},\r
{'g', mglColor(0,1,0)}, {'G', mglColor(0,0.5,0)},\r
{'b', mglColor(0,0,1)}, {'B', mglColor(0,0,0.5)},\r
p.a = (s[0].a*(1-u)+s[2].a*u)*v + (s[1].a*(1-u)+s[3].a*u)*(1-v); // for alpha use inverted\r
}\r
//-----------------------------------------------------------------------------\r
-bool mglTexture::IsSame(const mglTexture &t) const\r
-{ return n==t.n && !memcmp(col,t.col,514*sizeof(mglColor)); }\r
-//-----------------------------------------------------------------------------\r
long mglBase::AddTexture(const char *cols, int smooth)\r
{\r
mglTexture t(cols,smooth);\r
* Free Software Foundation, Inc., *\r
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
***************************************************************************/\r
-#include "mgl/base_cf.h"\r
+#include "mgl2/base_cf.h"\r
//-----------------------------------------------------------------------------\r
//\r
// C interfaces\r
//\r
//-----------------------------------------------------------------------------\r
+void mgl_set_color(char id, float r, float g, float b)\r
+{\r
+ register size_t i;\r
+ for(i=0;mglColorIds[i].id;i++) if(mglColorIds[i].id==id) mglColorIds[i].col = mglColor(r,g,b);\r
+}\r
+void mgl_set_color_(char *id, float *r, float *g, float *b, int) { mgl_set_color(*id,*r,*g,*b); }\r
+//-----------------------------------------------------------------------------\r
+void mgl_set_def_sch(HMGL gr, const char *sch) { gr->SetDefScheme(sch); }\r
+void mgl_set_def_sch_(uintptr_t *gr, const char *sch,int l)\r
+{ char *s=new char[l+1]; memcpy(s,sch,l); s[l]=0;\r
+ _GR_->SetDefScheme(s); delete []s; }\r
+//-----------------------------------------------------------------------------\r
const char *mgl_get_mess(HMGL gr) { return gr->Mess.c_str(); }\r
int mgl_get_warn(HMGL gr) { return gr->GetWarn(); }\r
void mgl_set_warn(HMGL gr, int code, const char *txt)\r
***************************************************************************/\r
#include <stdlib.h>\r
#include <wchar.h>\r
-#include "mgl/canvas.h"\r
+#include "mgl2/canvas.h"\r
//-----------------------------------------------------------------------------\r
mglCanvas::mglCanvas(int w, int h) : mglBase()\r
{\r
float mglCanvas::GetOrgX(char dir) const\r
{\r
float res = Org.x;\r
- if(isnan(res))\r
+ if(mgl_isnan(res))\r
{\r
if(strchr("xyz",dir)) res = FindOptOrg(dir,0);\r
else if(dir=='t') res = Min.x;\r
float mglCanvas::GetOrgY(char dir) const\r
{\r
float res = Org.y;\r
- if(isnan(res))\r
+ if(mgl_isnan(res))\r
{\r
if(strchr("xyz",dir)) res = FindOptOrg(dir,1);\r
else if(dir=='t') res = Min.y;\r
float mglCanvas::GetOrgZ(char dir) const\r
{\r
float res = Org.z;\r
- if(isnan(res))\r
+ if(mgl_isnan(res))\r
{\r
if(strchr("xyz",dir)) res = FindOptOrg(dir,2);\r
else if(dir=='t') res = Min.z;\r
a.n1 = p; a.n4 = type; add_prim(a); }\r
void mglCanvas::mark_plot(long p, char type, float size)\r
{\r
- if(p<0 || isnan(Pnt[p].x)) return;\r
+ if(p<0 || mgl_isnan(Pnt[p].x)) return;\r
long pp=p;\r
mglDrawReg d; d.set(this,1,1,0);\r
if(size>=0) size *= MarkSize;\r
void mglCanvas::line_plot(long p1, long p2)\r
{\r
if(PDef==0) return;\r
- if(p1<0 || p2<0 || isnan(Pnt[p1].x) || isnan(Pnt[p2].x)) return;\r
+ if(p1<0 || p2<0 || mgl_isnan(Pnt[p1].x) || mgl_isnan(Pnt[p2].x)) return;\r
mglDrawReg dd; dd.set(this,1,1,0);\r
long pp1=p1,pp2=p2;\r
float pw = fabs(PenWidth),d;\r
a.n3 = p3; add_prim(a);}\r
void mglCanvas::trig_plot(long p1, long p2, long p3)\r
{\r
- if(p1<0 || p2<0 || p3<0 || isnan(Pnt[p1].x) || isnan(Pnt[p2].x) || isnan(Pnt[p3].x)) return;\r
+ if(p1<0 || p2<0 || p3<0 || mgl_isnan(Pnt[p1].x) || mgl_isnan(Pnt[p2].x) || mgl_isnan(Pnt[p3].x)) return;\r
long pp1=p1,pp2=p2,pp3=p3;\r
mglDrawReg d; d.set(this,1,1,0);\r
if(TernAxis&4) for(int i=0;i<4;i++)\r
a.n3 = p3; a.n4 = p4; add_prim(a); }\r
void mglCanvas::quad_plot(long p1, long p2, long p3, long p4)\r
{\r
- if(p1<0 || isnan(Pnt[p1].x)) { trig_plot(p4,p2,p3); return; }\r
- if(p2<0 || isnan(Pnt[p2].x)) { trig_plot(p1,p4,p3); return; }\r
- if(p3<0 || isnan(Pnt[p3].x)) { trig_plot(p1,p2,p4); return; }\r
- if(p4<0 || isnan(Pnt[p4].x)) { trig_plot(p1,p2,p3); return; }\r
+ if(p1<0 || mgl_isnan(Pnt[p1].x)) { trig_plot(p4,p2,p3); return; }\r
+ if(p2<0 || mgl_isnan(Pnt[p2].x)) { trig_plot(p1,p4,p3); return; }\r
+ if(p3<0 || mgl_isnan(Pnt[p3].x)) { trig_plot(p1,p2,p4); return; }\r
+ if(p4<0 || mgl_isnan(Pnt[p4].x)) { trig_plot(p1,p2,p3); return; }\r
long pp1=p1,pp2=p2,pp3=p3,pp4=p4;\r
mglDrawReg d; d.set(this,1,1,0);\r
if(TernAxis&4) for(int i=0;i<4;i++)\r
//-----------------------------------------------------------------------------\r
float mglCanvas::text_plot(long p,const wchar_t *text,const char *font,float size,float sh,float col,bool rot)\r
{\r
- if(p<0 || isnan(Pnt[p].x)) return 0;\r
+ if(p<0 || mgl_isnan(Pnt[p].x)) return 0;\r
if(size<0) size *= -FontSize;\r
if(!font) font="";\r
\r
shift *= h; B.z= q.z;\r
if(ll==0) { Pop(); return 0; }\r
\r
- if(isnan(ll) || !get(MGL_ENABLE_RTEXT))\r
+ if(mgl_isnan(ll) || !get(MGL_ENABLE_RTEXT))\r
{\r
fscl = fsize; ftet = 0;\r
B.x = q.x; B.y= q.y - shift;\r
long n=leg.size(), iw, ih;\r
if(n<1) { SetWarn(mglWarnLeg); return; }\r
static int cgid=1; StartGroup("Legend",cgid++);\r
- if(ll<=0 || isnan(ll)) ll=0.1;\r
+ if(ll<=0 || mgl_isnan(ll)) ll=0.1;\r
ll *=font_factor;\r
if(size<0) size = -size*FontSize;\r
// setup font and parse absolute coordinates\r
if(lbl==NULL) { id=1; return; }\r
if(ObjId<0) { ObjId = -id; id++; }\r
register size_t len = Grp.size();\r
- if(ObjId>=0 &&len>0 && ObjId!=Grp[len-1].Id)\r
- MGL_PUSH(Grp,mglGroup(lbl,ObjId),mutexGrp);\r
+ if(ObjId>=0 && len>0 && ObjId!=Grp[len-1].Id)\r
+ { MGL_PUSH(Grp,mglGroup(lbl,ObjId),mutexGrp); }\r
+ else if(ObjId<0)\r
+ { MGL_PUSH(Grp,mglGroup(lbl,ObjId),mutexGrp); }\r
}\r
//-----------------------------------------------------------------------------\r
void mglCanvas::EndGroup() { LoadState(); }\r
* Free Software Foundation, Inc., *\r
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
***************************************************************************/\r
-#include "mgl/canvas.h"\r
-#include "mgl/canvas_cf.h"\r
+#include "mgl2/canvas.h"\r
+#include "mgl2/canvas_cf.h"\r
//-----------------------------------------------------------------------------\r
#undef _GR_\r
#define _GR_ ((mglCanvas *)(*gr))\r
***************************************************************************/\r
#include <wchar.h>\r
#include <algorithm>\r
-#include "mgl/surf.h"\r
-#include "mgl/cont.h"\r
-#include "mgl/data.h"\r
-#include "mgl/eval.h"\r
+#include "mgl2/surf.h"\r
+#include "mgl2/cont.h"\r
+#include "mgl2/data.h"\r
+#include "mgl2/eval.h"\r
//-----------------------------------------------------------------------------\r
//\r
// Text printing along a curve\r
void mgl_cont_xy(HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)\r
{\r
float r = gr->SaveState(opt);\r
- long Num = isnan(r)?7:long(r+0.5);\r
+ long Num = mgl_isnan(r)?7:long(r+0.5);\r
if(Num<1) { gr->SetWarn(mglWarnCnt,"Cont"); return; }\r
mglData v(Num);\r
for(long i=0;i<Num;i++) v.a[i] = gr->Min.c + (gr->Max.c-gr->Min.c)*float(i+1)/(Num+1);\r
void mgl_cont(HMGL gr, HCDT z, const char *sch, const char *opt)\r
{\r
float r = gr->SaveState(opt);\r
- long Num = isnan(r)?7:long(r+0.5);\r
+ long Num = mgl_isnan(r)?7:long(r+0.5);\r
if(Num<1) { gr->SetWarn(mglWarnCnt,"Cont"); return; }\r
mglData v(Num);\r
for(long i=0;i<Num;i++) v.a[i] = gr->Min.c + (gr->Max.c-gr->Min.c)*float(i+1)/(Num+1);\r
void mgl_contf_xy(HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)\r
{\r
float r = gr->SaveState(opt);\r
- long Num = isnan(r)?7:long(r+0.5);\r
+ long Num = mgl_isnan(r)?7:long(r+0.5);\r
if(Num<1) { gr->SetWarn(mglWarnCnt,"Cont"); return; }\r
mglData v(Num+2); v.Fill(gr->Min.c, gr->Max.c);\r
mgl_contf_xy_val(gr,&v,x,y,z,sch,0);\r
void mgl_contf(HMGL gr, HCDT z, const char *sch, const char *opt)\r
{\r
float r = gr->SaveState(opt);\r
- long Num = isnan(r)?7:long(r+0.5);\r
+ long Num = mgl_isnan(r)?7:long(r+0.5);\r
if(Num<1) { gr->SetWarn(mglWarnCnt,"Cont"); return; }\r
mglData v(Num+2); v.Fill(gr->Min.c, gr->Max.c);\r
mgl_contf_val(gr,&v,z,sch,0);\r
void mgl_contv_xy(HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)\r
{\r
float r = gr->SaveState(opt);\r
- long Num = isnan(r)?7:long(r+0.5);\r
+ long Num = mgl_isnan(r)?7:long(r+0.5);\r
if(Num<1) { gr->SetWarn(mglWarnCnt,"Cont"); return; }\r
mglData v(Num);\r
for(long i=0;i<Num;i++) v.a[i] = gr->Min.c + (gr->Max.c-gr->Min.c)*float(i+1)/(Num+1);\r
void mgl_contv(HMGL gr, HCDT z, const char *sch, const char *opt)\r
{\r
float r = gr->SaveState(opt);\r
- long Num = isnan(r)?7:long(r+0.5);\r
+ long Num = mgl_isnan(r)?7:long(r+0.5);\r
if(Num<1) { gr->SetWarn(mglWarnCnt,"Cont"); return; }\r
mglData v(Num);\r
for(long i=0;i<Num;i++) v.a[i] = gr->Min.c + (gr->Max.c-gr->Min.c)*float(i+1)/(Num+1);\r
void mgl_cont3_xyz(HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, float sVal, const char *opt)\r
{\r
float r = gr->SaveState(opt);\r
- long Num = isnan(r)?7:long(r+0.5);\r
+ long Num = mgl_isnan(r)?7:long(r+0.5);\r
if(Num<1) { gr->SetWarn(mglWarnCnt,"Cont3"); return; }\r
mglData v(Num);\r
for(long i=0;i<Num;i++) v.a[i] = gr->Min.c + (gr->Max.c-gr->Min.c)*float(i+1)/(Num+1);\r
void mgl_cont3(HMGL gr, HCDT a, const char *sch, float sVal, const char *opt)\r
{\r
float r = gr->SaveState(opt);\r
- long Num = isnan(r)?7:long(r+0.5);\r
+ long Num = mgl_isnan(r)?7:long(r+0.5);\r
if(Num<1) { gr->SetWarn(mglWarnCnt,"Cont3"); return; }\r
mglData v(Num);\r
for(long i=0;i<Num;i++) v.a[i] = gr->Min.c + (gr->Max.c-gr->Min.c)*float(i+1)/(Num+1);\r
void mgl_contf3_xyz(HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, float sVal, const char *opt)\r
{\r
float r = gr->SaveState(opt);\r
- long Num = isnan(r)?7:long(r+0.5);\r
+ long Num = mgl_isnan(r)?7:long(r+0.5);\r
if(Num<1) { gr->SetWarn(mglWarnCnt,"ContF3"); return; }\r
mglData v(Num+2); v.Fill(gr->Min.c, gr->Max.c);\r
mgl_contf3_xyz_val(gr,&v,x,y,z,a,sch,sVal,0);\r
void mgl_contf3(HMGL gr, HCDT a, const char *sch, float sVal, const char *opt)\r
{\r
float r = gr->SaveState(opt);\r
- long Num = isnan(r)?7:long(r+0.5);\r
+ long Num = mgl_isnan(r)?7:long(r+0.5);\r
if(Num<1) { gr->SetWarn(mglWarnCnt,"ContF3"); return; }\r
mglData v(Num+2); v.Fill(gr->Min.c, gr->Max.c);\r
mgl_contf3_val(gr,&v,a,sch,sVal,0);\r
void mgl_axial_xy(HMGL gr, HCDT x, HCDT y, HCDT a, const char *sch, const char *opt)\r
{\r
float r = gr->SaveState(opt);\r
- long Num = isnan(r)?3:long(r+0.5);\r
+ long Num = mgl_isnan(r)?3:long(r+0.5);\r
if(Num<1) { gr->SetWarn(mglWarnCnt,"Axial"); return; }\r
mglData v(Num);\r
for(long i=0;i<Num;i++) v.a[i] = gr->Min.c + (gr->Max.c-gr->Min.c)*float(i+1)/(Num+1);\r
void mgl_axial(HMGL gr, HCDT a, const char *sch, const char *opt)\r
{\r
float r = gr->SaveState(opt);\r
- long Num = isnan(r)?3:long(r+0.5);\r
+ long Num = mgl_isnan(r)?3:long(r+0.5);\r
if(Num<1) { gr->SetWarn(mglWarnCnt,"Axial"); return; }\r
mglData v(Num);\r
for(long i=0;i<Num;i++) v.a[i] = gr->Min.c + (gr->Max.c-gr->Min.c)*float(i+1)/(Num+1);\r
***************************************************************************/\r
#include <stdlib.h>\r
#include <float.h>\r
-#include "mgl/other.h"\r
-#include "mgl/data.h"\r
+#include "mgl2/other.h"\r
+#include "mgl2/data.h"\r
//-----------------------------------------------------------------------------\r
//\r
// TriPlot series\r
void mgl_tricont_xyzc(HMGL gr, HCDT nums, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, const char *opt)\r
{\r
float r = gr->SaveState(opt);\r
- long n = (isnan(r) || r<=0) ? 7:long(r+0.5);\r
+ long n = (mgl_isnan(r) || r<=0) ? 7:long(r+0.5);\r
mglData v(n);\r
for(long i=0;i<n;i++) v.a[i] = gr->Min.c + (gr->Max.c-gr->Min.c)*float(i+1)/(n+1);\r
mgl_tricont_xyzcv(gr,&v,nums,x,y,z,a,sch,0);\r
#include <stdlib.h>\r
#include <string.h>\r
#include <unistd.h>\r
-#include "mgl/data.h"\r
-#include "mgl/eval.h"\r
+#include "mgl2/data.h"\r
+#include "mgl2/eval.h"\r
\r
int mglNumThr=0;\r
void mglFillP(long x,long y, const mreal *a,long nx,long ny,mreal _p[4][4]);\r
double t;\r
if(n==2) return x*x;\r
if(n==1) return x;\r
- if(n<0) return 1/mgl_ipow(x,-n);\r
+ if(n<0) return 1./mgl_ipow(x,-n);\r
if(n==0) return 1;\r
t = mgl_ipow(x,n/2); t = t*t;\r
if(n%2==1) t *= x;\r
for(i=1;i<nx;i++)\r
{\r
ii = i*n;\r
- if(isnan(a[ii-n])) { qq=true; continue; }\r
+ if(mgl_isnan(a[ii-n])) { qq=true; continue; }\r
if(qq)\r
{\r
a[ii] += omod(a[ii-n]-a[ii], da);\r
#include <glob.h>\r
#endif\r
\r
-#include "mgl/data.h"\r
-#include "mgl/eval.h"\r
+#include "mgl2/data.h"\r
+#include "mgl2/eval.h"\r
\r
#if MGL_HAVE_HDF5\r
#include <hdf5.h>\r
register long nn=d->GetNN();\r
const mglData *b = dynamic_cast<const mglData *>(d);\r
if(b) for(long i=0;i<nn;i++)\r
- { v = b->a[i]; if(!isnan(v)) m = m>v ? m:v; }\r
+ { v = b->a[i]; if(!mgl_isnan(v)) m = m>v ? m:v; }\r
else for(long i=0;i<nn;i++)\r
- { v = d->vthr(i); if(!isnan(v)) m = m>v ? m:v; }\r
+ { v = d->vthr(i); if(!mgl_isnan(v)) m = m>v ? m:v; }\r
return m;\r
}\r
float mgl_data_max_(uintptr_t *d) { return mgl_data_max(_DT_); }\r
register long nn=d->GetNN();\r
const mglData *b = dynamic_cast<const mglData *>(d);\r
if(b) for(long i=0;i<nn;i++)\r
- { v = b->a[i]; if(!isnan(v)) m = m<v ? m:v; }\r
+ { v = b->a[i]; if(!mgl_isnan(v)) m = m<v ? m:v; }\r
else for(long i=0;i<nn;i++)\r
- { v = d->vthr(i); if(!isnan(v)) m = m<v ? m:v; }\r
+ { v = d->vthr(i); if(!mgl_isnan(v)) m = m<v ? m:v; }\r
return m;\r
}\r
float mgl_data_min_(uintptr_t *d) { return mgl_data_min(_DT_); }\r
for(long ii=0;ii<nn;ii++)\r
{\r
v = d->vthr(ii);\r
- if(!isnan(v) && m < v)\r
+ if(!mgl_isnan(v) && m < v)\r
{ m=v; *i=ii%nx; *j=(ii/nx)%ny; *k=ii/(nx*ny); }\r
}\r
return m;\r
for(long ii=0;ii<nn;ii++)\r
{\r
v = d->vthr(ii);\r
- if(!isnan(v) && m > v)\r
+ if(!mgl_isnan(v) && m > v)\r
{ m=v; *i=ii%nx; *j=(ii/nx)%ny; *k=ii/(nx*ny); }\r
}\r
return m;\r
}\r
void mgl_data_fill(HMDT d, float x1,float x2,char dir)\r
{\r
- if(isnan(x2)) x2=x1;\r
+ if(mgl_isnan(x2)) x2=x1;\r
if(dir<'x' || dir>'z') dir='x';\r
long par[2]={d->nx,d->ny};\r
mreal b[2]={x1,x2-x1};\r
else s = dim*d->ny;\r
for(i=s;i<nn;i++) // determines borders of existing data\r
{\r
- if(isnan(a[i])) continue;\r
+ if(mgl_isnan(a[i])) continue;\r
a1 = (a1<a[i] ? a1 : a[i]); a2 = (a2>a[i] ? a2 : a[i]);\r
}\r
if(a1==a2) { if(a1!=0) a1=0.; else a2=1; }\r
#include <math.h>\r
#include <string.h>\r
\r
-#include "mgl/data.h"\r
+#include "mgl2/data.h"\r
\r
#if MGL_HAVE_GSL\r
#include <gsl/gsl_fft_complex.h>\r
#include <math.h>\r
#include <string.h>\r
\r
-#include "mgl/data.h"
+#include "mgl2/data.h"
//-----------------------------------------------------------------------------\r
#include <stdlib.h>\r
#include <zlib.h>\r
#include <png.h>\r
-#include "mgl/data.h"\r
+#include "mgl2/data.h"\r
//-----------------------------------------------------------------------------\r
long mgl_col_dif(unsigned char *c1,unsigned char *c2,bool sum)\r
{\r
#include <ctype.h>\r
#include <string.h>\r
\r
-#include "mgl/eval.h"\r
+#include "mgl2/eval.h"\r
\r
#if MGL_HAVE_GSL\r
#include <gsl/gsl_sf.h>\r
else return (Kod==EQ_A) ? a1[int(Res)] : Res;\r
}\r
double a = Left->CalcIn(a1);\r
- if(!isnan(a))\r
+ if(!mgl_isnan(a))\r
{\r
if(Kod<EQ_SIN)\r
{\r
// try to bypass calc b if a==0\r
if(a==0 && z2[Kod-EQ_LT]!=3) return z2[Kod-EQ_LT];\r
double b = Right->CalcIn(a1);\r
- return !isnan(b) ? f2[Kod-EQ_LT](a,b) : NAN;\r
+ return !mgl_isnan(b) ? f2[Kod-EQ_LT](a,b) : NAN;\r
}\r
else if(Kod<EQ_SN) return f1[Kod-EQ_SIN](a);\r
#if MGL_HAVE_GSL\r
else if(Kod<=EQ_DC)\r
{\r
double sn=0,cn=0,dn=0,b = Right->CalcIn(a1);\r
- if(isnan(b)) return NAN;\r
+ if(mgl_isnan(b)) return NAN;\r
gsl_sf_elljac_e(a,b, &sn, &cn, &dn);\r
switch(Kod)\r
{\r
if(Kod<EQ_LT) return (Kod==EQ_A && id==(int)Res)?1:0;\r
\r
double a = Left->CalcIn(a1), d = Left->CalcDIn(id,a1);\r
- if(!isnan(a) && !isnan(d))\r
+ if(!mgl_isnan(a) && !mgl_isnan(d))\r
{\r
if(Kod<EQ_SIN)\r
{\r
double b = Right->CalcIn(a1), c = Right->CalcDIn(id,a1);\r
- return !isnan(b) ? (d?f21[Kod-EQ_LT](a,b)*d:0) + (c?f22[Kod-EQ_LT](a,b)*c:0) : NAN;\r
+ return !mgl_isnan(b) ? (d?f21[Kod-EQ_LT](a,b)*d:0) + (c?f22[Kod-EQ_LT](a,b)*c:0) : NAN;\r
}\r
else if(Kod<EQ_SN) return (d?f11[Kod-EQ_SIN](a)*d:0);\r
#if MGL_HAVE_GSL\r
else if(Kod<=EQ_DC)\r
{\r
double sn=0,cn=0,dn=0,b = Right->CalcIn(a1);\r
- if(isnan(b)) return NAN;\r
+ if(mgl_isnan(b)) return NAN;\r
gsl_sf_elljac_e(a,b, &sn, &cn, &dn);\r
switch(Kod) // At this moment parse only differentiation or argument NOT mu !!!\r
{\r
#include <time.h>\r
#include <math.h>\r
#include <string.h>\r
-#include "mgl/evalc.h"\r
-#include "mgl/addon.h"\r
-#include "mgl/data.h"\r
+#include "mgl2/evalc.h"\r
+#include "mgl2/addon.h"\r
+#include "mgl2/data.h"\r
#if MGL_HAVE_GSL\r
#include <gsl/gsl_sf.h>\r
#endif\r
if(Kod==EQ_NUM) return Res;\r
\r
dual a = Left->CalcIn(a1);\r
- if(isnan(a.real()) || isnan(a.imag())) return NAN;\r
+ if(mgl_isnan(a.real()) || mgl_isnan(a.imag())) return NAN;\r
\r
if(Kod<EQ_SIN)\r
{\r
dual b = Right->CalcIn(a1);\r
- if(isnan(b.real()) || isnan(b.imag())) return NAN;\r
+ if(mgl_isnan(b.real()) || mgl_isnan(b.imag())) return NAN;\r
return f2[Kod-EQ_ADD](a,b);\r
}\r
else return f1[Kod-EQ_SIN](a);\r
#include <time.h>
#include <math.h>
#include <wchar.h>
-#include "mgl/parser.h"
+#include "mgl2/parser.h"
#if MGL_HAVE_GSL
#include <gsl/gsl_sf.h>
#include <gsl/gsl_errno.h>
else if(!wcscmp(p,L"sa")) { d.Momentum('a',x,y,z,k);v=z; }
else if(!wcscmp(p,L"ka")) { d.Momentum('a',x,y,z,k);v=k; }
// if this is valid suffix when finish parsing (it can be float number)
- if(!isnan(v)) { res.a[0] = v; delete []str; return res; }
+ if(!mgl_isnan(v)) { res.a[0] = v; delete []str; return res; }
}
for(n=0;n<len;n++) if(str[n]=='(') break;
if(n>=len) // this is number or variable
#include <unistd.h>
#endif
-#include "mgl/parser.h"
+#include "mgl2/parser.h"
#define iint(x) floor((x)+0.5)
wchar_t *mgl_str_copy(const char *s);
//-----------------------------------------------------------------------------
#include <stdarg.h>
#include <png.h>
-#include "mgl/canvas.h"
-#include "mgl/canvas_cf.h"
+#include "mgl2/canvas.h"
+#include "mgl2/canvas_cf.h"
#if MGL_HAVE_JPEG
extern "C" {
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
-#include "mgl/canvas.h"
-#include "mgl/canvas_cf.h"
+#include "mgl2/canvas.h"
+#include "mgl2/canvas_cf.h"
#include <stdlib.h>
#include <time.h>
#include <zlib.h>
else if(q.type==6) // text
{
const mglText &t = gr->GetPtx(q.n3);
- float ftet = isnan(p1.v)||isnan(p1.u) ? 0:-180*atan2(p1.v,p1.u)/M_PI;
+ float ftet = mgl_isnan(p1.v)||mgl_isnan(p1.u) ? 0:-180*atan2(p1.v,p1.u)/M_PI;
int f,a; mglGetStyle(t.stl.c_str(), &f, &a);
std::string ss=cname;
if((a&3)==2) ss.append(",west"); if((a&3)==0) ss.append(",east");
#include <stdio.h>\r
#include <time.h>\r
#include <zlib.h>\r
-#include "mgl/canvas.h"\r
-#include "mgl/canvas_cf.h"\r
+#include "mgl2/canvas.h"\r
+#include "mgl2/canvas_cf.h"\r
#undef _GR_\r
#define _GR_ ((mglCanvas *)(*gr))\r
#define _Gr_ ((mglCanvas *)(gr))\r
fprintf(fp,"# Created by MathGL library\n# Title: %s\n",(descr && *descr) ? descr : fname);\r
for(i=0;i<size_t(gr->GetPntNum());i++)\r
{\r
- mglPnt pp = gr->GetPnt(i);\r
+ const mglPnt &pp = gr->GetPnt(i);\r
fprintf(fp,"v %g %g %g\n",pp.x,pp.y,pp.z);\r
fprintf(fp,"vt %g %g\n",1-pp.ta,pp.c/ntxt);\r
-// if(isnan(pp.u)) fprintf(fp,"vn 0 0 0\n");\r
+// if(mgl_isnan(pp.u)) fprintf(fp,"vn 0 0 0\n");\r
// else fprintf(fp,"vn %g %g %g\n",pp.u,pp.v,pp.w);\r
}\r
// primitive definition in groups\r
fprintf(fp,"# List of Vertices, with (x,y,z) coordinates.\n");\r
for(i=0;i<gr->GetPntNum();i++)\r
{\r
- mglPnt pp = gr->GetPnt(i);\r
+ const mglPnt &pp = gr->GetPnt(i);\r
fprintf(fp,"%g %g %g\n",pp.x,pp.y,pp.z);\r
}\r
fclose(fp);\r
fprintf(ff,"# Indices of vertices to connect for faces\n");\r
for(i=0;i<gr->GetPrmNum();i++)\r
{\r
- const mglPrim q=gr->GetPrm(i);\r
+ const mglPrim &q=gr->GetPrm(i);\r
if(q.type==1) fprintf(fp,"%ld %ld\n",q.n1+1,q.n2+1);\r
if(q.type==2) fprintf(ff,"%ld %ld %ld\n",q.n1+1,q.n2+1,q.n3+1);\r
if(q.type==3) fprintf(ff,"%ld %ld %ld\n%ld %ld %ld\n",q.n1+1,q.n2+1,q.n3+1,q.n4+1,q.n2+1,q.n3+1);\r
register long i,nf=0;\r
for(i=0;i<gr->GetPrmNum();i++) // find number of faces\r
{\r
- const mglPrim q=gr->GetPrm(i);\r
+ const mglPrim &q=gr->GetPrm(i);\r
if(q.type==2 || q.type==3) nf++;\r
}\r
if(nf<=0) return; // nothing to do\r
fprintf(fp,"%ld %ld 0\n",gr->GetPntNum(), nf);\r
for(i=0;i<gr->GetPntNum();i++)\r
{\r
- mglPnt pp = gr->GetPnt(i);\r
+ const mglPnt &pp = gr->GetPnt(i);\r
if(colored)\r
fprintf(fp,"%g %g %g %g %g %g %g\n", pp.x, pp.y, pp.z, pp.r, pp.g, pp.b, pp.a);\r
else fprintf(fp,"%g %g %g\n", pp.x, pp.y, pp.z);\r
fprintf(fp,"<LIGHTING>\n<AMBIENT>%g, %g, %g</AMBIENT>\n",AmbBr, AmbBr, AmbBr);\r
register unsigned long i,j;\r
if(get(MGL_ENABLE_LIGHT)) for(i=0;i<10;i++)\r
- if(light[i].n && isnan(light[i].r.x))\r
+ if(light[i].n && mgl_isnan(light[i].r.x))\r
{\r
fprintf(fp, "<DIRECTIONALLIGHT>\n<DIRECTION>%g, %g, %g</DIRECTION>\n", light[i].d.x, light[i].d.y, light[i].d.z);\r
fprintf(fp, "<SPECULAR>%g, %g, %g</SPECULAR>\n</DIRECTIONALLIGHT>\n", light[i].c.r, light[i].c.g, light[i].c.b);\r
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
***************************************************************************/\r
#include <ctype.h>\r
-#include "mgl/fit.h"\r
-#include "mgl/eval.h"\r
-#include "mgl/data.h"\r
+#include "mgl2/fit.h"\r
+#include "mgl2/eval.h"\r
+#include "mgl2/data.h"\r
\r
#if MGL_HAVE_GSL\r
#include <gsl/gsl_multifit_nlin.h>\r
#include <wchar.h>\r
#endif\r
\r
-#include "mgl/base.h"\r
-#include "mgl/font.h"\r
+#include "mgl2/base.h"\r
+#include "mgl2/font.h"\r
//-----------------------------------------------------------------------------\r
extern unsigned mgl_numg, mgl_cur;\r
extern float mgl_fact;\r
#else\r
#include <GL/gl.h>\r
#endif\r
-#include "mgl/opengl.h"\r
+#include "mgl2/opengl.h"\r
#include <algorithm>\r
//-----------------------------------------------------------------------------\r
/// Create mglGraph object in OpenGL mode.\r
GLenum lght[8] = {GL_LIGHT0,GL_LIGHT1,GL_LIGHT2,GL_LIGHT3,GL_LIGHT4,\r
GL_LIGHT5,GL_LIGHT6,GL_LIGHT7};\r
float amb[4], pos[4],dif[4],dir[4];\r
- bool inf = isnan(r.x);\r
+ bool inf = mgl_isnan(r.x);\r
if(n<0 || n>7) { SetWarn(mglWarnLId); return; }\r
if(c.Valid())\r
{\r
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
-#include "mgl/other.h"\r
-#include "mgl/surf.h"\r
-#include "mgl/cont.h"\r
-#include "mgl/eval.h"
-#include "mgl/data.h"
+#include "mgl2/other.h"\r
+#include "mgl2/surf.h"\r
+#include "mgl2/cont.h"\r
+#include "mgl2/eval.h"
+#include "mgl2/data.h"
#include <stdlib.h>
//-----------------------------------------------------------------------------\r
//
void mgl_dens_x(HMGL gr, HCDT a, const char *sch, float sv, const char *opt)
{
register long i,j,k,n=a->GetNx(),m=a->GetNy(),l=a->GetNz();
- if(isnan(sv)) sv = gr->GetOrgX('x');
+ if(mgl_isnan(sv)) sv = gr->GetOrgX('x');
if(n<2 || m<2) { gr->SetWarn(mglWarnLow,"DensX"); return; }
if(sv<gr->Min.x || sv>gr->Max.x) { gr->SetWarn(mglWarnSlc,"DensX"); return; }
mglData xx,yy,zz,aa;
void mgl_dens_y(HMGL gr, HCDT a, const char *sch, float sv, const char *opt)
{
register long i,j,k,n=a->GetNx(),m=a->GetNy(),l=a->GetNz();
- if(isnan(sv)) sv = gr->GetOrgX('x');
+ if(mgl_isnan(sv)) sv = gr->GetOrgX('x');
if(n<2 || m<2) { gr->SetWarn(mglWarnLow,"DensY"); return; }
if(sv<gr->Min.x || sv>gr->Max.x) { gr->SetWarn(mglWarnSlc,"DensY"); return; }
mglData xx,yy,zz,aa;
void mgl_dens_z(HMGL gr, HCDT a, const char *sch, float sv, const char *opt)
{
register long i,j,k,n=a->GetNx(),m=a->GetNy(),l=a->GetNz();
- if(isnan(sv)) sv = gr->GetOrgX('x');
+ if(mgl_isnan(sv)) sv = gr->GetOrgX('x');
if(n<2 || m<2) { gr->SetWarn(mglWarnLow,"DensZ"); return; }
if(sv<gr->Min.x || sv>gr->Max.x) { gr->SetWarn(mglWarnSlc,"DensZ"); return; }
mglData xx,yy,zz,aa;
void mgl_cont_x_val(HMGL gr, HCDT v, HCDT a, const char *sch, float sv, const char *opt)
{
register long i,j,k,n=a->GetNx(),m=a->GetNy(),l=a->GetNz();
- if(isnan(sv)) sv = gr->GetOrgX('x');
+ if(mgl_isnan(sv)) sv = gr->GetOrgX('x');
if(n<2 || m<2) { gr->SetWarn(mglWarnLow,"ContX"); return; }
if(sv<gr->Min.x || sv>gr->Max.x) { gr->SetWarn(mglWarnSlc,"ContX"); return; }
gr->SaveState(opt);\r
void mgl_cont_y_val(HMGL gr, HCDT v, HCDT a, const char *sch, float sv, const char *opt)
{
register long i,j,k,n=a->GetNx(),m=a->GetNy(),l=a->GetNz();
- if(isnan(sv)) sv = gr->GetOrgX('x');
+ if(mgl_isnan(sv)) sv = gr->GetOrgX('x');
if(n<2 || m<2) { gr->SetWarn(mglWarnLow,"ContY"); return; }
if(sv<gr->Min.x || sv>gr->Max.x) { gr->SetWarn(mglWarnSlc,"ContY"); return; }
gr->SaveState(opt);\r
void mgl_cont_z_val(HMGL gr, HCDT v, HCDT a, const char *sch, float sv, const char *opt)
{
register long i,j,k,n=a->GetNx(),m=a->GetNy(),l=a->GetNz();
- if(isnan(sv)) sv = gr->GetOrgX('x');
+ if(mgl_isnan(sv)) sv = gr->GetOrgX('x');
if(n<2 || m<2) { gr->SetWarn(mglWarnLow,"ContZ"); return; }
if(sv<gr->Min.x || sv>gr->Max.x) { gr->SetWarn(mglWarnSlc,"ContZ"); return; }
gr->SaveState(opt);\r
void mgl_cont_x(HMGL gr, HCDT a, const char *sch, float sv, const char *opt)
{
float r = gr->SaveState(opt);
- long Num = (isnan(r) || r<=0) ? 7:long(r+0.5);
+ long Num = (mgl_isnan(r) || r<=0) ? 7:long(r+0.5);
mglData v(Num);
for(long i=0;i<Num;i++) v.a[i] = gr->Min.c + (gr->Max.c-gr->Min.c)*float(i+1)/(Num+1);
mgl_cont_x_val(gr,&v,a,sch,sv,0);
void mgl_cont_y(HMGL gr, HCDT a, const char *sch, float sv, const char *opt)
{
float r = gr->SaveState(opt);
- long Num = (isnan(r) || r<=0) ? 7:long(r+0.5);
+ long Num = (mgl_isnan(r) || r<=0) ? 7:long(r+0.5);
mglData v(Num);
for(long i=0;i<Num;i++) v.a[i] = gr->Min.c + (gr->Max.c-gr->Min.c)*float(i+1)/(Num+1);
mgl_cont_y_val(gr,&v,a,sch,sv,0);
void mgl_cont_z(HMGL gr, HCDT a, const char *sch, float sv, const char *opt)
{
float r = gr->SaveState(opt);
- long Num = (isnan(r) || r<=0) ? 7:long(r+0.5);
+ long Num = (mgl_isnan(r) || r<=0) ? 7:long(r+0.5);
mglData v(Num);
for(long i=0;i<Num;i++) v.a[i] = gr->Min.c + (gr->Max.c-gr->Min.c)*float(i+1)/(Num+1);
mgl_cont_z_val(gr,&v,a,sch,sv,0);
void mgl_contf_x_val(HMGL gr, HCDT v, HCDT a, const char *sch, float sv, const char *opt)
{
register long i,j,k,n=a->GetNx(),m=a->GetNy(),l=a->GetNz();
- if(isnan(sv)) sv = gr->GetOrgX('x');
+ if(mgl_isnan(sv)) sv = gr->GetOrgX('x');
if(n<2 || m<2) { gr->SetWarn(mglWarnLow,"ContFX"); return; }
if(sv<gr->Min.x || sv>gr->Max.x) { gr->SetWarn(mglWarnSlc,"ContFX"); return; }
gr->SaveState(opt);
void mgl_contf_y_val(HMGL gr, HCDT v, HCDT a, const char *sch, float sv, const char *opt)
{
register long i,j,k,n=a->GetNx(),m=a->GetNy(),l=a->GetNz();
- if(isnan(sv)) sv = gr->GetOrgX('x');
+ if(mgl_isnan(sv)) sv = gr->GetOrgX('x');
if(n<2 || m<2) { gr->SetWarn(mglWarnLow,"ContFY"); return; }
if(sv<gr->Min.x || sv>gr->Max.x) { gr->SetWarn(mglWarnSlc,"ContFY"); return; }
gr->SaveState(opt);
void mgl_contf_z_val(HMGL gr, HCDT v, HCDT a, const char *sch, float sv, const char *opt)
{
register long i,j,k,n=a->GetNx(),m=a->GetNy(),l=a->GetNz();
- if(isnan(sv)) sv = gr->GetOrgX('x');
+ if(mgl_isnan(sv)) sv = gr->GetOrgX('x');
if(n<2 || m<2) { gr->SetWarn(mglWarnLow,"ContFZ"); return; }
if(sv<gr->Min.x || sv>gr->Max.x) { gr->SetWarn(mglWarnSlc,"ContFZ"); return; }
gr->SaveState(opt);
void mgl_contf_x(HMGL gr, HCDT a, const char *sch, float sv, const char *opt)
{
float r = gr->SaveState(opt);
- long Num = (isnan(r) || r<=0) ? 7:long(r+0.5);
+ long Num = (mgl_isnan(r) || r<=0) ? 7:long(r+0.5);
mglData v(Num); v.Fill(gr->Min.c, gr->Max.c);
mgl_contf_x_val(gr,&v,a,sch,sv,0);
}
void mgl_contf_y(HMGL gr, HCDT a, const char *sch, float sv, const char *opt)
{
float r = gr->SaveState(opt);
- long Num = (isnan(r) || r<=0) ? 7:long(r+0.5);
+ long Num = (mgl_isnan(r) || r<=0) ? 7:long(r+0.5);
mglData v(Num); v.Fill(gr->Min.c, gr->Max.c);
mgl_contf_y_val(gr,&v,a,sch,sv,0);
}
void mgl_contf_z(HMGL gr, HCDT a, const char *sch, float sv, const char *opt)
{
float r = gr->SaveState(opt);
- long Num = (isnan(r) || r<=0) ? 7:long(r+0.5);
+ long Num = (mgl_isnan(r) || r<=0) ? 7:long(r+0.5);
mglData v(Num); v.Fill(gr->Min.c, gr->Max.c);
mgl_contf_z_val(gr,&v,a,sch,sv,0);
}
#include <ctype.h>
#include <wchar.h>
//-----------------------------------------------------------------------------
-#include "mgl/parser.h"
-#include "mgl/canvas_cf.h"
+#include "mgl2/parser.h"
+#include "mgl2/canvas_cf.h"
//-----------------------------------------------------------------------------
#ifdef WIN32
#include <io.h>
* Free Software Foundation, Inc., *\r
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
***************************************************************************/\r
-#include "mgl/data.h"\r
+#include "mgl2/data.h"\r
#include <complex>\r
#define dual std::complex<double>\r
#define GAMMA 0.1\r
k3[2] = eqs.CalcD(var,'v'); k3[5] = -eqs.CalcD(var,'z');\r
// ty = cy/(k2*h); k3+=k2; md->H(ty,k2);\r
var['t'-'a']=k*dt+dt; for(i=0;i<6;i++)\r
- { var[v[i]-'a'] = x[i]+k2[i]*dt; k3[i] += k2[i]; }\r
+ { var[v[i]-'a'] = x[i]+k3[i]*dt; k3[i] += k2[i]; }\r
k2[0] = eqs.CalcD(var,'p'); k2[3] = -eqs.CalcD(var,'x');\r
k2[1] = eqs.CalcD(var,'q'); k2[4] = -eqs.CalcD(var,'y');\r
k2[2] = eqs.CalcD(var,'v'); k2[5] = -eqs.CalcD(var,'z');\r
#include <stdlib.h>\r
#include <math.h>\r
#include <algorithm>\r
-#include "mgl/canvas.h"\r
+#include "mgl2/canvas.h"\r
//-----------------------------------------------------------------------------\r
void mglCanvas::SetSize(int w,int h)\r
{\r
{\r
const mglPnt &p0=Pnt[id];\r
mglPoint pp(p0.x,p0.y,p0.z), nn(p0.u,p0.v,p0.w);\r
- if(isnan(pp.x)) return -1;\r
+ if(mgl_isnan(pp.x)) return -1;\r
mglPoint q=pp/(2*B.pf), p, n=nn;\r
register float w=B1.b[0]/2, h=B1.b[4]/2, d=B1.b[8]/2, xx=B1.x-w/2, yy=B1.y-h/2;\r
if(TernAxis&1) // usual ternary axis\r
register float b0=0,b1=0,b2=0, ar,ag,ab;\r
ar = ag = ab = AmbBr;\r
\r
-// if(get(MGL_ENABLE_LIGHT) && !isnan(p.u))\r
- if(!isnan(p.u))\r
+// if(get(MGL_ENABLE_LIGHT) && !mgl_isnan(p.u))\r
+ if(!mgl_isnan(p.u))\r
{\r
float d0,d1,d2,nn;\r
register long i;\r
for(i=0;i<10;i++)\r
{\r
if(!light[i].n) continue;\r
- if(isnan(light[i].q.x)) // source at infinity\r
+ if(mgl_isnan(light[i].q.x)) // source at infinity\r
{\r
nn = 2*(p.u*light[i].p.x+p.v*light[i].p.y+p.w*light[i].p.z) /\r
(p.u*p.u+p.v*p.v+p.w*p.w+1e-6);\r
if(u*(1.f-u)<0.f || v*(1.f-v)<0.f) continue; // second root bad\r
}\r
p = p1+d1*u+d2*v+d3*(u*v);\r
- if(isnan(p.u) && !isnan(p.v))\r
+ if(mgl_isnan(p.u) && !mgl_isnan(p.v))\r
{ p.u = nr.x; p.v = nr.y; p.w = nr.z; }\r
pnt_plot(i,j,p.z,col2int(p,r));\r
}\r
if(Quality&2) // slow but accurate\r
{\r
p = p1+d1*u+d2*v;\r
- if(isnan(p.u) && !isnan(p.v) && anorm)\r
+ if(mgl_isnan(p.u) && !mgl_isnan(p.v) && anorm)\r
{ p.u = nr.x; p.v = nr.y; p.w = nr.z; }\r
pnt_plot(i,j,p.z,col2int(p,r));\r
}\r
* Free Software Foundation, Inc., *\r
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
***************************************************************************/\r
-#include "mgl/plot.h"\r
-#include "mgl/eval.h"\r
-#include "mgl/data.h"\r
+#include "mgl2/plot.h"\r
+#include "mgl2/eval.h"\r
+#include "mgl2/data.h"\r
#include <stdlib.h>\r
//-----------------------------------------------------------------------------\r
//\r
{\r
if(eqY==0 || eqY[0]==0) return; // nothing to plot\r
float r = gr->SaveState(opt);\r
- long n = (isnan(r) || r<=0) ? 100:long(r+0.5);\r
+ long n = (mgl_isnan(r) || r<=0) ? 100:long(r+0.5);\r
\r
float *x = (float *)malloc(n*sizeof(float));\r
float *y = (float *)malloc(n*sizeof(float));\r
void mgl_fplot_xyz(HMGL gr, const char *eqX, const char *eqY, const char *eqZ, const char *pen, const char *opt)\r
{\r
float r = gr->SaveState(opt);\r
- long n = (isnan(r) || r<=0) ? 100:long(r+0.5);\r
+ long n = (mgl_isnan(r) || r<=0) ? 100:long(r+0.5);\r
\r
float *x = (float *)malloc(n*sizeof(float));\r
float *y = (float *)malloc(n*sizeof(float));\r
if(n<2) { gr->SetWarn(mglWarnLow,"Radar"); return; }\r
mglData x(n+1,ny), y(n+1,ny);\r
float m=a->Minimal(), r=gr->SaveState(opt);\r
- if(isnan(r) || r<0) r = m<0 ? -m:0;\r
+ if(mgl_isnan(r) || r<0) r = m<0 ? -m:0;\r
register long i,j;\r
for(j=0;j<ny;j++)\r
{\r
mglPoint p1,p2,p3,p4,nn;\r
long n1,n2,n3,n4;\r
gr->SetPenPal(pen,&pal); gr->Reserve(2*n*m);\r
- long s=gr->AddTexture(pen,1);\r
+// long s=gr->AddTexture(pen,1);\r
for(j=0;j<m;j++)\r
{\r
c2=c1=gr->NextColor(pal);\r
bool wire = pen && strchr(pen,'#');\r
\r
gr->SetPenPal(pen,&pal); gr->Reserve(2*n*m);\r
- long s=gr->AddTexture(pen,1);\r
+// long s=gr->AddTexture(pen,1);\r
for(j=0;j<m;j++)\r
{\r
c2=c1=gr->NextColor(pal);\r
bool sh = pen && strchr(pen,'!');\r
\r
gr->SetPenPal(pen,&pal); gr->Reserve(2*n*m);\r
- long s=gr->AddTexture(pen,1);\r
+// long s=gr->AddTexture(pen,1);\r
for(j=0;j<m;j++)\r
{\r
c2=c1=gr->NextColor(pal);\r
{\r
if(gr->Stop) { delete []d; return; }\r
register long mm,k;\r
- for(mm=j=0;j<m;j++) if(!isnan(y->v(i,j)))\r
+ for(mm=j=0;j<m;j++) if(!mgl_isnan(y->v(i,j)))\r
{ d[mm]=y->v(i,j); mm++; }\r
if(m==0) { b[i]=NAN; break; }\r
qsort(d, mm, sizeof(float), mgl_cmp_flt);\r
if(n<2) { gr->SetWarn(mglWarnLow,"Tape"); return; }\r
static int cgid=1; gr->StartGroup("Tape",cgid++);\r
float ll, rr = gr->SaveState(opt);\r
- if(rr==0 || isnan(rr)) rr = mgl_norm(gr->Max-gr->Min)*gr->BarWidth/25;\r
+ if(rr==0 || mgl_isnan(rr)) rr = mgl_norm(gr->Max-gr->Min)*gr->BarWidth/25;\r
m = x->GetNy() > y->GetNy() ? x->GetNy() : y->GetNy(); m = z->GetNy() > m ? z->GetNy() : m;\r
gr->SetPenPal(pen,&pal); gr->Reserve(4*n*m);\r
mglPoint p1,p2,q1,q2,l,nn,qn=mglPoint(NAN,NAN);\r
#include <stdio.h>\r
#include <time.h>\r
#include <zlib.h>\r
-#include "mgl/canvas.h"\r
-#include "mgl/canvas_cf.h"\r
+#include "mgl2/canvas.h"\r
+#include "mgl2/canvas_cf.h"\r
\r
#include "oPRCFile.h"\r
#include <map>\r
***************************************************************************/\r
#include <wchar.h>\r
#include <stdlib.h>\r
-#include "mgl/canvas.h"\r
-#include "mgl/prim.h"\r
-#include "mgl/data.h"\r
+#include "mgl2/canvas.h"\r
+#include "mgl2/prim.h"\r
+#include "mgl2/data.h"\r
//-----------------------------------------------------------------------------\r
//\r
// Mark & Curve series\r
void mgl_line(HMGL gr, float x1, float y1, float z1, float x2, float y2, float z2, const char *pen,int n)\r
{\r
static int cgid=1; gr->StartGroup("Line",cgid++);\r
- if(isnan(z1) || isnan(z2)) z1=z2=gr->Min.z;\r
+ if(mgl_isnan(z1) || mgl_isnan(z2)) z1=z2=gr->Min.z;\r
mglPoint p1(x1,y1,z1), p2(x2,y2,z2), p=p1,nn=mglPoint(NAN);\r
gr->SetPenPal(pen);\r
n = (n<2) ? 2 : n;\r
gr->SetPenPal(stl,&pal);\r
float c1,c2,c3,c4,zz=(gr->Min.z+gr->Max.z)/2;\r
c1=c2=c3=c4=gr->CDef;\r
- if(isnan(z0)) z0 = zz; if(isnan(z1)) z1 = zz;\r
- if(isnan(z2)) z2 = zz; if(isnan(z3)) z3 = zz;\r
+ if(mgl_isnan(z0)) z0 = zz; if(mgl_isnan(z1)) z1 = zz;\r
+ if(mgl_isnan(z2)) z2 = zz; if(mgl_isnan(z3)) z3 = zz;\r
mglPoint p1(x0,y0,z0), p2(x1,y1,z1), p3(x2,y2,z2), p4(x3,y3,z3);\r
if(gr->GetNumPal(pal)>=4)\r
{ c2=gr->NextColor(pal); c3=gr->NextColor(pal); c4=gr->NextColor(pal); }\r
if(x->GetNx()!=n || z->GetNx()!=n)\r
{ gr->SetWarn(mglWarnDim,"Label"); return; }\r
if(n<2) { gr->SetWarn(mglWarnLow,"Label"); return; }\r
- float size=gr->SaveState(opt); if(isnan(size)) size=-0.7;\r
+ float size=gr->SaveState(opt); if(mgl_isnan(size)) size=-0.7;\r
static int cgid=1; gr->StartGroup("Label",cgid++);\r
m = x->GetNy() > y->GetNy() ? x->GetNy() : y->GetNy(); m = z->GetNy() > m ? z->GetNy() : m;\r
\r
* Free Software Foundation, Inc., *\r
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
***************************************************************************/\r
-#include "mgl/define.h"\r
-#include "mgl/surf.h"\r
-#include "mgl/data.h"\r
-#include "mgl/eval.h"\r
+#include "mgl2/define.h"\r
+#include "mgl2/surf.h"\r
+#include "mgl2/data.h"\r
+#include "mgl2/eval.h"\r
//-----------------------------------------------------------------------------\r
void mgl_mesh_plot(mglBase *gr, long *pos, long n, long m, int how)\r
{\r
{ // TODO: Add strong function variation analisys ???\r
if(eqZ==0 || eqZ[0]==0) return; // nothing to plot\r
float r = gr->SaveState(opt);\r
- long n = (isnan(r) || r<=0) ? 100:long(r+0.5);\r
+ long n = (mgl_isnan(r) || r<=0) ? 100:long(r+0.5);\r
mglData z(n,n);\r
mglFormula *eq = new mglFormula(eqZ);\r
register int i,j;\r
{ // TODO: Add strong function variation analisys ???\r
if(eqZ==0 || eqZ[0]==0) return; // nothing to plot\r
float r = gr->SaveState(opt);\r
- long n = (isnan(r) || r<=0) ? 100:long(r+0.5);\r
+ long n = (mgl_isnan(r) || r<=0) ? 100:long(r+0.5);\r
mglData x(n,n), y(n,n), z(n,n);\r
if(n<=0) n=100;\r
mglFormula *ex, *ey, *ez;\r
if(gr->Stop) { delete []pos; return; }\r
p = mglPoint(GetX(x,i,j,k).x, GetY(y,i,j,k).x, zVal);\r
zz = z->v(i,j,k); c = gr->GetC(ss,zz);\r
- if(isnan(zz)) p.x = NAN;\r
+ if(mgl_isnan(zz)) p.x = NAN;\r
pos[i+n*j] = gr->AddPnt(p,c,s);\r
}\r
mgl_surf_plot(gr,pos,n,m);\r
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
-#include "mgl/font.h"
+#include "mgl2/font.h"
/// Table of LaTeX symbols and its UTF8 codes. This array MUST BE sorted!!!
mglTeXsymb mgl_tex_symb[] = {
* Free Software Foundation, Inc., *\r
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
***************************************************************************/\r
-#include "mgl/vect.h"\r
-#include "mgl/eval.h"\r
-#include "mgl/data.h"\r
+#include "mgl2/vect.h"\r
+#include "mgl2/eval.h"\r
+#include "mgl2/data.h"\r
#include <stdlib.h>\r
//-----------------------------------------------------------------------------\r
//\r
if(n<2) { gr->SetWarn(mglWarnLow,"Traj"); return; }\r
if(n!=x->GetNx() || z->GetNx()!=n || y->GetNx()!=n || ay->GetNx()!=n || az->GetNx()!=n)\r
{ gr->SetWarn(mglWarnDim,"Traj"); return; }\r
- float len=gr->SaveState(opt); if(isnan(len)) len = 0;\r
+ float len=gr->SaveState(opt); if(mgl_isnan(len)) len = 0;\r
static int cgid=1; gr->StartGroup("Traj",cgid++);\r
\r
register long i, j;\r
bool both = x->GetNx()*x->GetNy()*x->GetNz()==n*m*l && y->GetNx()*y->GetNy()*y->GetNz()==n*m*l && z->GetNx()*z->GetNy()*z->GetNz()==n*m*l;\r
if(!(both || (x->GetNx()==n && y->GetNx()==m && z->GetNx()==l)))\r
{ gr->SetWarn(mglWarnDim,"Vect"); return; }\r
-
+\r
gr->SaveState(opt);\r
static int cgid=1; gr->StartGroup("Vect3",cgid++);\r
bool dot = sch && strchr(sch,'.');\r
bool both = x->GetNx()==n && y->GetNx()==n && x->GetNy()==m && y->GetNy()==m;\r
if(!(both || (x->GetNx()==n && y->GetNx()==m))) { gr->SetWarn(mglWarnDim,"Flow"); return; }\r
float r = gr->SaveState(opt);\r
- long num = isnan(r)?5:long(r+0.5);\r
+ long num = mgl_isnan(r)?5:long(r+0.5);\r
static int cgid=1; gr->StartGroup("Flow",cgid++);\r
\r
long ss = gr->AddTexture(sch);\r
if(!(both || (x->GetNx()==n && y->GetNx()==m && z->GetNx()==l)))\r
{ gr->SetWarn(mglWarnDim,"Flow"); return; }\r
float r = gr->SaveState(opt);\r
- long num = isnan(r)?3:long(r+0.5);\r
+ long num = mgl_isnan(r)?3:long(r+0.5);\r
static int cgid=1; gr->StartGroup("Flow3",cgid++);\r
bool cnt=!(sch && strchr(sch,'#'));\r
long ss = gr->AddTexture(sch);\r
mglPoint dx(1/fabs(gr->Max.x-gr->Min.x),1/fabs(gr->Max.y-gr->Min.y),1/fabs(gr->Max.z-gr->Min.z));\r
\r
float dt = 0.5/(ax.nx > ax.ny ? ax.nx : ax.ny),e,f,g,ff[4],gg[4],h,s=1;\r
- float ss = 4/mgl_ipow(gr->Max.c - gr->Min.c,2);\r
+ float ss = 4./mgl_ipow(gr->Max.c - gr->Min.c,2);\r
if(u<0 || v<0) { dt = -dt; u = -u; v = -v; s = -1;}\r
register long k=0,m;\r
bool end = false;\r
bool both = x->GetNx()==n && y->GetNx()==n && x->GetNy()==m && y->GetNy()==m;\r
if(!(both || (x->GetNx()==n && y->GetNx()==m))) { gr->SetWarn(mglWarnDim,"Pipe"); return; }\r
float r = gr->SaveState(opt);\r
- long num = isnan(r)?5:long(r+0.5);\r
+ long num = mgl_isnan(r)?5:long(r+0.5);\r
static int cgid=1; gr->StartGroup("Pipe",cgid++);\r
\r
long ss = gr->AddTexture(sch);\r
nn = (ax.nx > ax.ny ? ax.nx : ax.ny);\r
nn = (nn > ax.nz ? nn : ax.nz);\r
float dt = 0.2/nn, e,f,g,ee[4],ff[4],gg[4],h,s=1,u1,v1,w1;\r
- float ss = 4/mgl_ipow(gr->Max.c - gr->Min.c,2);\r
+ float ss = 4./mgl_ipow(gr->Max.c - gr->Min.c,2);\r
\r
if(u<0 || v<0 || w<0)\r
{ dt = -dt; u = -u; v = -v; w = -w; s = -1;}\r
if(!(both || (x->GetNx()==n && y->GetNx()==m && z->GetNx()==l)))\r
{ gr->SetWarn(mglWarnDim,"Pipe"); return; }\r
float r = gr->SaveState(opt);\r
- long num = isnan(r)?3:long(r+0.5);\r
+ long num = mgl_isnan(r)?3:long(r+0.5);\r
static int cgid=1; gr->StartGroup("Pipe3",cgid++);\r
if(sch && strchr(sch,'i')) r0 = -fabs(r0);\r
\r
* Free Software Foundation, Inc., *\r
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
***************************************************************************/\r
-#include "mgl/define.h"\r
-#include "mgl/volume.h"\r
-#include "mgl/data.h"\r
-#include "mgl/eval.h"\r
+#include "mgl2/define.h"\r
+#include "mgl2/volume.h"\r
+#include "mgl2/data.h"\r
+#include "mgl2/eval.h"\r
#include <vector>\r
//-----------------------------------------------------------------------------\r
//\r
void mgl_surf3_xyz(HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, const char *opt)\r
{\r
float r = gr->SaveState(opt);\r
- long num = isnan(r)?3:long(r+0.5);\r
+ long num = mgl_isnan(r)?3:long(r+0.5);\r
for(long i=0;i<num;i++)\r
{\r
float v = gr->Max.c + (gr->Min.c-gr->Max.c)*(i+1.)/(num+1);\r
void mgl_surf3(HMGL gr, HCDT a, const char *sch, const char *opt)\r
{\r
float r = gr->SaveState(opt);\r
- long num = isnan(r)?3:long(r+0.5);\r
+ long num = mgl_isnan(r)?3:long(r+0.5);\r
for(long i=0;i<num;i++)\r
{\r
float v = gr->Max.c + (gr->Min.c-gr->Max.c)*(i+1.)/(num+1);\r
void mgl_surf3a_xyz(HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, HCDT b, const char *sch, const char *opt)\r
{\r
float r = gr->SaveState(opt);\r
- long num = isnan(r)?3:long(r+0.5);\r
+ long num = mgl_isnan(r)?3:long(r+0.5);\r
if(b->GetNx()==num && b->GetNy()==1 && b->GetNz()==1)\r
{\r
float v,a0=gr->AlphaDef;\r
void mgl_surf3a(HMGL gr, HCDT a, HCDT b, const char *sch, const char *opt)\r
{\r
float r = gr->SaveState(opt);\r
- long num = isnan(r)?3:long(r);\r
+ long num = mgl_isnan(r)?3:long(r);\r
if(b->GetNx()==num && b->GetNy()==1 && b->GetNz()==1)\r
{\r
float v,a0=gr->AlphaDef;\r
void mgl_surf3c_xyz(HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, HCDT b, const char *sch, const char *opt)\r
{\r
float r = gr->SaveState(opt);\r
- long num = isnan(r)?3:long(r+0.5);\r
+ long num = mgl_isnan(r)?3:long(r+0.5);\r
for(long i=0;i<num;i++)\r
{\r
float v = gr->Max.c + (gr->Min.c-gr->Max.c)*(i+1.)/(num+1);\r
void mgl_surf3c(HMGL gr, HCDT a, HCDT b, const char *sch, const char *opt)\r
{\r
float r = gr->SaveState(opt);\r
- long num = isnan(r)?3:long(r+0.5);\r
+ long num = mgl_isnan(r)?3:long(r+0.5);\r
for(long i=0;i<num;i++)\r
{\r
float v = gr->Max.c + (gr->Min.c-gr->Max.c)*(i+1.)/(num+1);\r
# new files and destination for html docs.
if(MGL_HAVE_DOC)
+ set(MGL_PNG alpha.png area.png aspect.png axial.png axis.png barh.png bars.png belt.png boxplot.png
+ box.png boxs.png candle.png chart.png cloud.png colorbar.png combined.png cones.png conta.png contd.png
+ contfa.png contf.png contf_xyz.png cont.png contv.png cont_xyz.png curvcoor.png cut.png dat_diff.png
+ dat_extra.png densa.png dens.png dens_xyz.png dew.png dots.png error.png fall.png fit.png flow.png
+ fog.png grad.png hist.png inplot.png label.png legend.png loglog.png map.png mark.png mesh.png mirror.png
+ molecule.png parser.png pde.png pipe.png plot.png primitives.png qo2d.png radar.png region.png schemes.png
+ several_light.png stem.png step.png stereo.png stfa.png style.png surf3a.png surf3c.png surf3.png
+ surfa.png surfc.png surf.png tape.png tens.png ternary.png textmark.png text.png ticks.png tile.png
+ tiles.png torus.png traj.png triplot.png tube.png type0.png type1.png type2.png vect.png venn.png)
+
+# foreach(SAMPLE ${MGL_PNG})
+# add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/texinfo/png/${SAMPLE}
+# COMMAND ${CMAKE_BINARY_DIR}/examples/mgl_example --kind=${SAMPLE}
+# WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/texinfo/png )
+# endforeach(SAMPLE)
+
add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/texinfo/png/all.png
-# COMMAND LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/mgl ${CMAKE_BINARY_DIR}/examples/mgl_example
COMMAND ${CMAKE_BINARY_DIR}/examples/mgl_example
COMMAND touch ${CMAKE_SOURCE_DIR}/texinfo/png/all.png
-# MAIN_DEPENDENCY ${CMAKE_BINARY_DIR}/examples/mgl_example
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/texinfo/png
)
- add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/texinfo/small/all.png
- COMMAND ${CMAKE_BINARY_DIR}/examples/mgl_example -mini
- COMMAND touch ${CMAKE_SOURCE_DIR}/texinfo/small/all.png
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/texinfo/small
- )
+ add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/texinfo/small/all.png
+ COMMAND ${CMAKE_BINARY_DIR}/examples/mgl_example -mini
+ COMMAND touch ${CMAKE_SOURCE_DIR}/texinfo/small/all.png
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/texinfo/small
+ )
# set_source_files_properties(${CMAKE_BINARY_DIR}/examples/mgl_example PROPERTIES GENERATED 1)
# ADD_CUSTOM_TARGET(gen_all_png DEPENDS ${CMAKE_SOURCE_DIR}/texinfo/png/all.png)
# ADD_DEPENDENCIES(gen_all_png mgl_example)
- set(list_texi_files_en mathgl_en.texi mgl_en.texi overview_en.texi example_en.texi ex_mgl_en.texi parse_en.texi core_en.texi concept_en.texi widget_en.texi data_en.texi other_en.texi appendix_en.texi fdl.texi)
- set(list_texi_files_ru mathgl_ru.texi mgl_ru.texi overview_ru.texi example_ru.texi ex_mgl_ru.texi parse_ru.texi core_ru.texi concept_ru.texi widget_ru.texi data_ru.texi other_ru.texi appendix_ru.texi fdl.texi)
+ set(list_texi_files_en mathgl_en.texi mgl_en.texi overview_en.texi example_en.texi ex_mgl_en.texi parse_en.texi
+ core_en.texi concept_en.texi widget_en.texi data_en.texi other_en.texi appendix_en.texi fdl.texi)
+ set(list_texi_files_ru mathgl_ru.texi mgl_ru.texi overview_ru.texi example_ru.texi ex_mgl_ru.texi parse_ru.texi
+ core_ru.texi concept_ru.texi widget_ru.texi data_ru.texi other_ru.texi appendix_ru.texi fdl.texi)
add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/texinfo/web_en.pdf
COMMAND ${findtp} -I ${CMAKE_SOURCE_DIR}/texinfo/png web_en.texi
add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/texinfo/mathgl_en.info
COMMAND ${findth} -I=${CMAKE_SOURCE_DIR}/texinfo/png --split=section mathgl_en.texi -o mathgl_en
- COMMAND ${findth} -I=${CMAKE_SOURCE_DIR}/texinfo/png --split=node --frames -o mgl_web_en mathgl_en.texi
+ COMMAND ${findth} -I=${CMAKE_SOURCE_DIR}/texinfo/png --split=node --frames -o doc_en mathgl_en.texi
COMMAND ${findth} -I=${CMAKE_SOURCE_DIR}/texinfo/png --split=no mgl_en.texi -o mgl_en.html
COMMAND ${findmi} --no-validate mathgl_en.texi
DEPENDS ${CMAKE_SOURCE_DIR}/texinfo/png/all.png
)
add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/texinfo/mathgl_ru.info
COMMAND ${findth} -I=${CMAKE_SOURCE_DIR}/texinfo/png --split=section mathgl_ru.texi -o mathgl_ru
+ COMMAND ${findth} -I=${CMAKE_SOURCE_DIR}/texinfo/png --split=node --frames -o doc_ru mathgl_ru.texi
COMMAND ${findth} -I=${CMAKE_SOURCE_DIR}/texinfo/png --split=no mgl_ru.texi -o mgl_ru.html
COMMAND ${findmi} --no-validate mathgl_ru.texi
DEPENDS ${CMAKE_SOURCE_DIR}/texinfo/png/all.png
+++ /dev/null
-SUBDIRS = png .
-
-CLEANFILES = mathgl_en.info mathgl_en.info-1 mathgl_en.info-2 mathgl_en.info-3 mgl_en.info \
-mathgl_ru.info mathgl_ru.info-1 mathgl_ru.info-2 mathgl_ru.info-3 mathgl_ru.info-4 mgl_ru.info
-
-MAKEINFOHTML = texi2html
-TEXI2PDF = texi2pdf
-
-#AM_MAKEINFOHTMLFLAGS = --split=chapter
-AM_MAKEINFOFLAGS = --no-validate
-
-info_TEXINFOS = mathgl_en.texi
-mathgl_en_TEXINFOS = \
-overview_en.texi example_en.texi core_en.texi class_en.texi widget_en.texi \
-data_en.texi other_en.texi mgl_cmd_en.texi samples_en.texi appendix_en.texi fdl.texi
-
-
-info_TEXINFOS += mathgl_ru.texi
-mathgl_ru_TEXINFOS = \
-overview_ru.texi example_ru.texi core_ru.texi class_ru.texi widget_ru.texi \
-data_ru.texi other_ru.texi mgl_cmd_ru.texi samples_ru.texi appendix_ru.texi fdl.texi
-
-info_TEXINFOS += mgl_en.texi
-mgl_en_TEXINFOS = \
-mgl_cmd_en.texi samples_en.texi ex_mgl_en.texi concept_en.texi fdl.texi
-
-info_TEXINFOS += mgl_ru.texi
-mgl_ru_TEXINFOS = \
-mgl_cmd_ru.texi samples_ru.texi ex_mgl_ru.texi concept_ru.texi fdl.texi
-
-#mglpng=$(DESTDIR)$(docdir)/png_static
-
-#install-data-local: install-html install-pdf
-install-data-local:
-# mkdir -p $(mglpng)
-# cp -r $(top_srcdir)/texinfo/png_static/*.png $(mglpng)
-uninstall-local:
-# rm -rf $(mglpng)
-
-#all-local: html pdf
-all-local: html
- ./filter.py
The C interface is a base for many other interfaces. It contains the pure C functions for most of the methods of MathGL classes. In distinction to C++ classes, C functions must have an argument HMGL (for graphics) and/or HMDT (for data arrays), which specifies the object for drawing or manipulating (changing). So, firstly, the user has to create this object by the function @code{mgl_create_*()} and has to delete it after the use by function @code{mgl_delete_*()}.
-All C functions are described in the header file @code{#include <mgl/mgl_c.h>} and use variables of the following types:
+All C functions are described in the header file @code{#include <mgl2/mgl_cf.h>} and use variables of the following types:
@itemize
@item
@code{HMGL} --- Pointer to class @code{mglGraph} (@pxref{MathGL core}).
@end verbatim
This becomes useful if you create many @code{mglData} objects, for example.
-@end ifclear
\ No newline at end of file
+@end ifclear
@end ifset
@ifclear UDAV
-The core of MathGL is @strong{mglGraph} class defined in @code{#include <mgl/mgl.h>}. It contains a lot of plotting functions for 1D, 2D and 3D data. It also encapsulates parameters for axes drawing. Moreover an arbitrary coordinate transformation can be used for each axis. All plotting functions use data encapsulated in mglData class (see @ref{Data processing}) that allows to check sizes of used arrays easily. Also it have many functions for data handling: modify it by formulas, find momentums and distribution (histogram), apply operator (differentiate, integrate, transpose, Fourier and so on), change data sizes (interpolate, squeeze, crop and so on). Additional information about colors, fonts, formula parsing can be found in @ref{General concepts} and @ref{Other classes}.
+The core of MathGL is @strong{mglGraph} class defined in @code{#include <mgl2/mgl.h>}. It contains a lot of plotting functions for 1D, 2D and 3D data. It also encapsulates parameters for axes drawing. Moreover an arbitrary coordinate transformation can be used for each axis. All plotting functions use data encapsulated in mglData class (see @ref{Data processing}) that allows to check sizes of used arrays easily. Also it have many functions for data handling: modify it by formulas, find momentums and distribution (histogram), apply operator (differentiate, integrate, transpose, Fourier and so on), change data sizes (interpolate, squeeze, crop and so on). Additional information about colors, fonts, formula parsing can be found in @ref{General concepts} and @ref{Other classes}.
@end ifclear
@menu
@anchor{palette}
@deftypefn {MGL command} {} palette 'colors'
@ifclear UDAV
-@deftypefnx {Method on @code{mglGraph}} @code{void} SetPalette (@code{const char *}@var{colors})
-@deftypefnx {C function} @code{void} mgl_set_palette (@code{HMGL} gr, @code{const char *}@var{colors})
+@deftypefnx {Method on @code{mglGraph}} @code{void} SetPalette (@code{const char *}colors)
+@deftypefnx {C function} @code{void} mgl_set_palette (@code{HMGL} gr, @code{const char *}colors)
@end ifclear
Sets the palette as selected colors. Default value is @code{"Hbgrcmyhlnqeup"} that corresponds to colors: dark gray @samp{H}, blue @samp{b}, green @samp{g}, red @samp{r}, cyan @samp{c}, magenta @samp{m}, yellow @samp{y}, gray @samp{h}, blue-green @samp{l}, sky-blue @samp{n}, orange @samp{q}, yellow-green @samp{e}, blue-violet @samp{u}, purple @samp{p}. The palette is used mostly in 1D plots (see @ref{1D plotting}) for curves which styles are not specified. Internal color counter will be nullified by any change of palette. This includes even hidden change (for example, by @code{Box()} or @code{Axis()} functions).
@end deftypefn
+@ifclear UDAV
+@deftypefn {Method on @code{mglGraph}} @code{void} SetDefScheme (@code{const char *}sch)
+@deftypefnx {C function} @code{void} mgl_set_def_sch (@code{HMGL} gr, @code{const char *}sch)
+Sets the @var{sch} as default color scheme. Default value is @code{"BbcyrR"}.
+@end deftypefn
+
+@deftypefn {C function} @code{void} mgl_set_color (@code{char} id, @code{float} r, @code{float} g, @code{float} b)
+Sets RGB values for color with given @var{id}.
+@end deftypefn
+@end ifclear
+
@c ==================================================================
@node Error handling, , Palette and colors, Graphics setup
@subsection Error handling
@end ifset
@ifclear UDAV
-Основным классом MathGL является класс @strong{mglGraph}, определённый в @code{#include <mgl/mgl.h>}. Он включает в себя множество функций для построения графиков от 1D, 2D и 3D массивов. Он также содержит функции вывода текста и построения осей координат. Есть возможность построения в произвольной системе координат, которая задается строковыми формулами. Все графические функции используют класс mglData (см. @ref{Data processing}) для хранения массивов данных. Это позволяет легко контролировать размеры, работу с памятью и производить обработку данных. Дополнительная информация о цветах, шрифтах, вычисления формул может быть найдена в @ref{General concepts} и @ref{Other classes}.
+Основным классом MathGL является класс @strong{mglGraph}, определённый в @code{#include <mgl2/mgl.h>}. Он включает в себя множество функций для построения графиков от 1D, 2D и 3D массивов. Он также содержит функции вывода текста и построения осей координат. Есть возможность построения в произвольной системе координат, которая задается строковыми формулами. Все графические функции используют класс mglData (см. @ref{Data processing}) для хранения массивов данных. Это позволяет легко контролировать размеры, работу с памятью и производить обработку данных. Дополнительная информация о цветах, шрифтах, вычисления формул может быть найдена в @ref{General concepts} и @ref{Other classes}.
@end ifclear
@menu
Задает палитру как последовательность цветов. Значение по умолчанию @code{"Hbgrcmyhlnqeup"}, что соответствует цветам: темно серый @samp{H}, синий @samp{b}, зелёный @samp{g}, красный @samp{r}, голубой @samp{c}, малиновый @samp{m}, жёлтый @samp{y}, серый @samp{h}, сине-зелёный @samp{l}, небесно-голубой @samp{n}, оранжевый @samp{q}, желто-зелёный @samp{e}, сине-фиолетовый @samp{u}, фиолетовый @samp{p}. Палитра в основном используется в 1D графиках (см. @ref{1D plotting}) для кривых с неопределённым стилем линии.
@end deftypefn
+
+@ifclear UDAV
+@deftypefn {Method on @code{mglGraph}} @code{void} SetDefScheme (@code{const char *}sch)
+@deftypefnx {C function} @code{void} mgl_set_def_sch (@code{HMGL} gr, @code{const char *}sch)
+Устанавливает @var{sch} в качестве цветовой схемы по умолчанию. Начальное значение @code{"BbcyrR"}.
+@end deftypefn
+
+@deftypefn {C function} @code{void} mgl_set_color (@code{char} id, @code{float} r, @code{float} g, @code{float} b)
+Задает RGB значения для цвета с заданным @var{id}.
+@end deftypefn
+@end ifclear
+
@c ==================================================================
@node Error handling, , Palette and colors, Graphics setup
@subsection Обработка ошибок
@end ifset
@ifclear UDAV
-This chapter describe class @code{mglData} for working with data array. This class is defined in @code{#include <mgl/data.h>}. The class has functions for easy and safe allocation, resizing, loading and saving, modifying of data arrays. Also it can numerically differentiate and integrate data, interpolate, fill data by formula and so on. Class supports data with dimensions up to 3 (like function of 3 variables -- x,y,z). The internal representation of numbers is float. Float type was chosen because it has smaller size in memory and usually it has enough precision in plotting purposes. You can change it by selecting option @code{--enable-double} at the library configuring (see @ref{Installation}). Data arrays are denoted by Small Caps (like @sc{dat}) if it can be (re-)created by MGL commands.
+This chapter describe class @code{mglData} for working with data array. This class is defined in @code{#include <mgl2/data.h>}. The class has functions for easy and safe allocation, resizing, loading and saving, modifying of data arrays. Also it can numerically differentiate and integrate data, interpolate, fill data by formula and so on. Class supports data with dimensions up to 3 (like function of 3 variables -- x,y,z). The internal representation of numbers is float. Float type was chosen because it has smaller size in memory and usually it has enough precision in plotting purposes. You can change it by selecting option @code{--enable-double} at the library configuring (see @ref{Installation}). Data arrays are denoted by Small Caps (like @sc{dat}) if it can be (re-)created by MGL commands.
@end ifclear
@menu
@end ifset
@ifclear UDAV
-MathGL have a special class @code{mglExpr} for evaluating of formula specified by the string. This class is defined in @code{#include <mgl/mgl.h>}. It is the fast variant of formula evaluation. At creation it will be recognized and compiled to tree-like internal code. At evaluation stage only fast calculations are performed. There is no difference between lower or upper case in formulas. If argument value lie outside the range of function definition then function returns NaN. @xref{Textual formulas}.
+MathGL have a special class @code{mglExpr} for evaluating of formula specified by the string. This class is defined in @code{#include <mgl2/mgl.h>}. It is the fast variant of formula evaluation. At creation it will be recognized and compiled to tree-like internal code. At evaluation stage only fast calculations are performed. There is no difference between lower or upper case in formulas. If argument value lie outside the range of function definition then function returns NaN. @xref{Textual formulas}.
@deftypefn {Constructor on @code{mglExpr}} @code{} mglExpr (@code{const char *}expr)
@deftypefnx {C function} @code{HMEX} mgl_create_expr (@code{const char *}expr)
@end ifset
@ifclear UDAV
-В данной главе описывается класс @code{mglData} для работы с массивами данных, определённый в @code{#include <mgl/mgl_data.h>}. Он содержит функции для выделения памяти и изменения размера данных, чтения данных из файла, численного дифференцирования, интегрирования, интерполяции и пр., заполнения по текстовой формуле и т.д. Класс позволяет работать с данными размерности не более 3 (как функции от трёх переменных -- x,y,z). По умолчанию внутреннее представление данных -- float, выбранный в силу меньшего размера занимаемой памяти и достаточной для построения графиков точности. Базовый тип можно сменить на этапе установки (@pxref{Installation and usage}) указав опцию @code{--enable-double}. Однако, в дальнейшем в документации будет использован тип @code{float}. Массивы которые могут быть созданы командами MGL отображаются Small Caps шрифтом (например, @sc{dat}).
+В данной главе описывается класс @code{mglData} для работы с массивами данных, определённый в @code{#include <mgl2/mgl_data.h>}. Он содержит функции для выделения памяти и изменения размера данных, чтения данных из файла, численного дифференцирования, интегрирования, интерполяции и пр., заполнения по текстовой формуле и т.д. Класс позволяет работать с данными размерности не более 3 (как функции от трёх переменных -- x,y,z). По умолчанию внутреннее представление данных -- float, выбранный в силу меньшего размера занимаемой памяти и достаточной для построения графиков точности. Базовый тип можно сменить на этапе установки (@pxref{Installation and usage}) указав опцию @code{--enable-double}. Однако, в дальнейшем в документации будет использован тип @code{float}. Массивы которые могут быть созданы командами MGL отображаются Small Caps шрифтом (например, @sc{dat}).
@end ifclear
* Public variables::
@end ifset
@ifclear UDAV
-В MathGL есть специальный класс @code{mglExpr} для вычисления формул заданных строкой. Класс определён в @code{#include <mgl/mgl.h>}. При создании класса происходит разбор формулы в древовидную структуру. А при вычислении только выполняется достаточно быстрый обход по дереву. В данный момент нет различия между верхним и нижним регистром. Если аргумент какой-либо функции лежит вне её области определения, то возвращается NaN. @xref{Textual formulas}.
+В MathGL есть специальный класс @code{mglExpr} для вычисления формул заданных строкой. Класс определён в @code{#include <mgl2/mgl.h>}. При создании класса происходит разбор формулы в древовидную структуру. А при вычислении только выполняется достаточно быстрый обход по дереву. В данный момент нет различия между верхним и нижним регистром. Если аргумент какой-либо функции лежит вне её области определения, то возвращается NaN. @xref{Textual formulas}.
@deftypefn {Constructor on @code{mglExpr}} @code{} mglExpr (@code{const char *}expr)
@deftypefnx {C function} @code{HMEX} mgl_create_expr (@code{const char *}expr)
--- /dev/null
+\input texinfo
+@setfilename mathgl_en.info
+@set VERSION 2.0
+@settitle MathGL @value{VERSION}
+@syncodeindex pg cp
+@comment %**end of header
+
+@copying
+This manual is for MathGL (version @value{VERSION}), a collection of classes and routines for scientific plotting. Please report any errors in this manual to @email{mathgl.abalakin@@gmail.org}.
+
+Copyright @copyright{} 2008 Alexey Balakin.
+
+@quotation
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU Free Documentation License, Version 1.2 or
+any later version published by the Free Software Foundation; with no
+Invariant Sections, with the Front-Cover Texts being ``A GNU Manual,''
+and with the Back-Cover Texts as in (a) below. A copy of the
+license is included in the section entitled ``GNU Free Documentation
+License.''
+
+(a) The FSF's Back-Cover Text is: ``You have the freedom to
+copy and modify this GNU manual. Buying copies from the FSF
+supports it in developing GNU and promoting software freedom.''
+@end quotation
+@end copying
+
+@dircategory MathGL documentation system
+@direntry
+* MathGL: (mathgl). The library for scientific graphics.
+@end direntry
+
+@titlepage
+@title MathGL
+@subtitle for version @value{VERSION}
+@author A.A. Balakin (@uref{http://mathgl.sourceforge.net/})
+@page
+@vskip 0pt plus 1filll
+@insertcopying
+@end titlepage
+
+@contents
+
+@ifnottex
+@node Top
+@top MathGL
+
+This file documents the Mathematical Graphic Library (MathGL), a collection of classes and routines for scientific plotting. It corresponds to release @value{VERSION} of the library. Please report any errors in this manual to @email{mathgl.abalakin@@gmail.org}. More information about MathGL can be found at the project homepage, @uref{http://mathgl.sourceforge.net/}.
+
+Copyright @copyright{} 2008 Alexey A. Balakin.
+
+@quotation
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU Free Documentation License, Version 1.2 or
+any later version published by the Free Software Foundation; with no
+Invariant Sections, with the Front-Cover Texts being ``A GNU Manual,''
+and with the Back-Cover Texts as in (a) below. A copy of the
+license is included in the section entitled ``GNU Free Documentation
+License.''
+
+(a) The FSF's Back-Cover Text is: ``You have the freedom to
+copy and modify this GNU manual. Buying copies from the FSF
+supports it in developing GNU and promoting software freedom.''
+@end quotation
+
+@end ifnottex
+
+@menu
+* Overview::
+* Examples::
+* General concepts::
+* MathGL core::
+* Widget classes::
+* Data processing::
+* MGL scripts::
+* Other classes::
+* TeX-like symbols::
+* Copying This Manual::
+* Index::
+@end menu
+
+@macro fig {fname,text}
+@center @image{../\fname\, 11cm, , \text\, .png}
+@end macro
+
+@macro reklama
+@end macro
+
+@rmacro sref {arg}
+@xref{\arg\}, for sample code and picture.
+@end rmacro
+@macro tdref {nam}
+@uref{http://mathgl.sourceforge.net/pdf_u3d/\nam\.pdf, 3D pdf}
+@end macro
+
+
+@node Overview, Examples, , Top
+@include overview_en.texi
+
+@node Examples, General concepts, Overview, Top
+@include example_en.texi
+
+@node General concepts, MathGL core, Examples, Top
+@include concept_en.texi
+
+@node MathGL core, Widget classes, General concepts, Top
+@include core_en.texi
+
+@node Widget classes, Data processing, MathGL core, Top
+@include widget_en.texi
+
+@node Data processing, MGL scripts, Widget classes, Top
+@include data_en.texi
+
+@node MGL scripts, Other classes, Data processing, Top
+@include parse_en.texi
+
+@node Other classes, TeX-like symbols, MGL scripts, Top
+@include other_en.texi
+
+@node TeX-like symbols, Copying This Manual, Other classes, Top
+@appendix TeX-like symbols
+@include appendix_en.texi
+
+@node Copying This Manual, Index, TeX-like symbols, Top
+@appendix GNU Free Documentation License
+@include fdl.texi
+
+@node Index, , Copying This Manual, Top
+@unnumbered Index
+
+@printindex cp
+
+@bye
--- /dev/null
+\input texinfo
+@setfilename mathgl_ru.info
+@c @documentlanguage ru
+@documentencoding UTF-8
+@set VERSION 2.0
+@settitle MathGL @value{VERSION}
+@syncodeindex pg cp
+@comment %**end of header
+
+@copying
+Это документация для MathGL (версии @value{VERSION}) -- библиотеки классов и функций для построения научной графики. Пожалуйста сообщайте о любых ошибках в этом руководстве на @email{mathgl.abalakin@@gmail.org}.
+
+Copyright @copyright{} 2009 Алексей Балакин.
+
+@quotation
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU Free Documentation License, Version 1.2 or
+any later version published by the Free Software Foundation; with no
+Invariant Sections, with the Front-Cover Texts being ``A GNU Manual,''
+and with the Back-Cover Texts as in (a) below. A copy of the
+license is included in the section entitled ``GNU Free Documentation
+License.''
+
+(a) The FSF's Back-Cover Text is: ``You have the freedom to
+copy and modify this GNU manual. Buying copies from the FSF
+supports it in developing GNU and promoting software freedom.''
+@end quotation
+@end copying
+
+@dircategory MathGL documentation system
+@direntry
+* MathGL: (mathgl). The library for scientific graphics.
+@end direntry
+
+@titlepage
+@title MathGL
+@subtitle версия @value{VERSION}
+@author А.А. Балакин (@uref{http://mathgl.sourceforge.net/})
+@page
+@vskip 0pt plus 1filll
+@insertcopying
+@end titlepage
+
+@contents
+
+@ifnottex
+@node Top
+@top MathGL
+
+Это документация для MathGL (версии @value{VERSION}) -- библиотеки классов и функций для построения научной графики. Пожалуйста сообщайте о любых ошибках в этом руководстве на @email{mathgl.abalakin@@gmail.org}. Дополнительную информацию о MathGL можно найти на домашней странице проекта @uref{http://mathgl.sourceforge.net/}.
+
+Copyright @copyright{} 2009 Алексей Балакин.
+
+@quotation
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU Free Documentation License, Version 1.2 or
+any later version published by the Free Software Foundation; with no
+Invariant Sections, with the Front-Cover Texts being ``A GNU Manual,''
+and with the Back-Cover Texts as in (a) below. A copy of the
+license is included in the section entitled ``GNU Free Documentation
+License.''
+
+(a) The FSF's Back-Cover Text is: ``You have the freedom to
+copy and modify this GNU manual. Buying copies from the FSF
+supports it in developing GNU and promoting software freedom.''
+@end quotation
+
+@end ifnottex
+
+@menu
+* Overview::
+* Examples::
+* General concepts::
+* MathGL core::
+* Widget classes::
+* Data processing::
+* MGL scripts::
+* Other classes::
+* TeX-like symbols::
+* Copying This Manual::
+* Index::
+@end menu
+
+@ifhtml
+@macro fig {fname,text}
+@center @image{../\fname\, 11cm, , \text\, .png}
+@end macro
+@end ifhtml
+
+@ifnothtml
+@iftex
+@macro fig {fname,text}
+@center @image{\fname\, 11cm, , \text\, .png}
+@end macro
+@end iftex
+
+@ifnottex
+@macro fig {fname,text}
+@c @center @image{\fname\, 11cm, , \text\, .png}
+@end macro
+@end ifnottex
+@end ifnothtml
+
+
+@rmacro sref {arg}
+См. раздел @ref{\arg\}, для примеров кода и графика.
+@end rmacro
+@macro tdref {nam}
+@uref{http://mathgl.sourceforge.net/pdf_u3d/\nam\.pdf, 3D pdf}
+@end macro
+
+
+@node Overview, Examples, , Top
+@include overview_ru.texi
+
+@node Examples, General concepts, Overview, Top
+@include example_ru.texi
+
+@node General concepts, MathGL core, Examples, Top
+@include concept_ru.texi
+
+@node MathGL core, Widget classes, General concepts, Top
+@include core_ru.texi
+
+@node Widget classes, Data processing, MathGL core, Top
+@include widget_ru.texi
+
+@node Data processing, MGL scripts, Widget classes, Top
+@include data_ru.texi
+
+@node MGL scripts, Other classes, Data processing, Top
+@include parse_ru.texi
+
+@node Other classes, TeX-like symbols, MGL scripts, Top
+@include other_ru.texi
+
+@node TeX-like symbols, Copying This Manual, Other classes, Top
+@appendix Символы TeX
+@include appendix_ru.texi
+
+@node Copying This Manual, Index, TeX-like symbols, Top
+@appendix GNU Free Documentation License
+@include fdl.texi
+
+@node Index, , Copying This Manual, Top
+@unnumbered Индекс
+
+@printindex cp
+
+@bye
Note, that MathGL v.2.* have only 2 end-user interfaces: one for C/Fortran and similar languages which don't support classes, another one for C++/Python/Octave and similar languages which support classes. So, most of samples placed in this chapter can be run as is (after minor changes due to different syntaxes for different languages). For example, the C++ code
@verbatim
-#include <mgl/mgl.h>
+#include <mgl2/mgl.h>
int main()
{
mglGraph gr;
@end verbatim
in C will be as
@verbatim
-#include <mgl/mgl_cf.h>
+#include <mgl2/mgl_cf.h>
int main()
{
HMGL gr = mgl_create_graph(600,400);
The ``interactive'' way of drawing in MathGL consists in window creation with help of class @code{mglWindow} or @code{mglGLUT} (see @ref{Widget classes}) and the following drawing in this window. There is a corresponding code:
@verbatim
-#include <mgl/window.h>
+#include <mgl2/window.h>
int sample(mglGraph *gr)
{
gr->Rotate(60,40);
Alternatively you can create yours own class inherited from class @code{mglDraw} and re-implement the function @code{Draw()} in it:
@verbatim
-#include <mgl/window.h>
+#include <mgl2/window.h>
class Foo : public mglDraw
{
public:
@end verbatim
Or use pure C-functions:
@verbatim
-#include <mgl/mgl_cf.h>
+#include <mgl2/mgl_cf.h>
int sample(HMGL gr, void *)
{
mgl_rotate(gr,60,40,0);
The similar code can be written for @code{mglGLUT} window (function @code{sample()} is the same):
@verbatim
-#include <mgl/glut.h>
+#include <mgl2/glut.h>
int main(int argc,char **argv)
{
mglGLUT gr(sample,"MathGL examples");
The following code produces a bitmap PNG picture:
@verbatim
-#include <mgl/mgl.h>
+#include <mgl2/mgl.h>
int main(int ,char **)
{
mglGraph gr;
The code for export into other formats (for example, into vector EPS file) looks the same:
@verbatim
-#include <mgl/mgl.h>
+#include <mgl2/mgl.h>
int main(int ,char **)
{
mglGraph gr;
Note, that such kind of animation is rather slow and not well suitable for visualization of running calculations. For the last case one can use @code{Update()} function. The most simple case for doing this is to use @code{mglDraw} class and reimplement its @code{Calc()} method.
@verbatim
-#include <mgl/window.h>
+#include <mgl2/window.h>
class Foo : public mglDraw
{
mglPoint pnt; // some result of calculation
@anchor{GIF}
The simplest methods is making animated GIF. There are 3 steps: (1) open GIF file by @code{StartGIF()} function; (2) create the frames by calling @code{NewFrame()} before and @code{EndFrame()} after plotting; (3) close GIF by @code{CloseGIF()} function. So the simplest code for ``running'' sinusoid will look like this:
@verbatim
-#include <mgl/mgl.h>
+#include <mgl2/mgl.h>
int main(int ,char **)
{
mglGraph gr;
@anchor{MPEG}
The second way is saving each frame in separate file (usually JPEG) and later make the movie from them. MathGL have special function for saving frames -- it is @code{WriteFrame()}. This function save each frame with automatic name @samp{frame0001.jpg, frame0002.jpg} and so on. Here prefix @samp{frame} is defined by @var{PlotId} variable of @code{mglGraph} class. So the similar code will look like this:
@verbatim
-#include <mgl/mgl.h>
+#include <mgl2/mgl.h>
int main(int ,char **)
{
mglGraph gr;
#include <QApplication>
#include <QMainWindow>
#include <QScrollArea>
-#include <mgl/qt.h>
+#include <mgl2/qt.h>
int main(int argc,char **argv)
{
QApplication a(argc,argv);
There are 3 general ways. First, the point with @code{NAN} value as one of the coordinates will never be plotted. Second, special variables @var{CutMin}, @var{CutMax} or function @code{CutOff}() define the condition when the points should be omitted (see @ref{Cutting}). Last, you may change the transparency of a part of the plot by the help of functions @code{SurfA()}, @code{Surf3A()} (see @ref{Dual plotting}). In this last case the transparency is switched on smoothly.
@item I use VisualStudio, CBuilder or some other compiler (not MinGW/gcc). How can I link the MathGL library?
-In version 2.0, the recommended class @code{mglGraph} (header file @code{#include <mgl/mgl.h>}) contains only @code{inline} functions and is acceptable for any compiler with the same binary files. However, if you plan to access low-level features (i.e. classes mglBase, mglCanvas and so on) then you have to recompile MathGL by yours compiler.
+In version 2.0, the recommended class @code{mglGraph} (header file @code{#include <mgl2/mgl.h>}) contains only @code{inline} functions and is acceptable for any compiler with the same binary files. However, if you plan to access low-level features (i.e. classes mglBase, mglCanvas and so on) then you have to recompile MathGL by yours compiler.
@c @strong{Finally!} Please @emph{do not} ask me Windows-specific questions. I do not use Windows. I know nothing about Visual Basic, Visual C++, CBuiled or .NET. Please find the appropriate Usenet discussion group and ask your question there.
Note, that MathGL v.2.* have only 2 end-user interfaces: one for C/Fortran and similar languages which don't support classes, another one for C++/Python/Octave and similar languages which support classes. So, most of samples placed in this chapter can be run as is (after minor changes due to different syntaxes for different languages). For example, the C++ code
@verbatim
-#include <mgl/mgl.h>
+#include <mgl2/mgl.h>
int main()
{
mglGraph gr;
@end verbatim
in C will be as
@verbatim
-#include <mgl/mgl_cf.h>
+#include <mgl2/mgl_cf.h>
int main()
{
HMGL gr = mgl_create_graph(600,400);
The ``interactive'' way of drawing in MathGL consists in window creation with help of class @code{mglWindow} or @code{mglGLUT} (see @ref{Widget classes}) and the following drawing in this window. There is a corresponding code:
@verbatim
-#include <mgl/window.h>
+#include <mgl2/window.h>
int sample(mglGraph *gr)
{
gr->Rotate(60,40);
Alternatively you can create yours own class inherited from class @code{mglDraw} and re-implement the function @code{Draw()} in it:
@verbatim
-#include <mgl/window.h>
+#include <mgl2/window.h>
class Foo : public mglDraw
{
public:
@end verbatim
Or use pure C-functions:
@verbatim
-#include <mgl/mgl_cf.h>
+#include <mgl2/mgl_cf.h>
int sample(HMGL gr)
{
mgl_rotate(gr,60,40,0);
The similar code can be written for @code{mglGLUT} window (function @code{sample()} is the same):
@verbatim
-#include <mgl/glut.h>
+#include <mgl2/glut.h>
int main(int argc,char **argv)
{
mglGLUT gr(sample,"MathGL examples");
The following code produces a bitmap PNG picture:
@verbatim
-#include <mgl/mgl.h>
+#include <mgl2/mgl.h>
int main(int ,char **)
{
mglGraph gr;
The code for export in vector EPS file looks the same:
@verbatim
-#include <mgl/mgl.h>
+#include <mgl2/mgl.h>
int main(int ,char **)
{
mglGraph gr;
Note, that such kind of animation is rather slow and not well suitable for visualization of running calculations. For the last case one can use @code{Update()} function. The most simple case for doing this is to use @code{mglDraw} class and reimplement its @code{Calc()} method.
@verbatim
-#include <mgl/window.h>
+#include <mgl2/window.h>
class Foo : public mglDraw
{
mglPoint pnt; // some result of calculation
The simplest methods is making animated GIF. There are 3 steps: (1) open GIF file by @code{StartGIF()} function; (2) create the frames by calling @code{NewFrame()} before and @code{EndFrame()} after plotting; (3) close GIF by @code{CloseGIF()} function. So the simplest code for ``running'' sinusoid will look like this:
@verbatim
-#include <mgl/mgl.h>
+#include <mgl2/mgl.h>
int main(int ,char **)
{
mglGraph gr;
The second way is saving each frame in separate file (usually JPEG) and later make the movie from them. MathGL have special function for saving frames -- it is @code{WriteFrame()}. This function save each frame with automatic name @samp{frame0001.jpg, frame0002.jpg} and so on. Here prefix @samp{frame} is defined by @var{PlotId} variable of @code{mglGraph} class. So the similar code will look like this:
@verbatim
-#include <mgl/mgl.h>
+#include <mgl2/mgl.h>
int main(int ,char **)
{
mglGraph gr;
#include <QApplication>
#include <QMainWindow>
#include <QScrollArea>
-#include <mgl/qt.h>
+#include <mgl2/qt.h>
int main(int argc,char **argv)
{
QApplication a(argc,argv);
There are 3 general ways. First, the point with @code{NAN} value as one of the coordinates will never be plotted. Second, special variables @var{CutMin}, @var{CutMax} or function @code{CutOff}() define the condition when the points should be omitted (see @ref{Cutting}). Last, you may change the transparency of a part of the plot by the help of functions @code{SurfA()}, @code{Surf3A()} (see @ref{Dual plotting}). In this last case the transparency is switched on smoothly.
@item I use VisualStudio, CBuilder or some other compiler (not MinGW/gcc). How can I link the MathGL library?
-In version 2.0, the recommended class @code{mglGraph} (header file @code{#include <mgl/mgl.h>}) contains only @code{inline} functions and is acceptable for any compiler with the same binary files. However, if you plan to access low-level features (i.e. classes mglBase, mglCanvas and so on) then you have to recompile MathGL by yours compiler.
+In version 2.0, the recommended class @code{mglGraph} (header file @code{#include <mgl2/mgl.h>}) contains only @code{inline} functions and is acceptable for any compiler with the same binary files. However, if you plan to access low-level features (i.e. classes mglBase, mglCanvas and so on) then you have to recompile MathGL by yours compiler.
@c @strong{Finally!} Please @emph{do not} ask me Windows-specific questions. I do not use Windows. I know nothing about Visual Basic, Visual C++, CBuiled or .NET. Please find the appropriate Usenet discussion group and ask your question there.
@uref{http://mathgl.sourceforge.net/pdf_u3d/\nam\.pdf, 3D pdf}
@end macro
+@macro reklama
+@end macro
+
@node Overview, Examples, , Top
@include overview_en.texi
@end macro
@set UDAV
+@macro reklama
+@end macro
+
@c @node Overview, Examples, , Top
@c @include overview_en.texi
MathGL tries to remember all vertexes and all primitives and plot creation stage, and to use them for making final picture by demand. Basically for making plot, you need to add vertexes by @code{AddPnt()} function, which return index for new vertex, and call one of primitive drawing function (like @code{mark_plot(), arrow_plot(), line_plot(), trig_plot(), quad_plot(), text_plot()}), using vertex indexes as argument(s). @code{AddPnt()} function use 2 float numbers for color specification. First one is positioning in textures -- integer part is texture index, fractional part is relative coordinate in the texture. Second number is like a transparency of plot (or second coordinate in the 2D texture).
-I don't want to put here detailed description of @code{mglBase} class. It was rather well documented in @code{mgl/base.h} file. I just show and example of its usage on the base of circle drawing.
+I don't want to put here detailed description of @code{mglBase} class. It was rather well documented in @code{mgl2/base.h} file. I just show and example of its usage on the base of circle drawing.
First, we should prototype new function @code{circle()} as C function.
@verbatim
So, the complete sample will be
@verbatim
-#include <mgl/mgl.h>
+#include <mgl2/mgl.h>
//---------------------------------------------------------
#ifdef __cplusplus
extern "C" {
Let me, for example define class @code{mglComplex} which will handle complex number and draw its amplitude or phase, depending on flag @var{use_abs}:
@verbatim
#include <complex>
-#include <mgl/mgl.h>
+#include <mgl2/mgl.h>
#define dual std::complex<double>
class mglComplex : public mglDataA
{
long nx; ///< number of points in 1st dimensions ('x' dimension)
long ny; ///< number of points in 2nd dimensions ('y' dimension)
long nz; ///< number of points in 3d dimensions ('z' dimension)
- dual *a; ///< data array
+ dual *a; ///< data array
bool use_abs; ///< flag to use abs() or arg()
inline mglComplex(long xx=1,long yy=1,long zz=1)
@section mglColor class
@cindex mglColor
-Structure for working with colors. This structure is defined in @code{#include <mgl/type.h>}.
+Structure for working with colors. This structure is defined in @code{#include <mgl2/type.h>}.
There are two ways to set the color in MathGL. First one is using of float values of red, green and blue channels for precise color definition. The second way is the using of character id. There are a set of characters specifying frequently used colors. Normally capital letter gives more dark color than lowercase one. @xref{Line styles}.
@section mglPoint class
@cindex mglPoint
-Structure describes point in space. This structure is defined in @code{#include <mgl/type.h>}
+Structure describes point in space. This structure is defined in @code{#include <mgl2/type.h>}
@deftypecv {Parameter} mglPoint @code{float} {x, y, z, c}
Point coordinates @{x,y,z@} and one extra value @var{c} used for amplitude, transparency and so on. By default all values are zero.
@section mglFont class
@cindex mglFont
-Class for working with font: load, get metrics, parse and draw strings. This class is defined in @code{#include <mgl/font.h>}. This class is accessible only from C++ (and only from GNU compilers in default binary files).
+Class for working with font: load, get metrics, parse and draw strings. This class is defined in @code{#include <mgl2/font.h>}. This class is accessible only from C++ (and only from GNU compilers in default binary files).
The class is based on loading and drawing of vector Hershey font. There are two styles of specifying of the font type and aligning: by integer parameters or by string.
MathGL tries to remember all vertexes and all primitives and plot creation stage, and to use them for making final picture by demand. Basically for making plot, you need to add vertexes by @code{AddPnt()} function, which return index for new vertex, and call one of primitive drawing function (like @code{mark_plot(), arrow_plot(), line_plot(), trig_plot(), quad_plot(), text_plot()}), using vertex indexes as argument(s). @code{AddPnt()} function use 2 float numbers for color specification. First one is positioning in textures -- integer part is texture index, fractional part is relative coordinate in the texture. Second number is like a transparency of plot (or second coordinate in the 2D texture).
-I don't want to put here detailed description of @code{mglBase} class. It was rather well documented in @code{mgl/base.h} file. I just show and example of its usage on the base of circle drawing.
+I don't want to put here detailed description of @code{mglBase} class. It was rather well documented in @code{mgl2/base.h} file. I just show and example of its usage on the base of circle drawing.
First, we should prototype new function @code{circle()} as C function.
@verbatim
So, the complete sample will be
@verbatim
-#include <mgl/mgl.h>
+#include <mgl2/mgl.h>
//---------------------------------------------------------
#ifdef __cplusplus
extern "C" {
Let me, for example define class @code{mglComplex} which will handle complex number and draw its amplitude or phase, depending on flag @var{use_abs}:
@verbatim
#include <complex>
-#include <mgl/mgl.h>
+#include <mgl2/mgl.h>
#define dual std::complex<double>
class mglComplex : public mglDataA
{
@section mglColor class
@cindex mglColor
-Structure for working with colors. This structure is defined in @code{#include <mgl/type.h>}.
+Structure for working with colors. This structure is defined in @code{#include <mgl2/type.h>}.
There are two ways to set the color in MathGL. First one is using of float values of red, green and blue channels for precise color definition. The second way is the using of character id. There are a set of characters specifying frequently used colors. Normally capital letter gives more dark color than lowercase one. @xref{Line styles}.
@section mglPoint class
@cindex mglPoint
-Structure describes point in space. This structure is defined in @code{#include <mgl/type.h>}
+Structure describes point in space. This structure is defined in @code{#include <mgl2/type.h>}
@deftypecv {Parameter} mglPoint @code{float} {x, y, z, c}
Point coordinates @{x,y,z@} and one extra value @var{c} used for amplitude, transparency and so on. By default all values are zero.
@section mglFont class
@cindex mglFont
-Class for working with font: load, get metrics, parse and draw strings. This class is defined in @code{#include <mgl/font.h>}. This class is accessible only from C++ (and only from GNU compilers in default binary files).
+Class for working with font: load, get metrics, parse and draw strings. This class is defined in @code{#include <mgl2/font.h>}. This class is accessible only from C++ (and only from GNU compilers in default binary files).
The class is based on loading and drawing of vector Hershey font. There are two styles of specifying of the font type and aligning: by integer parameters or by string.
MathGL can be installed in 4 different ways.
@enumerate
@item
-Compile from sources. The standard script for autoconf/automake tool is included in the library. To run it, one should execute 3 commands: @code{./configure} after it @code{make} and @code{make install} with root/sudo rights. Sometimes after installation you may need to update the library list -- just execute @code{ldconfig} with root/sudo rights. Note, that if you try SVN version then you should run @code{./bootstrap} before configure.
+Compile from sources. The standard script cmake build system is useded in the library. To run it, one should execute commands: @code{cmake .} twice, after it @code{make} and @code{make install} with root/sudo rights. Sometimes after installation you may need to update the library list -- just execute @code{ldconfig} with root/sudo rights.
-Script @code{./configure} have several additional options which are switched off by default. They are: @code{--enable-fltk, --enable-glut, --enable-qt} for ebabling FLTK, GLUT and/or Qt windows; @code{--enable-jpeg, --enable-gif, --enable-hdf5} for enabling corresponding file formats; @code{--enable-all} for enabling all additional features. For using @code{double} as base internal data type use option @code{--enable-double}. For enabling language interfaces use @code{--enable-python, --enable-octave} or @code{--enable-langall} for all languages. The full list of options can be viewed by command @code{./configure --help}.
-
-@item
-One can use also CMake (@uref{http://www.cmake.org/}) for building MathGL library if autoconf/automake tools are absent. For example, it is the typical situation for Windows, MacOS and/or using of non-GNU compilers. You can use WYSIWYG tools to change CMake build options. Just specify the features you need and resolve all possible conflicts -- specify the paths for header files or libraries if they are not found automatically. After it run @code{make} and @code{make install} with root/sudo rights.
+There are several additional options which are switched off by default. They are: @code{enable-fltk, enable-glut, enable-qt} for ebabling FLTK, GLUT and/or Qt windows; @code{enable-jpeg, enable-gif, enable-hdf5} and so on for enabling corresponding file formats; @code{enable-all} for enabling all additional features. For using @code{double} as base internal data type use option @code{enable-double}. For enabling language interfaces use @code{enable-python, enable-octave} or @code{enable-langall} for all languages. You can use WYSIWYG tool (@code{cmake-gui}) to view all of them, or type @code{cmake -D enable-all=on -D enable-langall=on .} in command line for enabling all features.
@item
Use a precompiled binary. There are binaries for MinGW (platform Win32). For a precompiled variant one needs only to unpack the archive to the location of the compiler (or in any other folder and setup paths). By default, precompiled versions include the support of GSL (www.gsl.org) and PNG. So, one needs to have these libraries installed on system (it can be found, for example, at @uref{http://gnuwin32.sourceforge.net/packages.html}).
Есть три основных способа. Во-первых, можно вырезать точку, задав одну из ее координат равной @code{NAN}. Во-вторых, можно воспользоваться функцией @code{SetCutBox()} или @code{CutOff()} для удаления точек из некоторой области (@pxref{Cutting}). Наконец, можно сделать эти точки прозрачными (невидимыми) с помощью функций @code{SurfA()}, @code{Surf3A()} (@pxref{Dual plotting}). В последнем случае обеспечивается еще и плавность включения прозрачности.
@item Я использую VisualStudio, CBuilder или другой компилятор (не MinGW/gcc). Как мне подключить библиотеку MathGL?
-Начиная с версии 2.0, рекомендуемый к использованию класс mglGraph (заголовочный файл @code{#include <mgl/mgl.h>}) содержbn только с @code{inline} функции и может использоваться с любым компилятором без перекомпиляции бинарной версии библиотеки. Однако, если Вы планируете использовать низкоуровневые возможности (т.е. классы mglBase, mglCanvas и т.д.), то Вам следует перекомпилировать библиотеку MathGL с использованием Вашего компилятора.
+Начиная с версии 2.0, рекомендуемый к использованию класс mglGraph (заголовочный файл @code{#include <mgl2/mgl.h>}) содержbn только с @code{inline} функции и может использоваться с любым компилятором без перекомпиляции бинарной версии библиотеки. Однако, если Вы планируете использовать низкоуровневые возможности (т.е. классы mglBase, mglCanvas и т.д.), то Вам следует перекомпилировать библиотеку MathGL с использованием Вашего компилятора.
@item Как мне собрать MathGL под Windows?
Простейший путь -- использование комбинации CMake и MinGW. Также Вам может потребоваться дополнительные библиотеки, такие как GSL, PNG, JPEG и пр. Все они могут быть найдены на @url{http://gnuwin32.sourceforge.net/packages.html}. После установки всех компонент, просто запустите конфигуратор CMake и соберите MathGL командой make.
Следует создать отдельный поток для обработки сообщений в окно. Кросс-платформенный путь -- использование библиотеки @code{pthread}. Обновление данных в окне можно выполнить вызовом функции @code{mglGraphFLTK::Update()}. Пример код имеет вид:
@verbatim
//-----------------------------------------------------------------------------
-#include <mgl/window.h>
+#include <mgl2/window.h>
#include <pthread.h>
mglPoint pnt; // some global variable for changable data
В случае если требуется вывести статичную картинку с текущими результатами расчетов, то достаточно передать @code{NULL} вместо функции рисования и вызывать @code{Update()} по мере необходимости для обновления графика. Такой способ подходит и для пользователей фортрана.
@verbatim
//-----------------------------------------------------------------------------
-#include <mgl/window.h>
+#include <mgl2/window.h>
//-----------------------------------------------------------------------------
int sample(mglGraph *gr)
{
C интерфейс является базовым для большинства других интерфейсов. Он содержит функции на чистом C для большинства методов классов MathGL. В отличие от членов-функций C++ классов, C функции в качестве аргументов должны явно иметь переменные типа HMGL (для графики) и/или HMDT (для массивов данных) для указания объекта рисования или данных. Таким образом, первым вызовом пользователя должно быть создание этих объектов с помощью функций @code{mgl_create_*()}, а последним -- их удаление с помощью функций @code{mgl_delete_*()}.
-Все функции описанны в заголовочном файле @code{#include <mgl/mgl_c.h>} и используют переменные для идентификаторов объектов рисования/данных следующих типов:
+Все функции описанны в заголовочном файле @code{#include <mgl2/mgl_c.h>} и используют переменные для идентификаторов объектов рисования/данных следующих типов:
@itemize
@item
@code{HMGL} --- Указатель на класс @code{mglGraph} (@pxref{MathGL core}).
@section mglParse class
@cindex mglParse
-Class for parsing and executing MGL script. This class is defined in @code{#include <mgl/mgl.h>}.
+Class for parsing and executing MGL script. This class is defined in @code{#include <mgl2/mgl.h>}.
Class mglParse is the interpreter for MGL scripts. The main function of mglParse class is @code{Execute()}. Exactly this function parses and executes the script string-by-string. Also there are subservient functions for the finding and creation of a variable. These functions can be useful for displaying values of variables (arrays) in some external program (in window, for example). Function @code{AllowSetSize()} allows one to prevent changing the size of the picture inside the script (forbids the MGL command @code{setsize}).
@section mglParse class
@cindex mglParse
-Class for parsing and executing MGL script. This class is defined in @code{#include <mgl/mgl.h>}.
+Class for parsing and executing MGL script. This class is defined in @code{#include <mgl2/mgl.h>}.
Class mglParse is the interpreter for MGL scripts. The main function of mglParse class is @code{Execute()}. Exactly this function parses and executes the script string-by-string. Also there are subservient functions for the finding and creation of a variable. These functions can be useful for displaying values of variables (arrays) in some external program (in window, for example). Function @code{AllowSetSize()} allows one to prevent changing the size of the picture inside the script (forbids the MGL command @code{setsize}).
<a target="main" href="web_en/web_en_4.html"><b>Pictures</b></a></p>
<a target="main" href="web_en/web_en_5.html"><b>MGL scripts</b></a></p>
<a target="main" href="web_en/web_en_6.html"><b>Download</b></a></p>
-<a target="main" href="mathgl_en/mathgl_en.html"><b>Documentation</b></a></p>
+<a target="main" href="mgl_web_en/mathgl_en.html"><b>Documentation</b></a></p>
<a target="main" href="web_en/web_en_8.html"><b>Other projects</b></a></p>
<hr style="width: 100%; height: 1px;">
a library with large and growing set of graphics.
@end itemize
-At this version (1.11) MathGL has more than 35000 lines of code, more than 55 general types of graphics for 1d, 2d and 3d data arrays, including special ones for chemical and statistical graphics. It can export graphics to raster and vector (EPS or SVG) formats. It has Qt, FLTK, OpenGL interfaces and can be used even from console programs. It has functions for data processing and script MGL language for simplification of data plotting. Also it has several types of transparency and smoothed lightning, vector fonts and TeX-like symbol parsing, arbitrary curvilinear coordinate system and many over useful things. It can be used from code written on C++/C/Fortran/Python/Octave and many other languages. Finally it is platform independent and free (under GPL v.2.0 license).
+Now MathGL has more than 35000 lines of code, more than 55 general types of graphics for 1d, 2d and 3d data arrays, including special ones for chemical and statistical graphics. It can export graphics to raster and vector (EPS or SVG) formats. It has Qt, FLTK, OpenGL interfaces and can be used even from console programs. It has functions for data processing and script MGL language for simplification of data plotting. Also it has several types of transparency and smoothed lightning, vector fonts and TeX-like symbol parsing, arbitrary curvilinear coordinate system and many over useful things. It can be used from code written on C++/C/Fortran/Python/Octave and many other languages. Finally it is platform independent and free (under GPL v.2.0 license).
There is a @uref{http://sourceforge.net/forum/?group_id=152187, forum} where you can ask a question or suggest an improvement. However the @uref{http://groups.google.com/group/mathgl, MathGL group} is preferable for quicker answer.
@strong{Latest news}
@itemize
-@item @emph{29 March 2012.}
+@item @emph{12 April 2012.}
New version (v.2.0) of @uref{http://sourceforge.net/projects/mathgl, MathGL} is released. There are a lot of new features, which partially denoted @ref{News, here}.
@end itemize
@itemize
@item
-@strong{29 March 2012.}
+@strong{12 April 2012.}
New version (v.2.0) of @uref{http://sourceforge.net/projects/mathgl, MathGL} is released. There are a lot of new features, which partially denoted below.
@itemize @bullet
@item
@anchor{1D plotting}
@subsection Examples of graphics for 1d arrays
-@fig{plot, mathgl_en/mathgl_en_13.html#Plot-sample}
-@fig{radar, mathgl_en/mathgl_en_13.html#Radar-sample}
-@fig{step, mathgl_en/mathgl_en_13.html#Step-sample}
-@fig{tens, mathgl_en/mathgl_en_13.html#Tens-sample}
+@fig{plot, doc_en/mathgl_en_32.html#Plot-sample}
+@fig{radar, doc_en/mathgl_en_33.html#Radar-sample}
+@fig{step, doc_en/mathgl_en_34.html#Step-sample}
+@fig{tens, doc_en/mathgl_en_35.html#Tens-sample}
-@fig{area, mathgl_en/mathgl_en_13.html#Area-sample}
-@fig{region, mathgl_en/mathgl_en_13.html#Region-sample}
-@fig{stem, mathgl_en/mathgl_en_13.html#Stem-sample}
-@fig{torus, mathgl_en/mathgl_en_13.html#Torus-sample}
+@fig{area, doc_en/mathgl_en_36.html#Area-sample}
+@fig{region, doc_en/mathgl_en_37.html#Region-sample}
+@fig{stem, doc_en/mathgl_en_38.html#Stem-sample}
+@fig{torus, doc_en/mathgl_en_51.html#Torus-sample}
-@fig{bars, mathgl_en/mathgl_en_13.html#Bars-sample}
-@fig{barh, mathgl_en/mathgl_en_13.html#Barh-sample}
-@fig{cones, mathgl_en/mathgl_en_13.html#Cones-sample}
-@fig{chart, mathgl_en/mathgl_en_13.html#Chart-sample}
+@fig{bars, doc_en/mathgl_en_39.html#Bars-sample}
+@fig{barh, doc_en/mathgl_en_40.html#Barh-sample}
+@fig{cones, doc_en/mathgl_en_41.html#Cones-sample}
+@fig{chart, doc_en/mathgl_en_42.html#Chart-sample}
-@fig{boxplot, mathgl_en/mathgl_en_13.html#BoxPlot-sample}
-@fig{candle, mathgl_en/mathgl_en_13.html#Candle-sample}
-@fig{tube, mathgl_en/mathgl_en_13.html#Tube-sample}
-@fig{tape, mathgl_en/mathgl_en_13.html#Tape-sample}
+@fig{boxplot, doc_en/mathgl_en_43.html#BoxPlot-sample}
+@fig{candle, doc_en/mathgl_en_44.html#Candle-sample}
+@fig{tube, doc_en/mathgl_en_49.html#Tube-sample}
+@fig{tape, doc_en/mathgl_en_50.html#Tape-sample}
-@fig{error, mathgl_en/mathgl_en_13.html#Error-sample}
-@fig{mark, mathgl_en/mathgl_en_13.html#Mark-sample}
-@fig{textmark, mathgl_en/mathgl_en_13.html#TextMark-sample}
-@fig{label, mathgl_en/mathgl_en_13.html#Label-sample}
+@fig{error, doc_en/mathgl_en_45.html#Error-sample}
+@fig{mark, doc_en/mathgl_en_46.html#Mark-sample}
+@fig{textmark, doc_en/mathgl_en_47.html#TextMark-sample}
+@fig{label, doc_en/mathgl_en_48.html#Label-sample}
@anchor{2D plotting}
@subsection Examples of graphics for 2d arrays
-@fig{surf, mathgl_en/mathgl_en_14.html#Surf-sample}
-@fig{surfc, mathgl_en/mathgl_en_14.html#SurfC-sample}
-@fig{surfa, mathgl_en/mathgl_en_14.html#SurfA-sample}
-@fig{mesh, mathgl_en/mathgl_en_14.html#Mesh-sample}
+@fig{surf, doc_en/mathgl_en_53.html#Surf-sample}
+@fig{surfc, doc_en/mathgl_en_54.html#SurfC-sample}
+@fig{surfa, doc_en/mathgl_en_55.html#SurfA-sample}
+@fig{mesh, doc_en/mathgl_en_56.html#Mesh-sample}
-@fig{fall, mathgl_en/mathgl_en_14.html#Fall-sample}
-@fig{belt, mathgl_en/mathgl_en_14.html#Belt-sample}
-@fig{boxs, mathgl_en/mathgl_en_14.html#Boxs-sample}
-@fig{axial, mathgl_en/mathgl_en_14.html#Axial-sample}
+@fig{fall, doc_en/mathgl_en_57.html#Fall-sample}
+@fig{belt, doc_en/mathgl_en_58.html#Belt-sample}
+@fig{boxs, doc_en/mathgl_en_59.html#Boxs-sample}
+@fig{axial, doc_en/mathgl_en_67.html#Axial-sample}
-@fig{dens, mathgl_en/mathgl_en_14.html#Dens-sample}
-@fig{tile, mathgl_en/mathgl_en_14.html#Tile-sample}
-@fig{tiles, mathgl_en/mathgl_en_14.html#TileS-sample}
-@fig{grad, mathgl_en/mathgl_en_14.html#Grad-sample}
+@fig{dens, doc_en/mathgl_en_62.html#Dens-sample}
+@fig{tile, doc_en/mathgl_en_60.html#Tile-sample}
+@fig{tiles, doc_en/mathgl_en_61.html#TileS-sample}
+@fig{grad, doc_en/mathgl_en_68.html#Grad-sample}
-@fig{cont, mathgl_en/mathgl_en_14.html#Cont-sample}
-@fig{contf, mathgl_en/mathgl_en_14.html#ContF-sample}
-@fig{contd, mathgl_en/mathgl_en_14.html#ContD-sample}
-@fig{contv, mathgl_en/mathgl_en_14.html#ContV-sample}
+@fig{cont, doc_en/mathgl_en_63.html#Cont-sample}
+@fig{contf, doc_en/mathgl_en_64.html#ContF-sample}
+@fig{contd, doc_en/mathgl_en_65.html#ContD-sample}
+@fig{contv, doc_en/mathgl_en_66.html#ContV-sample}
@anchor{3D plotting}
@subsection Examples of graphics for 3d arrays
-@fig{surf3, mathgl_en/mathgl_en_15.html#Surf3-sample}
-@fig{surf3c, mathgl_en/mathgl_en_15.html#Surf3C-sample}
-@fig{surf3a, mathgl_en/mathgl_en_15.html#Surf3A-sample}
-@fig{cloud, mathgl_en/mathgl_en_15.html#Cloud-sample}
+@fig{surf3, doc_en/mathgl_en_70.html#Surf3-sample}
+@fig{surf3c, doc_en/mathgl_en_71.html#Surf3C-sample}
+@fig{surf3a, doc_en/mathgl_en_72.html#Surf3A-sample}
+@fig{cloud, doc_en/mathgl_en_73.html#Cloud-sample}
-@fig{densa, mathgl_en/mathgl_en_15.html#Dens3-sample}
-@fig{conta, mathgl_en/mathgl_en_15.html#Cont3-sample}
-@fig{contfa, mathgl_en/mathgl_en_15.html#ContF3-sample}
-@fig{dots, mathgl_en/mathgl_en_15.html#Dots-sample}
+@fig{densa, doc_en/mathgl_en_74.html#Dens3-sample}
+@fig{conta, doc_en/mathgl_en_75.html#Cont3-sample}
+@fig{contfa, doc_en/mathgl_en_76.html#ContF3-sample}
+@fig{dots, doc_en/mathgl_en_81.html#Dots-sample}
-@fig{dens_xyz, mathgl_en/mathgl_en_15.html#Dens-projection-sample}
-@fig{cont_xyz, mathgl_en/mathgl_en_15.html#Cont-projection-sample}
-@fig{contf_xyz, mathgl_en/mathgl_en_15.html#ContF-projection-sample}
-@fig{triplot, mathgl_en/mathgl_en_15.html#TriPlot-and-QuadPlot}
+@fig{dens_xyz, doc_en/mathgl_en_77.html#Dens-projection-sample}
+@fig{cont_xyz, doc_en/mathgl_en_78.html#Cont-projection-sample}
+@fig{contf_xyz, doc_en/mathgl_en_79.html#ContF-projection-sample}
+@fig{triplot, doc_en/mathgl_en_80.html#TriPlot-and-QuadPlot}
@anchor{Vector fields}
@subsection Examples of graphics for vector fields
-@fig{vect, mathgl_en/mathgl_en_16.html#Vect-sample}
-@fig{traj, mathgl_en/mathgl_en_16.html#Tra-sjample}
-@fig{flow, mathgl_en/mathgl_en_16.html#Flow-sample}
-@fig{pipe, mathgl_en/mathgl_en_16.html#Pipe-sample}
+@fig{vect, doc_en/mathgl_en_83.html#Vect-sample}
+@fig{traj, doc_en/mathgl_en_84.html#Tra-sjample}
+@fig{flow, doc_en/mathgl_en_85.html#Flow-sample}
+@fig{pipe, doc_en/mathgl_en_86.html#Pipe-sample}
@anchor{Extra samples}
@subsection Examples of additional features
-@fig{inplot, mathgl_en/mathgl_en_10.html#Subplots}
-@fig{axis, mathgl_en/mathgl_en_10.html#Axis-and-ticks}
-@fig{ticks, mathgl_en/mathgl_en_10.html#Axis-and-ticks}
-@fig{loglog, mathgl_en/mathgl_en_10.html#Axis-and-ticks}
-
-@fig{curvcoor, mathgl_en/mathgl_en_10.html#Curvilinear-coordinates}
-@fig{colorbar, mathgl_en/mathgl_en_10.html#Colorbars}
-@fig{box, mathgl_en/mathgl_en_10.html#Bounding-box}
-@fig{ternary, mathgl_en/mathgl_en_10.html#Ternary-axis}
-
-@fig{text, mathgl_en/mathgl_en_10.html#Text-features}
-@fig{legend, mathgl_en/mathgl_en_10.html#Legend-sample}
-@fig{cut, mathgl_en/mathgl_en_10.html#Cutting-sample}
-@fig{alpha, mathgl_en/mathgl_en_17.html#Transparency-and-lighting}
-
-@fig{type0, mathgl_en/mathgl_en_17.html#Types-of-transparency}
-@fig{type1, mathgl_en/mathgl_en_17.html#Types-of-transparency}
-@fig{type2, mathgl_en/mathgl_en_17.html#Types-of-transparency}
-@fig{fog, mathgl_en/mathgl_en_17.html#Adding-fog}
-
-@fig{combined, mathgl_en/mathgl_en_17.html#g_t_0060_0060Compound_0027_0027-graphics}
-@fig{several_light, mathgl_en/mathgl_en_17.html#Several-light-sources}
-@fig{stereo, mathgl_en/mathgl_en_17.html#Stereo-image}
-@fig{primitives, mathgl_en/mathgl_en_17.html#Using-primitives}
-
-@fig{stfa, mathgl_en/mathgl_en_17.html#STFA-sample}
-@fig{dat_diff, mathgl_en/mathgl_en_11.html#Change-data}
-@fig{dat_extra, mathgl_en/mathgl_en_11.html#Change-data}
-@fig{map, mathgl_en/mathgl_en_17.html#Mapping-visualization}
-
-@fig{hist, mathgl_en/mathgl_en_17.html#Making-histogram}
-@fig{fit, mathgl_en/mathgl_en_17.html#Nonlinear-fitting-sample}
-@fig{pde, mathgl_en/mathgl_en_17.html#PDE-solving-hints}
-@fig{parser, mathgl_en/mathgl_en_17.html#MGL-parser-using}
+@fig{inplot, doc_en/mathgl_en_17.html#Subplots}
+@fig{axis, doc_en/mathgl_en_18.html#Axis-and-ticks}
+@fig{ticks, doc_en/mathgl_en_18.html#Axis-and-ticks}
+@fig{loglog, doc_en/mathgl_en_18.html#Axis-and-ticks}
+
+@fig{curvcoor, doc_en/mathgl_en_19.html#Curvilinear-coordinates}
+@fig{colorbar, doc_en/mathgl_en_20.html#Colorbars}
+@fig{box, doc_en/mathgl_en_21.html#Bounding-box}
+@fig{ternary, doc_en/mathgl_en_22.html#Ternary-axis}
+
+@fig{text, doc_en/mathgl_en_23.html#Text-features}
+@fig{legend, doc_en/mathgl_en_24.html#Legend-sample}
+@fig{cut, doc_en/mathgl_en_25.html#Cutting-sample}
+@fig{alpha, doc_en/mathgl_en_90.html#Transparency-and-lighting}
+
+@fig{type0, doc_en/mathgl_en_91.html#Types-of-transparency}
+@fig{type1, doc_en/mathgl_en_91.html#Types-of-transparency}
+@fig{type2, doc_en/mathgl_en_91.html#Types-of-transparency}
+@fig{fog, doc_en/mathgl_en_92.html#Adding-fog}
+
+@fig{combined, doc_en/mathgl_en_89.html#g_t_0060_0060Compound_0027_0027-graphics}
+@fig{several_light, doc_en/mathgl_en_93.html#Several-light-sources}
+@fig{stereo, doc_en/mathgl_en_102.html#Stereo-image}
+@fig{primitives, doc_en/mathgl_en_94.html#Using-primitives}
+
+@fig{stfa, doc_en/mathgl_en_95.html#STFA-sample}
+@fig{dat_diff, doc_en/mathgl_en_29.html#Change-data}
+@fig{dat_extra, doc_en/mathgl_en_29.html#Change-data}
+@fig{map, doc_en/mathgl_en_96.html#Mapping-visualization}
+
+@fig{hist, doc_en/mathgl_en_97.html#Making-histogram}
+@fig{fit, doc_en/mathgl_en_98.html#Nonlinear-fitting-sample}
+@fig{pde, doc_en/mathgl_en_99.html#PDE-solving-hints}
+@fig{parser, doc_en/mathgl_en_100.html#MGL-parser-using}
@external
Command may have several set of possible arguments (for example, @code{plot ydat} and @code{plot xdat ydat}). All command arguments for a selected set must be specified. However, some arguments can have default values. These argument are printed in [], like @code{text ydat ['stl'='']} or @code{text x y 'txt' ['fnt'='' size=-1]}. At this, the record @code{[arg1 arg2 arg3 ...]} means @code{[arg1 [arg2 [arg3 ...]]]}, i.e. you can omit only tailing arguments if you agree with its default values. For example, @code{text x y 'txt' '' 1} or @code{text x y 'txt' ''} is correct, but @code{text x y 'txt' 1} is incorrect (argument @code{'fnt'} is missed).
-For more details see @uref{../mathgl_en/mathgl_en_64.html#MGL-scripts, MathGL documentation}
+For more details see @uref{../doc_en/mathgl_en_166.html#MGL-scripts, MathGL documentation}
@external
There are set of ``window'' classes for making a window with MathGL graphics: @code{mglWindow} and @code{mglGLUT} for whole window, @code{Fl_MathGL} and @code{QMathGL} as widgets. All these classes allow user to show, rotate, export, and change view of the plot using keyboard. Most of them (except @code{mglGLUT}) also have toolbar and menu for simplifying plot manipulation. All window classes have mostly the same set of functions.
-For callback drawing you can use: @code{NULL} pointer if you'll update plot manually, global function of type @code{int draw(@code{HMGL} gr, @code{void *}p)} or @code{int draw(@code{mglGraph *}gr)}, or instance of class derived from @code{mglDraw} class. This class is defined in @code{#include <mgl/window.h>} and have only 2 methods:
+For callback drawing you can use: @code{NULL} pointer if you'll update plot manually, global function of type @code{int draw(@code{HMGL} gr, @code{void *}p)} or @code{int draw(@code{mglGraph *}gr)}, or instance of class derived from @code{mglDraw} class. This class is defined in @code{#include <mgl2/window.h>} and have only 2 methods:
@verbatim
class mglDraw
{
@cindex Fl_MathGL
@cindex widgets
-Class is FLTK widget which display MathGL graphics (defined in @code{#include <mgl/fltk.h>}).
+Class is FLTK widget which display MathGL graphics (defined in @code{#include <mgl2/fltk.h>}).
@fig{fltk, Example of FLTK window with MathGL plot.}
@cindex QMathGL
@cindex widgets
-Class is Qt widget which display MathGL graphics (defined in @code{#include <mgl/qt.h>}).
+Class is Qt widget which display MathGL graphics (defined in @code{#include <mgl2/qt.h>}).
@fig{qt, Example of Qt window with MathGL plot.}
Есть целый набор ``оконных'' классов для создания окон с графикой MathGL: @code{mglGraphFLTK}, @code{mglGraphQT}, @code{mglGraphGLUT}. Все эти классы позволяют пользователю просмотривать, вращать, экспортировать рисунок. Большинство из них (кроме @code{mglGraphGLUT}) являются наследниками класса @code{mglGraphZB} и используют ``присоединенный'' класс для центрального виджета окна. Все оконные классы имеют схожий набор функций (@pxref{mglGraphAB class}). Ниже приведен список классов с краткими комментариями.
@deftp {Class} mglGraphFLTK
-Создает окно используя библиотеку FLTK. Окно имеет панель инструментов и меню для упрощения действий с графиками. ``Присоединенный'' класс элемента интерфейса -- @code{Fl_MathGL}. Класс определен в @code{#include <mgl/mgl_fltk.h>}.
+Создает окно используя библиотеку FLTK. Окно имеет панель инструментов и меню для упрощения действий с графиками. ``Присоединенный'' класс элемента интерфейса -- @code{Fl_MathGL}. Класс определен в @code{#include <mgl2/mgl_fltk.h>}.
@end deftp
@deftp {Class} Fl_MathGL
-Класс реализует элемент интерфейса FLTK для отображения графики MathGL. Класс определен в @code{#include <mgl/mgl_fltk.h>}.
+Класс реализует элемент интерфейса FLTK для отображения графики MathGL. Класс определен в @code{#include <mgl2/fltk.h>}.
@end deftp
@float
@end float
@deftp {Class} mglGraphQT
-Создает окно используя библиотеку Qt. Окно имеет панель инструментов и меню для упрощения действий с графиками. ``Присоединенный'' класс элемента интерфейса -- @code{QMathGL}. Класс определен в @code{#include <mgl/mgl_qt.h>}.
+Создает окно используя библиотеку Qt. Окно имеет панель инструментов и меню для упрощения действий с графиками. ``Присоединенный'' класс элемента интерфейса -- @code{QMathGL}. Класс определен в @code{#include <mgl2/mgl_qt.h>}.
@end deftp
@deftp {Class} QMathGL
-Класс реализует элемент интерфейса Qt для отображения графики MathGL. Класс определен в @code{#include <mgl/mgl_qt.h>}.
+Класс реализует элемент интерфейса Qt для отображения графики MathGL. Класс определен в @code{#include <mgl2/qt.h>}.
@end deftp
@float
@end float
@deftp {Class} mglGraphGLUT
-Создает окно используя библиотеку GLUT. Класс определен в @code{#include <mgl/mgl_glut.h>}.
+Создает окно используя библиотеку GLUT. Класс определен в @code{#include <mgl2/glut.h>}.
@end deftp
@float
@cindex Fl_MathGL
@cindex widgets
-Класс реализует элемент интерфейса FLTK для отображения графики MathGL (определен в @code{#include <mgl/mgl_fltk.h>}).
+Класс реализует элемент интерфейса FLTK для отображения графики MathGL (определен в @code{#include <mgl2/fltk.h>}).
@deftypemethod Fl_MathGL @code{void} set_draw (@code{mglDraw *}dr)
Задает функцию рисования из класса производного от @code{mglDraw}.
@cindex QMathGL
@cindex widgets
-Класс реализует элемент интерфейса Qt для отображения графики MathGL (определен в @code{#include <mgl/mgl_qt.h>}).
+Класс реализует элемент интерфейса Qt для отображения графики MathGL (определен в @code{#include <mgl2/qt.h>}).
@deftypemethod QMathGL @code{void} setDraw (@code{mglDraw *}dr)
Задает функцию рисования из класса производного от @code{mglDraw}.
+++ /dev/null
-http://ubuntuforums.org/showthread.php?t=1862084
-Device 0 (VID=0502 and PID=337d) is UNKNOWN.
-
-============= NEW =============
-
-2. Add help about cmake into the "Installation and using" -- after build system will be ready
-3. Add FAQ about MPEG/GIF and PDF
-
-4. Check RunThr() in python
-
-============= FOR V.2.1 ========
-
-1. MPI_Send(), MPI_Recv()
-2. Use Hershey as built-in font ?!!
-3. Import/Export via GIF (as 3d data) ???
-4. Read DICOM files ???
-5. Export to JavaScript (WebGL)
-6. GTK and WX window/widgets
-7. Labels at TriCont()
-
-8. Option 'absolute' for coordinates in absolute range (i.e. [0,1]) ???
-9. Save primitives for frames (not bitmap) ??? -- see MGL_USEDRWDAT
-10. Enable several fonts at the same picture
-11. Table(float x, float y, HCDT dat, char *xlabels, char *ylabels, char *stl) -- draw table with values (+ auto reduce font size?)
-12. Parallelization of drawing (MathGL level) -- bug with primitives drawing --> pixel.cpp
-13. Triangulation + GridData (for interpolation to regular grid)
-14. Axis -- projection (ternary + quaternary)
-15. Examples of animation, u3d, x3d, js and so on
-
-16. Check fontsize maximum ?!?
-17. curved text (in new sample) look not so good
-18. emulate fog in EPS/SVG
-19. line segment losses in EPS ???
-
-20. Add mglDataC for complex data -- main diff is reading/saving data
-21. MGL testing system ???
-22. Export to X3D
-23. Try libtcc (TinyCC) as alternative to MGL -- in mgllab???
-24. Use OI & Z for determining {x,y,z} from {xs,ys}. Try to find closest.
-25. More accurate intersections in Region
-26. Add flag for drawing 3d arrows instead of 2d (S,D -- cube, T -- sq.pyramid, I -- square, O -- sphere???, A,K,V -- ???)
-27. s_hull for triangulation -- add define for any cerr (or exclude streams
-at all) + testing
-28. Add extra texture in Error -- for handling transparency of "marks"
-29. Textual colors, like "{0xFF00FF}" ?!?
-
-============= UDAV =============
-
-01. Dialog for data input
------------------------------------------------
-| [Data name |V|] |
-| [x1] [x2] [func] {ADD} |
-| [y1] [y2] [suf|V] {ADD} |
-| [z1] [z2] [oper|V] [dir] {ADD} |
-| Reuslt [ ] |
-| {Cancel} {OK} |
------------------------------------------------
-Ranges can be inverted.
-Remove other setting if data name is changed.
-
-02. Double click -> jump to string + setup dialog (optionally)
-03. Dialog for InPlot(s):
-{SubPlot,MultiPlot} -- enable rotate,aspect,title
-{ColumnPlot} -- enable rotate,several
-{StickPlot} -- enable several
-{InPlot} -- enable rotate,aspect,title
-
-04. Group/ungroup if command in single line, separated by ':'
-05. Hide plot/group by putting "#h " at beginning of line
-06. Annotation of plot/group -- comment before it
-09. Data change via menu/toolbar -- save to internal script => enable undo + save initial array(?)
-10. Add primitives by mouse at beginning of script + change its size/position by mouse + "attraction" points
-11. Drag&drop plot/group between inplots
-12. Create default plot dependently of selected row/column/range in data table
-13. Show plot at creation stage (if option is enabled -- can be size_t process!!!)
-14. Rotate/perspective/lighting/... of primitive list (without script re-execution)
-
-15. QTreeWidgetItem -- ICON (if,for,once,subplot,...); Cmd text; LINE - POS in group/line. After editing/changing --> put text to editor.
-
-17. Setupable hot-keys ?!?
-18. Insert just filename (without path) by demand
-
-============= UNSURE ===========
-
-1. Problem with \calB and so on (\calH, ...) -- they are present only in italic font :(.
-2. create PWT fonts
-3. \dfrac for normal size and centering (sample \big\big{\frac{1}{2}}) ???
-4. "Cut off" curves if text is printed inside it (for contour labels) ?!?
-5. String variables in MGL + readstr command.
-6. Pool of threads for speeding up ???
-7. Drops as mglPrim -- not accurate but smaller memory and faster
-8. Text aspect ratio in OpenGL mode
#include <QLayout>
#include <QLineEdit>
#include <QPushButton>
-#include <mgl/parser.h>
+#include <mgl2/parser.h>
#include "args_dlg.h"
extern mglParser parser;
//-----------------------------------------------------------------------------
#include <QListView>
#include <QComboBox>
#include <QTextEdit>
-#include <mgl/parser.h>
+#include <mgl2/parser.h>
#include "calc_dlg.h"
extern mglParser parser;
mglData mglFormulaCalc(const wchar_t *string, mglParser *arg);
#include <QInputDialog>
#include <QToolButton>
#include <QSpinBox>
-#include <mgl/parser.h>
+#include <mgl2/parser.h>
//-----------------------------------------------------------------------------
#include "dat_pnl.h"
#include "info_dlg.h"
for(i=0;i<nx;i++) for(j=0;j<ny;j++)
{
f = var->d.GetVal(i,j,kz);
- if(isnan(f)) s = "nan";
+ if(mgl_isnan(f)) s = "nan";
else s.sprintf("%g",f);
tab->item(j,i)->setText(s);
}
f = s=="nan" ? NAN : s.toDouble();
if(f!=var->d.GetVal(c,r,kz))
{
- if(isnan(f)) s="nan"; else s.sprintf("%g", f);
+ if(mgl_isnan(f)) s="nan"; else s.sprintf("%g", f);
tab->item(r,c)->setText(s);
}
var->d.SetVal(f,c,r,kz);
#include <QComboBox>
#include <QTextEdit>
#include <QTabWidget>
-#include "mgl/parser.h"
-#include "mgl/qt.h"
+#include "mgl2/parser.h"
+#include "mgl2/qt.h"
#include "info_dlg.h"
extern mglParser parser;
//-----------------------------------------------------------------------------
#include <QToolButton>
#include <QInputDialog>
#include <QMessageBox>
-#include <mgl/parser.h>
+#include <mgl2/parser.h>
//-----------------------------------------------------------------------------
#include "mem_pnl.h"
#include "info_dlg.h"
#include <QMessageBox>
#include <QTextBrowser>
#include <QToolButton>
-#include <mgl/parser.h>
+#include <mgl2/parser.h>
#include "newcmd_dlg.h"
#include "opt_dlg.h"
#include <QFileDialog>
#include <QTextStream>
#include <QRadioButton>
-#include <mgl/parser.h>
+#include <mgl2/parser.h>
#include "open_dlg.h"
int numDataOpened=0;
extern mglParser parser;
#include <QTextEdit>
#include <QMdiArea>
-#include <mgl/parser.h>
-#include "mgl/qt.h"
+#include <mgl2/parser.h>
+#include "mgl2/qt.h"
#include "plot_pnl.h"
#include "anim_dlg.h"
extern bool mglAutoSave;
#include <QLabel>\r
#include <QLayout>\r
#include "qmglsyntax.h"\r
-#include <mgl/parser.h>\r
+#include <mgl2/parser.h>\r
mglParser parser;\r
int mgl_cmd_cmp(const void *a, const void *b);\r
// comment string keyword option suffix number\r
+++ /dev/null
-#DEFINES += MGL_DOC_DIR=\\\"$(MGLDOCDIR)\\\"
-TEMPLATE = app
-CONFIG += release \
- warn_on \
- thread \
- qt
-TARGET = ../bin/udav
-RESOURCES += udav.qrc
-SOURCES += calc_dlg.cpp \
- hint_dlg.cpp \
- find_dlg.cpp \
- textedit.cpp \
- style_dlg.cpp \
- setup_dlg.cpp \
- qmglsyntax.cpp \
- qmglcanvas.cpp \
- prop_dlg.cpp \
- opt_dlg.cpp \
- open_dlg.cpp \
- newcmd_dlg.cpp \
- main.cpp \
- info_dlg.cpp \
- files_dlg.cpp \
- args_dlg.cpp \
- anim_dlg.cpp \
- mem_pnl.cpp \
- dat_pnl.cpp \
- plot_pnl.cpp \
- help_pnl.cpp \
- text_pnl.cpp \
- udav_wnd.cpp
-HEADERS += calc_dlg.h \
- hint_dlg.h \
- find_dlg.h \
- textedit.h \
- style_dlg.h \
- setup_dlg.h \
- qmglsyntax.h \
- qmglcanvas.h \
- prop_dlg.h \
- opt_dlg.h \
- open_dlg.h \
- newcmd_dlg.h \
- info_dlg.h \
- files_dlg.h \
- args_dlg.h \
- anim_dlg.h \
- mem_pnl.h \
- dat_pnl.h \
- plot_pnl.h \
- help_pnl.h \
- text_pnl.h \
- udav_wnd.h
-DISTFILES += ../TODO \
- ../ChangeLog.txt \
- ../INSTALL
-RC_FILE = udav.rc
-INSTALLS += target data icon desc
-TRANSLATIONS = udav_ru.ts
-LIBS += -lmgl -lhdf5
-desc.files += ../UDAV.desktop
-icon.files += udav.png
-data.files += udav_ru.qm
-target.path = /usr/local/bin/
-data.path = /usr/local/share/udav/
-icon.path = /usr/local/share/pixmaps/
-desc.path = /usr/local/share/applications/
-OTHER_FILES += ReadMe
#include <QLayout>\r
#include <QLabel>\r
#include <QLineEdit>\r
-#include <mgl/mgl.h>\r
+#include <mgl2/mgl.h>\r
//-----------------------------------------------------------------------------\r
#include "xpm/none.xpm"\r
#include "xpm/mark_.xpm"\r
#include <QBoxLayout>
#include <QPrinter>
#include <QMenu>
-#include <mgl/parser.h>
+#include <mgl2/parser.h>
//-----------------------------------------------------------------------------
#include "udav_wnd.h"
#include "qmglsyntax.h"
#include <QTextCodec>
#include <QTranslator>
//-----------------------------------------------------------------------------
-#include "mgl/parser.h"
-#include "mgl/qt.h"
+#include "mgl2/parser.h"
+#include "mgl2/qt.h"
#include "udav_wnd.h"
#include "text_pnl.h"
#include "plot_pnl.h"
endif(MGL_HAVE_WX)
if(MGL_HAVE_QT)
include(${QT_USE_FILE})
- qt_wrap_cpp(mgl-qt MGL_MOC_FILES ../include/mgl/mgl_qt.h)
+ qt_wrap_cpp(mgl-qt MGL_MOC_FILES ../include/mgl2/qt.h)
set(mgl_wnd_src ${mgl_wnd_src} qt.cpp ${MGL_MOC_FILES})
endif(MGL_HAVE_QT)
+++ /dev/null
-AM_CXXFLAGS += -I$(top_srcdir)/include -I$(top_builddir)/include
-
-bin_PROGRAMS = mglconv
-if USE_FLTK
-bin_PROGRAMS += mglview
-endif
-
-mglconv_SOURCES = mglconv.cpp
-mglconv_LDADD = $(top_builddir)/src/libmgl.la
-
-if USE_FLTK
-mglview_SOURCES = mglview.cpp
-mglview_LDADD = $(top_builddir)/widgets/libmgl-wnd.la $(top_builddir)/src/libmgl.la
-mglview_CXXFLAGS = $(FLTK_FLAGS) $(AM_CXXFLAGS)
-endif
-
#include <string.h>\r
#include <locale.h>\r
#include <unistd.h>\r
-#include "mgl/mgl.h"\r
+#include "mgl2/mgl.h"\r
void mgl_error_print(const char *Message, void *par);\r
void mgl_ask_gets(const wchar_t *quest, wchar_t *res);\r
//-----------------------------------------------------------------------------\r
for(i=0;i<var.size();i++)\r
{\r
gr.NewFrame();\r
- printf("frame %d for $0 = \"%ls\"\n",i,var[i].c_str());\r
+ printf("frame %ld for $0 = \"%ls\"\n",i,var[i].c_str());\r
p.AddParam(0,var[i].c_str());\r
p.Execute(&gr,str.c_str());\r
if(gr.Message()[0]) printf("%s\n",gr.Message());\r
#include <string.h>
#include <locale.h>
#include <unistd.h>
-#include "mgl/window.h"
-#include "mgl/parser.h"
+#include "mgl2/window.h"
+#include "mgl2/parser.h"
//-----------------------------------------------------------------------------
std::wstring str;
mglParse p(true);
-set(mgl_wnd_hdr ../include/mgl/window.h ../include/mgl/canvas_wnd.h)
+set(mgl_wnd_hdr ../include/mgl2/window.h ../include/mgl2/canvas_wnd.h)
set(mgl_wnd_src window.cpp)
#set(mgl_wnd_src )
if(MGL_HAVE_FLTK)
include_directories(${FLTK_INCLUDE_DIR})
set(mgl_wnd_src ${mgl_wnd_src} fltk.cpp)
- set(mgl_wnd_hdr ${mgl_wnd_hdr} ../include/mgl/fltk.h)
+ set(mgl_wnd_hdr ${mgl_wnd_hdr} ../include/mgl2/fltk.h)
endif(MGL_HAVE_FLTK)
if(MGL_HAVE_GLUT)
include_directories(${GLUT_INCLUDE_DIR})
set(mgl_glut_src glut.cpp window.cpp)
- set(mgl_glut_hdr ../include/mgl/glut.h ../include/mgl/window.h)
+ set(mgl_glut_hdr ../include/mgl2/glut.h ../include/mgl2/window.h)
add_library(mgl-glut SHARED ${mgl_glut_src} ${mgl_glut_hdr})
add_library(mgl-glut-static STATIC ${mgl_glut_src} ${mgl_glut_hdr})
if(MGL_HAVE_WX)
include(${wxWidgets_USE_FILE})
set(mgl_wnd_src ${mgl_wnd_src} wx.cpp)
- set(mgl_wnd_hdr ${mgl_wnd_hdr} ../include/mgl/fltk.h)
+ set(mgl_wnd_hdr ${mgl_wnd_hdr} ../include/mgl2/fltk.h)
endif(MGL_HAVE_WX)
if(MGL_HAVE_QT)
include(${QT_USE_FILE})
-# qt_wrap_cpp(mgl-wnd MGL_MOC_FILES ../include/mgl/qt.h)
- qt4_wrap_cpp(MGL_MOC_FILES ../include/mgl/qt.h)
+# qt_wrap_cpp(mgl-wnd MGL_MOC_FILES ../include/mgl2/qt.h)
+ qt4_wrap_cpp(MGL_MOC_FILES ../include/mgl2/qt.h)
set(mgl_wnd_src ${mgl_wnd_src} qt.cpp ${MGL_MOC_FILES})
- set(mgl_wnd_hdr ${mgl_wnd_hdr} ../include/mgl/qt.h)
+ set(mgl_wnd_hdr ${mgl_wnd_hdr} ../include/mgl2/qt.h)
endif(MGL_HAVE_QT)
add_library(mgl-wnd SHARED ${mgl_wnd_src} ${mgl_wnd_hdr})
+++ /dev/null
-AM_CXXFLAGS += -I$(top_srcdir)/include -I$(top_builddir)/include
-
-WIDGETS =
-if USE_QT
-WIDGETS += -DHAVE_QT
-endif
-if USE_FLTK
-WIDGETS += -DHAVE_FLTK
-endif
-
-lib_LTLIBRARIES = libmgl-wnd.la
-libmgl_wnd_la_LDFLAGS = $(LDFLAGS) -no-undefined -version-info $(MGL_CURRENT):$(MGL_REVISION):$(MGL_AGE)
-libmgl_wnd_la_LIBADD = $(top_builddir)/src/libmgl.la
-libmgl_wnd_la_CPPFLAGS = $(AM_CXXFLAGS) $(WIDGETS)
-libmgl_wnd_la_CXXFLAGS = $(AM_CXXFLAGS) $(WIDGETS)
-libmgl_wnd_la_SOURCES = window.cpp
-#libmgl_wnd_la_SOURCES =
-
-
-if USE_FLTK
-libmgl_wnd_la_LIBADD += $(FLTK_LIBS)
-libmgl_wnd_la_CXXFLAGS += $(FLTK_FLAGS)
-libmgl_wnd_la_SOURCES += fltk.cpp
-endif
-
-if USE_QT
-include $(top_srcdir)/config/autotroll.mk
-ACLOCAL_AMFLAGS = -I $(top_srcdir)/config/
-
-libmgl_wnd_la_LDFLAGS += $(QT_LDFLAGS)
-libmgl_wnd_la_LIBADD += $(QT_LIBS)
-libmgl_wnd_la_CPPFLAGS += $(QT_CPPFLAGS)
-libmgl_wnd_la_CXXFLAGS += $(QT_CXXFLAGS)
-libmgl_wnd_la_SOURCES += $(top_builddir)/include/mgl/qt.moc.cpp qt.cpp $(top_srcdir)/include/mgl/qt.h
-
-BUILT_SOURCES = $(top_builddir)/include/mgl/qt.moc.cpp
-CLEANFILES = $(BUILT_SOURCES)
-endif
#endif
#endif
//-----------------------------------------------------------------------------
-#include "mgl/fltk.h"
+#include "mgl2/fltk.h"
//-----------------------------------------------------------------------------
#include "xpm/alpha_on.xpm"
#include "xpm/light_on.xpm"
#include <stdio.h>\r
#include <stdlib.h>\r
\r
-#include "mgl/glut.h"\r
+#include "mgl2/glut.h"\r
\r
mglCanvasGLUT *_mgl_glwnd;\r
void _mgl_key_up(unsigned char ch,int ,int );\r
#include <QFileDialog>
#include <QInputDialog>
#include <stdio.h>
-#include "mgl/qt.h"
+#include "mgl2/qt.h"
//-----------------------------------------------------------------------------
#if !defined(WIN32) && !defined(__APPLE__)
#include <X11/Xlib.h>
* Free Software Foundation, Inc., *\r
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\r
***************************************************************************/\r
-#include "mgl/canvas_wnd.h"\r
+#include "mgl2/canvas_wnd.h"\r
//-----------------------------------------------------------------------------\r
mglCanvasWnd::mglCanvasWnd() : mglCanvas()\r
{\r