Commit 6a1bb75a authored by David Llewellyn-Jones's avatar David Llewellyn-Jones

Improved user interface thanks to Vadi. Added example function files to the distribution build.

parent 34c54b5e
EXTRA_DIST = linux/build windows/build.bat
EXTRA_DIST = linux/build windows/build.bat examples/*.xml
SUBDIRS = src ui
dist_doc_DATA = AUTHORS ChangeLog COPYING INSTALL NEWS README
......
Functy-0.1: 12-April-2009
- First pre-release version to use the autotools for the build process
Functy-0.1: 26-April-2009
- First pre-release version built from SourceForge.net
Functy-0.2: not yet released
- Improved interface courtesey of Vadi
- Improved function interpretation (especially negatives)
- Support for more functions (acos, cosh, abs, etc.)
Functy ReadMe
=============
Functy is a 3D graph drawing package. The emphasis for the application is to allow cartesian functions to be plotted and altered quickly and easily.
The source can be browsed at: https://www.flypig.org.uk/trac/repos/browser/Home/Functy
Functy is a 3D graph drawing package. The emphasis for the application is to allow Cartesian functions to be plotted and altered quickly and easily.
Install
......@@ -22,11 +20,11 @@ License
Read COPYING for information on the license. Functy is released under the MIT License.
Contact
=======
Contact and Links
=================
More information can be found at: https://www.flypig.org.uk/trac/repos/wiki/Symbolic
The source code can be obtained via svn from: https://www.flypig.org.uk/svn/repos/Home/Symbolic/
More information can be found at: http://functy.sourceforge.net/
The source code can be obtained via svn from: https://functy.svn.sourceforge.net/svnroot/functy
I can be contacted via one of the following.
......
<?xml version='1.0' encoding='UTF-8' ?>
<functy>
<settings>
<show-axes bool="0"/>
<invert bool="0"/>
<wireframe bool="0"/>
</settings>
<range>
<min>
<coord x="-5.000000" y="-5.000000" z="-20.000000"/>
</min>
<width>
<coord x="10.000000" y="10.000000" z="40.000000"/>
</width>
</range>
<function>
<equation>6+(5*sin(t)*cos(x))+cos(y*5)</equation>
<red>(2+cos(y*2))/2</red>
<green>0</green>
<blue>0.550</blue>
<alpha>1</alpha>
<accuracy double="0.020000"/>
</function>
<function>
<equation>6+(5*sin(t*1.2)*cos(x+(t/6)))+cos(y*5)</equation>
<red>(2+cos(y*2))/2</red>
<green>0</green>
<blue>0.550</blue>
<alpha>1</alpha>
<accuracy double="0.020000"/>
</function>
<function>
<equation>6+(5*sin(t*1.3)*cos(x+(t/7)))+cos(y*5)</equation>
<red>(2+cos(y*2))/2</red>
<green>0</green>
<blue>0.550</blue>
<alpha>1</alpha>
<accuracy double="0.020000"/>
</function>
</functy>
<?xml version='1.0' encoding='UTF-8' ?>
<functy>
<settings>
<show-axes bool="0"/>
<invert bool="0"/>
<wireframe bool="0"/>
</settings>
<range>
<min>
<coord x="66.926720" y="19.187932" z="-29.386562"/>
</min>
<width>
<coord x="14.693281" y="14.693281" z="58.773123"/>
</width>
</range>
<function>
<equation>5*(1-((x MOD 4)&gt;1)*((y MOD 4)&gt;1))</equation>
<red>(y MOD 2)&gt;1</red>
<green>(x MOD 2)&gt;1</green>
<blue>(z&gt;4)</blue>
<alpha>(z&gt;4)</alpha>
<accuracy double="0.020000"/>
</function>
</functy>
<?xml version='1.0' encoding='UTF-8' ?>
<functy>
<settings>
<show-axes bool="0"/>
<invert bool="0"/>
<wireframe bool="0"/>
</settings>
<range>
<min>
<coord x="-15.860812" y="-19.524615" z="-68.518853"/>
</min>
<width>
<coord x="34.259426" y="34.259426" z="137.037706"/>
</width>
</range>
<function>
<equation>(10*cos((((x+0)**2)+((y+0)**2))**(1/2))/(((((((x+0)**2)+((y+0)**2))**(1/2))**2)/5)+2))+(15*cos((((x+5)**2)+((y+3)**2))**(1/2))/(((((((x+1)**2)+((y+3)**2))**(1/2))**2)/6)+3))+(18*cos((((x-8)**2)+((y+1)**2))**(1/2))/(((((((x-8)**2)+((y-3)**2))**(1/2))**2)/2)+3))</equation>
<red>0.050+(z/10)</red>
<green>0.337+(z/10)</green>
<blue>0.000+(z/10)</blue>
<alpha>1.000</alpha>
<accuracy double="0.010000"/>
</function>
<function>
<equation>0.5+(0.05*sin(((t/3)+y+(cos(x)/2.7))/0.2))</equation>
<red>0.5+(0.1*sin(((t/4)+x+(cos(y)/1.7))/0.3))</red>
<green>0.681</green>
<blue>0.9+(0.1*sin(((t/4)+x+(cos(y)/1.7))/0.3))</blue>
<alpha>0.400</alpha>
<accuracy double="0.010000"/>
</function>
<function>
<equation>22+((sin((x/2))*cos((y/3))))</equation>
<red>0.8</red>
<green>0.8</green>
<blue>0.8</blue>
<alpha>(((sin((y/10)+(t/20)))+(cos((x/10)+(t/12)))+0.5)*((sin((y/6)+(t/28)))+(cos((x/4)+(t/44)))+1))*0.4</alpha>
<accuracy double="0.020000"/>
</function>
</functy>
<?xml version='1.0' encoding='UTF-8' ?>
<functy>
<settings>
<show-axes bool="0"/>
<invert bool="0"/>
<wireframe bool="0"/>
</settings>
<range>
<min>
<coord x="-18.000000" y="-18.000000" z="-50.000000"/>
</min>
<width>
<coord x="36.000000" y="36.000000" z="100.000000"/>
</width>
</range>
<function>
<equation>(((1+0.3*sin(t/5))/(1+(((x+10*sin(0.23*t))**2)+((y+10*cos(0.31*t))**2))**0.5)) + ((1+0.3*sin(t/4))/(1+(((x+10*sin(0.17*t))**2)+((y+10*cos(0.22*t))**2))**0.5)) + ((1+0.3*sin(t/7))/(1+(((x+10*sin(0.37*t))**2)+((y+10*cos(0.25*t))**2))**0.5)))</equation>
<red>2</red>
<green>1</green>
<blue>0</blue>
<alpha>1</alpha>
<accuracy double="0.033333"/>
</function>
<function>
<equation>0.3</equation>
<red>0</red>
<green>0</green>
<blue>.5</blue>
<alpha>0.7</alpha>
<accuracy double="0.020000"/>
</function>
</functy>
<?xml version='1.0' encoding='UTF-8' ?>
<functy>
<settings>
<show-axes bool="0"/>
<invert bool="0"/>
<wireframe bool="0"/>
</settings>
<range>
<min>
<coord x="-18.000000" y="-18.000000" z="-50.000000"/>
</min>
<width>
<coord x="36.000000" y="36.000000" z="100.000000"/>
</width>
</range>
<function>
<equation>(((1+0.3*sin(t/5))/(1+(((x+10*sin(0.23*t))**2)+((y+10*cos(0.31*t))**2))**0.5)) + ((1+0.3*sin(t/4))/(1+(((x+10*sin(0.17*t))**2)+((y+10*cos(0.22*t))**2))**0.5)) + ((1+0.3*sin(t/7))/(1+(((x+10*sin(0.37*t))**2)+((y+10*cos(0.25*t))**2))**0.5)))</equation>
<red>(4/(1+(((x+10*sin(0.23*t))**2)+((y+10*cos(0.31*t))**2))**0.5))</red>
<green>(4/(1+(((x+10*sin(0.17*t))**2)+((y+10*cos(0.22*t))**2))**0.5))</green>
<blue>(4/(1+(((x+10*sin(0.37*t))**2)+((y+10*cos(0.25*t))**2))**0.5))</blue>
<alpha>1</alpha>
<accuracy double="0.033333"/>
</function>
<function>
<equation>0.3</equation>
<red>0</red>
<green>0</green>
<blue>.5</blue>
<alpha>0.2</alpha>
<accuracy double="0.020000"/>
</function>
</functy>
<?xml version='1.0' encoding='UTF-8' ?>
<functy>
<settings>
<show-axes bool="0"/>
<invert bool="0"/>
<wireframe bool="0"/>
</settings>
<range>
<min>
<coord x="-12.000000" y="-12.000000" z="-12.000000"/>
</min>
<width>
<coord x="24.000000" y="24.000000" z="24.000000"/>
</width>
</range>
<function>
<equation>(1/(1+(((x+10*sin(0.3*t))**2)+((y+10*cos(0.5*t))**2)))) + (1/(1+(((x+10*sin(1.1*t))**2)+((y+10*cos(0.8*t))**2)))) + (1/(1+(((x+10*sin(0.7*t))**2)+((y+10*cos(0.6*t))**2))))</equation>
<red>3*z</red>
<green>2*z</green>
<blue>0.2</blue>
<alpha>1</alpha>
<accuracy double="0.020000"/>
</function>
</functy>
<?xml version='1.0' encoding='UTF-8' ?>
<functy>
<settings>
<show-axes bool="0"/>
<invert bool="1"/>
<wireframe bool="0"/>
</settings>
<range>
<min>
<coord x="-5.000000" y="-5.000000" z="-20.000000"/>
</min>
<width>
<coord x="10.000000" y="10.000000" z="40.000000"/>
</width>
</range>
<function>
<equation>0 - (4 * cos ((((x * x) + (y * y))**(1/2))+0))</equation>
<red>0.5</red>
<green>0.5</green>
<blue>1.0</blue>
<alpha>0.9</alpha>
<accuracy double="0.020000"/>
</function>
<function>
<equation>3 * cos ((((x * x) + (y * y))**(1/2))-sin(0*1.1))</equation>
<red>1.0</red>
<green>0.5</green>
<blue>0.5</blue>
<alpha>0.9</alpha>
<accuracy double="0.020000"/>
</function>
</functy>
<?xml version='1.0' encoding='UTF-8' ?>
<functy>
<settings>
<show-axes bool="0"/>
<invert bool="0"/>
<wireframe bool="0"/>
</settings>
<range>
<min>
<coord x="-8.396829" y="-10.823920" z="-27.209779"/>
</min>
<width>
<coord x="13.604890" y="13.604890" z="54.419558"/>
</width>
</range>
<function>
<equation>(1*(acos(cos(x)))-(1*acos(cos(y))))**2</equation>
<red>0.701</red>
<green>1.000</green>
<blue>0.714</blue>
<alpha>1.000</alpha>
<accuracy double="0.010000"/>
</function>
</functy>
<?xml version='1.0' encoding='UTF-8' ?>
<functy>
<settings>
<show-axes bool="1"/>
<invert bool="0"/>
<wireframe bool="0"/>
</settings>
<range>
<min>
<coord x="-5.000000" y="-5.000000" z="-20.000000"/>
</min>
<width>
<coord x="10.000000" y="10.000000" z="40.000000"/>
</width>
</range>
<function>
<equation>0 - (4 * cos ((((x * x) + (y * y))**(1/2))+t))</equation>
<red>0.5</red>
<green>0.5</green>
<blue>1.0</blue>
<alpha>0.9</alpha>
<accuracy double="0.020000"/>
</function>
<function>
<equation>3 * cos ((((x * x) + (y * y))**(1/2))-sin(t*1.1))</equation>
<red>1.0</red>
<green>0.5</green>
<blue>0.5</blue>
<alpha>0.9</alpha>
<accuracy double="0.020000"/>
</function>
</functy>
<?xml version='1.0' encoding='UTF-8' ?>
<functy>
<settings>
<show-axes bool="0"/>
<invert bool="0"/>
<wireframe bool="0"/>
</settings>
<range>
<min>
<coord x="-15.661471" y="-0.147014" z="-34.276485"/>
</min>
<width>
<coord x="17.138244" y="17.138244" z="68.552970"/>
</width>
</range>
<function>
<equation>(3*sin(t)*exp(asin(sin(x))*asin(sin(y))))-10</equation>
<red>sin(y)</red>
<green>z/5</green>
<blue>0.550</blue>
<alpha>1</alpha>
<accuracy double="0.020000"/>
</function>
<function>
<equation>(3*cos(t)*exp(asin(cos(x))*asin(cos(y))))-10</equation>
<red>sin(y)</red>
<green>z/5</green>
<blue>0.550</blue>
<alpha>1</alpha>
<accuracy double="0.020000"/>
</function>
<function>
<equation>(0-10)-(3*cos(t)*exp(asin(sin(x))*asin(cos(y))))</equation>
<red>sin(y)</red>
<green>z/5</green>
<blue>0.550</blue>
<alpha>1</alpha>
<accuracy double="0.020000"/>
</function>
<function>
<equation>(0-10)-(3*sin(t)*exp(asin(cos(x))*asin(sin(y))))</equation>
<red>sin(y)</red>
<green>z/5</green>
<blue>0.550</blue>
<alpha>1</alpha>
<accuracy double="0.020000"/>
</function>
</functy>
<?xml version='1.0' encoding='UTF-8' ?>
<functy>
<settings>
<show-axes bool="0"/>
<invert bool="0"/>
<wireframe bool="0"/>
</settings>
<range>
<min>
<coord x="-5.000000" y="-5.000000" z="-20.000000"/>
</min>
<width>
<coord x="10.000000" y="10.000000" z="40.000000"/>
</width>
</range>
<function>
<equation>6+(5*sin(t)*cos(x))+cos(y*5)</equation>
<red>(2+cos(y*2))/2</red>
<green>0</green>
<blue>0.550</blue>
<alpha>1</alpha>
<accuracy double="0.020000"/>
</function>
</functy>
<?xml version='1.0' encoding='UTF-8' ?>
<functy>
<settings>
<show-axes bool="0"/>
<invert bool="0"/>
<wireframe bool="0"/>
</settings>
<range>
<min>
<coord x="-14.360527" y="-14.896742" z="-63.443382"/>
</min>
<width>
<coord x="31.721691" y="31.721691" z="126.886765"/>
</width>
</range>
<function>
<equation>0.6*(ln((sin(t)*cos(x))+1.2)*(ln(cos(y)+1.1)))</equation>
<red>1</red>
<green>0.427</green>
<blue>0.728</blue>
<alpha>1</alpha>
<accuracy double="0.010000"/>
</function>
</functy>
<?xml version='1.0' encoding='UTF-8' ?>
<functy>
<settings>
<show-axes bool="0"/>
<invert bool="0"/>
<wireframe bool="0"/>
</settings>
<range>
<min>
<coord x="6.018429" y="14.076060" z="-21.600000"/>
</min>
<width>
<coord x="10.800000" y="10.800000" z="43.200000"/>
</width>
</range>
<function>
<equation>0-4</equation>
<red>sin(x)</red>
<green>cos(y)</green>
<blue>0.677</blue>
<alpha>0.5</alpha>
<accuracy double="0.020000"/>
</function>
<function>
<equation>2+(2*sin(x+t)*cos(y+t))</equation>
<red>(x MOD 2)&gt;1</red>
<green>(y MOD 2)&gt;1</green>
<blue>0</blue>
<alpha>((x MOD 2)&gt;1)+((y MOD 2)&gt;1)</alpha>
<accuracy double="0.020000"/>
</function>
</functy>
......@@ -104,6 +104,8 @@ static void ClearAllFunctions (FunctyPersist * psFunctyData);
static gboolean LoadFilePress (GtkWidget * psWidget, gpointer psData);
static gboolean SaveFilePress (GtkWidget * psWidget, gpointer psData);
void PauseAnimation (bool boPause, FunctyPersist * psFunctyData);
void NewFunction (FunctyPersist * psFunctyData);
static gboolean AddCartesianPress (GtkColorButton * psWidget, gpointer psData);
///////////////////////////////////////////////////////////////////
// Function definitions
......@@ -855,7 +857,7 @@ void PopulateFunctionList (GtkListStore * psFunctionListModel, FunctyPersist * p
GSList * psFuncList;
psFuncList = GetFunctionList (psFunctyData->psVisData);
AddFunction (NULL, psFunctionListModel);
//AddFunction (NULL, psFunctionListModel);
while (psFuncList) {
AddFunction ((FuncPersist *)(psFuncList->data), psFunctionListModel);
......@@ -951,15 +953,8 @@ void EditFunction (GtkTreeModel * psTreeModel, GtkTreeIter * psTreeIter, FunctyP
GtkWidget * psFunctionEdit;
FuncPersist * psFuncData;
GtkWidget * psWidget;
GtkWidget * psColourWidget;
char const * szFunction;
double fAccuracy;
GString * szValue;
GdkColor sColour;
double fRed;
double fGreen;
double fBlue;
double fAlpha;
// Populate the Function window using information taken from the supplied row
......@@ -994,44 +989,74 @@ void EditFunction (GtkTreeModel * psTreeModel, GtkTreeIter * psTreeIter, FunctyP
gtk_spin_button_set_value (GTK_SPIN_BUTTON (psWidget), (1.0 / fAccuracy));
SetColourButton (psFunctyData);
psWidget = glade_xml_get_widget (psFunctyData->psXML, "Function");
gtk_widget_show (psWidget);
}
else {
gtk_entry_set_text (GTK_ENTRY (psFunctionEdit), FUNCTION_NEW);
// If the function data is NULL we'll start to edit a new function
NewFunction (psFunctyData);
}
}
void NewFunction (FunctyPersist * psFunctyData) {
GtkWidget * psWidget;
GtkWidget * psFunctionEdit;
GtkWidget * psColourWidget;
GString * szValue;
GdkColor sColour;
double fRed;
double fGreen;
double fBlue;
double fAlpha;
psFunctyData->psFuncEdit = NULL;
szValue = g_string_new ("");
psFunctionEdit = glade_xml_get_widget (psFunctyData->psXML, "FunctionEdit");
GetNextColour (& fRed, & fGreen, & fBlue, & fAlpha, psFunctyData);
gtk_entry_set_text (GTK_ENTRY (psFunctionEdit), FUNCTION_NEW);
sColour.red = (guint16)floor ((65535.0 * fRed) + 0.5);
g_string_printf (szValue, "%.3f", fRed);
psColourWidget = glade_xml_get_widget (psFunctyData->psXML, "Red");
gtk_entry_set_text (GTK_ENTRY (psColourWidget), szValue->str);
szValue = g_string_new ("");
sColour.green = (guint16)floor ((65535.0 * fGreen) + 0.5);
g_string_printf (szValue, "%.3f", fGreen);
psColourWidget = glade_xml_get_widget (psFunctyData->psXML, "Green");
gtk_entry_set_text (GTK_ENTRY (psColourWidget), szValue->str);
GetNextColour (& fRed, & fGreen, & fBlue, & fAlpha, psFunctyData);
sColour.blue = (guint16)floor ((65535.0 * fBlue) + 0.5);
g_string_printf (szValue, "%.3f", fBlue);
psColourWidget = glade_xml_get_widget (psFunctyData->psXML, "Blue");
gtk_entry_set_text (GTK_ENTRY (psColourWidget), szValue->str);
sColour.red = (guint16)floor ((65535.0 * fRed) + 0.5);
g_string_printf (szValue, "%.3f", fRed);
psColourWidget = glade_xml_get_widget (psFunctyData->psXML, "Red");
gtk_entry_set_text (GTK_ENTRY (psColourWidget), szValue->str);
g_string_printf (szValue, "%.3f", fAlpha);
psColourWidget = glade_xml_get_widget (psFunctyData->psXML, "Alpha");
gtk_entry_set_text (GTK_ENTRY (psColourWidget), szValue->str);
sColour.green = (guint16)floor ((65535.0 * fGreen) + 0.5);
g_string_printf (szValue, "%.3f", fGreen);
psColourWidget = glade_xml_get_widget (psFunctyData->psXML, "Green");
gtk_entry_set_text (GTK_ENTRY (psColourWidget), szValue->str);
g_string_free (szValue, TRUE);
sColour.blue = (guint16)floor ((65535.0 * fBlue) + 0.5);
g_string_printf (szValue, "%.3f", fBlue);
psColourWidget = glade_xml_get_widget (psFunctyData->psXML, "Blue");
gtk_entry_set_text (GTK_ENTRY (psColourWidget), szValue->str);
psWidget = glade_xml_get_widget (psFunctyData->psXML, "Colour");
gtk_color_button_set_color (GTK_COLOR_BUTTON (psWidget), & sColour);
gtk_color_button_set_alpha (GTK_COLOR_BUTTON (psWidget), (guint16)floor ((65535.0 * ALPHA_NEW) + 0.5));
}
g_string_printf (szValue, "%.3f", fAlpha);
psColourWidget = glade_xml_get_widget (psFunctyData->psXML, "Alpha");
gtk_entry_set_text (GTK_ENTRY (psColourWidget), szValue->str);
g_string_free (szValue, TRUE);
psWidget = glade_xml_get_widget (psFunctyData->psXML, "Colour");
gtk_color_button_set_color (GTK_COLOR_BUTTON (psWidget), & sColour);
gtk_color_button_set_alpha (GTK_COLOR_BUTTON (psWidget), (guint16)floor ((65535.0 * ALPHA_NEW) + 0.5));
psWidget = glade_xml_get_widget (psFunctyData->psXML, "Function");
gtk_widget_show (psWidget);
}
static gboolean AddCartesianPress (GtkColorButton * psWidget, gpointer psData) {
FunctyPersist * psFunctyData = (FunctyPersist * )psData;
NewFunction (psFunctyData);
return TRUE;
}
void GetNextColour (double * pfRed, double * pfGreen, double * pfBlue, double * pfAlpha, FunctyPersist * psFunctyData) {
if (pfRed) {
* pfRed = 0.4 + 0.6 * ((cos (psFunctyData->fNewColour) + 1.0) / 2.0);
......@@ -1333,6 +1358,8 @@ int main (int argc, char *argv[]) {
g_signal_connect (psWidget, "clicked", G_CALLBACK (PlotFunctionPress), (gpointer)psFunctyData);
psWidget = glade_xml_get_widget (psFunctyData->psXML, "EditFunction");
g_signal_connect (psWidget, "clicked", G_CALLBACK (EditFunctionPress), (gpointer)psFunctyData);
psWidget = glade_xml_get_widget (psFunctyData->psXML, "AddCartesian");
g_signal_connect (psWidget, "clicked", G_CALLBACK (AddCartesianPress), (gpointer)psFunctyData);
psWidget = glade_xml_get_widget (psFunctyData->psXML, "DeleteFunction");
g_signal_connect (psWidget, "clicked", G_CALLBACK (DeleteFunctionPress), (gpointer)psFunctyData);
psWidget = glade_xml_get_widget (psFunctyData->psXML, "OpenView");
......@@ -1343,7 +1370,7 @@ int main (int argc, char *argv[]) {
g_signal_connect (psWidget, "clicked", G_CALLBACK (RangeSetApply), (gpointer)psFunctyData);
psWidget = glade_xml_get_widget (psFunctyData->psXML, "RangeOkay");
g_signal_connect (psWidget, "clicked", G_CALLBACK (RangeSetPress), (gpointer)psFunctyData);
psWidget = glade_xml_get_widget (psFunctyData->psXML, "Load");
psWidget = glade_xml_get_widget (psFunctyData->psXML, "Open");
g_signal_connect (psWidget, "clicked", G_CALLBACK (LoadFilePress), (gpointer)psFunctyData);
psWidget = glade_xml_get_widget (psFunctyData->psXML, "Save");
g_signal_connect (psWidget, "clicked", G_CALLBACK (SaveFilePress), (gpointer)psFunctyData);
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment