What is Zhu3D for?
With Zhu3D you can view, animate and solve up to three functions in
3D-space in a complete interactive manner. In addition, you further can
observe an independent parametric system. The OpenGL-viewer supports zooming,
scaling, rotating, translating as well as filed lightning, transparency or surface-properties. Numerical solutions of an
equation-system are found with a quite fast and reliable adaptive random search..
Getting started
When you first start Zhu3D, the screen-layout is optimized for a quite
narrow resolution of 1024x768. These effort is done, because a lot
of
people are still using notebooks or TFT's, where this is default.
If you do not like the actual window/icon-sizes, their location or
the application font size, change everything according to your
preferences. Especially under Windows it may be worthwile to change the
font too, the default system font is quite unsightly.
Application settings are altered with the menu
"Settings/Appearance". After the next restart,
your settings are automatically default - as long as you change
something again. Zhu3D should be useable from the 1024x768
resolution up to huge 30"-displays.
The menu "Editor/Show all open" can help you to find open or minimized
editors with one mouse-click. The reverse is done with "Editor/Hide all open". If you want an individual
startup-screen, simply overwrite the file
startup.zhu in the system directory with your favorite graph. The same is valid for benchmark.zhu.
For those , who are not intimate with computer graphics: The
main light/material-property is the diffuse portion, followed by the
ambient share. With these two settings you can can handle the most common tasks.
IMPORTANT HINT:
Due to screensize limitations some widgets have abbreviated names and/or
seemingly "nameless" sliders. But things are easy and
follow conventions: Where you see direction sliders, they name XYZ
from left
to the right. For lights or materials you have the same for
RGBA, which stands for red, green, blue and alpha-shares. Consider,
that every widget, slider or abbreviation has a tooltip, which
explains details!
In some examples I utilized the "unused" portion of the input editor as
commentary-fields. Use the function/parameter-checkbox to
switch between the explanations and the equations.
Animation
Zhu3D internally does not distinguish between the static and the
animation mode. With the exception of solving and benchmarking, all
settings and interactive actions can be applied to both modes without
any differences - some hardware-power prerequisited. Controlling
animation is done via Editors/Animation. Under Linux the
GPU-utilization is indicated quite smooth and accurate, Windows reacts
more disruptive here. Especially for older Windows-versions don't count
single frames. But at least you will get a clear indication, when the
100%-level is reached.
Benchmark
The benchmark is can be started only when animation is turned off and
runs for five seconds. To make results comparable, anything else is
switched off and the window-properties are fixed. After returning, the
original state is restored automatically.
Mouse handling
There is not much to remember. When you click on the viewer-window, you can use the mouse in the following ways:
* For rotating the view press down the left button
* For moving the measuring-cross, press down the right button
* For zooming the view press down the middle button
* For translating the view press down both the left and right buttons
Saving files
When saving files, the actual state of Zhu3D is completely saved within
them. When animation is turned on, its properties are stored with no
further action required. Such a file will be reloaded as an animation
automatically and will be replayed with the given speed. This is
independent from system-speed - at least, when your system CPU/GPU is
fast enough:-) There is nothing magic with the file-format. You can
inspect or alter the file-descriptions with a simple editor.
When you do not enter a specific file-postfix (like .zhu, .jpg or
.png), the program automatically chooses the correct one depending on
the current situation and/or settings. Saving/loading files resets your
current work-directory. The latter is automatically stored, when you
exit Zhu3D.
Saving pictures
First chose your preferred format in the settings menu. You can save
pictures either in in PNG- or JPG-format, where PNG is default at the first start. Then
set your desired picture dimensions and quality in the
Settings/Picture/Properties-section. To initiate the grabbing, use
File/Save pic or press <Strg-P>. After the render-process, which
may need quite a while with bigger pictures, choose a filename for your
new picture. New PNG/JPG- and the quality-settings will be remembered when restarting Zh3D.
The quality-factor of 85 is a good compromise, values from 90 to 100
will mainly blow up the filesize. After rendering and when relocking the X and Y-values,
Zhu3D resets the latter automatically to the current graph-dimensions. This
makes it easy, to preserve the x/y-relation of your actual graph.
Hints on solving
For solving an equation, you have to provide Zhu3D with a reasonable
starting-value for it's internal calculations. This is done by moving
the measuring cross "relatively near" to a possible solution.
After that, click on the solver-button. The solver-report-window will pop up and inform
you, whether the attempt was successfull or not. As further control,
check the new position of the cross. It moves automatically to the
position where Zhu3D thinks, it has found the solution. Just selecting
the menu Editor/Solver without prior solving with the
toolbar-button will show you just an empty window.
In really extreme cases finding a reasonable starting point may be eased when you:
* Make all F0/F1/F2 and the cross visible
* Deselect the wire-frame-view of course
* Scale the xyz-scale as needed and then scale down z sharpely
* Switch to infinite light in the Editors/Global light-menu
Doing so you will see a relatively flat view of your functions. After
that, it is easy to set the cross near enough to a possible solution.
In the work-directory you will find some examples, which have a lot of
solutions and you can play arround. When you are in the parametric-mode
or animation is on, solving makes no sense and is therefore disabled
automatically.
One word to the solver precision. Zhu3D works with
a threshold of 0.5e-7 internally, what is pretty close to
the theoretical maximum of a 4-byte float-format. In other words:
You can expect a precision of 5-6 digits normally, 7 with
good luck. This is the reason why the solver-report is limited to
six
decimal places.
Transparency
The light- and the material-editor consequently provide a slider for
alpha-channel-values. Normally the alpha-values do not affect the view
and therefore are set to 255 by default. The exception is the view of
transparent graphs. To control this effect, open the materials-editor
and change the alpha-values of the diffuse properties.
When the 2-sided mode is on, be aware that you may have to change the
frontside as well as the backside values to get the desired effect. To
keep things simple, you may change to the one-sided mode in the global
light-editor.
Light sources
You have up to eight independent light sources numbered from 0..7. By
default two of them are enabled and all light colours are set to white.
Imagine all original light-positions as edges of the "normal-cube" with
coordinates from [1,1,1] to [-1,-1-1]. With the default settings, the
lights 0-3 are the foreground-lights, 4-7 are the background-lights.
Changes are made via the Editors/Lights menu. The effects should be
obvious, when you play arround a little bit with it.
Somehow tricky maybe the spotlights. This effect is depending on the
settings in the spotlight section and of course the position of the
choosen light source (the "distance"-slider). To see something useful,
you have to tune the sliders very accurate. A hint: To make life with
spotlight-finding easier, set the spotlight-angle, the
spotlight-intensity as well as the common attenuations near to the
maximimum at the beginning. Doing so, the changing of the
spotlight-direction-vector gives you a bright impression on what is
going on and you easely can catch the desired spotlight-angle instead
of fishing in the dark. Have a look at the spotlight-example, where you
immediately can watch those effects in a clear manner.
The global light is set - you may not be surprised - within the
Editors/Global light-menu. Switching on the infinite-mode maybe
especially
useful, when viewing very flat graphs. In this mode you can not use
spotlights, the distance-slider an the attenuations of course.
Therefore they are turned off automatically. The global ambient light
is comfortable way for brightening the whole view.
Material properties
Changing material properties is simply done via the Editors/Material
menu. Most things should be obvious. The only pitfall may be the
specular light section, which is responsible for the shininess
properties of the function-surfaces. To see an effect, at least one
light source must emit some sort of specular light of course! The short
and simple formula: If there is no specular light, the material can not
reflect it. By default, therefore each light source emits some specular
share too.
Normally the material-editor stores all your latest settings. However,
when you switch your global settings from 2-sided surfaces to 1-sided
ones, the editor switches rigorous to foreground-properties. For your
conveniance this automatisms prevents you from editing backsides, when
just foregrounds are available.
Hints on scaling/viewing
Scaling X and Y up or down will scale each of these axes individually.
Using the common A(ll)-button, all axes are scaled to the same length
automatically. Don't forget to scale up, when viewing-results are
disappointing because of too narrow clipping. Hint: Scale down - mostly
the z-axis - when tesselation is not as propper as expected. Keep in
mind: As your screen is two-dimensional, rotation around the
Z-axis can be reached only with the corresponding
Z-slider of course.
Settings of Triangle/Quads and the resolution of the grid will
influence the viewing too of course. Scaling accuracy/speed is
determined by the Settings/Scale menu. Zooming and translating can be
accelerated by the shortcuts <Strg-+>, respectively -, L, R, U
and D. Alternatively you can use the mouse as described above.
COMFORT HINT: For quick consecutive scaling with + or -, press down the mouse button
continually instead of clicking like a crazy mouse-machine.
Function-input and the parser
Finish editing a new function with <Return>. If something is
strange, or the parser cannot handle it, you will get a error-message.
The function parser is relatively clever. Decimal numbers are
recognized as well as scientific notation. E.g it handles stuff like:
* 2x+3y^3+abs(x)!+y^log(sin(x)+2)
* sin((0.2*x)/2y) + 0.3e-2
* (cos(s-2t)+sin(t))*2+$pi^(3st)
Input is not case sensitive, furthermore you don't have to care for
blanks. As common in mathematical notation, you simply can write write
xy or sin(st) instead of x*y or sin(s*t) for instance. Copy, cut and
paste are supported. Implemented are the following functions,
operators and constants:
+, -, *, /, %, !, ^, sin(), cos(), tan(), asin(), acos(), atan(),
sinh(), cosh(), tanh(), asinh(), acosh(), atanh(), int(), frac(),
log(), log10(), sqrt(), abs(), sig(), gamma(), $pi (=3,14..), $e
(=2,71..). A comment starts with #.
When calculating, Zhu3D relaxes error handling. You may get a message,
but you can draw functions like sqrt(x)/y. In cases of zero-divisions
or negative roots, the function values returned are zero. To avoid
error messages or uncertainties with roots or similar functions, use
abs() in case of doubt.
Parametric systems
To
enable this, just activate the parameter checkbox in the mode section.
From now on, function input and scaling is dealing with a parametric
system only. Some things like solving for instance gives no sense in
this mode. For not confusing you, these items are disabled
automatically.
The major change when enabling the parametric mode, is the meaning of
the function system. Instead of three independent functions, you will
get a single system determined by the parameters s and t. According to
theory, the values for x, y and z are depending on three function
U(s,t), V(s,t) and W(s,t) now. As you easily can watch, scaling gets an
appropriate new meaning too. Instead of rescaling x-values for
instance, you are doing so for the the function U(s,t).
The standard intervall for s and t is [-1, 1], which you change by
scaling U and V. This avoids an extra window for individual
interval-settings and seems appropriate to me. Maybe I will change this
in future versions. The file-format is already prepared for this and
will stay compatible. A short note to the viewer: As you will have an
infinite amount of possible Z-values usually, tesselation may result in
ambigous views. Reduce the scaling of U and/or V to the neccessary
minimum in this cases. Load the sphere-file to try out, what happens.
Here you have to scale up U and V near to [-$pi,pi] to see the whole
sphere. Further examples for parametric systems are the Zhu3D-files
screw, torus, nine or klein for instance. When viewing a system with
just a single parameter instead of two, there are of course no surfaces
to plot! The results will be curves instead, so you have to switch to
the point-mode to see something.
Handling and complexity
At a first glance, you may be overwhelmed by the settings Zhu3D
provides. But do not hesitate – and watch out for tooltips in
cases of doubt! Operating errors are nearly impossible, as dull actions
are turned off automatically depending on actual modes. In most cases you will never have to adjust any of the default
material- or lightning-parameters. Maybe you never want to use the
parametric-mode. Quite shure you never will need spotlights with
peculiar amounts of RGBA-shining values - except you want to create some artwork. So you are not forced to become
an expert in computer graphics.
What the hell means Zhu?
Zhu3D was named after the chinese mathematician Zhu Shijie. Around 1300
AC he was the very first to solve a complex non-linear equation-system
in a
modern way. Of course you will find his historic masterpiece in the work-directory. It's name is zhu.zhu of course.
One remark: Shijie missed
to specify the second non-trivial solution because of its negative
signs. But this was an omission due to historic and mental blockades in
the imagination of numbers, which was finally overcomed foremost hundreds of
years later. With Zhu3D you will see and find this solution at a glance:-)
Not very spectacular - at least from an
optical point of view - is ninebooks.zhu. This historic example is from
the great "Nine
books", a mathematical milestone published in China around 200 BC. What
is somehow spectacular however: These old folks solved this linear
system with a similar algorithm, the famous mathematician Carl
Friedrich Gauss reinvented some 2000 years later.