2012 Jan 20 Fri rev.3945

Due to an incompatibility between Matlab and Windows 7, Matlab's OpenGL
renderer is unable to take screenshots and movies correctly in that environment.
There is therefore a new submenu of the Plot menu, calle Renderer, which allows
you to specify which of Matlab's renderer's to use.  The options are "OpenGL"
(the default), "zbuffer", "painters", and "none".  These are listed in descending
order of preference: use OpenGL unless it doesn't work, otherwise use zbuffer, etc.
zbuffe and painters can give inferior quality, especially when there are
multicoloured gradients.

The "None" renderer is exactly what it sounds like: when selected, no picture
will be drawn.

The setting is persistent between Matlab sessions and is recorded in the
GFtbox_config.txt file.

Some obsolete code has been deleted.


2011 Dec 12 Mon rev.3904

Fixed an error in the saving of OBJ files.


2011 Nov 21 Tue rev.3875

When computing resultant growth for each finite element from the displacements
of its vertexes, a more accurate (but slower) method is used for decomposing
the deformation into a rotation and a growth.


2011 Nov 17 Thu rev.3858

Fix to loadmesh_anyfile(), to delete possibly invalid plotting data.


2011 Nov 08 Tue rev.3834

The "Recent Projects" menu now has an extra item at the end, "Clear Recent
Projects".  This will remove all of the recent projects from that menu, except
for the current project, if there is one.

An error in the implementation of transport has been fixed.


2011 Oct 13 Thu rev.3758

There is a new menu command Projects>Recent Projects.  This records the last
15 projects opened, most recent first.  Selecting any of the menu items
opens the project.  If any items are disabled, that means that the project
does not exist, perhaps because it was deleted or moved, or the file system
containing it is inaccessible.  If you believe such a project has become
available again, the Projects>Refresh Project Menus command will force a
re-scan of the recent projects.  On quitting GFtbox, the directory names of
the recent projects are stored in GFtbox_config.txt in the GFtbox source code
directory, and are loaded from there when GFtbox starts up.


2011 Oct 04 Tue rev.3756

Fixed an error in edge numbering in exported MSR files.

MSR export now also writes the resultant growth tensors over the last time step.
The length of the time step is written as

    FACEGROWTHDT dt

and the resultant growth is written as lines

    FACEGROWTH kmax kmin vx vy vz

where kmax and kmin are the growth rates in the principal directions of the growth
tensor most closely parallel to the surface, and [vx vy vz] is the principal direction
corresponding to kmax.  There is one FACEGROWTH line for each triangular face, and they
are listed in the same order as the faces.

Note that [vx vy vz] is not guaranteed to be exactly parallel to the face.

These data are written as part of the first of the two objects in an exported MSR file
(the triangle mesh).


Transport of morphogens is now implemented, although its status is experimental.
there is a new field of the mesh, m.transportfield.  This is a cell array with one
item for every morphogen.  By default each of these items is an empty array.  To
use this feature to define a transport field for morphogen number i, have your
interaction function set m.transportfield{i} to an N*3 array, where N is the
number of finite elements.  Each row is the velocity of the flow of that morphogen
in the corresponding finite element.  Your interaction function must recompute
m.transportfield{i} on every iteration, since growth and mesh transformations
will invalidate it.


2011 Sep 27 Tue rev.3752

GFtbox now exports the mesh to MSR format version 1.2, by the Mesh>Save MSR
menu command.

The procedures

    [msr,ok] = msrfilereader( filename );
    msrfilewriter( filename, msr );

in GrowthToolbox/Utils/MSR read an MSR 1.2 file into an internal data structure
and write such a data structure to an MSR 1.2 file.

The exported MSR file contains two objects: the first is the triangle mesh, and the
second is the mesh of triangular prisms.


2011 Sep 01 Thu rev.xxxx

There are some changes to the GUI.  The Load and Save As buttons have been
replaced by menu commands Open Project and Save Project As on the Projects
menu.  The Projects menu has been reordered, with minor changes to some of
the menu item names.

There are two new commands on the Movies menu, neither of which is
implemented yet.  These are part of a forthcoming system for scripting movies.


2011 Aug 26 Fri rev.3674

There are some internal enhancements to the method of constructing dialog boxes.

There are some new commands:

img = leaf_getimage( m )

Takes a snapshot of the current display of the mesh m and returns it in a
Matlab image structure.  The image is not saved to disk.  If this is called
while a movie is being made, the image is guaranteed to have the same size
as the movie's frame size.  There are no optional arguments.

[m,ok] = leaf_savestage( m )

Save the current state of the mesh as a stage file.  There are no optional
arguments.


2011 Aug 3 Wed rev. 3664

Modification by JAB
There was a problem seeing results imported from the runs directory. The
imported results are stage files that replace existing stage files. The problem
was that the Stages menu did not allow them to be selected. This has now
been changed - the imported stage files can now be selected.


2011 Jul 19 Tue rev.3628

There is a new option to leaf_setproperty, 'biocolormode'.
If this is set to 'area', biological cells will be colour-coded by area.
If it is set to 'auto' (the default), they will be colour-coded according
to the colour parameters set by the Cells panel, or set by leaf_setproperty
through the options 'colors', 'colorvariation', and 'colorparams' or by
directly assigning to m.secondlayer.cellcolor.


2011 Jul 15 Fri rev.3621

For backwards compatibility, old projects that stored experimental runs in
the "movies" subdirectory will have all such runs moved into the new "runs"
subdirectory the first time that the "Stages>Import Experiment Stages..."
command is invoked.  Note that old versions of GFtbox will not be able to
see the "runs" subdirectory.

Fixed an error in the Movies>Spin/Tilt/Gyrate commands.

The highlighting of nodes that are fixed in space has been reimplemented.


2011 Jul 13 Wed rev.3609

Files saved by the menu item Stages>Save Experiment Stages... command are
now stored in subfolders of a folder called "runs" in the current project
folder, instead of in "movies".  The dialog requesting a name for the saved
run now asks for just a name, instead of both a name and a description.
The default name is "run_" followed by a time stamp.

The "New morphogen" dialog now provides another type of morphogen, "Cellular",
identified by a "c_" prefix.  These should be used for morphogens defining
properties that relate to biological cells. Note that as yet, none of the
morphogen prefixes are used in any way by GFtbox, which does not care what
you call your morphogens.  They are provided for the convenience of the user
in structuring their model.


2011 Jul 08 Fri rev.3605

When an existing project is saved as a new copy, all files in the old project
directory, with certain exceptions, are now copied over to the new project
directory.  (Previously GFtbox would only copy files it specifically knew
were necessary; now it copies everything it does not know to be unnecessary.)
The files that are excluded from copying are:
    The movies and snapshots directories and their entire contents.
    Stage files.
    Any file whose name is of any of the following forms:
        Begins with ".".
        Ends with "~", ".asv", "BAK.m", or ".tmp".
        Begins with the name of the old model, except for the initial mesh,
            the static file, the interaction function, and the notes file.
Upper and lower case are not distinguished when determining these matches.
This means that if you have auxiliary data files of your own (e.g. data
for constructing the biological layer), they will automatically be copied
across to any new copy of your project.

The biological cells are now coloured according to size.  This should be a
user option, but has for the moment been hard-wired for the convenience of
one of our current projects.  The colour coding puts the minimum and maximum
of the current cell areas at the first and last points on the following scale
of equally spaced colours: dark blue, blue, cyan, green, yellow, orange, red,
dark red.

There is a new function mpc = mgenPerCell( m, mgenName, cellindex ).  This
calculates the average value of the named morphogen over the biological cell
given by cellindex.


2011 Jun 08 Wed rev.3565

Because of some incompatibilities between different platforms, the system of
highlighting the chain of submenus of the Projects menu that leads to the
current project has been changed.  These are now indicated by the presence of
a "*" at the beginning of the menu name.


2011 Jun 07 Tue rev.3562

Fixed an error that caused some of the text items in the GUI to ignore changes.


2011 Jun 06 Mon rev.3558

The 'monochrome' option for leaf_plotoptions has been removed.  To specify
the monochrome or rainbow colour scales, use the 'cmaptype' option, with
value either 'monochrome' or 'rainbow'.  Custom colour scales can be specified
by the 'custom' value for 'cmaptype' and supplying a colour map in the 'cmap'
option.  This does not affect the use of the "Monochrome" button in the GUI,
which switches between monochrome and rainbow modes.

Some errors have been fixed regarding the interactions of various plotting
controls.

There is a new button on the Plot Options panel called "From picture", between
the "Auto color range" checkbox and the Min/Max text items.  This causes the
current range of the color bar (if it is present) to be copied to the Min/Max
items.


2011 Jun 02 Thu rev.3554

Fixed an error in the help text for leaf_deletenodes.


2011 Jun 02 Thu rev.3550

Fixed error in multi-plot dialog.


2011 May 31 Tue rev.3548

Minor tweaks.

Modified GFtboxRevision() so that it will work even if SVN admin files are
absent.  The current version number is stored in GFtbox_version.txt, and
updated from the SVN admin files if they are present.

This version uploaded to sourceforge.


2011 May 26 Thu rev.3545

Fixed an error in the plotting code.


2011 May 25 Wed rev.3541

Mac users of the latest version of Matlab may notice that some of the
separator lines between menu items in the main menu bar are missing, e.g.
above each of the "Help" submenus.  This appears to be a Matlab problem
with Mac OS native menus.  The same code run in version R2008a (in which
Matlab uses Java Swing for its menus) creates separator lines where expected.


2011 May 23 Mon rev.3540

A citations file GFtbox_citations.txt has been added, with references to the
basic papers relating to GFtbox.  Items in the Help menu display this
information in either BibTeX or plain text format.

There is a new menu command Movie>Convert to Flash.  At the moment this does
nothing but set the globalProps.flashmovie property of the mesh.  It is
intended that when this flag is set, any movies created will automatically
be converted to Flash format when they are closed.  This has not yet been
implemented.


2011 May 23 Mon rev.3538

Some changes have been made for compatibility with Matlab R2011a on Mac OS.
Because the Mac OS version of Matlab does not support any way of setting the
text style or colour of a menu item, italics and underlining are no
longer used in menus.  Colour is still set but only has effect on Windows
or older versions of Matlab on Mac OS.  The handling of the Stages menu has
been completely revised.  This should not cause any change in visible
behaviour.

Excessively long menus (due to large numbers of projects in a single
directory, or large numbers of stage files) are now avoided by automatically
rearranging them into hierarchical menus.

There is a new codec on the Movie>Codec menu, "Motion JPEG AVI".  This is only
available on newer versions of Matlab (R2010a or later).  It provides superior
quality and reasonable file size, and is the only compressor available on
Mac OS installations or on 64-bit Windows.

There is a new menu item Movie>Quality.  This sets the quality of compression
for compressed movies.  It is an integer from 0 to 100.  The default value is 75.


2011 May 06 Fri rev.3529

The dialog for creating new morphogens has been revised.  Morphogens are now classified
into five types: identity, signalling, visual, local and other.  When you create a new
morphogen you have to specify which type it should be, and the new name will automatically
be given a prefix that identifies its type (except for "other", which has no prefix).
Currently, GFtbox does not use this classification or these prefixes internally, but this
is not guaranteed to always be so, and you should take care to use these as intended.
The dialog allows you to create any number of morphogens at once.


2011 May 05 rev.3527

Various minor improvements.  Thumbnails now have their borders (white or black)
automatically trimmed off, and problems with loading some very old projects have
been fixed.


2011 May 03 rev.3526

The project menu items for the currently loaded project (or previously loaded project,
if there is no current project) are now distinguished by being underlined and a shade
of dark brown.

----

The directory selection interface for saving a new project has been revised.  It now
first asks you for a name for the project, then puts up a dialog asking you to select
the directory in which your new project directory should be created.  (Yes, it would
be better for these to be combined into a single dialog, but MATLAB gives no way of
doing this.)  The directory you select must not itself be a project directory; if it is,
you will be asked to choose again.  (GFtbox determines whether a directory is a project
directory by looking inside it for a MAT-file whose name is the same as that of the
directory.  If there is such a file, the directory is a project directory.)  The name
for a new project by default begins "GPT_" and ends with the date in the form
"_yyyymmdd", and this is already entered into the dialog that asks you for a name.
You can override this if you want, but are recommended not to.

----

There is a new menu command, Projects>Purge Current Project, and a new command-line
procedure leaf_purgeproject.  These delete all unnecessary files from a project:
the movies and snapshots directories and all their contents, and all the stage files.
No other files will be deleted.  The menu command will ask for confirmation, as will
leaf_purgeproject if its 'confirm' option is given.  The menu command sends deleted
files to the waste bin rather than instantly deleting them.  This is also an option
that can be given to leaf_purgeproject.

----

The Misc>Make Thumbnail command now hides the legend, axes, scale bar, and colour bar
before making the thumbnail, and restores them afterwards.


2011 Apr 15 Fri rev.3497

In the top left corner of the GFtbox window, a thumbnail of the current project is
displayed.  Initially, this will be the default GFtbox thumbnail, but you can create
your own thumbnail by the Misc>Make Thumbnail menu command.  This takes a snapshot
of the current state, exactly like clicking the Snapshot button, but saves it into
the file GPT_thumbnail.png in the project directory.  On loading a project, or making
a new thumbnail for a project, the image in this file is loaded and displayed.

If no thumbnail has been defined for a project, one will automatically be created
from the current state when the project is unloaded, i.e. when you use the
Projects>Close Current Project menu command, load a new project, create a new mesh,
close the GFtbox window, or close Matlab.

Although the thumbnail is displayed in an area of 50 by 50 pixels, the actual thumbnail
file is a full-size snapshot.

There is a problem with the bioApresplitproc/bioApostsplitproc feature added in rev.3484
on 2011 Apr 13, meaning that projects using this feature may not load properly.  Until this
is fixed the feature should not be used.  If you need to use this feature, you must not set
these fields of the mesh to function handles, but to strings containing the name of the
function, and the functions must be defined in separate files in your project, not within
the interaction function file.


2011 Apr 14 Thu rev.3492

There are two new commands on the Help menu, "Citation (bibtex)' and 'Citation (plain text)'.
These display a citation in either format of the basic paper relating to GFtbox.

A few bug fixes following the recent directory reorganisation.


2011 Apr 13 Wed rev.3484

The directory structure of GFtbox has been rearranged somewhat, and the gigabytes-large
Papers subdirectory has been eliminated.  You many find that on startup, Matlab now
warns of nonexistent directories on the command path.  Matlab's pathtool command can be
used to eliminate these.  The Motifs subdirectory is now empty; the projects that it
uesd to contain are now in DArT_Models/trunk/Old_Motifs (purged of unnecessary files).


2011 Apr 13 Wed rev.3484

There are two new options to leaf_setproperty:
    'bioApresplitproc'
    'bioApostsplitproc'
These are by default the empty string.  If they are set to function handles, then
bioApresplitproc is called whenever GFtbox is about to consider whether to split the
biological cells.  bioApresplitproc can use whatever criteria the user requires to
decide which cells should be split, and where the splitting plane should be.  For
eachj cell that is split, bioApostsplitproc is called to do any cleanup that the
uer requires.  If the bioApresplitproc procedure needs to pass information on the the
bioApostsplitproc procedure, it should do so via the userdata field of the mesh.

Using these procedures usefully requires a substantial amount of both Matlab programming
knowledge, and knowledge of the internal data structures of GFtbox.


2011 Apr 13 Wed rev.3484

There are the following new options to leaf_setproperty, with their default values:

        'perturbRelGrowthEstimate', 0.01
        'perturbInitGrowthEstimate', 0.00001
        'perturbDiffusionEstimate', 0.0001
        'resetRand', false

These affect the random perturbation that is applied to the initial estimate of a
solution to the growth and diffusion calculations.  For growth, the displacements
calculated in the previous step are normally used as the initial estimate for the
current step, perturbed by perturbRelGrowthEstimate.  A value of 0.01 means that
the perturbation has a range of 1% of the previous displacements (i.e. +/- 0.5%).
If there is no previous displacement, or if the 'usePrevDispAsEstimate' property
is false (set in the GUI by the menu item  Misc>Use Prev Displacement As Guess)
then the perturbation is perturbInitGrowthEstimate times the thickness of the mesh.

For diffusion calculations, the initial estimate is the current distribution,
perturbed by a proportion perturbDiffusionEstimate of its maximum absolute value.

The 'resetRand' property is useful when you need a model to behave identically and
deterministically on all runs.  It reseeds the random number generator before
generating each of these random perturbations, thus guaranteeing that the randomness,
though still present, is identical on each run.


2011 Feb 25 Fri rev.3408

Bug fixes.


2011 Feb 24 Thu rev.3406

Fixed an error in the construction of cup, cap, and capsule meshes.


2011 Feb 22 Tue rev.3404

Fixed a problem that could result in meshes that were modified by using the
"Replace" button to fail to reload.

The "Show seams" command now works again.


2011 Feb 21 Mon rev.3400

leaf_makesecondlayer takes a new option, 'cellcolors'.  The value should be an
N*3 array consisting of N RGB color values, where N is the number of biological
cells to be created.  This option is not used when the 'mode' option is 'grid' or 'full',
since in those cases the number of cells to be made is not known in advance.
If this option is missing or empty, the older method of assigning random
colors based on the 'color' and 'colorvariation' arguments is used.

If at any time one wishes to change the colors of biological cells, one can assign
directly to the N*3 array m.secondlayer.cellcolors.


m.globalDynamicProps contains a new element, 'doinit', initially true.  When a
new interaction function is generated, in the two places where it tests Steps(m)==0,
it now tests (Steps(m)==0) && m.globalDynamicProps.doinit.  This makes no change to
existing behaviour (since doinit is by default true), but makes it easier to perform
non-interactive simulations in which some parameters are passed in from outside,
instead of being set up by the interaction function.  The general method is this:
after loading your mesh from a project file, call

    m = leaf_dointeraction( m );

in order to force m to be initialised.  Now set whatever parameters you wish
in m.userdata, and set m.globalDynamicProps.doinit to false.  You can now run your
simulation with leaf_iterate, and the initialisation code in your interaction function
will not be called, even when Steps(m) is still zero.

The reason you may need to do things in this two-step fashion is that you may be
setting up data structures in the initialisation code in your interaction function
that you need to have available before you can decide what parameters you want to
use for a particular run.  m.globalDynamicProps.doinit allows you to call the
interaction function to do the initialisation, then modify m.userdata to your
requirements, and then turn off m.globalDynamicProps.doinit, so that those
modifications are not simply overwritten by the initialisation code.

The test of m.globalDynamicProps.doinit is performed in code that is generated when
a new interaction function is created.  If you want to use this in an existing
interaction function, edit your own code to operate similarly.

The same effect could be achieved by creating your own doinit flag in m.userdata
and testing that in your interaction function, since both of the Steps(m)==0 tests
occur in user code sections, which you can edit in any way you choose.  Using a
"system" field in m.globalDynamicProps allows for having Growth Toolbox functions
such as SilentGFtbox that invoke this mechanism; it is a design principle that
Growth Toolbox functions never look at m.userdata.


Note that (as is in principle always true) if you create an interaction function
with this or any later version of GFtbox, it will not work with earlier versions,
as an earlier version will not recognise doinit as a valid field of
m.globalDynamicProps.  Models created with old versions of GFtbox should always
be compatible with later version, as they are automatically upgraded on loading.
If an old model does not work on a current version of GFtbox, this is an error
in GFtbox and should be reported.


2011 Feb 10 Thu rev.3391

A few bug fixes.

An extension to leaf_makesecondlayer allows for easier importing of external data
in which vertexes are indexed from zero instead of from 1.  If any vertex index
in the 'celldata' option is zero, it will be assumed to be zero-indexed, otherwise
1-indexed.  Alternatively, the 'vertexindexing' option can be specified as either
0 or 1, with the corresponding effect.  Note that data read from MSR files is
always zero-indexed.

A new function msrfilewriter( filename, msrdata ) has been added, which writes
data as read by msrfilereader.


2011 Feb 02 Wed rev.3381

leaf_computeGrowthFromDisplacements takes an additional option, 'anisotropythreshold'.
This is a non-negative number.  At every point where the anisotropy
(computed as described below) is less than this value, the axes returned
will all be set to zero vectors.  This means that if these axes are plotted,
then wherever the anisotropy is below the threshold, no axes will be drawn.
The growth rates will still be returned normally.

Anisotropy is computed from the first two growth rates.  Calling the larger
kmax and the smaller kmin, anisotropy is defined to be (kmax-kmin)/kmax.
Zero means perfect isotropy, and 1 means growth in one direction only.
Values larger than 1 are possible if the tissue is growing in one direction
and shrinking in the other.

Specifying an anisotropythreshold of zero therefore means that no axes are
zeroed.  A value of 0.5 would mean that axes are zeroed wherever kmax is
less than twice kmin.

Here is some example code from an interaction function:

    if Steps(m)==0 % First iteration
        m.userdata.oldnodes = m.prismnodes;
        m.userdata.starttime = realtime;
        m.userdata.startstep = Steps(m);
        % Zero out old tensor values in the plot options.  This is necessary
        % because all of the plot options are stored in the static file, and
        % therefore persist even when the project is restarted.
        m = leaf_plotoptions( m, ...
            'perelement', [], ...
            'perelementaxes', [], ...
            'perelementcomponents', [] );
    end
    
    if Steps(m) > 0
        % Calculate the displacement of every node since the initial state.
        displacements = m.prismnodes - m.userdata.oldnodes;
        % Find the growth rates and axes, with an anisotropy threshold that
        % zeroes the axes wherever kmin is at least 90% of kmax.
        [g,gf] = leaf_computeGrowthFromDisplacements( m, displacements, ...
                    realtime - m.userdata.starttime, ...
                    'axisorder', 'maxminnor', ...
                    'anisotropythreshold', 0.1 );
        % Plot kmax as a colour-coded quantity, and the axes for kmax and kmin.
        % The axis color is set to yellow.
        m = leaf_plotoptions( m, ...
            'perelement', g(:,1), ...
            'cmaptype', 'monochrome', ...
            'perelementaxes', gf(:,[1 2],:), ...
            'perelementcomponents', g(:,[1 2]), ...
            'axescolor', [1 1 0], ...
            'drawtensoraxes', true );
    end




2011 Feb 02 Wed rev.3380

leaf_computeGrowthFromDisplacements takes an additional option, 'axisorder'.
This allows one to specify three different orderings of the growth rates and
axes that it returns.

If 'axisorder' is 'parpernor' (the default), they are returned as previously,
i.e. the growth rate on the axis most nearly parallel to the polariser gradient,
the rate and axis most nearly perpendicular within the surface, and the rate
and axis most nearly normal to the surface.

If it is 'maxminnor', then the first two growth rates will be permuted to put
the larger first, and the axes similarly permuted.

If it is 'descending' then the rates will be returned in descending order, and
the axes in the corresponding order.


2011 Feb 01 Tue rev.3379

Bug fixes to plotting of user-defined axes.


2011 Jan 31 Mon rev.3378

leaf_plot and leaf_plotoptions take two new options, 'perelementaxes' and
'perelementcomponents'.  These are used to plot user-specified axes.  The value
for 'perelementaxes' should be a 3*K*N array, where there are N finite elements
in the mesh.  Each of the N 3*K matrices consists of K unit vectors.  These will
be the directions of the axes to be plotted.  If 'perelementcomponents' is not
specified, then the axes will all of drawn of equal length, otherwise
'perelementcomponents' should be an N*K matrix giving the lengths of the axes.
The axes will always be scaled so that the longest axis at each point has the same
length.  This length will be a proportion of the distance between sets of axes.
Any number of axes can be drawn at each point, and they do not have to be orthogonal.

leaf_computeGrowthFromDisplacements returns results suitable for use with these options.
Example code from an interaction function:

    if Steps(m)==0 % First iteration
        m.userdata.oldnodes = m.prismnodes;
        m.userdata.starttime = realtime;
        m.userdata.startstep = Steps(m);
        % Clear out old data.  It's a bit unsatisfactory that this is necessary,
        % but if it isn't done then the last user-supplied values of these
        % plot options will continue to be displayed even when the initial state
        % of the mesh is reloaded.
        m.plotdefaults.perelement = [];
        m.plotdefaults.perelementaxes = [];
        m.plotdefaults.perelementcomponents = [];
    end
    
    if Steps(m) > 0
        displacements = m.prismnodes - m.userdata.oldnodes;
        [g,gf] = leaf_computeGrowthFromDisplacements( m, displacements, ...
                    realtime - m.userdata.starttime );
        m = leaf_plotoptions( m, ...
            'perelement', g(:,1), ...
            'cmaptype', 'monochrome', ...
            'perelementaxes', gf, ...
            'perelementcomponents', g, ...
            'drawtensoraxes', true );
    end

The above code plots, at each step, the growth of each finite element since the start
of the simulation up to the step before the current one.  The parallel component is
plotted as a colour-coded value, and all three principal growth rates are plotted as
sets of axes.

Note that leaf_plotoptions is not smart enough to automatically turn 'drawtensoraxes'
on when you supply the 'perelementaxes' option, nor smart enough to choose a default
value for 'cmaptype'.  You need to specify these explicitly or the things you expected
to see may not be drawn.

The colour of the axes is dark blue by default, but can be specified as any RGB value
with the option 'axescolor'.


2011 Jan 28 Fri rev.3376

A new function, leaf_computeGrowthFromDisplacements, allows growth tensors
to be computed from a user-supplied set of node displacements.  This allows
computing actual growth over a period of time, rather than just over a single
time step (which is how the growth quantities displayed by GFtbox are computed).
See the help text for further details.


2011 Jan 25 Tue rev.3374

Various bug fixes.


2011 Jan 21 Fri rev.3365

It is now possible to create the biological layer from external data.
leaf_makesecondlayer takes two new options, 'vertexdata' and 'celldata'.
Vertexdata is an N*3 array of the positions of all of the cell vertexes.
Celldata is a cell array in which each element is an array of the indexes
of the vertexes of one cell, listed in order around the cell.  The vertexes
are indexed from 1 to N.  The new cells can either add to or replace any
previously existing biological layer, depending on the boolean 'add' option.
The default is to add to the existing layer.

It is up to the user to supply sensible data, i.e. vertex locations that
actually lie on or very close to the mesh, and vertex indexes that lie within
the range of the vertex array.

When 'vertexdata' and 'celldata' are supplied, most of the other options
become irrelevant and are ignored.  The options that are still effective are
'add', 'colors', and 'colorvariation'.

leaf_circle, leaf_semicircle, and leaf_rectangle all take a new option, 'centre'.
Its value is the position of the centre of the new mesh.  The default is [0,0,0].
This functionality is not available from within the GUI.


2011 Jan 14 Fri rev.3346

Fixed error in multi-plot dialog.


2011 Jan 12 Wed rev.3344

Fixed errors in multi-plotting.


2010 Dec 20 Mon rev.3331

A new function msrfilereader has been added to parse MSR files.  This is just a
first attempt and there are very likely to be errors and omissions, and it may
later be revised without concern for backward compatibility.  For experimental use
only.


2010 Dec 13 Mon rev.3315

Various bug-fixes.

Unfixed bug: the export of meshes to VRML (for printing on a 3D printer) is currently
broken, following the rewriting of leaf_plot and leaf_plotoptions.  Normal service will
be resumed as soon as possible.


2010 Nov 26 Fri rev.3285

Fix to colour-mixing when plotting multiple morphogens.


2010 Nov 25 Thu rev.3272

Several bug-fixes.


2010 Nov 23 Tue rev.3268

The plotting options have been redesigned.  Most of the previous options still exist and
behave in the same way.  The GUI works the same, except that the "Canvas" checkbox on the
Plot Options panel has been removed.  Turning it off causes the mesh to not be plotted at
all, which is not particularly useful.  If you call leaf_plot or leaf_plotoptions from
your interaction function, you may need to update your code.

The colour picker for morphogens has been moved from the Plot Options panel to the Morphogens
panel, where there are now two color pickers: one for positive values and one for negative.

The following options no longer exist:
    plotmode
    multicolor
    multimorphogen
'plotmode" previously specified what sort of data you were plotting as a colour-coded
quantity.  This is now implied by the other arguments.
'multicolor' specified that you were plotting multiple morphogens simultaneously, and
'multimorphogen' specified the set of morphogens to plot.  This information
is now implied simply by specifying multiple morphogens as the value of the 'morphogen'
option.

The data actually plotted are no longer stored in the plotdefaults structure, but in a new field of the mesh, m.plotdata.
This contains fields 'pervertex' (a boolean, to specify whethr the data are per-vertex or per-finite element), and 'value',
which is an N*1 or N*3 array.  In the first case it is a scalar value for each vertex or finite element, in the second it is a
colour.  There are also pervertexA, valueA, pervertexB, and valueB fields corresponding to the new A/B plot options
described below.

More things can now be plotted by invoking leaf_plot or leaf_plotoptions:
    'morphogen': a morphogen or set of morphogens
    'outputquantity': Combine any of 'resultant', 'specified', or 'residual' with 'growth',
        'bend', or 'anisotropy'; alternatively, use 'rotation.  Optionally follow any
        of these with 'rate'.
    'pervertex' a user-specified scalar or colour per vertex
    'perelement': a user-specified scalar or colour per finite element

Plotting options can be specified to plotdifferent things on the two sides of the mesh.
For each of the options 'morphogen', 'outputquantity', 'pervertex', or 'perelement',
the option name can be followed by 'A' or 'B', and it will specify a quantity to be plotted
on just the A or B side.  With 'outputquantity(A,B)' can be given 'outputaxes(A,B)', which
must take one of the values in the 'Tensor axes' menu (but in lower case), i.e. 'total',
'areal', etc.  For example, to plot polariser on the A side and resultant areal growth rate
on the B side:

    m = leaf_plotoptions( m, 'morphogenA', 'POLARISER', ...
                          'outputquantityB', 'resultantgrowthrate', ...
                          'outputaxesB', 'areal' );

Only one sort of quantity can be specified for each side.  If you try to plot two different
sorts of thing on the same side, only one of them will be plotted and the other ignored.

If you want either or both sides to be blank you can specify this explicitly with the
blank/blankA/blankB options, with the value true.

If the option 'drawtensoraxes' is true then tensor axes will be drawn.  For example, adding
this option to the above call of leaf_plotoptions will cause a cross to be drawn in every
finite element indicating the major and minor axes within the plane of the mesh.

A color bar is drawn only if a single quantity is being plotted, otherwise it is hidden.

The problems sometimes seen in the previous version, whereby GFtbox would sometimes forget
what it was supposed to be plotting, have been fixed.  No doubt they have been replaced by
a new set of problems.  This is a complete rewrite of the plotting code and there are
bound to be some teething troubles.

Possible forthcoming features:
1.  When plotting complicated combinations, it is not practical to display a legend
describing what is being plotted.  A button might be provided to bring up a window displaying
a complete description which can be copied and pasted as a first draft of a caption for a
published paper.
2.  Tensor axes are only drawn if an output quantity is being plotted on both sides, and
they are always drawn on the side specified by the 'Decor' radio buttons.  They should be
independently drawable on the A and B sides.
3.  One might want to draw tensor axes without painting the surface with a tensor quantity,
e.g. paint the surface to show some morphogen, while drawing axes for resultant growth.
This has not been implemented.


2010 Oct 14 Thu rev.3184

A new function, m = calculateOutputs( m ), provides access to the specified, actual, and
residual growth tensors, and the rotation vectors, resulting from the previous simulation
step.  They are stored in m.outputs.  Note that these are only recalculated when you call
calculateOutputs.  (A later version of GFtbox may do this automatically.)  m.outputs is a
structure with the following components:

    m.outputs.specifiedstrain.A
    m.outputs.specifiedstrain.B
    m.outputs.actualstrain.A
    m.outputs.actualstrain.B
    m.outputs.residualstrain.A
    m.outputs.residualstrain.B
    m.outputs.rotation

The first six of these are N*6 matrices, holding a 6-element tensor for each finite element.
The last is an N*3 matrix of rotation vectors for each finite element.

To obtain principal components and axes for any of the tensor quantities, call for example

    [amounts,frames] = tensorsToComponents( m.outputs.actualstrain.A );

For this example, amounts will be the principal components of actual growth on the A side,
listed in descending order. frames will be the corresponding frames of reference, as a 3*3*N
matrix. The columns of frames(:,:,i) are the principal axes of the tensor for the ith finite
element. If you want the components listed in the order parallel, perpendicular, and normal,
call:

    [amounts,frames] = tensorsToComponents( m.outputs.actualstrain.A, m.cellFrames );

To convert any per-element quantity to a per-vertex quantity, call 

    perVxQuantity = perFEtoperVertex( m, perFEquantity );

The per-element quantity can be an N*K matrix, where N is the number of finite elements.
perVxQuantity will then be M*K where M is the number of vertices.


2010 Oct 11 Mon rev.3170

Minor changes to the generation of new interaction functions.


2010 Oct 08 Fri rev.3157

Bug-fixes to plotting routine:

1. When finite element edges are not drawn, the edge of the mesh should still be drawn, but
wasn't.

2. Attempting to plot certain quantities would cause a program error.


2010 Oct 07 Thu rev.3154

The layout of interaction functions has been changed slightly.  The section at the end, after
the main interaction function, where users can define their own functions, is now delimited by a line

    %%% USER CODE: SUBFUNCTIONS

Existing interaction functions will be automatically converted.  New interaction functions also
contain some extra documentation in the user code sections.


2010 Oct 07 Thu rev.3150

There are two new plotting options, 'mgenownsideonly' and 'taper'.  When mgenownsideonly
is true, the standard morphogens KAPAR, KAPER, KBPAR, and KBPER will be plotted only on their
own side of the mesh.  At the border of the mesh (if there is one) they will be painted
half-way through the mesh.  This can be done either with a solid colour extending from the 
A or B side to the mid-surface (if 'taper' is false), or tapering off from the full colour value
at the A or B surface to white at the mid-surface (if 'taper' is true').

The default values are mgenownsideonly=false, taper=true. These options cannot be set from the
GUI, only from the interaction function by the leaf_plotoptions command.

This has fairly limited use at the moment.  It only applies if you are plotting just a single
morphogen at once.  In particular, you cannot plot an A morphogen on the A side and a B morphogen
on the B side simultaneously.  Nor can you specify that any other morphogen or output quantity
should be plotted on just one side of the mesh.  All of these possibilities will eventually be
implemented; but not yet.


2010 Oct 01 Fri, rev.3140

When saving a new project, the new project will automatically appear in the Projects menu.
Previously one would have to do Projects>Refresh Project Menus before it would appear.


2010 Sep 21 Tue, rev. 3106

Some small bug fixes.


2010 Aug 04 Wed, rev. 3050

The bulk modulus and Poisson's ratio can be set to different values for each finite element,
a feature that has existed for some time but has ever been publicised.  Here is an example of how
to do this in the interaction function, given user-defined morphogens called BULKMOD and POISSON.

        m.cellbulkmodulus = max( perVertextoperFE( m, bulkmod_p ), 0.001 );
        m.cellpoisson = min( max( perVertextoperFE( m, poisson_p ), 0 ), 0.49 );
        m = mgenElasticity( m );

The min/max calls are there to force the values to lie within a reasonable range: bulk modulus
must be positive, and poisson's ratio must be non-negative and less than 0.5.  m.cellbulkmodulus
and m.cellpoisson are column vectors of values, one for each finite element.  mgenElasticity()
computes the resulting elasticity tensors for each finite element.

When plotting the biological layer, you now have control over the colours of the edges and vertexes.
The following will set the colours to dark grey (the initial default):

    m = leaf_plotoptions( m, ...
        'bioApointcolor', [0.2 0.2 0.2], ...
        'bioAlinecolor', [0.2 0.2 0.2], ...
        'bioAnewlinecolor', [0.2 0.2 0.2] );

The bioAnewlinecolor field is the colour that cell edges are drawn when they result from cell
divisions.


2010 Jul 30 Fri, rev. 3040

The error measurement used when judging when to terminate the diffusion and growth computations
now allows two options: "Norm" (the default) or "Max", selectable on the Misc>Error Measurement
menu.  When "norm" is chosen, the size of the error vector is taken to be its Euclidean length,
i.e. sqrt(sum of squares of individual errors).  When "Max" is chosen, the error is the maximum
of the absolute values of the individual errors. These options are also available on the command
line:

    m = leaf_setproperty( m, 'solvertolerancemethod', 'norm' );
    m = leaf_setproperty( m, 'solvertolerancemethod', 'max' );

Exported VRML files now support clipping.  That is, if you are displaying the mesh using a
clipping plane or clipping morphogens to hide part of it, when you save to VRML then only the
visible part of the mesh will be output.

A problem with clipping has been fixed: if the entire mesh is invisible, this would cause
plotting to go wrong, and could make it impossible to import a mesh whose clipping parameters
made it entirely invisible.

Certain characters in directory names could make the "Projects>Show Current Project Folder"
command fail.  This is now fixed.  Note that the full path name of any project directory now
must not include either of the characters semicolon or single-quote.


2010 Jul 22 Thu, rev. 3017

The Projects menu has been revised.

1.  It is now possible to have multiple user projects directories.  You can add one with
"Projects>Add User Projects Folder...".  All of the user projects directories are listed on
the Projects menu.  A user projects directory can be either a folder containing many project
folders, or a single project folder.

2.  The GUI makes no provision for removing a user projects directory.  To do that, you
need to close GFtbox and edit the file GFtbox_config.txt in the GrowthToolbox directory.  Delete every
line that begins "projectdir" which names a directory you do not want to appear on the Projects menu.
Do the same with the "defaultprojectdir" line.

3.  If a project outside all the user projects directories is opened, then that project is
added to the Projects menu, and it will still be on the Projects menu if GFtbox is closed and
reopened (assuming the project itself still exists).

4.  The user projects folder containing the currently open project is highlighted on the menu
in orange, as are the submenus all the way down to the project folder.  When a project is closed,
the highlighting remains in effect; the path that it indicates is used as the starting point
for the file dialog that comes up when using the Load... or Save As... buttons.

5.  When you start GFtbox for the first time, you will have no user projects directories, so GFtbox
will automatically create one called GFtboxProjects in your home directory.

It has been made easier to rename project directories.  Previously, if you renamed a folder
containing a GFtbox project, it would no longer be recognised as containing one, even if you
renamed the main MAT file within the folder to agree.  This is because the name of the model is
stored in multiple places, all of which GFtbox assumes agree with each other.  This has now
been at least partially fixed.
The name of the main MAT file must still be identical to the folder name, plus a
.mat extension, since this is the way that GFtbox recognises GFtbox projects.  However,
some other occurrences of the model name will now automatically be updated to agree
whenever a model is loaded.  Besides occurrences within the data structure, the files which
will be renamed if necessary are the static file, the notes file, and the interaction function.
Other files, such as saved snapshots and movies, which also contain the model name, will not
be renamed.

If you rename a project directory while GFtbox is running, and the directory was on the Projects menu,
you will need to use the Projects>Refresh Project Menus command to update the menus.

It has been made easier to start up GFtbox on a completely new installation.  After installing
GFtbox, just cd to the GrowthToolbox directory (which will be wherever you chose to put it), and
give the GFtbox command.  GFtbox will start up and automatically add all of its source file
directories to the Matlab command path.  If you give the "savepath" command on the Matlab
console, you will in subsequent sessions be able to give the GFtbox command without first cd-ing
to the GrowthToolbox directory.

You should not use addpath(genpath('GrowthToolbox')) to put the GFtbox directories on the
command path, as that will add a very large number of unnecessary directories to the path.
If you have been using older versions of GFtbox, then you may already have a very large number
of unnecessary directories on the path.  To check, give the "path" command:
all directories with ".svn" in their name serve no useful purpose on the command path.  They
do no harm, but you might want to revert to the Matlab default path and then reestablish a saner
path by running GFtbox and using the savepath command.

The menu item Misc>Prevent Membrane Shear has been renamed (back) to Misc>Rectify Verticals.
This is because the transformation which it applies (when enabled) is a remeshing of the
substance, not a deformation of it.  The canvas is just as free to shear whether this is
on or off.


2010 May 28 Fri, rev. 2787

Fixed a problem introduced in the importing of stages, whereby the previously loaded mesh
would not be replaced by the mesh for the appropriate imported stage.

The items "Actual growth rate" and "Actual bend rate" on the menu underneath the
Plot Output Value checkbox have been renamed to "Resultant growth rate" and "Resultant
bend rate".  There are several new items on the menu: "Resultant anisotropy rate",
"Specified anisotropy rate", "Residual anisotropy rate", and "Residual anisotropy".
These plot the relevant measure of anisotropy, defined as the difference between growth
(or growth rate) parallel and perpendicular to the polariser.  This is a scalar quantity,
not a tensor, so the tensor property menu just below does not affect how these quantities
are plotted.


2010 May 27 Thu, rev. 2774

The mesh thickness can now be set through the GUI. On the Thickness subpanel of the
Mesh Editor panel, type a positive value into the text box and click the Set button.

When the Stages>Import Experiment Stages... command is used to load a set of stage files,
the description of that set (taken from its associated CommandLine.txt file) is appended
to the name in the title bar of the figure.  Note that this should be taken as describing
the last set of stage files that were loaded, as GFtbox has no way to know if any
recomputation of stages that you subsequently do should count as a new run or a
recomputation of an old run.  The run description wil be removed from the title bar
if you use either the Delete All Stages or the Delete All Stages and Times commands
on the Stages menu.

Internally, two strings are stored that describe the last loaded run: m.globalProps.savedrunname
and m.globalProps.savedrundesc.  The latter is the string that appears in the title bar.
The former is not currently displayed, and is the base name of the directory containing the stage files.
These strings are also the strings supplied by the user in the dialog for saving the current
set of stage files.  Both strings can also be set by leaf_setproperty:

    m = leaf_setproperty( m, 'savedrunname', ..., 'savedrundesc', ... );

An error causing the colour bar to vanish has been fixed.


2010 May 26 Wed, rev. 2772

The Thickness subpanel of the Mesh Editor panel now has a "Set" button and a text box.
If you enter a positive number into the text box and click Set, then the thickness of the
mesh will be set everywhere to the specified value.


2010 May 17 Mon, rev. 2748

Bug fixes to VRML exporting.

Since the Thickness subpanel on the Mesh Editor panel was simplified, there is no longer
any way to set the mesh thickness from the GUI.  One will be provided, but in the meantime,
you can set the thickness of the mesh everywhere to a value T as follows:

1.  Use the Wizard>Export Mesh command.

2.  In the Matlab command window, type the commands:

    global EXTERNMESH
    EXTERNMESH = setAbsoluteThickness( EXTERNMESH, T );

3.  Use the Wizard>Import Mesh command.

Alternatvely, you can do this in your interaction function:

    m = setAbsoluteThickness( m, T );


2010 May 14 Fri, rev 2744

When a new interaction function is created, there are now sme new chunks of boilerplate
code added to the user code sections.  These should be ignored for the moment and can
safely be deleted.  They are intended to assist the user in following some guidelines
for writing interaction functions, currently under construction.  Existing interaction
functions will be unaffected.

When exporting to VRML, there is a new feature in the dialog for scaling and setting the
thickness of the model.  The "Set minimum" checkbox and text item in the "Thickness" panel
allows you to specify the minimum thickness of the 3D model.  Wherever the thickness
of the mesh (after whatever scaling you specify) is less than this value, it will be
increased.  The purpose of this is to avoid the model having excessively thin and fragile
parts, while not changing it elsewhere.  Note that the dialog uses units of millimetres
throughout.  The size in millimetres of the print chamber of the 3D printer is 200 by
150 by 150.


2010 May 13 Thu, rev. 2735

It is now possible to add several morphogens at once, and to set some of their properties.
The "New" button in the Morphogens panel allows any amount of text to be typed.  The names
of the new morphogens should be entered, separated by spaces.  The diffusion and decay
constants of any of these morphogens can be set by typing text like this:

    FOO(diff=3) BAR(diff=0.5,decay=1) FROB

This will create a morphogen FOO with diffusion constant 3 and decay constant 0,
a morphogen BAR with diffusion constant 0.5 and decay constant 1, and a morphogen FROB with
both properties set to 0.  The default values for unspecified properties are zero.
Letter case is ignored: the example could equally well be written as:

    foo(DIFF=3) Bar(diff=0.5,DECAY=1) fRoB

The leaf_mgen_absorption command has been extended to take arguments in the same form as
the leaf_mgen_conductivity command, allowing diffusion constants for multiple morphogens
to be set with a single call.

The function askForText is available for general use.  [S,OK] = askForText( TITLE, RUBRIC )
presents a modal dialog whose title is TITLE and which displays the text RUBRIC at the top.
It contains a multiline editable text box for the user to type into, and OK and Cancel buttons.
The text will be returned in S, and OK will be true if the user closed the dialog by clicking
the OK button.  The dialog will be automatically sized so as to display the whole of the
RUBRIC text, and is resizable by the user.


2010 May 10 Mon, rev. 2695

When there is no colorbar to display, the space it occupies is now made the same colour
as the main picture, instead of letting the green background show through.

There are two new commands:

    s = leaf_getplotoptions( m, ... );
    s = leaf_getproperty( m, ... );

Unlike most leaf_* commands, these do not modify m and therefore do not return a new
value of m.  They are used to read the plotting options or the miscellaneous properties
of m respectively.  The arguments are names of plotting options or properties that would
be supplied to leaf_plot or leaf_setproperty, and the result is a structure whose fields
have those names and whose values are the values they have in m.


2010 Apr 20 Tue, rev. 2694

The "Snapshot screen res" command on the Misc menu has been renamed to "Hi-res snapshots",
and the sense of the check mark reversed.  When unchecked, snapshots are taken from the
screen buffer -- you get the actual pixels on the screen at the time.  When checked,
snapshots are taken as a user-specified resolution given in dots per inch.  This value
can be set by the new "Misc>Hi-res dots per inch..." menu command.  High-resolution
snapshots have the advantage of being of arbitrarily high resolution, and independent
of the screen (so are unaffected by whatever other windows may happen to be overlying GFtbox).
They have the disadvantage of taking much longer to do and of including the entire window,
not just the plotting area, and will therefore always require editing afterwards.

From the command-line, the dots per inch value can be set by:

    m = leaf_plotoptions( m, 'hiresdpi', ... );

The leaf_snapshot command can be instructed to take high resolution snapshots by passing
the 'resolution' option with the desired value.  To use the value already stored in the mesh,
pass the empty list as the option value:

    m = leaf_snapshot( m, 'resolution', [] );

If an explicit resolution vcalue is given, it affects only the snapshot being taken.  It is
not stored into the mesh's plot options.


2010 Apr 19 Fri, rev. 2667

The Thickness subpanel of the Mesh Editor panel has been revised.  It now contains
just two radio buttons called "Physical" and "Direct".  These correspond to the
"Physical" and "KNOR (anti-curl)" items on the previous popup menu.  The other two
modes on that popup menu, "KNOR" and "Scaled" have been withdrawn, as have the
"Initial" and "Scaling" sliders.  They are still available at the command line via
the leaf_setproperty command but are deprecated.

When the thickness mode is "Physical", the growth in thickness of the mesh is determined
by the KNOR factor in the same way as the growth in area is determined by KAPAR...KBPER.
When the thickness mode in "Direct", the growth in thickness is set directly from the
value of KNOR, bypassing the elasticity computation.  In this mode there is never any residual
growth in thickness.  In general, "Physical" mode is to be preferred as more physically
realistic, but in some circumstances, "Direct" mode can overcome certain modelling
artefacts.


2010 Apr 07 Wed rev. 2641

The pull-down menu in the Thickness subpanel of the Mesh Editor panel has one renamed option
and one new option.  "Specified" is now called "KNOR", and behaves the same as formerly.
The new option is "KNOR (anti-curl)".  The four thickness modes differ in (a) the value they
use for specified growth normal to the surface in the elasticity computation, and (b) what they
set the actual thickness of the canvas to after that computation.  In the table below, KNOR
denotes the value of the KNOR morphogen, and AASG means the Average Along-Surface Growth
(the average of KAPAR, KAPER, KBPAR, and KBPER).

                        Specified       Actual

    "Physical"          KNOR            As given by the elasticity computation
    "KNOR"              KNOR            KNOR
    "KNOR (anti-curl)"  AASG            KNOR
    "Scaled"            AASG            Proportional to a power of the area.

In the first two modes, wherever KNOR is less than AASG, the mesh will tend to bend more as
it grows larger, wherever it is already bent, and where KNOR is greater than AASG, it will
tend to flatten out. In the last two modes, there should be no tendency for the mesh to curl
or flatten depending on KNOR.

This is an experimental feature to explore the possible mechanisms whereby leaves regulate
their curvatures as they grow.


2010 Apr 06 Wed rev. 2634

Fixes for previously noted plotting problems, when the selected property failed to be plotted.
This also changes the use of leaf_plotoptions in Matlab code to select the monochrome or rainbow
colour scale.  The method is now:

    m = leaf_plotoptions( m, 'monochrome', true/false );

Previously, this was done through the 'cmaptype' plot option, which should no longer be used
except when defining custom colour scales.


2010 Mar 30 Tue rev. 2624

The handling of mesh thickness has changed.  In the Thickness subpanel of the Mesh Editor
panel, the Physical checkbox has been replaced by a popup menu with three options.

"Physical" means the same as what checking the Physical checkbox meant: growth in thickness is
specified by the morphogen KNOR; the actual thickness resulting from that may differ.

"Specified" means that the growth in thickness will be exactly that specified by KNOR.  This
is a new mode of operation.

"Scaled" means what unchecking the Physical checkbox meant: thickness is a fixed function of
total mesh area, specified by the "Initial" and "Scale" sliders.  Thickness everywhere =
Initial * totalarea^(Scale/2).

From the commandline, the equivalent operation is to call

    m = leaf_setproperty( m, 'thicknessMode', option );

where option is 'actual', 'specified', or 'scaled'.  Previously, the command would have been

    m = leaf_setproperty( m, 'physicalThickness', true/false );

The 'physicalThickness' property no longer exists and the above command will now have no effect.

There are currently some errors in handling of the plotting controls which may result in
no morphogen being plotted, or the legend not being updated correctly.  Pro tem this can be
worked around by toggling the Multiplot or Monochrome checkboxes on and off until the desired
plot shows up.

An error in the Plot>MultiPlot menu command has been fixed, which caused the wrong morphogens
to be selected.


2010 Mar 29 Mon rev. 2616

There is a new command on the Plot menu, Auto Zoom and Centre.  This combines the functions
of the Auto Zoom and Auto Centre commands.


2010 Mar 23 Tue rev. 2609

When saving a mesh as VRML, a dialog is presented allowing you to scale the mesh and to
modify its thickness by any amount.  You may wish to do this when exporting for printing on a
3D printer.  This allows you to do so without modifying the mesh itself.


2010 Mar 22 Mon rev. 2602

There is a new command on the Stages menu, "Save Experiment Stages...".  This will bring
up a dialog asking you to choose a "name" and a "description".  All current stage files will
be copied to a directory within the current project directory, movies/NAME/meshes, where NAME
is the name you gave.  The associated snapshots will also be copied to the same directory.
A file called "CommandLine.txt" will be created in movies/NAME containing the description,
and a copy of the interaction function will be palced there, with its .m extension replaced by
.txt. NAME and DESC default to the current date and time in the form DDMMYYYY_HHMMSS.

This works with the Stages>Import Experiment Stages... command, which brings up a dialog
showing a list of the contents of all the CommandLine.txt files from all the movies/NAME
directories.  When you choose one, all of the stage files in movies/NAME/meshes will be copied
to the current project folder and will become the current stage files.


2010 Mar 11 Thu rev. 2580

There is a new setting in the Cells panel, "Axis ratio".  This allows elliptical
biological cells to be created.  The value given for Axis ratio is the ratio of
major axis to minor axis.  The major axis will be parallel to the polariser gradient.
Where the gradient is zero the cell will be created circular, regardless of the specified axis ratio.

From the command line, the same effect can be obtained with the 'axisratio' option to
leaf_makesecondlayer.


2010 Feb 25 Wed rev. 2529

The functions perFEtoperVertex and perVertextoperFE, which convert a quantity that is
defined for each finite element into one that is defined for each vertex, and vice versa,
have been enhanced to convert vector quantities.  They are called as:

    perVx = perFEtoperVertex( m, perFE );
    perFE = perVertextoperFE( m, perVx );

If the mesh m contains V vertexes and F finite elements, then perFE is an F*K array and
perVx is a V*K array, for any K.  Note that when K=1, you must ensure that the argument is
a column vector, not a row vector.  Previously these functions would accept either.


2010 Feb 24 Wed rev. 2525

There are two new submenus of the Misc menu, Precision and Solver.

Misc>Precision allows single or double precision to be selected for the elasticity computation.
Single precision is a little faster and uses less memory, but may be a little less accurate.
The default is double precision.

The Solver menu allows the selection of a method of solution for the elasticity computation.
There are three: cgs, lsqr, and culaSgesv.
This is mainly a wizard feature at the moment: most users should leave the default choice
of cgs selected.  Cgs and lsqr invoke the Matlab functions of those names, which use the
conjugate gradient squared or least squares method respectively.  culaSgesv requires
(1) installation of the CULA Basic library from culatools.org, (2) mex compilation of
use_culaSgesv.m, (3) a graphics card supporting CUDA functiionality, and (4) up to date
drivers for the graphics card.  I have been able to make this work on a Mac but not yet
on Windows.  The CULA library provides an interface to CUDA functionality allowing array
computations to be performed on the graphics card.  So far I have found cgs to produce better
and faster results.


2010 Feb 12 Fri rev. 2436

Errors in plotting, whereby the selected quantity would fail to be plotted, have been fixed.

The handling of residual strain when using strain retention and freezing has been improved.


2010 Feb 04 Thu rev. 2392

There is a problem with some GFtbox projects which results in the mesh drawn on the screen
jittering around slightly when the viewpoint is changed, or from one timestep to the next.
This is especially annoying when making movies.  The reason that this sometimes happens is
that for some reason, that I haven't yet determined, the camera viewpoint is moving a very
long way from the mesh (and the field of view is correspondingly narrow, so the mesh still
fills the viewing area).  This results in rounding errors when computing viewpoints, which
is the source of the jitter.  I believe this is also the reason that the axes sometimes
are not aligned with their tick marks.

I haven't yet tracked down where the camera distance and view angle are taking on these
extreme values, but for the moment a remedy is available with the procedure:

    m = rectifyMeshFOV( m );

This will reset the field of view to a reasonable value, and at the same time adjust the
camera distance so that mathematically, the scene appears unchanged, but numerically, the
jitter is eliminated.  This can be placed in your interaction function.


2010 Jan 27 Wed rev. 2319

Minor bug fixes.


2010 Jan 12 Tue rev. 2230

There is a new checkbox in the Simulation panel, "Frozen gradients".  This
determines how polariser gradients below the threshold set in the Min.pol.grad.
box are handled.  If checked, wherever the magnitude of the gradient is below
the threashold, the last value that was above the threshold is used: the gradient
is "frozen in" when it drops below the threshold.  When unchecked, gradients
below the threshold are treated as zero, i.e. growth there is isotropic, and the
rate in every direction is the average of the parallel and perpendicular growth
rates.


2009 Dec 02 Wed rev. 2073

Clamped values were not always being maintained, e.g. in the presence of dilution by growth,
production, or decay.  They now are.

Most leaf_* commands that have a morphogen argument can now accept multiple morphogens,
either as an array of morphogen indexes or a cell array of morphogen names.  To enable this,
FindMorphogenIndex has been modified to be able to also accept multiple morphogens, and return
an array of morphogen indexes.  The result it returns on failure has been
changed: if none of the supplied morphogens exist, it returns an empty array.  User code that
uses this function and checks for failure will therefore need to be modified. 


2009 Nov 27 Fri rev. 2051

Some useful functions added:

    [bbox,bboxsize] = mesh_bbox( m );

tells you the bounding box and its size, for a canvas m.  bbox is a 2*3 matrix:
the first row is the minimum x, y, and z coord and the second is the maximum x, y, and z.
bboxsize is bbox(2,:)-bbox(1,:), i.e. the diameter in the x, y, and z directions.

    config = getGFtboxConfig();

returns the configuration parameters contained in the config file for GFtbox (which lives at
GFtbox/GFtbox_config.txt).  Giving the getGFtboxConfig command at the Matlab prompt produces
output like this:

            GFtboxName: 'GFtbox'
         codedirectory: [1x71 char]
        configFilename: [1x89 char]
            compressor: 'None'
                revnum: 2050
               revdate: '2009-11-27T13:50:57.827340Z'
              FontName: 'Helvetica'
             FontUnits: 'points'
              FontSize: 10
            FontWeight: 'normal'
             FontAngle: 'normal'
      bioedgethickness: '1'
         biovertexsize: '1'
               userdir: '/Users/gilgamesh/Documents/MATLAB/GFtboxProjects'

There is no setGFtboxConfig command, and the config file should not be manually edited.

userdir is a full path to your default projects folder, set from within GFtbox by the
Projects>Set User Projects Folder
command.

codedirectory is a full path to the GFtbox directory.  configFilename is a full path
to the config file that this command reads.

The Font* properties are the default font information for the GUI.

revnum and revdate are the revision number and date as displayed in the "About rev. xxxx" menu.


2009 Nov 26 Thu rev. 2048

Bug fixes.


2009 Nov 13 Fri rev. 1975

New plot option 'decorscale' allows the lengths of tensor axes, gradient arrows, cell normals,
and vertex displacements to be scaled up or down from their default lengths.  A value of 1 gives
the current behaviour, a value of 2 will draw all of these things twice as long, etc.  Set it by
calling leaf_plotoptions:

    m = leaf_plotoptions( m, 'decorscale', 2 );

A reminder of some existing plot options that you might also be interested in: 'arrowthickness'
sets the thickness of all of these decorations in pixels.  'arrowheadsize' sets the length of the
arrowhead of gradient arrows as a proportion of the total length.  The default is 0.5.
'arrowheadratio' sets the ratio of width to length of the arrow head.  Default is 0.3.


2009 Nov 12 Thu rev. 1972

Fixed an error concerning dissection and biological cells.

Fixed an error causing monochrome plotting of all morphogens to be in red instead of the
morphogen's specified colour.


2009 Nov 11 Wed rev. 1968

Bug fix to flattening.

The plotting options related to tensor quantities have been reorganised, to allow tensor axes
to be drawn together with morphogens.  Previously, tensor axes would only be drawn while
the corresponding tensor quantity was also being plotted as a colour-coded value.

The only change in GUI operation is that if "Tensor axes" is checked, tensor axes will be drawn even
while morphogens are being plotted, or while no colour-coded quantity is being plotted,
provided that the tensor property selected in the menu just above
the Plot Options panel has a one-dimensional quantity selected (i.e. "Parallel", "Perpendicular",
"Major", or "Minor".

From the command line, the 'plotquantity' option to leaf_plot and leaf_plotoptions is still
supported, but deprecated.  Instead, use 'plotmode', which must be one of 'morphogen', 'tensor',
'vertexcolors', 'facecolors', or 'blank'.  When it is 'tensor', set 'tensorquantity' to the
string that previously would have been the value of 'plotquantity', i.e. 'actualgrowth',
'specifiedbend', etc.

Examples:

To plot the morphogen 'FOO':

    m = leaf_plot( m, ...
            'plotmode', 'morphogen', ...
            'morphogen', 'FOO' );

To plot the actual growth parallel to the polariser:

    m = leaf_plot( m, ...
            'plotmode', 'tensor', ...
            'tensorquantity', 'actualgrowth', ...
            'tensorproperty', 'parallel' );

To draw a morphogen together with tensor axes:

    m = leaf_plot( m, ...
            'plotmode', 'morphogen', ...
            'morphogen', 'FOO', ...
            'drawtensoraxes', true, ...
            'tensorquantity', 'actualgrowth', ...
            'tensorproperty', 'parallel' );

To draw a tensor together with tensor axes:

    m = leaf_plot( m, ...
            'plotmode', 'tensor', ...
            'drawtensoraxes', true, ...
            'tensorquantity', 'actualgrowth', ...
            'tensorproperty', 'parallel' );

To draw tensor axes but no colour-coded quantity:

    m = leaf_plot( m, ...
            'plotmode', 'blank', ...
            'drawtensoraxes', true, ...
            'tensorquantity', 'actualgrowth', ...
            'tensorproperty', 'parallel' );

The 'vertexcolors' and 'facecolors' values for 'plotmode' allow the user to plot any per-vertex
or per-face data of their own.  These are largely untested, though, but if anyone would find them
useful, I can get them working.

It appears that some installations of Matlab are missing randperm.m, which should be a standard
Matlab function.  If the command "which randperm" tells you that it does not exist, then
search your Matlab installation for the file, and if present, put its containing folder on your
Matlab command path.  If the file is not present anywhere, copy the following into a new file
called randperm.m and put it in any folder on your command path:

    function p = randperm(n)
    %RANDPERM Random permutation.
    %   RANDPERM(n) is a random permutation of the integers from 1 to n.
    %   For example, RANDPERM(6) might be [2 4 5 6 1 3].
    %   
    %   Note that RANDPERM calls RAND and therefore changes RAND's state.
    %
    %   See also PERMUTE.

    %   Copyright 1984-2004 The MathWorks, Inc.
    %   $Revision: 5.10.4.1 $  $Date: 2004/03/02 21:48:27 $

    [ignore,p] = sort(rand(1,n));


2009 Nov 10 Tue rev. 1963

Flattening a mesh should now appropriately modify the display of tensor quantities
(actual, specified, and residual growth and bend) and tensor axes.

The Project>Open Current Project Folder command shold now work on both Windows and Mac OS
machines.  If anyone is using GFtbox on Linux, please let me know whether it works there,
and if not, how it can be made to work.

A new property has been added, canceldrift.  If the following command is executed (in the
interaction function):

    m = leaf_setproperty( m, 'canceldrift', true );

then after every iteration, the whole mesh will be rigidly moved and rotated so as to cancel out
any change in overall position or rotation.  This should eliminate a tendency for the whole mesh
to sometimes tilt by large angles, especially when a few nodes at one edge of the mesh are fixed
in space.  The default value for canceldrift is false.

Some minor bug fixes.

WARNING: At some point, Mathworks changed the syntax of a Matlab feature (exception
handling) in a way that is incompatible with earlier versions.  Version 7.4.0.287 (R2007a)
will throw an error during some operations.  If this happens, either upgrade to a newer
version (7.6.0.324 (R2008a) and later are ok), or complain loud enough and I'll make
the code compatible with older versions.


2009 Oct 26 Mon rev. 1875

A new function is provided, m = initProperties(m), which sets to a standard state
certain fields of m:

       morphogens              all set to 0
       mgen_production         all set to 0
       mgen_absorption         all set to 0
       mgen_dilution           all set to 0
       mgenswitch              all set to 1
       mutantLevel             all set to 1
       allMutantEnabled        true

The purpose of this function is to be called from your interaction function at time
zero in order to set various fields to a standard state, before initialising them
as you wish.


2009 Oct 23 Fri rev. 1855

An error has been corrected in the creation of the "Lobes" mesh type, that
prevented very small meshes from being created.


2009 Oct 22 Thu rev. 1848

A new menu command has been added, Misc>Allow Sparse Matrices.  When checked
(the default), a large matrix that is constructed to perform the elasticity
calculation will be stored as a sparse matrix if there is not enough memory to
store it as a full matrix.  This allows larger problems to be solved within the
limits of memory, but the solution process may be slower.  A message is written
to the command window whenever this is done.

When unchecked, sparse matrices are never used.

The command-line equivalent is:

    m = leaf_setproperty( m, 'allowsparse', ... );

with a value of true or false.


2009 Oct 22 Thu rev. 1843

A problem has surfaced when running multiple simulations concurrently on the same
project directory.  Each of the simulations reads the project's static file when
it starts, but may also rewrite it from time to time (whenever it calls any
leaf_* procedure which changes any of the information stored in the static file.
If one simulation reads the file after another has updated it, it may read
data that are not correct for that simulation.

To fix this problem, there is a new mesh property, staticreadonly, by default false,
which can be set by

    m = leaf_setproperty( m, 'staticreadonly', ... );

When true, the static file for the project is never rewritten.  When false, it is
rewritten every time a leaf_* procedure is called or any GUI operation performed
which changes any part of m which is stored in the static file.

If you are running multiple simulations concurrently on the same project, then in
the Matlab script that you have written to launch your simulations, you should call

    m = leaf_setproperty( m, 'staticreadonly', true );

immediately after initially loading the mesh.

Do not set any other properties in the same call to leaf_setproperty, since some
of those properties are stored in the static file, and there is no guarantee about
the order they are processed.

The staticreadonly property itself is not stored in the static file.

GUI equivalent: the menu item Misc>Static File Is Read-only.

In general, for complex simulations it is typically more convenient to set up the
initial state entirely by means of the interaction function rather than with the GUI.
When doing this it is generally wise to arrange that when your interaction function
sets up the initial state, it begins by explicitly resetting all values to a standard
state. For example:

    m.morphogens(:) = 0;
    m.mgen_production(:) = 0;
    m.mutantLevel(:) = 1;

...and so on.  In particular, all fields that are stored in the static file, affect
the simulation, and which you are varying between simulations should be explicitly set.
Roughly, this is everything except the mesh geometry, morphogen distribution and
production, and all other per-vertex, per-edge, per-finite element, or per-clone
properties. If you are varying any such properties (for example, Poisson's ratio)
between simulations, have your interaction function set them to the desired values
at the start of the simulation.


2009 Oct 21 Wed

An error in the renaming of morphogens has been fixed, whereby the list of
morphogens to be plotted was not updated.  The only effect of this was to fail
to plot a renamed morphogen, and to complain that it did not exist.


2009 Oct 20 Tue rev 1838

There are functions, dirname = GFtboxDir(), which returns the full path name
of the Growth Toolbox directory, and [rev,date] = GFtboxRevision(), which returns
the SVN revision number as a double and its timestamp as a string.


2009 Oct 7 Wed rev. 1807

A new feature has been added whereby the user can specify, through the interaction
function, the movements of some of the vertexes.  This is done by two new fields of
the mesh structure, m.drivennodes and m.drivenpositions.

m.drivennodes should be set to a list of the indexes of all the nodes whose positions
are to be specified on the current iteration.  If the same nodes are to be driven
throughout the simulation, this only needs to be done at time 0, but if different sets
of nodes are to be driven at different times, then m.drivennodes can be set on every
call of the interaction function.

m.drivenpositions should be set by the interaction function on each iteration.  Its
value should be an N*3 array (where N is the length of m.drivennodes) giving the
positions that the nodes should have at the end of the current timestep (i.e. at time
m.globalDynamicProps.currenttime + m.globalProps.timestep).

There are two important limitations of this feature in its current implementation.

1.  It is NOT COMPATIBLE with any operation on the mesh that changes the set of nodes,
because that will change the indexing of the nodes.  You must either avoid all such
operations, or make arrangements to rediscover the nodes that you want to drive after
every such operation.  Operations to avoid include:

(a) The Retriangulate, Split long edges, and Split bent edges checkboxes in the
Simulation panel.  These should all be turned off.

(b) The Dissect button on the Simulation panel, the Refine mesh button on the Mesh
Editor panel, and clicking to delete FEs.

(c) All leaf_* procedures performing such operations: leaf_deletepatch, leaf_refineFEM,
leaf_subdivide, etc.

2.  The specified position refers to the midpoint of the line joining the vertexes
on opposite sides of the mesh.  Both of these vertexes will move identically, and the
thickness of the mesh at these points will never change.  This implies that not only
will the mesh point move as directed, but the tangent plane to the mesh at that point
will never change.

Here is an example of an interaction function demonstrating the feature.

    if Steps(m)==0
        % The following node indexes were found by clicking on the intended
        % vertexes while the Simulation panel was selected.  The mesh is
        % rectangular.  The first five vertexes are the middle half of one
        % edge, and the other five are the middle half of the opposite edge.
        m.drivennodes = [53 66 79 92 105 65 78 91 104 117];
        % I save the initial coordinates of those nodes in m.userdata, a structure
        % in which you can store whatever you want.
        m.userdata.originalnodes = m.nodes( m.drivennodes, : );
    end
    % This is the amount by which to displace the nodes from their original
    % positions on the current iteration.
    moveamount = 0.5*sin((realtime+dt)*pi);
    m.drivenpositions = m.userdata.originalnodes + ...
        [ repmat( [-moveamount 0 0], 5, 1 ); ... % The first five nodes move towards -X.
          repmat( [moveamount 0 0], 5, 1 ) ]; % The other five nodes move towards +X.

The demonstration project can be found in the toolbox subdirectory GFtbox/Motifs/testmove2,
or accessed from GFtbox from the Projects/Motifs/testmove2 menu item.


2009 Oct 1 Thu, revision 1764

An error in the elasticity computations has been fixed, the effect of which was to make
anisotropic growth in directions not parallel to the global XYZ axes to be slightly less
anisotropic than it was specified to be.  In the worst case, an object specified to grow
uniformly in the XY plane at 45 degrees to the X and Y axes would in fact grow in that
direction at only 3/4 of the specified rate, and grow perpendicularly at 1/4 of that rate.
Total volumetric growth was unaffected.

All models made hitherto should be rerun and modified if necessary.

An error in the handling of the text/slider combos in the GUI has been fixed.  If you type
a value into the text box that is outside the range of the slider, then either the text
value will be adjusted to fit the slider, or the slider bounds will be adjusted to include
the value typed.



2009 Sep 15 Tue

An error has been fixed that cause the scale bar to fail to be redrawn
whenever it changed size.

The legend (the large text at the top of the picture area) can now be
specified more flexibly.  The Plot/Set Legend menu command brings up a dialog
into which you can type a legend string.  Certain character sequences in this
string will be automatically replaced by other information when the legend is
displayed:

    %T    Time, e.g. "250.25 hours"
    %q    Name of the quantity currently being plotted.
    %m    A list of all factors currently at mutant levels, or "WILDTYPE" if
          the wild type is being run.  If no factors have mutant levels defined,
          this is replaced by the empty string.
    %c for any other character c: the character c is inserted.
    \n    A newline character
    \c for any other character c: the character c is inserted.

The default string can be restored with the "Get default" button in the dialog.

The command-line equivalent is

    m = leaf_setproperty( m, 'legendTemplate', ... );

The previous 'legend' field of m.globalProps has been removed.


2009 Sep 01 Tue

New Plot menu commands: Show/Hide Node Numbers, Edge Numbers, and FE Numbers.
These allow the internal index numbers of the nodes, edges or cells of the finite
element mesh to be displayed.  (NOTE: Show/Hide Edge Numbers has not been
implemented.)

The corresponding options to leaf_plot and leaf_plotoptions are 'nodenumbering',
'edgenumbering', and 'FEnumbering'.  The colour of the text can also be set by
the options 'nodenumbercolor', 'edgenumbercolor', and 'FEnumbercolor' (not
available thorugh the GUI).  The default colours are red, dark green, and dark
blue respectively.


2009 Aug 07 Fri

Fixed an error affecting the 'nodes' and 'nonnodes' options to leaf_addseam.


2009 Jul 30 Thu

When plotting polariser gradient arrows with a positive sparsity value, the
values plotted are now the direction of the average gradient over a region
around the position of the arrow, instead of being the direction of the
gradient at the single point at the midpoint of the arrow.


2009 Jul 18 Sat

An error in viewpoint management due to a Matlab bug has been fixed.


2009 Jul 16 Thu

It is now possible for the user to set the polarisation direction in the
interaction function, instead of letting it be calculated as the gradient
of the POLARISER morphogen.  To do this, add something like this to the interaction
function:

        m = leaf_setproperty( m, 'userpolarisation', true );
        for i=1:size(m.gradpolgrowth,1)
            m.gradpolgrowth(i,:) = [1 0 0];
        end

The first line enables this feature, and the remainder sets the polarisation
vector in every element.  These vectors are expressed in the global frame of
reference.  In this example the polarisation direction is parallel to the X axis.

Note that when leaf_setproperty( m, 'userpolarisation', true ) has been called,
the user-defined polarisation will remain in force, ignoring the polariser
morphogen, even after reloading the project.  To revert to using the POLARISER
morphogen, you must call leaf_setproperty( m, 'userpolarisation', false ).

There have been some tweaks to the management of viewpoint parameters.
Note that if you want to set the viewpoint from your code, you should always use
leaf_plotoptions or leaf_plot to do this, and not directly assign to components of
m.plotdefaults.  To access the current viewpoint parameters, see
m.plotdefaults.matlabViewParams and m.plotdefaults.ourViewParams.  For the list of
viewpoint-related parameters, see the release notes for 2009 Jul 09 Thu.

Do not access m.plotdefaults.azimuth, m.plotdefaults.elevation, or m.plotdefaults.roll.
These parameters are deprecated and will eventually be withdrawn.


2009 Jul 13 Mon

Click-dragging to change the view now works even if you click on the mesh,
provided no other action is selected in the Mesh Editor or Factors panels.
If either panel is being displayed, select the "----" item in the pull-down
menu of click actions to allow clicking on the mesh to change the view.


2009 Jul 10 Fri

Three new commands on the Plot menu allow saving and loading of viewpoints.

"Save View..." saves the current view parameters into a file in the 'viewpoints'
subdirectory of your projects directory.

"Load View..." loads a set of view parameters from such a file and makes that
the current view.

All saved viewpoints are also available on the Plot>Use View submenu.

The 'autozoom' and 'autocentre' plot options are now off by default.

Bug fixes relating to the handling of stage files.


2009 Jul 09 Thu

The effects of dragging to pan or zoom can now persist when the leaf is replotted.
To enable this, you must turn off the Auto Zoom and Auto Centre menu items in the
Plot menu.  From the command line or the interaction function call

    m = leaf_plotoptions( m, 'autozoom', false, 'autocentre', false );

The "Set Default View From Current" menu command has been moved to the Plot menu.
The "Set Default View..." command has been removed.

The way of controlling the viewpoint has been completely revised.  The following
options are now available in leaf_plot and leaf_plotoptions:

    CameraViewAngle     real number, field width in degrees.
    CameraUp            vector, the direction that is projected to the vertical
                        on the screen.
    CameraTarget        vector, the point the camera is looking at
    CameraPosition      vector, the position of teh camera

    azimuth             real number, degrees of rotation about the Z axis.
    elevation           real number, degrees of elevation of the camera above
                        the XY plane.  When positive, the camera is looking
                        downwards, when negative, upwards.
    roll                real number, degrees of roll of the camera from the vertical
                        about the direction it is looking in.
    pan                 pair of real numbers, the distance right and up that the view
                        line is translated from the parallel line passing through the
                        origin of coordinates.
    targetdistance      real number, the distance of CameraTarget behind the plane
                        through the origin perpendicular to the view direction.
    camdistance         real number, the distance of CameraTarget in front of the
                        plane through the origin perpendicular to the view
                        direction.

The first four are the parameters that Matlab uses itself.  The others are sometimes
more convenient to use.  Note that each set separately completely specifies the view,
and therefore combining options from both sets simultaneously is not a good idea.  In
case of conflict, the first set overrides the second.

There are two further options:

    autozoom        If true, whenever the mesh is plotted, the CameraPosition will be
                    set so that the bounding box of the axes fills the picture.
    autocentre      If true, whenever the mesh is plotted, the CameraTarget will be
                    moved to the centre of the bopunding box of the axes.  The
                    CameraPosition will be moved by the same amount, to preserve the
                    direction of view.

These are both on by default.


2009 Jul 03 Fri

Help is now available for all of the leaf_* commands, on the Help menu,
organised both alphabetically and by topic.

An error in the handling of thresholds for multiple morphogen plotting has
been fixed.


2009 Jun 30 Tue

It is now possible to specify a plotting priority and a plotting threshold when
plotting multiple morphogens
simultaneously.  Morphogens of the same priority will have their colours mixed.
Morphogens of higher priority will overlay morphogens of lower priority, instead of
mixing with them.  Priorities and thresholds are set by a command such as:

       m = leaf_mgen_plotpriority( m, ...
        {'id_sink','id_source','id_ridge'}, [1 1 2], [0 0.1 0.2] );

This gives priority 2 to the morphogen id_ridge, 1 to id_sink and id_source, and leaves
all others with the default priority of zero.  If all morphogens are being plotted together,
then where id_ridge is greater than 0.2, its colour will be plotted.  Elsewhere, where
id_sink > 0 or id_source > 0.1, their colours will be  mixed and plotted.  Everywhere else, the
other morphogen colours will be mixed together.

Priorities can be any real number, and multiple morphogens can have the same priority.
The thresholds are optional and default to zero.  The threshold has no effect when
plotting a single morphogen.


2009 Jun 23 Tue

Fixed an error in the making of Voronoi layers of biological cells (the "Fill
with cells" button on the Cells panel.


2009 Jun 22 Mon

There is a new menu command Plot>Set Canvas Colors...  It allows you to select
the colours of the faces and edges of the canvas.  Face colour is only operative
when multiplotting.  Edge color is operative whenever edges are being drawn.

Command-line equivalent:
    m = leaf_plotoptions( m, 'canvascolor', [...], 'FElinecolor', [...] );
The required values are RGB triples.


2009 Jun 17 Thu

Snapshot file names now have the form modelname-NNNN-NN.png, where NNNN is
the model time and NN is an index number to distinguish snapshots taken
at the same model time.


2009 Jun 16 Wed

When plotting in monochrome mode, the colours no longer vanish after a simulation
step.


2009 Jun 08 Tue

When exporting VRML models for 3D printing, clones should now be handled correctly
by the printer software.  (Previously, the presence of clones caused the mesh to
lose its colours.)

Fixed an error in plotting gradient arrows with clipping.


2009 May 22 Fri

All of the circular shapes of mesh (circle, hemisphere, cylinder, etc., but not
snapdragon) now have two parameters "X wd." and "Y wd." in the GUI, replacing
"Radius".  From the command line, the options are 'xwidth' and 'ywidth' instead
of 'radius'.  If either is zero it defaults to the other.


2009 May 21 Thu

There is an additional option to leaf_makesecondlayer, 'allowoverlap'.  By
default this is true. If false, if a cell would be created overlapping an existing
cell, it is not created.  If this happens, a message is printed to the command window
saying how many cells were actually created.  In the GUI, this feature is provided by
the "Allow overlap" checkbox in the Cells panel.

The options to leaf_makesecondlayer determining the size of clones have been
revised.

New options:
    absdiam: The diameter of each cell to be created, in length units.
    absarea: The area of each cell to be created, in length units^2.
    reldiam: The diameter of each cell to be created, as a proportion of
        the diameter of the mesh (estimated as the square root of the area).
    relarea: The area of each cell to be created, as a proportion of the
        area of the mesh.
Only one of these should be given.

Old options no longer in use:
    abssize: The radius of each cell to be created, in length units.
    relsize: The radius of each cell to be created, relative to the diameter
        of the mesh.
    relFEsize: The radius of each cell to be created, relative to the diameter
        of a typical FE.
    relinitarea: The area of each cell to be created, relative to the area
        of the initial state of the mesh.
If you currently use any of these, you will need to change your code.


2009 May 20 Wed

Internal tweaks to the method of randomly colouring clones.

To create clones with random colours, call:

    m = leaf_makesecondlayer( m, 'colorvariation', 1, ...other options... );

To randomly recolour the existing clones, call:

    m = leaf_colourA( m, 'colorvariation', 1 );

If you want clones that split to transmit their colours to their offspring, you
need to set the colorvariation back to a small number or zero after creating the clones:

    m = leaf_makesecondlayer( m, 'colorvariation', 1, ...other options... );
    m = leaf_setproperty( m, 'colorvariation', 0 );

A value of 0 will make new cells identical to their parents; a value of around 0.02
will allow a slight variation.


2009 May 14 Thu

There has been some substantial reworking of some of the internal data structures.
I've made some effort to test that everything still works, but it's quite possible
I've missed something somewhere.  Let me know if things are going wrong.

The following members of m.plotdefaults no longer exist: hfigure, hpicture,
hpictureBackground, hlegend, hscalebar, hcolorbar, hcolortexthi, hcolortextlo,
hmaxcolor, hmincolor.  If you need to access any of these, then you need to write:

    h = guidata( m.pictures(1) );

and then access h.picture, h.pictureBackground, h.legend, etc.  There is no h.figure;
the figure window itself is m.pictures(1).  When plotting in stereo, m.pictures(2) is
the other figure window.

The new command leaf_light(m,on) turns the scene light on and off.  (Already in the GUI
as Plot>Turn Light On/Off.)


2009 May 13 Wed

Gouraud shading is now supported. This means that when you turn on the light
(Plot>Turn Light On), the lighting will be less discontinuous from one finite
element to the next, although not completely smooth.  I also tried Phong shading,
but it doesn't visibly differ from Gouraud.

Fixed an error when plotting thin meshes with clipping.


2009 May 11 Mon (Update)

A new command,
    m = leaf_createmesh( m, nodes, triangles );
allows a mesh to be created from a set of nodes and triangles. These report
their type in m.meshparams.type as 'custom'.


2009 May 11 Mon

Exporting to VRML now supports biological cells that are drawn on just one side
of the mesh.

There is a problem with loading VRML files into the 3D printing software,
whereby if biological cells are present, colours on the mesh surface are ignored.
Colours of the biological cells are printed correctly. When biological cells are
not exported to VRML, colours of the mesh surface are printed correctly.

Interaction functions can now contain user code after the end of the main function.
This allows you to define subfunctions which can be called from the main interaction
function.  Functions defined here will not be accessible from outside the
interaction function.

Fixed an error in leaf_delete_mgen (again) that would sometimes prevent it from
deleting a morphogen.


2009 Apr 30 Thu

There is a new command:
    [avethick,minthick,maxthick] = averageMeshThickness( m );
which returns the average, minimum, and maximum thickness of the mesh.


2009 Apr 28 Tue

Fixed an error in leaf_delete_mgen that would sometimes prevent it from
deleting a morphogen.

Added some new functions for accessing the values of the actual growth and
bend, since at present these could be plotted but their values were not
accessible.
    [growthrate,growthframe] = actualGrowth( m );
    [bendrate,bendframe] = actualBend( m );
See the help text for these functions for further details.

The method of positioning polariser gradient arrows has been modified so that they
will tend to be in the same positions from one plot to another.  This feature can
be turned off by unchecking the menu item Plot>Static Decorations.  For looking at
the mesh on the screen, Static Decorations is better, but for movies, I find that
turning Static Decorations off gives a more animated impression of the polariser
gradient field.


2009 Apr 24 Fri

Fixed a bug that would sometimes turn the whole canvas transparent in multi-plot mode.


2009 Apr 21 Tue

1. The "Mutant" checkbox on the Plot Options panel has been removed, on the grounds of
being excessively confusing and insufficiently useful.  Its purpose was to switch
between plotting the mutant state of the current morphogen and the wild-type state.
Instead, only the mutant state will be plotted.

2. Fixed an error in multi-morphogen plotting, which was ignoring the mutant levels
and always plotting wild-type values.

3. Fixed an error in the generation of clone colours which tended to create them as
red, regardless of the colour the user asked for.

4. A new plot option, not available from the GUI, is 'canvascolor'.  This sets the
colour of the surface, when no morphogens are present.  Where morphogens are present,
the background colour is mixed with the morphogen colour.  For example:

    m = leaf_plotoptions( m, 'canvascolor', [0.5 0.5 0.5] );

sets the canvas to grey.  This command can be placed in the interaction function.
The mixing method is defined so that where a morphogen is at its maximum value,
the canvas colour does not show through at all; it shows through in proportion as
the morphogen falls short of its maximum.

At present this only applies to multi-plot mode, not to the plotting of a single
morphogen.  There is a workaround if you want to plot a single morphogen against
a background canvas colour: use multi-plot mode, and select the desired morphogen
and one other whose value is zero everywhere.


2009 Apr 20 Mon

There is now an option for the polariser gradient threshold (as set by the "Min.
pol. grad." box on the Simulation panel) to act as a relative threshold instead
of an absolute one, i.e. the gradient is frozen if the ratio of the polariser
gradient to the polariser is below the threshold.  The "Rel. pol. grad." checkbox
selects whether this is done.

There is a new field in the mesh structure, m.growthanglepervertex.  This specifies
that the principal axxis of growth should be not parallel to the polariser gradient,
but rotated by the given angle. The sense of the angle is given by the right-hand
rule applied to the cell normal (which can be displayed by Plot>Show Normals). The
angle is given in radians.  m.growthanglepervertex can be set in the interaction
function.  The simplest method is to add a morphogen of your own to play this role,
and in your interaction function, do this, supposing the morphogen is called ANGLE:

    m.growthanglepervertex = angle_p;

To see the requested growth direction, select the "Plot output value" checkbox,
select "Specified growth" in the menu below it, and select "Major" in the menu below
that.  The demo project "growthangle" sets the growth to rotate through 10 radians every
time unit.

Every menu now has an extra item at the foot, called Help, which gives help on all the
items in that menu.


2009 Apr 17 Fri

Most of the menus now have an extra command at the foot, called "Help".  This
command provides help for the commands on that menu.


2009 Apr 15 Wed

When Sparsity (on the Plot options panel) is set to a positive number, the polariser
gradient arrows are now uniformly randomly distributed over the surface, with a minimum
distance between them of the sparsity value times the diameter of the mesh.  (When
sparsity is zero, one arrow is drawn at the centre of each finite element.)  Because of
the way in which this is done, the arrows will be at completely different positions
each time the mesh is replotted.

To set the colours of the polariser gradient arrows, call

    m = leaf_plotoptions( m, 'highgradcolor', hicolor, 'lowgradcolor', locolor );

where hicolor and locolor are the colours you want for high and low values of the
gradient.  By default, these are dark blue and dark red respectively.  The call of
leaf_plotoptions can go in the interaction function, and will also affect all saved
stage files.


2009 Apr 08 Wed

Multi-morphogen plotting is now implemented.
1.  Use the Plot/Multi-plot menu command to select the set of morphogens you want
to plot together.
2.  Turn on the Multi-plot checkbox on the Plot Options panel to plot the selected set.
Turn it off to see just the current morphogen.
3.  To choose the colour of a morphogen, use the color picker on the Plot Options panel.
This will set the colour for the current morphogen.  If you want to see just the current
morphogen, plotted in the chosen colour, you need to turn on the Monochrome checkbox.
4.  There is a text box next to the Multi-plot checkbox.  This defines a parameter that
affects how colours are mixed together.  You can probably leave this at the default
setting.  If you want to experiment with it, the value must be between 0 and 1, but not
equal to 1.  Zero is equivalent to multiplying the colours, in which case for saturated
colours, red*greeen = red*blue = black.  When the parameter is positive, the colours are
brightened before multiplying, then de-brightened.  The result is that mixing saturated
red and green will give a dark yellow, while red and blue will give dark purple.

For monochrome plotting, the colour range previously went from white at the foot
of the colour bar, through the specified colour c at 3/4 the way up the colour bar),
to (2/3)*c (a darker version of c) at the top.  The latter part has been eliminated
and the colour bar now goes from white at the foot to the selected colour at the top.

There may be some rough edges in the implementation still.  In particular, adding,
deleting, or renaming a morphogen may not refresh all the places in the mesh structure
where morphogen names or indexes are stored.  Sometimes the plot may not be updated
when it should; to force a replot, use the Plot/Replot menu command.

The azimuth, elevation, and roll angles are now displayed just to the right of the top
of the colour bar.  (You may have to make the window wider or less tall to see them --
the resizing algorithm isn't taking them into account in placing the GUI elements.)
The default values can be set by two commands on the Plot menu.  Set Default View From
Current makes the current view the default.  Set Default View... brings up a dialog
wherein you can type the desired values.  The default view is the one you get by clicking
the little square at the intersection of the azimuth and elevation sliders.


2009 Apr 07 Tue

Multiple morphopgens can be plotted simultaneously.  Each morphogen will have the
colour selected for it in the colour picker next to the Monochrome checkbox.
However, this is at present only available through the interaction function.  If
you want a multiplot of morphogens 'FOO' and 'BAR', place the following code in
the i.f., so that it will run every time the i.f. is called:

        m = leaf_plotoptions( m, 'morphogen', { 'FOO', 'BAR' } );

Unfortunately, this will revert to plotting a single morphogen the next time you
change the plot options in the GUI, or change the selected morphogen, or do anything
else that forces a replot.  Only the plot that happens immediately after a simulation
step will do the multi-morphogen plotting.  I will be working on improving this.

The length represented by the scale bar is now by default automatically chosen to be
"reasonable", i.e. to provide a bar that is not excessively long or short, while
representing a roundish number.  In the Params/Distance Unit command, set a positive
value to specify exactly the length you want, or zero to get the default choice.


2009 Apr 06 Mon

There is now a scale bar at the bottom left of the plot.  By default it is
one unit long, but this can be changed by the Params/Distance Unit... menu
command.  The Show/Hide Scale Bar command on the Plot menu turns it on and off.

The azimuth, elevation, and roll angles are now shown just to the right of
the colour bar.  The numbers are degrees.

I'm in the middle of making it possible to plot multiple morphogens in different
colours.  The colour picker next to the Monochrome checkbox on the Plot options
panel now selects the colour only for the currently plotted morphogen.  (However,
it simultaneously sets that colour for all plotting of output quantities.  It will
eventually be fixed so that the output quantities can have their own separately
specified colours as well.)  By default, every new morphogen is red; while new meshes
and upgraded old meshes are given colours for their existing morphogens which are
saturated, bright colours of various hues spaced around the colour circle.

The command-line equivalent for specifying morphogen colours is:

    m = leaf_mgen_color( m, 'morphogen', mgens, 'color', colors );

These colours will only be used when the Monochrome checkbox is checked, otherwise
the rainbow colour scheme will be used.

This is just preparatory to providing a way to specify plotting multiple morphogens
simultaneously....which is not done yet.  I am thinking that it would be too complicated
to provide anything in the GUI for this.  From the command-line, I only need to extend
leaf_plot to handle a 'morphogen' argument consisting of a list of morphogens.  How to
make this available in the GUI or from the interaction function is trickier.


2009 Mar 31 Tue update 2

Bug fix to previous update.

Exporting to VRML can now write out the clones as well.  The implementation is
so far incomplete, in that not all of the plot options are implemented.  Each
clone will appear on both sides of the mesh (i.e. "Plot/Duplicate cells on both
side" is treated as being always on).  Clipping is (still) not supported.

Note that to see clones in the VRML output, you must see clones in the on-screen
plot.  In general, what you see in the plot should be what you get in the VRML.


2009 Mar 31 Tue

The mutant levels of morphogens are no longer stored in the static data file.
This means that when setting the mutant level of a morphogen (on the Factors
panel), the setting only has effect for the current state of the mesh rather
than all stages of the project, and will not be saved to disk until you
explicitly save the mesh.  This is also true of the mgenswitch component of
the mesh, but I don't think anyone ever uses that.

There are some internal changes to the way that GFtbox manages the camera
parameters.  This should not produce any visible changes, but if you see the
camera viewpoint behaving unexpectedly, let me know.


2009 Mar 27 Fri

leaf_subdivide now takes an extra option, 'force', which is true or false.
If true (the default), all of the requested subdivisions will happen.  If
false, edges will not be split where this would result in excessively small
cells or cell angles.


2009 Mar 26 Thu update 2

It is now possible to use a morphogen to control where edges of the mesh may
be split.  Rather than create a new standard morphogen to do this, I've added
a command to let the user nominate any morphogen for the role.

    m = leaf_splitting_factor( m, morphogenname );

nominates the named morphogen to control mesh transformations.  Pass the empty
string to turn this feature off.  When a morphogen is nominated for this purpose,
automatic splitting of long edges will only be performed if the morphogen has a
value of at least 0.5 at both ends.

You may also want to do this:

    m = leaf_mgeninterpolation( m, 'morphogen', morphogenname, ...
            'interpolation', 'max' );

so that when an edge from a vertex with a high value of the morphogen to one with
a low value is split, the new vertex obtains the high value.

The 'mgensplit' project in the standard Motifs directory illustrates how to use this
feature.


2009 Mar 26 Thu

The Enable checkbox on the Interaction panel has been replaced by a menu command
Misc/Enable Interaction Function, because the checkbox was too easy for people
to click by accident.  In addition, when the interaction function is disabled,
the word "DISABLED" appears in the Interaction panel.

A new function obj2vrml(infile,outfile) will convert any OBJ file to VRML
(VRML 97, to be precise).  It only handles the following parts of an OBJ file:
"v" (vertex coordinates), "f" (face vertexes), "vc" (vertex colours) and "fc"
(face colours).  This is for creating VRML files that can be used in our new 3D
printer.  A forthcoming version of GFtbox will include a menu command to save
as VRML directly.

A new command Mesh/Save VRML saves the current mesh as VRML, suitable for
printing on the 3D printer.  The command-line equivalent is leaf_save( m, filename )
where the file name has a '.wrl' extension.  The file will be saved into the meshes
subdirectory of the project.  Currently only the shape and the colours of the
current plot are saved: clipping and the biological layer are ignored.

When saving OBJ or VRML files from the command line, leaf_save now takes an extra
option, 'bbox'.  The value
is either a single number, a triple, or a sextuple, and specifies a bounding box.
The mesh will be scaled to fit into the bounding box.  The scaling is isotropic: the
mesh will be scaled to fit the tightest bound, and centered in the other dimensions.
A single value specifies the size in each direction of a bounding box centred at the
origin.  A triple specifies the size along each axis of a box centred at the origin.
A sextuple specifies a bounding box situated anywhere, in the form [xmin xmax ymin
ymax zmin zmax].  From the GUI, a mesh is always saved in its actual size and position.

To view VRML files, you need either a standalone VRML viewer or a VRML plugin for a
web browser.  I recommend Cortona, downloadable free from www.cortona3d.com/cortona,
which works with Firefox and Internet Explorer on Windows.

Diffusion calculations are now interruptible by the Stop button.


2009 Mar 25 Wed

Taking a high-res snapshot (with "Misc/Snapshot Screen Res" turned off) no
longer leaves the GUI in a scrambled state.


2009 Mar 24 Tue

The "Params/Time unit..." command was failing to set the current time.
Fixed.


2009 Mar 20 Fri

The "Plot output quantity" has two new items (actually old ones reinstated):
"Specified growth" and "Specified bend".  These plot the per-face tensor
quantities calculated from the per-vertex growth morphogens, and allow a more
direct comparison between what you asked for and what you got.

Took out some unnecessary debugging messages.


2009 Mar 17 Tue

A difficulty in setting breakpoints within interaction functions has been
removed.  (Technical explanation: the Restart and Reload buttons now invoke
leaf_reload with the 'rewrite' option set to false.)

There are two new options on the Plot menu, "Opacity..." and "Ambient Strength..."
These let you set the opacity of the mesh and (if the light source is turned on)
the strength of the ambient light.  Both range from 0 to 1.  For opacity,
1 = completely opaque and 0 = invisibly transparent.  For ambient light, 0 is
none and 1 is the maximum.  From the command line, these are the options 'alpha'
and 'ambientstrength' to leaf_plot and leaf_plotoptions.


2009 Mar 16 Mon

Took out an unnecessary debugging message on startup.

Greatly speeded up the creation of clones.

The static file (the file xxxx_static.mat in the project directory) is now
automatically updated whenever any of the data stored in it changes, instead
of being updated only when you explicitly save the current mesh.  This means
that when you change plotting options, diffusion constants, or various other
properties of the mesh, the changes will automatically persist even if you
immediately close the project or close Matlab.

Diffusion constants etc. written as comments to the interaction function
are now printed with enough significant figures to be able to see them, even
if they are very small.


2009 Mar 12 Thu

New command on Plot menu: "Make External Figure".  This invokes a dialog allowing
you to plot any stage file of the current project in a separate window.

New option on Plot menu: "Duplicate Cells on Both Sides".  By default this is on,
and the biological layer is plotted on both sides of the mesh.  If this is off,
each biological cell is plotted on only one side.  Which side it is on is chosen
randomly when it is created with the "Scatter cells" button.  Voronoi layers
("Fill with cell" button) are always entirely on the A side.

New option on Misc menu: Rectify Verticals.  The default is false.  When true,
if physical thickness of enabled (on the Mesh editor panel), then after each
iteration, fininte element vertex pairs on opposite sides of the surface are
moved so as to make the line joining them perpendicular to the surface.  This 
prevents excessive amounts of shearing of elements building up.


2009 Mar 09 Mon

Bug fixes, updates to manual.


2009 Mar 05 Thu

The controls on the Cells panel have been rearranged.  The "Frac. cells" slider
and text box no longer exist.  Use "Number of cells" to specify the number of
cells you want.  On the command line, use the 'numcells' option, not 'fraccells'
in leaf_makesecondlayer.

When biological cells were being created, and were much larger than the finite
elements, they would not always be created circular.  Now they are; a side-effect
of doing this properly is that generation of biological cells can be much slower.


2009 Mar 03 Tue

The manual has been updated (available on the Help menu).

More internal bug fixes.


2009 Mar 02 Mon

There are three new mesh types: cup, cap, and capsule.  These are cylinders with
a hemispherical end cap on the bottom, the top, and both ends respectively.
Extra parameters in the GUI allow specifying the height of the hemispheres and the
number of rings of triangular elements they are divided into.

The size, shape, thickness, and colour of polariser gradient arrows is now settable
in leaf_plot and leaf_plotoptions.  The default values are:
    'arrowthickness', 2         Pixel thickness of the lines making up the arrow.
    'arrowheadlength', 0.5      Head length as a proportion of total length.
    'arrowheadratio', 0.3       ratio of half the width of the arrowhead to its length.
    'highgradcolor', [0 0 0.3]  Colour of polariser gradient arrows where the gradient
                                is above the threshold for effectiveness.
    'lowgradcolor', [0.5 0 0]   Colour of polariser gradient arrows where the gradient
                                is below the threshold.
The default arrowheadratio was previously 0.6, but by request this has been reduced.
At the moment these cannot be varied through the GUI.

The "Set all zero" button on the Morphogens panel no longer zeros the diffusion constants,
only the morphogen values, production rates, and clamp settings.

The default value for the tolerance when calculating diffusion has been lowered from
0.001 to 0.00001.

Bug fixes.


2009 Feb 27 Fri

Fixed an interaction between growth, mesh retriangulation, and the biological layer
that was misplacing some of the biological cells.

In some circumstances, after rewriting an interaction function for compatibility with
the current version of the toolbox, Matlab would still see the old version.  This is
now fixed.  (Handy Matlab tip: after a piece of Matlab code has rewritten a function
and closed the file, call clear(functionname).  This will force Matlab to forget any
cached compiled version and recompile the source file the next time the function is
called.)

Fixed some errors in the loading of stripped meshes.


2009 Feb 26 Thu

Some bug fixes to maintain compatibility with older projects.


2009 Feb 25 Wed

The thicknessAbsolute component of globalProps has been moved to globalDynamicProps.


2009 Feb 24 Tue update

The cellscale component of globalProps has been moved to globalDynamicProps.
This corrects a problem whereby the lengths of polarisation gradient arrows
were not correctly scaling with the size of the mesh.


2009 Feb 24 Tue

Clipping now clips the biological layer as well.

I've made a fairly large change to how certain things operate.  This is an
alpha-test version, released by popular demand.  Use with caution; a project
upgraded to this version will not be usable by any earlier version.

The change is that most properties of the mesh are now saved in a single file
per project, called (modelname)_static.mat.  Everything, in fact, except for
the parts that must differ between stage files:
    the geometry
    the morphogen distribution
    the current time, current iteration, current area, and a few other small things

In particular, the diffusion constants, dilution setting, mutant level, simulation
options, plot options, and more will remain unchanged when you load a new stage file.
If, for example, you change a dilution constant and save the mesh, the new value will
be applied to all previously saved stage files.  Whatever morphogen you were
plotting, and with whatever clipping options, those settings will continue in force
when you load a different stage file.  When you save any stage file, or the initial
mesh, all of those static settings will be written out to the (modelname)_static.mat
file and will be read in again the next time the project is loaded.
  
Note that you may have to edit your interaction functions to be compatible with
this version, after which they will not be compatible with previous versions.
Everywhere that you use any of these:
        m.globalProps.currenttime
        m.globalProps.currentIter
        m.globalProps.laststagesuffix
        m.globalProps.currentArea
        m.globalProps.previousArea
        m.globalProps.locatenode
        m.globalProps.locateDFs
you must replace globalProps by globalDynamicProps.

There is a new button on the interaction function panel called "Rewrite".  This
forces the i.f. to be rewritten to be compatible with the current version.
Normally this happens automatically when required, but I was experiencing a certain
loss of faith that it always was.  This only rewrites the automatically generated
parts, the user code must be updated manually as described above.


2009 Feb 19 Thu

Clipping can now be specified by a combination of morphogen values: only nodes
with specified morphogen values above or below a threshold will be displayed.
This is accessed through a new checkbox on the Plot panel called "Clip" and a
button "Mgens".  The checkbox turns the feature on and off.  The button brings
up a dialog in which you can specify a set of morphogens, a threshold, and
select options above/below and all/any with radio buttons.  Above/below determines
whether the visible nodes are those with values above or below the threshold.
All/any specifies whether the nodes must have values above/below the threshold
for all the selected morphogens, or for at least one.

The features can be accessed from the command line by new options to leaf_plot
and leaf_plotoptions:

'clipbymgen'    Boolean, turns the feature on and off.

'clipmgens'     An array of morphogen indexes or a cell array of morphogen names.

'clipmgenthreshold'  The threshold, a real number.

'clipmgenabove' Boolean, true if the visible nodes are those at or above the threshold,
false if the visible nodes are those at or below the threshold. Note that nodes precisely
at the threshold are always visible.

'clipmgenall'   Boolean, true if the visible nodes are those for which all the
specified morphogens satisfy the threshold, false if only at least one needs to.


2009 Feb 18 Wed

Bug fix: leaf_iterate was trying to access the GUI in some circumstances where it
was being run from a script with no GUI.

Some warning messages about non-fatal defects in the mesh have been suppressed.

A new menu command Misc/Validate Mesh gives a verbose report to the command
window about defects in the mesh.

leaf_requeststages can now give names to stages.  The 'names' option takes a cell
array of strings of the same length as the stages given in the 'stages' option.
These names are displayed in the Stages menu but are not otherwise used.
When leaf_requeststages is used in 'add' mode, new names, if supplied, override
old ones for stages of the same timestamp.  This feature is not currently
available in the GUI.

Bug fix: the calculation of an initial estimate sometimes yielded invalid data.


2009 Feb 17 Tue

The Run panel has been reorganised. "Run for" runs for a specified number of
iterations.  "Run until" runs until a given time.  "Run to" runs until a given
multiple of the initial area is reached.

The way that stage files are handled has been revised.

When saving the current project as a new project:

1.  If the current mesh is the initial mesh, it is saved as the initial mesh
of the new project.  Otherwise, it is saved as a stage file of the new project,
and the initial mesh of the current project is copied to the initial mesh of the
new project.

2.  Stage files are not copied across.  However, a record of the stage times is
preserved in the current mesh.  However, note that if the current mesh is not the
initial mesh, then if the initial mesh is reloaded, only the stage times
recorded in that mesh will appear in the Stages menu.

Stages listed in the Stages menu for which no file exists are indicated in
parentheses.  Selecting one of these files will cause that stage to be computed
starting from either the current mesh or the latest existing stage before the
requested stage, whichever is later.

The "Compute More Stages" command now adds the requested stages to the Stages
menu before computing them, so that if you interrupt the computation, the
requested stage times still appear on the menu (parenthesised, for the files
that do not exist).

The "Request More Stages" command adds the requested stages to the Stages
menu, but does not compute them.  The command-line equivalent is 
    m = leaf_requeststages( m, times );
where times is a list of stage times (as floating point numbers).  Times
already saved will be retained; call
    m = leaf_requeststages( m, times, 'mode', 'replace' );
to discard any previously stored times.  Note that any existing stage files
will have their times added back in the next time the Stages menu is accessed.
leaf_requeststages does not recompute any stages.

On the command line, if no explicit list of stages is given to
leaf_recomputestages, it will recompute all stages stored in the mesh by
leaf_requeststages.

The Stages menu contains new commands "Delete All Stages..." and "Delete All
Stages and Times...".  These both ask the user for confirmation, following
which the first deletes all stage files for the current project, and the second
deletes the stage files and removes all the stage times from the menu.
The command-line equivalent is m = leaf_deletestages( m, 'times', boolean ).

The way that stage times tend to disappear when you load a different stage file
is an instance of a general problem.  Some of the information in the mesh is
dynamic: it must be different in each stage file: all of the geometry and
the distribution of morphogens.  Other parts of the information shoudl perhaps
be the same for all stage files.  For example, the interaction function is
already treated this way: there is only one (although a backup copy is saved
with each stage file, only the current i.f. is executed when a stage file is
loaded and run.  Perhaps the stage times, diffusion constants, plot options,
morphogen set, and in fact everything but the geometry and morphogen distribution
should be handled in this way: a single version that applied to every stage file.
Thus changing the diffusion constant of a morphogen would apply immediately to
every saved stage.

Implementing this would involve saving each mesh as two files: one for the dynamic
part and one for the static part.  The static part would be a single file per
project, while the dynamic part would be one file for each saved stage in the project.


2009 Feb 13 Fri

On the Misc menu is a checkable menu item, "Use Prev Disp As Guess".  When
checked, the displacements computed on the previous step will be used as the
initial estimate for the displacements being computed on the current step.
For complex models, this can substantially reduce the time for each
simulation step.  By default this is turned on.  The property is stored in
the mesh and can be set from the command line by
    m = leaf_setproperty( m, 'usePrevDispAsEstimate', trueOrFalse );

More data is written to the interaction function:
Randomness of the mesh geometry, even if zero, and
dilution-by-growth setting for each morphogen.


2009 Feb 12 Thu

Bug fix -- was crashing during simulation steps in some circumstances.

When reverting to an earlier version, GFtbox did not correctly display the
version number.  Fixed.


2009 Feb 11 Wed

The GUI elements in the neighbourhood of the factors menu have been rearranged
in order to reduce the chance of accidental clicks on the wrong element. In
particular, the CLEAR button has been removed and replaced by the "Close
Project" item on the Projects menu. Functionality is unchanged.

The Recompute Stages... menu command was not handling user interrupts properly.
This has been fixed.

Command-key equivalents for some of the GUI elements have been removed.
I don't think anyone ever used them.

Note that the more responsive handling of the Stop button means that a 
simulation step can be interrupted in the middle. The mesh will still be
a valid data structure as far as the program is concerned, but on the
interrupted step, its interaction function will have been run and the
time incremented, but the displacements will have been discarded. This
may make its state inconsistent from the point of view of the user, and
you will probably want to reload the previous saved stage before continuing.


2009 Feb 06 Fri

If the user interrupts the current simulation step, the computed
displacements are discarded and no change is made to the mesh.  However,
the time is incremented; this is because the interaction function will
have been called and may have made changes to the mesh anyway.

The "Set Legend..." button on the Plot options panel has been moved to the
Plot menu.

Beneath the "Decor" buttons on the Plot options panel is a text box labelled
"Sparsity".  When this is zero, the decorations (gradient arrows, etc.) are
drawn in every finite element.
When it is positive, they are drawn only in a subset of the elements chosen
so that their centres are never closer than the sparsity value times the
maximum diameter of the mesh in the x, y, or z directions.  The decorations
will also be scaled to this distance.  From the command line, this parameter
can be specified as the 'sparsedistance' argument to leaf_plot or leaf_plotoptions.
A value of zero will draw decorations in every finite element.

All GUI controls now have tooltips.


2009 Feb 05 Thu

If the interaction function changes any parameter of the mesh which is
displayed in the GUI (e.g. diffusion constants, Poisson's ratio, etc.)
then the GUI will be updated at the end of the current simulation step.
Previously, the GUI would not update until it happened to need to.

Tooltips have been added to many of the GUI controls.

The GUI is now much more responsive to the Stop button.


2009 Jan 28 Wed

The plotting of the polarisation gradient has changed: the arrows are now
independent of the growth morphogens and indicate just the polarisation
gradient, irrespective of whether there is any growth or not.  The arrows
have also been made a little larger.

2009 Jan 23 Fri

New menu command Mesh/Flatten interactively flattens every connected
component of the mesh.


2009 Jan 21 Wed

Made MoveStagesToProject() available on the Stages/Import Experiment Stages...
menu command.

Fixed error in layout of the dialog invoked by the Stages/Compute More Stages...
command.

Extended setaxis() to allow for 2D coordinates.

In the procedure leaf_makesecondlayer, the 'probpervx' option can now take a
morphogen name or index as its value.  The effect is that the values of the
specified morphogen will be used as the probability per vertex for creating a
clone.  For example, the following command will create 200 clones, distributed
according to the value of KAPAR.

    m = leaf_makesecondlayer( EXTERNMESH, ...
            'mode', 'each', ...
            'probpervx', 'KAPAR', ...
            'numcells', 200 );

Note that the probpervx values are all relative: they will be normalised by replacing
all negative values by zero and then scaling to make the total probability per finite
element equal to 1.  If all the probabilities are zero, clones will be created with
uniform density.

In addition, when either probpervx or probperFE is specified, the probabilities are
additionally weighted by the areas of the finite elements.  Thus if a uniform
probability field is specified, a uniform density of clones will result, regardless
of the sizes of the finite elements.  The values supplied for these options should
therefore be thought of as probabilities per unit area, near each vertex or within
each cell respectively.


2009 Jan 20 Tue

Fixed error in stripping and inflating meshes: meshes weren't being inflated on
loading.

Added function MoveStagesToProject(ProjectDirectory) contributed by Andrew.  See
help text for details.

The edge width and vertex size items on the Cells panel now preserve their settings
from one invocation of GFtbox to the next.


2009 Jan 19 Mon

There is a new menu command, Misc/Strip Saved Meshes.  When this is checked
(the default is unchecked), all unnecessary components of the mesh data structure
will be deleted before saving to a MAT file.  They will be reconstituted when 
the MAT file is loaded.  The reason that this is not always done is that at
present, not all of the deleted information can be reconstituted: all information
about residual strain and the displacements from the previous iteration is lost.
If you are running the model with no strain retention then this will make no
difference.  Stripped meshes can give MAT files 1/10 of the size.  A future version
will retain all the information needed to perfectly reconstruct everything, but in
the meantime this may still be useful.

The command-line equivalent is the 'strip' option to leaf_savemodel, which takes
a boolean value.


2009 Jan 15 Thu

1.  The "Cells A/B" radio buttons have been renamed and their functions changed.
They are now called "Decor A/B".  Whichever is selected, that is the side of
the mesh that certain decorations are always drawn on, when the mesh is being drawn
as a material of finite thickness.  These things are: thickly drawn edges of
the finite elements, polarisation gradient arrows, strain crosses, and cell
normals.

To know which side is which, look and see which side those decorations appear.

Note that biological cells are always drawn on both sides of the mesh.

2.  A demo of flattening is now available.  If you have a variable m containing
a mesh (e.g. loaded from a .mat file or exported from GFtbox by the
Wizard/Export Mesh command), then the command demoFlatten(m) will, one by one,
go through all of the connected components of m and demonstrate their flattening.
See HELP DEMOFLATTEN for details.

Some more development will be required to make this a feature of GFtbox.


2009 Jan 14 Wed

More work on flattening.  Not ready for public release yet.


2009 Jan 13 Tue

The amount of randomness added to the mesh when it was created is now
stored in m.meshparams.randomness, and written to the interaction function
when the interaction function is created or the initial mesh is re-saved.
Meshes created before this change will have no stored value for randomness,
since the randomness is not a discoverable property of the mesh itself, only
of the way it was created.

There are numerous other new source files, but these should be ignored.  They're
work in progress.


2008 Dec 23 Tue

There is a new Flatten button on the Simulation panel, but it isn't much use yet.
It will flatten each connected component of the mesh onto its best-fit plane.
This is not (yet) a solution to the flattening problem, since what we want is
to flatten the mesh while distorting it as little as possible.  The Flatten button
flattens it while paying no attention to the distortion.


2008 Dec 22 Mon

A plotting error has been fixed, that caused strange results while recomputing
stages with clipping enabled.

A new command on the Projects menu, "Open Current Project Folder" opens the
current project folder window.  This only works on Windows.  If a Linux guru
can tell me how to do this on Linux, and how to discover whether Matlab is
running on Linux, I'll make this available on Linux; likewise MacOS.


2008 Dec 15 Sun

The view controls have been reimplemented.  The Pan/Zoom/Rot buttons are now
Pan/Zm/Rot/RU.  Rot and RU both perform trackball behaviours.  RU keeps the
Z axis upright, and changes only azimuth and elevation, while Rot allows
arbitrary rotations.  For both types of rotation, the azimuth/elevation/roll
scroll bars will keep track with the trackball effect.

To operate any of these controls, you must click on the background, not the
mesh itself, which will process mouse clicks in the usual way (e.g. editing
morphogen level, etc.) even while one of the view control buttons is active.


2008 Dec 12 Fri

There is now another scroll bar to the right of the elevation scroll bar, which
rolls the view around the view direction.  Clicking on the white square at the
foot of the roll scroll bar sets the roll angle back to zero.  Clicking on the
white square at the foot of the elevation scroll bar sets the default view.  

The view is now reset to the default view on loading a mesh.


2008 Dec 11 Thu

The way that GFtbox manages the camera position and orientation has been
completely changed.  I will shortly (i.e. in January) be implementing better
pan/zoom/roll controls that will work better with the rest of the program.


2008 Dec 10 Wed

The 'Compute More Stages...' dialog is a little more user-friendly: any
syntax error causes the dialog to be re-presented with an error message.


2008 Dec 09 Tue

Updates to stereo rendering code (not applicable to running GFtbox from the GUI).

Clicking on the background of the picture area will rotate the mesh in 3D,
even if the 'Rot' button on the Plot panel is not selected.  Unlike the effect
of the 'Rot' button, the rotation is not constrained to maintain the vertical.
Clicking on either the azimuth or elevation scrollbars has the side-effect of
restoring the vertical.  This new behaviour will eventually be better
integrated with the Pan/Zoom/Rot controls and the az/el scroll bars.

The behaviour of the 'Save As...' button and the leaf_savemodel commands
have changed.  When saving to a new project, the current state of the mesh
is saved as the initial state only if it is the initial state of the old
project, and is otherwise saved as a stage file.  All stage files of the
old project, and its initial state, are copied across to the new project,
except for any file that corresponds to the state that has just been saved.
The notes file and interaction function (if any) are also copied across.
Movie files and snapshots are not copied.

Or to put that more briefly, 'Save As...' saves a new copy of a whole project,
not merely the current state.

There is not currently any way to save a non-initial state as the initial
state of a new project, but if there's a demand for this, I can put it in.


2008 Dec 08 Mon

If you uncheck the Auto-name checkbox below the 'Record movie...' button,
the resulting file dialog will automatically start in the project's movies
folder, creating it if necessary.

The Help menu has been extended to include access to small help files
contained in the 'Help' directory in the toolbox directory.  Anyone can write
more of these.  Make them as plain text files and use the string you want
to appear in the Help menu as the file name, with .txt on the end.

The revision number is now visible in the menu bar.


2008 Dec 05 Fri

The 'Recompute More Stages...' command allows the user to specify any set of
stages to compute, even if they have not already been computed.  It brings up
a dialog box into which you can type the times of the stages you want.  For
a sequence of stages at regular intervals, the Matlanb syntax START:INCR:END
is supported: this means a sequence whose first element is START, whose
consecutive elements differ by INCR, and which ends at the last such value
less than or equal to END.  Note that because of the imperfection of floating
point arithmetic in computers, when any of these numbers is fractional, you
should specify a value of END fractionally larger than the final value you want.

When there are mutant levels for any morphogens, the list of mutant morphgens
is included in the legend.


2008 Dec 04 Thu

The 'Recompute Stages' command can now be interrupted by the Stop button.


2008 Dec 03 Wed

The 'Version' menu has been revised.  It contains two menu items, neither of
which do anything, but they tell you the SVN revision number of the toolbox
and the date of the revision.  (Note: I have found that the date that I am
extracting from the SVN admin files is not necessarily correct.  The revision
number should be, though.)

The toolbox SVN revision number and date are stored in the mesh and written to the
interaction function.  If you load a model that was saved from a more recent
version of GFtbox than the one you are running, a warning will be printed to
the command window, and the Run panel will turn and remain yellow.

If the model is stored on SVN, then the model's revision number and date are
also discovered and written to the interaction function.  Note that these are
completely independent of the toolbox revision number and date.

For programmers who want to access SVN revision numbers from their own code, the
function

    [rev,date] = svnrevision(dir,recurse);

will find the revision number and date for any directory that is stored on SVN.
If recurse is true, it will scan all subdirectories and return REV as a list
of all revision numbers found, in descending order, and DATE as a cell array of
all dates found, in descending order.  If recurse is false it will look only at
the current directory, and return a single revision number and a date string.
If the directory is not stored on SVN, or anything else goes wrong, the revision
number will be zero and the date string empty.  Date strings are in standard
Zulu format, e.g. 2009-01-01T00:00:00.000000Z.  (Technical note: the revision
number is the third token in the .svn/entries file, and the date is the sixth
token.  It is not entirely clear to me at the moment precisely what the date is
the date of.  It is usually older than the actual date at which changes were
last committed.)

The function [rev,date] = GFtboxRevision() will return the revision number and date
of GFtbox.


2008 Dec 02 Tue

Every project can now have a notes file associated with it.  This is just a text
file whose name is foo-notes.txt for a project called foo.  You can write anything
you like in this file -- GFtbox does not use it for anything.  The 'Notes' button on
the 'Interaction function' panel will open the notes file in the editor, creating
it if necessary.  When a project is saved as a new project, if it has a notes file
then it will be copied across and opened in the editor.

The 'Initialisation' panel has gone, as I never implemented the concept of a
separate initialisation function.  The 'Initialise' button has been moved to the
'Interaction function' panel and renamed to 'Call'.  Clicking this button calls the
interaction function.

Lighting can be turned on and off from the Plot menu.  The shading scheme is flat,
as Matlab can only do Gouraud or Phong shading for 'surface' objects, not the
general polygon sets that GFtbox draws.

The 'Recompute Stages' command now updates the legend and status text on each
iteration, and sets the busy indicator during the computation.


2008 Dec 01 Mon

The 'Recompute Stages' item on the Stages menu will recompute and resave all
stages from the current state to the last stage in the menu.  From the
command line,

    m = leaf_recomputestages( m, 'stages', [...], 'plot', -1 )

will do the same.  The array [...] should be a list of the times for which the
stage file should be saved.  In this example, the 'plot' option specifies that
no plotting of the mesh should be done: the plot option behaves here exactly as
it does for leaf_iterate.

When a mesh is created, the parameters and the type of the mesh (circle, rectangle,
etc.) are stored in the mesh.  If there is an interaction function, this information
is written to it as comments.  When a mesh is loaded that has this information stored
it will be copied to the corresponding elements of the GUI in the Mesh Editor panel.
Meshes created before this feature was introduced will not do this, as it is not
possible for GFtbox to figure out what the parameters were.

Minor bug fixes.


2008 Nov 28 Fri

When the size of polarisation gradient is below the threshold set by the
"Min pol grad" box in the Simulation panel, the gradient vector is frozen in
at its last value instead of being set to zero.  When plotting, frozen gradient
arrows are drawn in dark red, normal gradient arrows in dark blue.

New command leaf_rotate( m, ... ) allows the mesh to be rotated arbitrarily.


2008 Nov 27 Thu

Fixed an error in the plotting of actual/residual growth/bend.

Prevented the "Internal rotation" setting from being changed while the
simulation is running.

In principle, bulk modulus and Poisson's ratio can now vary over the mesh.
There is no user interface to access this feature yet.


2008 Nov 26 Wed

leaf_makesecondlayer now takes two new options, allowing the probability of
a cell to be created within an FE to be specified.  'probpervx' is a vector
specifying for each vertex of the mesh, the probability of creating a cell
near it.  'probperFE' specifies the probability for each FE.  The given
probability vector will be normalised to sum to 1.  The 'numcells' option should
also be given to specify the total number of cells to create.  These cells
will be distributed according to the given probabilities.

How you make these probabilities is up to you, but here is an example of what
you could do in your interaction function:

    m = leaf_makesecondlayer( m, 'mode', 'each', ...
                                 'numcells', 100, ...
                                 'probpervx', kapar_p+kaper_p );

This will create 100 cells distributed according to the total growth rate.


The arguments for leaf_colourA have changed.  Instead of 'uniform' and 'random',
the options are 'colors' and 'colorvariation', which have teh same meanings as for
leaf_makesecondlayer.


Errors in colour scaling of plotted quantities and in the colouring of biological
cells have been fixed.


2008 Nov 24 Mon

Fixed an error causing the colour mapping to sometimes be wrong.
Fixed an error causing the residual strains to be always zero.


2008 Nov 21 Fri

Fixed an error in the saving of projects.

New project in Motifs/rimripple, simulating the edge-rippling described in
Sharon, Marder, and Swinney "Leaves, Flowers, and Garbage Bags: Making Waves",
Am. Sci. v.92, 254-261, 2004. 


2008 Nov 20 Thu

The Motifs menu on the Projects menu is now implemented.  This behaves like the user
projects menu item, but loads projects from a Motifs folder within the GFtbox folder.
Projects loaded from the Motifs menu are automatically copied to a Motifs folder
within your user projects folder, and the original copy is left unchanged.

The current contents of the Motifs folder on SVN is just what I happened to have in
my Motifs folder.  It is likely to change arbitrarily in future.  Ideally, each
Motif project should have a text file explaining what it is supposed to demonstrate.

The Refresh item on the Projects menu causes the Motifs and user project folders to
be rescanned and the menus rebuilt.  This is not done automatically whenever the
Projects menu is accessed, as it can take a perceptible time.  The menus are
automatically refreshed whenever you either change the user projects folder of save
a new copy of a project (including the automatic copy-save when a Motifs project is
loaded.)


2008 Nov 18 Wed

The previous version accidentally lost the output quantity menu, which
slipped down the back of the sofa.  Now restored.

For command-line users:

leaf_loadmodel takes two new options, 'copyname' and 'copydir'.  When called
with these options, the loaded mesh is saved into a new project folder
whose name is the value of copyname and whose parent folder is the value of
copydir.  No files in the original project folder will be changed.  If the new
project folder already exists, it will be overwritten without warning.  If it
does not already exist, it will be created.  If for
any reason the project cannot be saved into the new folder, no model will be
loaded and the result will be [].  The purpose of this extension to leaf_loadmodel
is to allow projects to be accessed read-only.  In the GUI, this will be automatically
done when a project is loaded from the "Motifs" menu (which is not yet implemented).
The arguments default to the name of the loaded project and its
parent folder respectively.  If copyname is '?', the user will be prompted
to select/create a folder.  The folder specified by copydir must exist already.

leaf_savemodel now returns an optional second result, a boolean to say whether the
mesh was successfully saved.


2008 Nov 17 Mon

Previously, whenever a project was loaded, GFtbox would immediately rewrite
the interaction function in order to ensure its compatability with the current
version of GFtbox.  This is now done lazily, i.e. the interaction function
will not be rewritten until the first time it is called.  This ensures that
you can look at a project without immediately changing its i.f.  If you edit
the i.f. before it is ever called, you will see the original version.

There is now a new menu called "Projects".  It contains the "Set Projects
Folder" command (formerly on the Params menu, and two submenus.  The
first, called "Motifs", is not used yet.  The name of the second will be
the name of your projects folder, as defined in GFconfig.txt (which is in
your GFtbox folder, but not stored on SVN).  All GFtbox
project folders found within that folder will be added to the submenu.
Selecting any such menu item loads the project.  So if you keep all of your
GFtbox projects within a single folder whose name is entered in
GFconfig.txt, you will have easy access to all projects instead of clicking
your way through the open-folder dialog.

The "Motifs" menu is intended to work similarly on a folder of "standard"
example projects to be distributed with GFtbox, but before I implement that
I'll need to work out a way to avoid people accidentally overwriting those
projects and uploading them back to SVN.  Perhaps opening a "Motif" should
first make a new copy of it in your normal projects folder, and open that.

At some point I will make GFtbox add to the Projects menu all projects opened
in the current session.


2008 Nov 12 Wed

The clipping plane can now be placed anywhere.  Use the new controls at the
foot of the Plot panel to set azimuth, elevation, and distance from the origin.
Azimuth and elevation are defined so that when the azimuth and elevation of
the view are the same as those of the clipping plane, the plane is parallel
to the screen and the visible part of the mesh is on the far side of the plane.

From the command line, the clipping plane can be set by these arguments to
leaf_plot and leaf_plotoptions: clippingAzimuth, clippingElevation, and
clippingDistance.


2008 Nov 11 Tue

Bug fixes.


2008 Nov 06 Fri

There is a new type of second layer: a grid of square cells.  This is for
making D'Arcy Thompson-like pictures of deformed grids.  The Cells panel has
been rearranged, but all of the old controls are still there.

Bug notice: in speeding up the code for drawing the biological layer, I've
made it impossible to click on biological cells to shock or unshock them.
The effect will be to shock every cell.  The button for shocking a random
subset still works.


2008 Nov 06 Thu

The output quantities (Actual/Residual growth/bend) are now scaled by the
timestep, so that they represent rates of growth or bend, not the amount
over the last timestep.

Two new functions are available for converting between per-vertex quantities
and per-finite element quantities:
    b = perVertextoperFE( m, a );
    a = perFEtoperVertex( m, b );
For each of these, a and b are column vectors whose lengths are respectively
the number of vertexes fo teh mesh and the number of finite elements.
These are not inverses of each other: converting back and forth will have the
side-effect of slightly diffusing the distribution.


2008 Nov 05 Wed

Various improvements of efficiency, especially when there is a large
biological layer.


2008 Nov 04 Tue

Bug fixes to leaf_snapdragon relating to the new method of building the
snapdragon with a bowl-shaped base.


2008 Oct 31 Fri

The plot panels have been reorganised.  Some of the plot options have been
moved into the new Plot menu in the menubar, to make more space in the
window.  The menus determining what is plotted have been reorganised thus:

  [x] Plot current factor
    [Factors menu]
  [ ] Plot output value
    [Outputs Menu]
    [Tensor Property]

The two checkboxes determine whether a morphogen or a growth property is
plotted.  (If both checkboxes are off, no quantity is plotted -- this is
equivalent to selecting 'Blank' on the old Plot:what menu.)

The Factors menu selects what was called a morphogen and is now called a
factor -- this change of name has been made throughout the interface
(but not within interaction functions).

The Outputs menu contains a subset of the old Plot:what upper menu:
Actual growth and bend, Residual growth and bend, and Rotation.
The Tensor Property menu is the same as before (the lower Plot:what menu).
Each of the first four items on the Outputs menu selected a tensor field to
be plotted.   The Tensor Property menu selects what component of that field
is to be displayed:
    Major       largest component of the two components most nearly parallel
                    to the surface.
    Minor       smaller component of the two components most nearly parallel
                    to the surface.
    Parallel    component most nearly parallel to the polariser gradient.
    Perpendicular    of the components most nearly parallel to the surface,
                    the one most nearly perpendicular to the polariser gradient.
    Normal      the component most nearly perpendicular to the surface.
    Areal       the sum of the two components most nearly parallel to the surface.
    Total       the sum of all three components.

When the selected item on the Tensor Property menu is a single component
(i.e. not 'Areal' or 'Total'), checking the 'Tensor axes' checkbox will draw
the axis as well, in each finite element.

There are two new parameters to the Snapdragon mesh: 'Bowl' and 'BowlRg'.
These enable the base of the snapdragon to be a hemisphere instead of a
disc.  The value of 'Bowl' is the depth of the hemisphere as a proportion of
its radius (e.g. Bowl=0.5 gives a squashed hemisphere).  'BowlRg' specifies
the number of rings of finite elements to divide the base into.  If this is
zero the program will choose a default value.


2008 Oct 27 Mon

leaf_loadmodel and leaf_reload now take an option 'rewrite'.  If true (the
default) the interaction function is rewritten when the mesh is loaded, to
make sure it is compatible with the current version of GFtbox.  If false, it
is not.  Set rewrite to false when running GFtbox in multiple processes all
accessing the same project, to prevent interference between them.

leaf_plot takes a new option, 'uicontrols'.  By default this is true.  If it is
false, the sliderbars and text items will not be drawn.  This is to facilitate
off-line use with no graphic environment.

Flattening is now more effective than it was.  There is a new item in the
Simulation panel, called "Flatten ratio".  It can probably be ignored, but if
flattening produces chaotic results, try reducing the value.  Alternatively, if
flattening appears to be very slow, trry increasing the value.

The "Specified bend", "Actual Bend", and "Residual Bend" items on the lower
Plot:what menu have now been implemented.


2008 Oct 24 Fri

leaf_plot now takes an extra option, 'invisibleplot', by default false.
When true, the figure into which the mesh is being plotted is made in visible.
This is for use when driving the toolbox from the command-line on a machine
(e.g. the cluster) with no graphics.  The graphic structure representing the
figure is still created by leaf_plot, and the print() function can be used to
record a snapshot, but no graphic environment is required.


2008 Oct 23 Thu

There is a new item on the upper pulldown menu in the Plot:what panel, called
"Rotation".  This plots the component of angular velocity of each finite
element that is parallel to the surface.  The units are radians per second.
At the moment this is not compatible with edge-splitting -- spurious values
appear immediately following any such transformation of the mesh.


2008 Oct 22 Wed

Fixed error preventing new projects from being created.

Fixed error in construction of monochrome color maps.


2008 Oct 21 Tue

User-defined morphogens are now listed in alphabetical order on the morphogens
menu.

There is a limit of 1000 seconds on the elasticity computation.  It will be
abandoned if it takes any longer than this.  The limit can be changed by the
"Time limit" box in the Simulation panel.  To remove the limit, set it to zero.


2008 Oct 13 Mon

New menu command "GUI Format" allows selecting the font properties of the GUI.
When setting these, relative font sizes are preserved: the value given in the
font properties dialog applies to all the "ordinary" elements.

The file GFtbox_config.txt contains various settings that persist across
invocations of GFtbox.  Currently these are the default movie compressor,
the location of the default projects folder, and the default font
properties of the GUI.


2008 Oct 09 Thu

Various small bug fixes.


2008 Oct 03 Fri

A new field has been added, mgen_production.  This sets the rate of
production of a morphogen.  It only has an effect for diffusible
morphogens, and only when the diffusion computation is enabled in the
Simulation panel.  The production is implemented as part of the diffusion
calculation, giving a much more accurate result than changing the
morphogen value in the interaction function does.  To use mgen_production,
set it in the interaction function.  The value is a rate of production.
It can also be used for absorption: just specify a negative rate.
In general, absorption should be proportional to the amount of morphogen,
while production can be proportional to or independent of the morphogen.
For example, to cause POLARISER to be absorbed by another morphogen called
SINK, and produced by a morphogen called SOURCE do not write this:

    P = P .* inh( 5*dt, sink_l ) + 0.1*dt*source_l;

Instead, write this:

    m.mgen_production(:,polariser_i) = ...
        -P .* 5 * sink_l  +  0.1 * source_l;

The Decay parameter for each morphogen is still implemented, but is
redundant: a decay rate of D for the polariser is equivalent to writing
this in the interaction function:

    m.mgen_production(:,polariser_i) = -P .* D;


2008 Oct 02 Thu

An error preventing the loading of saved stage files has been fixed.

More information about the mesh is written as comments in the
interaction function.  (This is something in progress.)


2008 Oct 01 Wed

The Snapdragon, Lobes, and Rectangle mesh types now take an extra parameter,
called "Base".  This determines how many divisions are made around the base
of the snapdragon, the base of the lobes, or the base (the side with the
smallest value of Y) of the rectangle.  For the rectangle the number is just
the number of division along that edge, and by default is equal to the
number along the top edge.  For the lobes and the snapdragon, the number is the number of
divisions along one half of the base of a single lobe, and defaults to be
equal to the number of rings.  


2008 Sep 30 Tue

The Snapdragon and Lobes mesh types now take an additional parameter,
"Strips".  This is the number of strips of finite elements to create
in the rectangular part of the lobes.  If zero (the default), the number
will be chosen to give the best quality of triangles.


2008 Sep 29 Mon

There is a new text item on the Simulation panel, called "Tolerance".
This sets the tolerance used in the equation solver.  This is a relative
value and independent of the scale of the mesh.  The default is 0.001.

When a movie is started, the current mesh is now written as the first
frame.  (Previously the current mesh was not recorded, only the mesh
after each subsequent iteration.)

Bug notice: The "Edges" option in the "Split" subpanel of the "Cells"
panel does not work with a Voronoi-style biological layer (created by
the "Fill with cells" button).  It is intended for use only with a layer
of isolated cells (created with the "Scatter cells" button) and fakes
cell division by subdividing the edge only.

Bug notice: When loading an old model into the latest version, check the
value of the STRAINRET morphogen.  Unless you specifically want strain
retention, make sure this is set to zero everywhere.  In some circumstances,
due to the program improperly upgrading old versions of the mesh, it can
get set to 1.  This causes strain to accumulate without bound, eventually
producing spurious curling up of the mesh.


2008 Sep 25 Thu

The naming of stage files has been changed so as to record the real time
in the file name instead of the iteration number.  The filenames will have
the form MODELNAME_sAdB.mat or MODELNAME_sAdB.mat, where A and B are strings
of digits, and the time of simulation was A.B or A respectively.  The A
part is always 6 digits long, to ensure that the alphabetical order of
file names is the same as the temporal order.


2008 Sep 23 Tue 2

Fixed an error in setmeshfromnodes which was giving new meshes wrong
default values for the standard morphogens.


2008 Sep 23 Tue

An error in IsotropicStiffnessMatrix has been fixed.  In addition,
the internally used stiffness matrix is recomputed from the user-settable
Poisson's ratio every time a project is loaded.


2008 Sep 18 Thu

There is now a checkbox on the Simulation panel "Negative growth".  When
true, this allows growth factors to be negative.  When false, they will be
forced to be non-negative after each call of the interaction function.
The growth factors are, for K/BEND style models:
    KPAR, KPER, THICKNESS
For the A/B style models they are:
    KAPAR, KAPER, KBPAR, KBPER, KNOR

Conversion between K/BEND and A/B is now precise (when negative growth is
allowed).  A model should grow in exactly the same way before and after
conversion, provided the user code in its interaction function has been
correspondingly modified.  The formulas relating the two versions are:

    KAPAR = KPAR - BENDPAR       KAPER = KPER - BENDPER
    KBPAR = KPAR + BENDPAR       KBPER = KPER + BENDPER

    KPAR = (APAR + BPAR)/2       KPER = (APER + BPER)/2
    BENDPAR = (BPAR - APAR)/2    BENDPER = (BPER - APER)/2


2008 Sep 17 Wed

The K/A/B version of the standard morphogens has been replaced by just
A and B.  The standard morphogens are now these:
    KAPAR       Growth on the A side parallel to the polariser
    KAPEP       Growth on the A side perpendicular to the polariser
    KBPAR       Growth on the B side parallel to the polariser
    KBPER       Growth on the B side perpendicular to the polariser
    KNOR        Growth normal to the surface
    POLARISER   Its gradient establishes the parallel direction.
    STRAINRET   Amount of strain to retain
    ARREST      Limits splitting of cells in the biological layer

In order to visualise the equivalent growth and bending, one can add extra
morphogens, called (for example) KPAR, KPER, BENDPAR, and BENDPER, and add
the following code at the end of the morphogen section of the interaction
function:

        % Reconstruct the old growth and bend morphogens.
        kpar_p = (kapar_p + kbpar_p)/2;
        kper_p = (kaper_p + kbper_p)/2;
        bendpar_p = kbpar_p - kpar_p;
        bendper_p = kbper_p - kper_p;

Models that still use the K/BEND version of the standard morphogens will
still work as they used to.


2008 Sep 5 Fri (2)

The offset between the biological layer and the FE layer has been increased
from 0.05 to 0.2 times the thickness, to prevent the two layers overlapping
when the surface is uneven.  The value can also be set from the command line
as the 'layeroffset' property, e.g. m = leaf_property( m, 'layeroffset', 0.1 )

2008 Sep 5 Fri

The STRAINRET morphogen is now scaled so that 0 = retain no strain, 1 =
retain all strain.  Previously it went from 0 to 100.

A space inefficiency has been (partly) eliminated, allowing somewhat larger
meshes before running out of memory (2800 instead of 1800 FEs on my laptop).
It only applies to meshes with no fixed nodes; it will take some extra
programming to make the same saving when there are fixed nodes.

When running from the command line, the equation solver and the solver
tolerance can be specified by m = leaf_setproperty( m, 'solver', thesolver,
'solvertolerance', thetolerance ).  THESOLVER must be either 'cgs' (the
default) or 'lsqr', and THETOLERANCE by default is 0.001.  There is not yet
a GUI interface to this.  The lsqr solver is significantly slower than
the cgs solver.



2008 Sep 3 Wed

A minimum polarisation gradient can now be specified in the "Min. pol. grad."
box in the Simulation panel.  A polarisation gradient whose absolute value
is less than or equal to this value will be treated as zero, i.e. finite elements
with such a gradient will undergo isotropic growth.  The magnitude of the
gradient can be plotted by selecting "Polarisation" in the upper menu in the
Plot:what panel.  Elements with a gradient below the threshold will be plotted as
having zero gradient, and is polarisation arrows are being drawn, they will be
replaced by circle in all such elements.

The default method of interpolating morphogen values when an edge is split
is now to take the minimum of the values at the ends of the edge.  Previously,
the new value was the average of the old values.  (This may change the growth
behaviour of old models.)  The interpolation mode can be set for the currently
selected morphogen in the "On split" subpanel of the "Morphogens" panel.  The
command-line equivalent is leaf_mgeninterpolation.

Bug notice: when creating biological cells with the "Fill with cells" button,
the cells are drawn uncoloured, when they should be drawn in green (or
whatever colour is selected in the left of the two colour boxes.
Workaround: click the "Shock all cells button" to paint them all red, then
click the "Unshock" button to paint them green.


2008 Aug 1 Fri

Dissection is now implemented.  To create seams, select "Seam edges" from
the mouse mode menu in the Mesh Editor panel, then click on the edges of
the mesh.  Seams are preserved as the mesh develops.  Seams do not have to
divide the mesh into separate pieces, but a seam must consist of more than
a single edge.

To cut up the mesh along the seams, click the "Dissect" button on the
Simulation panel.  Nothing will seem to happen, but if you then click
"Explode", the separate pieces will be moved apart.

To flatten the mesh, check "Flatten" in the Simulation panel and then run the
simulation for some suitable number of steps.  During flattening, no growth
or diffusion happens, the interaction function is not called, and simulated
time does not pass.  For best results, turn off the physical implementation
of thickness in the Mesh Editor panel before flattening.  Surfaces with
complex curvature may not flatten well.  To see how flat things are, select
"Strain" in the upper menu in Plot:what.  During flattening, this displays
the amount by which the mesh is not flat.

The commands leaf_dissect and leaf_explode perform the same functions as
the Dissect and Explode buttons.


2008 Jul 27 Thu

New features:

1.  There is a threshold for the polarising gradient.  By default this is zero.
There is no GUI control for setting it, but calling
    m = leaf_setproperty( m, 'mingradient', 0.001 );
will set it to 0.001.  Wherever the polarising gradient has a magnitude less
than or equal to this value, the growth will be isotropic along the surface of
the leaf.  The areal growth will be the same.  Growth perpendicular to the
leaf is not affected.

Bug fixes:

1.  When saving a new project, the interaction function is correctly renamed.

2.  A confusion about the convention for which sides the A and B growth
morphogens relate to is cleared up.  (The side of the mesh that is drawn
with thin edges is the side that is selected by the A/B radio buttons in the
Plot:how panel.  FOr the snapdragon model, this means that the A side is the
inside.  For the snapdragon to bend inwards means that A growth is less than
B growth, which is equivalent to a positive value of bend for the K/BEND
morphogens.)

3.  Seam edges (if any) are now always drawn.

Clarification of the docs:

The leaf_plot command does not, contrary to its previous help text, take an
argument called 'stuff'.  This changed a while ago but the text was not updated.
Qhat is plotted is determined by three arguments:
    'plotquantity'
    'morphogen'
    'tensorproperty'
'plotquantity' and 'tensorproperty' take the values that appear in the two
menus at the top of the Plot:what panel (but in lower case and without spaces).
'morphogen' takes the name or index of a morphogen.  'tensorproperty is only
required is a tensor quantity is being plotted.  'morphogen' is only required
if a morphogen is being plotted.  Examples:
    m = leaf_plot( m, 'plotquantity', 'morphogen', 'morphogen', 'KPAR' );
        Plot the KPAR morphogen.  (Note that 'morphogen' appears twice: once
        as an argument to 'plotquantity', and once as an option name taking the
        argument 'KPAR'.)
    m = leaf_plot( m, 'plotquantity', 'specifiedgrowth', 'tensorproperty', 'areal' );
        Plot the specified areal growth.
    m = leaf_plot( m, 'plotquantity', 'blank' );
        Plot a blank mesh.

Dissection along the seams is not yet implemented.


2008 Jul 24 Fri

The layout of the interaction function has been changed, to add two new
sections of user code, one at the beginning and one at the end.  Within
these blocks, the code you write is allowed to make arbitrary changes to
the mesh (including, for example, calls to leaf_subdivide).  In the user
code in the middle, for morphogen interaction, your code must not make
changes to the structure of the mesh.

Whenever GFtbox regenerates the interaction function (which it does every
time a project is loaded or saved, or a morphogen is added, renamed, or
deleted), a backup is made both of the whole interaction
function and all of the non-empty user code sections.  The latter
go in files called init.txt, mid.txt, and final.txt.  The backup of the
whole interaction function has the name of the interaction function with
'BAK' appended.  Note that all of these backup files will be overwritten
every time the i.f. is regenerated, so if something goes wrong and your
interaction function loses its code, the first thing to do is make a copy
of the backup.

The submenus of the Mesh menu are now called "New Mesh Morphogen Version"
and "Change Morphogen Version", and their items are called "K/BEND" and
"K/A/B".  It is now possible to convert in both directions between the
growth/bend parameters and the growth/A growth/B growth parameters.  (But
for any one project I recommend choosing one and sticking with it.)

An error preventing the addition of new morphogens has been fixed.

Various other bug fixes.


2008 Jul 24 Thu

There is a new command, leaf_subdivide.  This subdivides every edge
of the mesh satisfying all the conditions specified by the arguments.
These conditions are:
    a certain morphogen is greater than or equal to a threshold
    the same morphogen is less than or equal to a threshold
    the edge is longer than a given length
    the edge is longer than a given length, relative to the threshold at
        which edges are subdivided automatically.
See the help text for further details.

--

Known bug not yet fixed: when creating multiple generations of clones of
different colours, their colours are not properly preserved when the clones
split.  Workaround: either turn off cell splitting in the Simulation panel,
or select "Split edges" in the Cells panel.


2008 Jul 23 Wed

The mesh structure has a new field, m.mgenswitch.  This contains a
single value for each morphogen.  The effective level of a morphogen is the
product of the actual morphogen value, the corresponding element of
m.mgenswitch, and the mutant level for the moprhogen.  Thus mgenswitch and
mutantlevel perform the same function, their effects being combined.  The
difference between them is in how they are intended to be used.  The mutant
level can be set in the GUI and is expected to be constant for each
morphogen throughout the life of the plant.  The mutation levels can be
switched on and off collectively by the "All wild type" checkbox.  The
switch level is intended for use by the interaction function to temporarily
modulate the effective levels of morphogens.  There is no GUI interface to
the switch levels.  Despite the name "switch", any value can be used, not
just 0 or 1.  Both mutant and switch levels can be set from the command line
by the new command leaf_mgen_modulate, which replaces leaf_setmutant.


2008 Jul 22 Tue

Fixed an error preventing some old projects from being loaded.


2008 Jul 21 Mon

1.  On the Mesh Editor panel there is a new subpanel in the bottom left, for
rotating the mesh.  Select which axis to rotate about and the angle, then
click the "+ rot." button to perform that rotation, or the "- rot." button
to perform the reverse rotation.  This rotates the mesh itself, not the
viewing direction.

2.  Revision of the plotting menus.  The Plot:what panel now contains two
menus at the top.  The first selects the type of thing to be plotted.
When the thing to be plotted is a tensor quantity, the second menu
specifies what scalar property of the tensor is to be plotted.

Options on the first menu:
    Morphogen: plot the morphogen currently selected in the morphogens menu.
        This is the only non-tensor quantity.
    Current growth/bend: plot the growth tensors or bend tensors specified
        by the current values of the growth-related morphogens.
    Specified growth/bend: like Current, but using the values at the
        beginning of the last timestep, to allow comparison with Actual
        growth/bend.
    Actual growth/bend: plot the growth or bend tensors that describe the
        actual growth in the last timestep.
    Residual growth/bend: the difference between Specified and Actual.
        This is equivalent to what was called "Strain" in the previous
        version.
    Stress growth/bend: Residual growth/bend multiplied by the elasticity
        tensor.  All of the other tensor quantities are dimensionless, but
        this one is measured in units of pressure in N/m^2 (equivalently,
        microNewtons per square millimetre).
    Strain, Stress: these plot the same as they did in the previous version
        of GFtbox.  They will be retained only until I'm satisfied that the
        new plotting options correctly include everything that those options
        do.
Actual bend and residual bend are not yet implemented.

For the tensor fields, the second menu options are:
    Total: the sum of the Areal and Normal values.  For growth quantities,
        this is the volumetric growth.
    Areal: the sum of Major and Minor (or equivalently, of Parallel and
        Perpendicular).  For growth quantities, this is the rate of growth
        of area.
    Major, Minor, Parallel, Perpendicular, Normal:
        These plot the tensor component along one of its three principal axes.
        Normal selects the axis most nearly perpendicular to the mesh.
        Of the other two axes, Major selects the greater value and Minor the
        lesser, while Parallel selects the axis most nearly parallel to the
        polarisation gradient and Perpendicular selects the other axis.

For bend tensors, the "Normal" value is always zero.  This is because bend
is half the difference between the growth tensors on the top and bottom
surfaces, and the growth in thickness is always the same on the top and
bottom.

3.  Slight change to the monochromatic colour scale: it now proceeds from white
to the selected colour and beyond that to a darker version of the selected
colour.

4.  Other minor bug fixes.


2008 Jul 14 Mon

Fixed problem with inh(k,m) and pro(k,m) being supplied with negative values
of the morphogen m.


2008 Jul 11 Fri

Fixed error in creation of bio layer.

The bio layer is now drawn on both sides of the mesh.


2008 Jul 10 Thu

New set of standard morphogens:
    KPAR
    KPER
    KNOR (was THICKNESS)
    POLARISER
    APER
    APER
    BPAR
    BPER
    STRAINRET
    ARREST

The old set was:
    KPAR
    KPERP
    POLARISER
    BPAR
    BPERP
    BENDPOLARISER (later called NOTUSED)
    ARREST
    STRAINRET
    THICKNESS

Both growth and bending now use the same polarising gradient, so BENDPOLARISER
is eliminated.  APAR/APER specifies the growth on side A (usually the bottom,
for flat meshes) as multiples of the general growth amounts KPAR and KPER.
BPAR/BPER do the same for the B side.  The default initial values for APAR,
APER, BPAR, and BPER are 1.

Both sets of morphogens are supported.  Existing meshes using the old set
can be upgraded by the "Upgrade Mesh" command on the Mesh menu.  Note that if
you have written an interaction function, it will almost certainly require
modification before it will run with the new morphogens. Version 0 on the menu
means the old morphogen set, version 1 the new. 

New meshes are by default created with the new set, but the default can be
changed by the "New Mesh Version" command on the "Mesh" menu.

An error in the creation of OBJ files has been fixed.


2008 Jul 1 Tue

Mostly internal changes.

In the main iteration loop, the invocation of the interaction function is now
the first thing that happens.  Previously the diffusion computation happened
before the interaction.

To minimise the effects of some numerical inaccuracies, the mesh is now rotated
about the Z axis by some angle theta before each iteration (after calling the
interaction function), and rotated back again before plotting.  theta increases
by 2 radians on every iteration.  These rotations are invisible to the user.
The effect is that petals which should grow in a rotationally symmetric manner
about the Z axis will do so more accurately than before.  This "internal
rotation" is incompatible with the presence of nodes which are fixed in the
X direction but not in the Y direction, or vice versa.  If any such nodes
are detected, the internal rotation will be disabled.  All other combinations
of fixed degrees of freedom are ok.  This feature can be turned on and off by
the "Internal rotation" checkbox on the Simulation panel. 

The "morphogenproduction" field of the mesh structure has been deleted.  This
was never used.


2008 Jun 30 Mon

Orientation of triangles in OBJ files has been fixed.  All surface normals
should now point outwards.

GFtbox_config.txt can now specify the default compressor.  The file must
reside in the GrowthToolbox folder and can contain a line of the form
    compressor Cinepak
"Cinepak" can be replaced by any of the items in the Movie/Codec... menu.


2008 Jun 26 Thu

Biological cells placed by the "Scatter cells" button are now placed at
completely random positions, instead of at the centres of random FEs.

Morphogen names are written to OBJ files.


2008 Jun 25 Wed

When saving OBJ files, morphogen information is also included.
Triangle vertexes are ordered so that when plotting with thickness turned
on, the surface normals all point outwards from the solid volume.


2008 Jun 25 Wed

Fixed a problem in managing the interaction function, which was sometimes
causing GFtbox to lose track of where it is and what it is called.


2008 Jun 24 Tue

1.  There is a new tool, MorphogenViewer.m, in the subfolder
GrowthToolbox/MorphogenViewer, written by AB.  No documentation yet.
Its purpose is to combine monochrome plots of different morphogens
into a single picture.

2.  When OBJ files are exported, if the mesh is being drawn thickly,
the invisible interior edge triangles are not output, and the visible
border edge triangles are correctly coloured.


2008 Jun 23 Mon

1.  In Plot:how there is a new checkbox called "Monochrome", and a coloured box
next to it that brings up a color picker when clicked.  When Monochrome is
on, the plot will be in monochrome, with zero and negative values represented
as white, and the maximum value represented as the selected colour.

The command-line equivalent is to give the following arguments to leaf_plot
or leaf_plotoptions:
    'cmaptype', 'monochrome', 'monocolors', [[1 1 1];[r2 g2 b2]]
A second colour can be specified instead of [1 1 1]; this will be used to
plot negative values.  To turn off monochrome plotting in subsequent calls to
leaf_plot, give the empty string as the 'cmaptype' argument.

2.  leaf_plot was ignoring the 'cmap' argument.  This has been fixed.

3.  leaf_plot complained if FEthicklinesize or FEthinlinesize was zero.  This
has been fixed.

3.  An error in the writing of colour information to OBJ files has been fixed.

4.  Saving to OBJ files now saves face colours when a per-face quantity
is being plotted (strain, stress, or realised growth).  These are prefixed by
"fc" in the obj file.  When the mesh is drawn as thick, the edge faces are
plotted in white (this will be fixed in the next version).


2008 Jun 20 Fri 16:00

The Hemisphere mesh type now has an extra parameter, Height.  It can be
positive or negative.

leaf_cylinder takes two new parameters, 'topcap' and 'bottomcap'.  Both
are booleans, and specify whether the specified end of the cylinder should be
closed by a hemispherical cap.  The default for both is false.  As yet there
is no GUI equivalent of this feature.


2008 Jun 20 Fri

Fixed an error in the creation of biological layers (wasn't always testing
correctly for whether the layer already existed).


2008 Jun 19 Thu

First version uploaded to SVN.

New since the last version put on the Wiki:

1.  It is possible to choose the colours of cells in the biological layer.
In the "Cells" panel there are two coloured boxes, initially green and red.
Clicking either box lets you set its colour.  When creating new cells, the
right-hand colour will be used for the cells.  Clicking on a biological cell
will toggle its state between that colour and the left-hand colour.

The "Color variation" textbox lets you specify how much variation around the
specified colors is allowed.  This is mainly useful for the method of creating
a biological layer that fills the entire surface with cells (which method only
works for flat meshes).  It forces neighbouring cells to have slightly
different colours, which improves the visual appearance.

The script command equivalent for these is
    m = leaf_setsecondlayerparams( m, ...
        'colors', thecolors, 'colorvariation', thevariation );
where thecolors is a 2*3 array containing the two RGB values, and
thevariation is a real number between 0 (no variation) and 1 (any colour
allowed).

The 'colors' and 'colorvariation' arguments can also be supplied to the
leaf_makesecondlayer command.

2.  When creating biological cells, the "Single" and "Scatter" buttons will add
to the cells already there, instead of discarding the previously existing
layer.  To discard the previous layer, click the "Delete all cells" button.
"Single" and "Scatter" cannot be combined with "Fill with cells":
"Fill with cells" will always discard the previous layer.
"Single" and "Scatter" should discard any previous filled layer, but in fact
they don't (because they have no way to tell that the existing layer was created
bythe "Fill with cells" button".  Nothing will go wrong, but it really isn't
very useful to combine them.

3.  The edge-flipping transformation (enabled by "Flip edges" in the Simulation
panel) omitted to adjust the bio layer so as to keep the cells where they are
when the mesh changes underneath it.  This is now fixed.

4.  Computational errors in the handling of spatially fixed nodes have been fixed.

5.  Setting Poisson's ratio to zero is correctly handled.  Previously it would
give a spurious divide-by-zero error.


