Commit 2fceb9a7 authored by David Llewellyn-Jones's avatar David Llewellyn-Jones

Updated naming of tubes to curves in Functy code.

parent 39f8c680
bin_PROGRAMS = ../functy
___functy_SOURCES = function.c function.h function_private.h functy.c functy.h textures.c textures.h utils.c utils.h vis.c vis.h filesave.c filesave.h cartesian.c cartesian.h spherical.c spherical.h shader.c shader.h tube.c tube.h vecsym.c vecsym.h
___functy_SOURCES = function.c function.h function_private.h functy.c functy.h textures.c textures.h utils.c utils.h vis.c vis.h filesave.c filesave.h cartesian.c cartesian.h spherical.c spherical.h shader.c shader.h curve.c curve.h vecsym.c vecsym.h
___functy_LDADD = -lsymbolic -lgtkglext-x11-1.0 -lgdkglext-x11-1.0 -lGLU -lglut -lXmu -lXt -lSM -lICE -lgtk-x11-2.0 -lpangox-1.0 -lX11 -lgdk-x11-2.0 -latk-1.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lgio-2.0 -lcairo -lpango-1.0 -lfreetype -lz -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lglee @FUNCTY_LIBS@
......
This diff is collapsed.
///////////////////////////////////////////////////////////////////
// Functy
// 3D graph drawing utility
//
// David Llewellyn-Jones
// http://www.flypig.co.uk
//
// Spring 2009
///////////////////////////////////////////////////////////////////
#ifndef CURVE_H
#define CURVE_H
///////////////////////////////////////////////////////////////////
// Includes
///////////////////////////////////////////////////////////////////
// Defines
///////////////////////////////////////////////////////////////////
// Structures and enumerations
typedef struct _CurvePersist CurvePersist;
///////////////////////////////////////////////////////////////////
// Global variables
///////////////////////////////////////////////////////////////////
// Function prototypes
CurvePersist * NewCurvePersist ();
void DeleteCurvePersist (CurvePersist * psCurveData);
void CurveSetFunction (char const * const szXFunction, char const * const szYFunction, char const * const szZFunction, char const * const szRadius, FuncPersist * psFuncData);
void CurveDeriveFunctions (FuncPersist * psFuncData);
void CurveSetFunctionColours (char const * const szRed, char const * const szGreen, char const * const szBlue, char const * const szAlpha, FuncPersist * psFuncData);
void CurvePopulateVertices (FuncPersist * psFuncData);
void CurveGetVertexDimensions (int * pnAVertices, int * pnPVertices, FuncPersist * psFuncData);
void CurveGenerateVertices (FuncPersist * psFuncData);
char const * CurveGetXFunctionString (FuncPersist * psFuncData);
char const * CurveGetYFunctionString (FuncPersist * psFuncData);
char const * CurveGetZFunctionString (FuncPersist * psFuncData);
char const * CurveGetRadiusString (FuncPersist * psFuncData);
void CurveSetFunctionPosition (double fXMin, double fYMin, double fZMin, FuncPersist * psFuncData);
char * CurveGenerateVertexShader (FuncPersist * psFuncData);
char * CurveGenerateFragmentShader (FuncPersist * psFuncData);
void CurveInitShader (FuncPersist * psFuncData);
void CurveSetShaderActive (bool boActive, FuncPersist * psFuncData);
void CurveSetFunctionAccuracyRadius (double fAccuracy, FuncPersist * psFuncData);
double CurveGetFunctionAccuracyRadius (FuncPersist * psFuncData);
char const * CurveGetXCentreString (FuncPersist * psFuncData);
char const * CurveGetYCentreString (FuncPersist * psFuncData);
char const * CurveGetZCentreString (FuncPersist * psFuncData);
void CurveSetFunctionCentre (char const * const szXCentre, char const * const szYCentre, char const * const szZCentre, FuncPersist * psFuncData);
bool CurveGetCentreTimeDependent (FuncPersist * psFuncData);
void CurveGetCentre (double * afCentre, FuncPersist * psFuncData);
void CurveUpdateCentre (FuncPersist * psFuncData);
void CurveSetFunctionTime (double fTime, FuncPersist * psFuncData);
///////////////////////////////////////////////////////////////////
// Function definitions
#endif /* CURVE_H */
......@@ -2,7 +2,7 @@
#include "filesave.h"
#include "spherical.h"
#include "tube.h"
#include "curve.h"
#define FILE_BUFFER_SIZE (1024)
#define MAX_LEVELS (4)
......@@ -164,7 +164,7 @@ bool SaveFile (char const * szFilename, bool boConfigure, FunctyPersist * psFunc
case FUNCTYPE_SPHERICAL:
fprintf(fhFile, "\t<function type=\"spherical\">\n");
break;
case FUNCTYPE_TUBE:
case FUNCTYPE_CURVE:
fprintf(fhFile, "\t<function type=\"curve\">\n");
break;
default:
......@@ -217,36 +217,36 @@ bool SaveFile (char const * szFilename, bool boConfigure, FunctyPersist * psFunc
fprintf(fhFile, "%s", szEscaped);
g_free (szEscaped);
break;
case FUNCTYPE_TUBE:
fValue = TubeGetFunctionAccuracyRadius ((FuncPersist *)(psFuncList->data));
case FUNCTYPE_CURVE:
fValue = CurveGetFunctionAccuracyRadius ((FuncPersist *)(psFuncList->data));
fprintf(fhFile, "\t\t<accuracy-radius double=\"%f\"/>\n", fValue);
szValue = TubeGetXFunctionString ((FuncPersist *)(psFuncList->data));
szValue = CurveGetXFunctionString ((FuncPersist *)(psFuncList->data));
szEscaped = g_markup_printf_escaped ("\t\t<equation-x>%s</equation-x>\n", szValue);
fprintf(fhFile, "%s", szEscaped);
g_free (szEscaped);
szValue = TubeGetYFunctionString ((FuncPersist *)(psFuncList->data));
szValue = CurveGetYFunctionString ((FuncPersist *)(psFuncList->data));
szEscaped = g_markup_printf_escaped ("\t\t<equation-y>%s</equation-y>\n", szValue);
fprintf(fhFile, "%s", szEscaped);
g_free (szEscaped);
szValue = TubeGetZFunctionString ((FuncPersist *)(psFuncList->data));
szValue = CurveGetZFunctionString ((FuncPersist *)(psFuncList->data));
szEscaped = g_markup_printf_escaped ("\t\t<equation-z>%s</equation-z>\n", szValue);
fprintf(fhFile, "%s", szEscaped);
g_free (szEscaped);
szValue = TubeGetXCentreString ((FuncPersist *)(psFuncList->data));
szValue = CurveGetXCentreString ((FuncPersist *)(psFuncList->data));
szEscaped = g_markup_printf_escaped ("\t\t<centre-x>%s</centre-x>\n", szValue);
fprintf(fhFile, "%s", szEscaped);
g_free (szEscaped);
szValue = TubeGetYCentreString ((FuncPersist *)(psFuncList->data));
szValue = CurveGetYCentreString ((FuncPersist *)(psFuncList->data));
szEscaped = g_markup_printf_escaped ("\t\t<centre-y>%s</centre-y>\n", szValue);
fprintf(fhFile, "%s", szEscaped);
g_free (szEscaped);
szValue = TubeGetZCentreString ((FuncPersist *)(psFuncList->data));
szValue = CurveGetZCentreString ((FuncPersist *)(psFuncList->data));
szEscaped = g_markup_printf_escaped ("\t\t<centre-z>%s</centre-z>\n", szValue);
fprintf(fhFile, "%s", szEscaped);
g_free (szEscaped);
......@@ -648,7 +648,7 @@ void StartElementFunction (FILESAVETAG eTag, gchar const * * aszAttributeNames,
eFuncType = FUNCTYPE_SPHERICAL;
}
else if (strcmp (aszAttributeValues[nAttribute], "curve") == 0) {
eFuncType = FUNCTYPE_TUBE;
eFuncType = FUNCTYPE_CURVE;
}
}
nAttribute++;
......@@ -675,7 +675,7 @@ void StartElementFunction (FILESAVETAG eTag, gchar const * * aszAttributeNames,
SetFunctionAccuracy (fValue, psFilesaveData->psFuncData);
break;
case FILESAVETAG_ACCURACYRADIUS:
TubeSetFunctionAccuracyRadius (fValue, psFilesaveData->psFuncData);
CurveSetFunctionAccuracyRadius (fValue, psFilesaveData->psFuncData);
break;
default:
// Do nothing
......@@ -713,10 +713,10 @@ void EndElementFunction (FILESAVETAG eTag, FilesavePersist * psFilesaveData) {
szYCentre = SphericalGetYCentreString (psFilesaveData->psFuncData);
szZCentre = SphericalGetZCentreString (psFilesaveData->psFuncData);
break;
case FUNCTYPE_TUBE:
szXCentre = TubeGetXCentreString (psFilesaveData->psFuncData);
szYCentre = TubeGetYCentreString (psFilesaveData->psFuncData);
szZCentre = TubeGetZCentreString (psFilesaveData->psFuncData);
case FUNCTYPE_CURVE:
szXCentre = CurveGetXCentreString (psFilesaveData->psFuncData);
szYCentre = CurveGetYCentreString (psFilesaveData->psFuncData);
szZCentre = CurveGetZCentreString (psFilesaveData->psFuncData);
break;
default:
// Do nothing
......@@ -750,8 +750,8 @@ void EndElementFunction (FILESAVETAG eTag, FilesavePersist * psFilesaveData) {
case FUNCTYPE_SPHERICAL:
SphericalSetFunctionCentre (psFilesaveData->szText->str, szYCentre, szZCentre, psFilesaveData->psFuncData);
break;
case FUNCTYPE_TUBE:
TubeSetFunctionCentre (psFilesaveData->szText->str, szYCentre, szZCentre, psFilesaveData->psFuncData);
case FUNCTYPE_CURVE:
CurveSetFunctionCentre (psFilesaveData->szText->str, szYCentre, szZCentre, psFilesaveData->psFuncData);
break;
default:
// Do Nothing
......@@ -763,8 +763,8 @@ void EndElementFunction (FILESAVETAG eTag, FilesavePersist * psFilesaveData) {
case FUNCTYPE_SPHERICAL:
SphericalSetFunctionCentre (szXCentre, psFilesaveData->szText->str, szZCentre, psFilesaveData->psFuncData);
break;
case FUNCTYPE_TUBE:
TubeSetFunctionCentre (szXCentre, psFilesaveData->szText->str, szZCentre, psFilesaveData->psFuncData);
case FUNCTYPE_CURVE:
CurveSetFunctionCentre (szXCentre, psFilesaveData->szText->str, szZCentre, psFilesaveData->psFuncData);
break;
default:
// Do Nothing
......@@ -776,8 +776,8 @@ void EndElementFunction (FILESAVETAG eTag, FilesavePersist * psFilesaveData) {
case FUNCTYPE_SPHERICAL:
SphericalSetFunctionCentre (szXCentre, szYCentre, psFilesaveData->szText->str, psFilesaveData->psFuncData);
break;
case FUNCTYPE_TUBE:
TubeSetFunctionCentre (szXCentre, szYCentre, psFilesaveData->szText->str, psFilesaveData->psFuncData);
case FUNCTYPE_CURVE:
CurveSetFunctionCentre (szXCentre, szYCentre, psFilesaveData->szText->str, psFilesaveData->psFuncData);
break;
default:
// Do Nothing
......@@ -785,13 +785,13 @@ void EndElementFunction (FILESAVETAG eTag, FilesavePersist * psFilesaveData) {
}
break;
case FILESAVETAG_EQUATIONX:
TubeSetFunction (psFilesaveData->szText->str, NULL, NULL, NULL, psFilesaveData->psFuncData);
CurveSetFunction (psFilesaveData->szText->str, NULL, NULL, NULL, psFilesaveData->psFuncData);
break;
case FILESAVETAG_EQUATIONY:
TubeSetFunction (NULL, psFilesaveData->szText->str, NULL, NULL, psFilesaveData->psFuncData);
CurveSetFunction (NULL, psFilesaveData->szText->str, NULL, NULL, psFilesaveData->psFuncData);
break;
case FILESAVETAG_EQUATIONZ:
TubeSetFunction (NULL, NULL, psFilesaveData->szText->str, NULL, psFilesaveData->psFuncData);
CurveSetFunction (NULL, NULL, psFilesaveData->szText->str, NULL, psFilesaveData->psFuncData);
break;
case FILESAVETAG_TEXFILE:
SetTextureValues (psFilesaveData->szText->str, szTexXScale, szTexYScale, szTexXOffset, szTexYOffset, psFilesaveData->psFuncData);
......
......@@ -49,8 +49,8 @@ FuncPersist * NewFuncPersist (FUNCTYPE eType) {
case FUNCTYPE_SPHERICAL:
psFuncData->Func.psSphericalData = NewSphericalPersist ();
break;
case FUNCTYPE_TUBE:
psFuncData->Func.psTubeData = NewTubePersist ();
case FUNCTYPE_CURVE:
psFuncData->Func.psCurveData = NewCurvePersist ();
break;
default:
psFuncData->Func.psNone = NULL;
......@@ -133,9 +133,9 @@ void DeleteFuncPersist (FuncPersist * psFuncData) {
DeleteSphericalPersist (psFuncData->Func.psSphericalData);
psFuncData->Func.psSphericalData = NULL;
break;
case FUNCTYPE_TUBE:
DeleteTubePersist (psFuncData->Func.psTubeData);
psFuncData->Func.psTubeData = NULL;
case FUNCTYPE_CURVE:
DeleteCurvePersist (psFuncData->Func.psCurveData);
psFuncData->Func.psCurveData = NULL;
break;
default:
// Do absolutely nothing
......@@ -240,8 +240,8 @@ void InitShader (FuncPersist * psFuncData) {
case FUNCTYPE_SPHERICAL:
SphericalInitShader (psFuncData);
break;
case FUNCTYPE_TUBE:
TubeInitShader (psFuncData);
case FUNCTYPE_CURVE:
CurveInitShader (psFuncData);
break;
default:
// Do absolutely nothing
......@@ -285,8 +285,8 @@ void SetFunctionShaderActive (bool boActive, FuncPersist * psFuncData) {
case FUNCTYPE_SPHERICAL:
SphericalSetShaderActive (boActive, psFuncData);
break;
case FUNCTYPE_TUBE:
TubeSetShaderActive (boActive, psFuncData);
case FUNCTYPE_CURVE:
CurveSetShaderActive (boActive, psFuncData);
break;
default:
// Do absolutely nothing
......@@ -302,8 +302,8 @@ void SetFunction (char const * const szFunction, FuncPersist * psFuncData) {
case FUNCTYPE_SPHERICAL:
SphericalSetFunction (szFunction, psFuncData);
break;
case FUNCTYPE_TUBE:
TubeSetFunction ("a", "0", "0", szFunction, psFuncData);
case FUNCTYPE_CURVE:
CurveSetFunction ("a", "0", "0", szFunction, psFuncData);
break;
default:
// Do absolutely nothing
......@@ -319,8 +319,8 @@ void SetFunctionColours (char const * const szRed, char const * const szGreen, c
case FUNCTYPE_SPHERICAL:
SphericalSetFunctionColours (szRed, szGreen, szBlue, szAlpha, psFuncData);
break;
case FUNCTYPE_TUBE:
TubeSetFunctionColours (szRed, szGreen, szBlue, szAlpha, psFuncData);
case FUNCTYPE_CURVE:
CurveSetFunctionColours (szRed, szGreen, szBlue, szAlpha, psFuncData);
break;
default:
// Do absolutely nothing
......@@ -341,8 +341,8 @@ void FunctionShadersRegenerate (FuncPersist * psFuncData) {
case FUNCTYPE_SPHERICAL:
szShader = SphericalGenerateVertexShader (psFuncData);
break;
case FUNCTYPE_TUBE:
szShader = TubeGenerateVertexShader (psFuncData);
case FUNCTYPE_CURVE:
szShader = CurveGenerateVertexShader (psFuncData);
break;
default:
// Do absolutely nothing
......@@ -363,8 +363,8 @@ void FunctionShadersRegenerate (FuncPersist * psFuncData) {
case FUNCTYPE_SPHERICAL:
szShader = SphericalGenerateFragmentShader (psFuncData);
break;
case FUNCTYPE_TUBE:
szShader = TubeGenerateFragmentShader (psFuncData);
case FUNCTYPE_CURVE:
szShader = CurveGenerateFragmentShader (psFuncData);
break;
default:
// Do absolutely nothing
......@@ -455,8 +455,8 @@ void SetFunctionPosition (double fXMin, double fYMin, double fZMin, FuncPersist
case FUNCTYPE_SPHERICAL:
SphericalSetFunctionPosition (fXMin, fYMin, fZMin, psFuncData);
break;
case FUNCTYPE_TUBE:
TubeSetFunctionPosition (fXMin, fYMin, fZMin, psFuncData);
case FUNCTYPE_CURVE:
CurveSetFunctionPosition (fXMin, fYMin, fZMin, psFuncData);
break;
default:
// Do absolutely nothing
......@@ -546,8 +546,8 @@ void GetVertexDimensions (int * pnV1Vertices, int * pnV2Vertices, FuncPersist *
case FUNCTYPE_SPHERICAL:
SphericalGetVertexDimensions (pnV1Vertices, pnV2Vertices, psFuncData);
break;
case FUNCTYPE_TUBE:
TubeGetVertexDimensions (pnV1Vertices, pnV2Vertices, psFuncData);
case FUNCTYPE_CURVE:
CurveGetVertexDimensions (pnV1Vertices, pnV2Vertices, psFuncData);
break;
default:
// Do absolutely nothing
......@@ -563,8 +563,8 @@ void PopulateVertices (FuncPersist * psFuncData) {
case FUNCTYPE_SPHERICAL:
SphericalPopulateVertices (psFuncData);
break;
case FUNCTYPE_TUBE:
TubePopulateVertices (psFuncData);
case FUNCTYPE_CURVE:
CurvePopulateVertices (psFuncData);
break;
default:
// Do absolutely nothing
......@@ -580,8 +580,8 @@ void GenerateVertices (FuncPersist * psFuncData) {
case FUNCTYPE_SPHERICAL:
SphericalGenerateVertices (psFuncData);
break;
case FUNCTYPE_TUBE:
TubeGenerateVertices (psFuncData);
case FUNCTYPE_CURVE:
CurveGenerateVertices (psFuncData);
break;
default:
// Do absolutely nothing
......@@ -648,8 +648,8 @@ char const * GetXCentreString (FuncPersist * psFuncData) {
case FUNCTYPE_SPHERICAL:
szResult = SphericalGetXCentreString (psFuncData);
break;
case FUNCTYPE_TUBE:
szResult = TubeGetXCentreString (psFuncData);
case FUNCTYPE_CURVE:
szResult = CurveGetXCentreString (psFuncData);
break;
default:
// Do absolutely nothing
......@@ -669,8 +669,8 @@ char const * GetYCentreString (FuncPersist * psFuncData) {
case FUNCTYPE_SPHERICAL:
szResult = SphericalGetYCentreString (psFuncData);
break;
case FUNCTYPE_TUBE:
szResult = TubeGetYCentreString (psFuncData);
case FUNCTYPE_CURVE:
szResult = CurveGetYCentreString (psFuncData);
break;
default:
// Do absolutely nothing
......@@ -690,8 +690,8 @@ char const * GetZCentreString (FuncPersist * psFuncData) {
case FUNCTYPE_SPHERICAL:
szResult = SphericalGetZCentreString (psFuncData);
break;
case FUNCTYPE_TUBE:
szResult = TubeGetZCentreString (psFuncData);
case FUNCTYPE_CURVE:
szResult = CurveGetZCentreString (psFuncData);
break;
default:
// Do absolutely nothing
......@@ -709,8 +709,8 @@ void GetCentre (double * afCentre, FuncPersist * psFuncData) {
case FUNCTYPE_SPHERICAL:
SphericalGetCentre (afCentre, psFuncData);
break;
case FUNCTYPE_TUBE:
TubeGetCentre (afCentre, psFuncData);
case FUNCTYPE_CURVE:
CurveGetCentre (afCentre, psFuncData);
break;
default:
// Do absolutely nothing
......@@ -726,8 +726,8 @@ void UpdateCentre (FuncPersist * psFuncData) {
case FUNCTYPE_SPHERICAL:
SphericalUpdateCentre (psFuncData);
break;
case FUNCTYPE_TUBE:
TubeUpdateCentre (psFuncData);
case FUNCTYPE_CURVE:
CurveUpdateCentre (psFuncData);
break;
default:
// Do absolutely nothing
......@@ -743,8 +743,8 @@ void SetFunctionCentre (char const * const szXCentre, char const * const szYCent
case FUNCTYPE_SPHERICAL:
SphericalSetFunctionCentre (szXCentre, szYCentre, szZCentre, psFuncData);
break;
case FUNCTYPE_TUBE:
TubeSetFunctionCentre (szXCentre, szYCentre, szZCentre, psFuncData);
case FUNCTYPE_CURVE:
CurveSetFunctionCentre (szXCentre, szYCentre, szZCentre, psFuncData);
break;
default:
// Do absolutely nothing
......
......@@ -29,7 +29,7 @@ typedef enum _FUNCTYPE {
FUNCTYPE_CARTESIAN,
FUNCTYPE_SPHERICAL,
FUNCTYPE_TUBE,
FUNCTYPE_CURVE,
FUNCTYPE_NUM
} FUNCTYPE;
......
......@@ -16,7 +16,7 @@
#include "cartesian.h"
#include "spherical.h"
#include "tube.h"
#include "curve.h"
#include "shader.h"
#include <symbolic.h>
......@@ -32,7 +32,7 @@ struct _FuncPersist {
union {
CartesianPersist * psCartesianData;
SphericalPersist * psSphericalData;
TubePersist * psTubeData;
CurvePersist * psCurveData;
void * psNone;
} Func;
......
......@@ -30,7 +30,7 @@
#include "functy.h"
#include "filesave.h"
#include "spherical.h"
#include "tube.h"
#include "curve.h"
///////////////////////////////////////////////////////////////////
// Defines
......@@ -706,7 +706,7 @@ static gboolean PlotFunctionApply (GtkWidget * psWidget, gpointer psData) {
fAccuracy = (1.0 / gtk_spin_button_get_value (GTK_SPIN_BUTTON (psWidgetAcc)));
SetFunctionAccuracy (fAccuracy, psFunctyData->psFuncEdit);
break;
case FUNCTYPE_TUBE:
case FUNCTYPE_CURVE:
psFunction = glade_xml_get_widget (psFunctyData->psXML, "RadiusEdit");
szFunction = gtk_entry_get_text (GTK_ENTRY (psFunction));
psFunction = glade_xml_get_widget (psFunctyData->psXML, "CurveXEdit");
......@@ -715,7 +715,7 @@ static gboolean PlotFunctionApply (GtkWidget * psWidget, gpointer psData) {
szYFunction = gtk_entry_get_text (GTK_ENTRY (psFunction));
psFunction = glade_xml_get_widget (psFunctyData->psXML, "CurveZEdit");
szZFunction = gtk_entry_get_text (GTK_ENTRY (psFunction));
TubeSetFunction (szXFunction, szYFunction, szZFunction, szFunction, psFunctyData->psFuncEdit);
CurveSetFunction (szXFunction, szYFunction, szZFunction, szFunction, psFunctyData->psFuncEdit);
// Set up the centre functions
psColourWidget = glade_xml_get_widget (psFunctyData->psXML, "XCentre");
......@@ -725,11 +725,11 @@ static gboolean PlotFunctionApply (GtkWidget * psWidget, gpointer psData) {
psColourWidget = glade_xml_get_widget (psFunctyData->psXML, "ZCentre");
szZCentre = gtk_entry_get_text (GTK_ENTRY (psColourWidget));
TubeSetFunctionCentre (szXCentre, szYCentre, szZCentre, psFunctyData->psFuncEdit);
CurveSetFunctionCentre (szXCentre, szYCentre, szZCentre, psFunctyData->psFuncEdit);
psWidgetAcc = glade_xml_get_widget (psFunctyData->psXML, "AccuracyRadiusCurve");
fAccuracy = (1.0 / gtk_spin_button_get_value (GTK_SPIN_BUTTON (psWidgetAcc)));
TubeSetFunctionAccuracyRadius (fAccuracy, psFunctyData->psFuncEdit);
CurveSetFunctionAccuracyRadius (fAccuracy, psFunctyData->psFuncEdit);
psWidgetAcc = glade_xml_get_widget (psFunctyData->psXML, "AccuracyCurve");
fAccuracy = (1.0 / gtk_spin_button_get_value (GTK_SPIN_BUTTON (psWidgetAcc)));
......@@ -778,10 +778,10 @@ static gboolean PlotFunctionApply (GtkWidget * psWidget, gpointer psData) {
szFunction = gtk_entry_get_text (GTK_ENTRY (psFunction));
SetFunction (szFunction, psFuncData);
break;
case FUNCTYPE_TUBE:
case FUNCTYPE_CURVE:
psWidgetAcc = glade_xml_get_widget (psFunctyData->psXML, "AccuracyRadiusCurve");
fAccuracy = (1.0 / gtk_spin_button_get_value (GTK_SPIN_BUTTON (psWidgetAcc)));
TubeSetFunctionAccuracyRadius (fAccuracy, psFuncData);
CurveSetFunctionAccuracyRadius (fAccuracy, psFuncData);
psWidgetAcc = glade_xml_get_widget (psFunctyData->psXML, "AccuracyCurve");
fAccuracy = (1.0 / gtk_spin_button_get_value (GTK_SPIN_BUTTON (psWidgetAcc)));
......@@ -795,7 +795,7 @@ static gboolean PlotFunctionApply (GtkWidget * psWidget, gpointer psData) {
szYFunction = gtk_entry_get_text (GTK_ENTRY (psFunction));
psFunction = glade_xml_get_widget (psFunctyData->psXML, "CurveZEdit");
szZFunction = gtk_entry_get_text (GTK_ENTRY (psFunction));
TubeSetFunction (szXFunction, szYFunction, szZFunction, szFunction, psFuncData);
CurveSetFunction (szXFunction, szYFunction, szZFunction, szFunction, psFuncData);
// Set up the centre functions
psColourWidget = glade_xml_get_widget (psFunctyData->psXML, "XCentre");
......@@ -805,7 +805,7 @@ static gboolean PlotFunctionApply (GtkWidget * psWidget, gpointer psData) {
psColourWidget = glade_xml_get_widget (psFunctyData->psXML, "ZCentre");
szZCentre = gtk_entry_get_text (GTK_ENTRY (psColourWidget));
TubeSetFunctionCentre (szXCentre, szYCentre, szZCentre, psFuncData);
CurveSetFunctionCentre (szXCentre, szYCentre, szZCentre, psFuncData);
break;
default:
// Do nothing
......@@ -1222,7 +1222,7 @@ void EditFunction (GtkTreeModel * psTreeModel, GtkTreeIter * psTreeIter, FunctyP
psWidget = glade_xml_get_widget (psFunctyData->psXML, "ZCentre");
gtk_entry_set_text (GTK_ENTRY (psWidget), szFunction);
break;
case FUNCTYPE_TUBE:
case FUNCTYPE_CURVE:
// Show the centre tab
psWidget = glade_xml_get_widget (psFunctyData->psXML, "TabContentsCentre");
gtk_widget_show (psWidget);
......@@ -1245,19 +1245,19 @@ void EditFunction (GtkTreeModel * psTreeModel, GtkTreeIter * psTreeIter, FunctyP
gtk_window_set_title (GTK_WINDOW (psWidget), "Edit Curve function");
// Set up the curve values
szFunction = TubeGetRadiusString (psFunctyData->psFuncEdit);
szFunction = CurveGetRadiusString (psFunctyData->psFuncEdit);
psWidget = glade_xml_get_widget (psFunctyData->psXML, "RadiusEdit");
gtk_entry_set_text (GTK_ENTRY (psWidget), szFunction);
szFunction = TubeGetXFunctionString (psFunctyData->psFuncEdit);
szFunction = CurveGetXFunctionString (psFunctyData->psFuncEdit);
psWidget = glade_xml_get_widget (psFunctyData->psXML, "CurveXEdit");
gtk_entry_set_text (GTK_ENTRY (psWidget), szFunction);
szFunction = TubeGetYFunctionString (psFunctyData->psFuncEdit);
szFunction = CurveGetYFunctionString (psFunctyData->psFuncEdit);
psWidget = glade_xml_get_widget (psFunctyData->psXML, "CurveYEdit");
gtk_entry_set_text (GTK_ENTRY (psWidget), szFunction);
szFunction = TubeGetZFunctionString (psFunctyData->psFuncEdit);
szFunction = CurveGetZFunctionString (psFunctyData->psFuncEdit);
psWidget = glade_xml_get_widget (psFunctyData->psXML, "CurveZEdit");
gtk_entry_set_text (GTK_ENTRY (psWidget), szFunction);
......@@ -1265,20 +1265,20 @@ void EditFunction (GtkTreeModel * psTreeModel, GtkTreeIter * psTreeIter, FunctyP
psWidget = glade_xml_get_widget (psFunctyData->psXML, "AccuracyCurve");
gtk_spin_button_set_value (GTK_SPIN_BUTTON (psWidget), (1.0 / fAccuracy));
fAccuracy = TubeGetFunctionAccuracyRadius (psFuncData);
fAccuracy = CurveGetFunctionAccuracyRadius (psFuncData);
psWidget = glade_xml_get_widget (psFunctyData->psXML, "AccuracyRadiusCurve");
gtk_spin_button_set_value (GTK_SPIN_BUTTON (psWidget), (1.0 / fAccuracy));
// Set up the centre values
szFunction = TubeGetXCentreString (psFunctyData->psFuncEdit);
szFunction = CurveGetXCentreString (psFunctyData->psFuncEdit);
psWidget = glade_xml_get_widget (psFunctyData->psXML, "XCentre");
gtk_entry_set_text (GTK_ENTRY (psWidget), szFunction);
szFunction = TubeGetYCentreString (psFunctyData->psFuncEdit);
szFunction = CurveGetYCentreString (psFunctyData->psFuncEdit);
psWidget = glade_xml_get_widget (psFunctyData->psXML, "YCentre");
gtk_entry_set_text (GTK_ENTRY (psWidget), szFunction);
szFunction = TubeGetZCentreString (psFunctyData->psFuncEdit);
szFunction = CurveGetZCentreString (psFunctyData->psFuncEdit);
psWidget = glade_xml_get_widget (psFunctyData->psXML, "ZCentre");
gtk_entry_set_text (GTK_ENTRY (psWidget), szFunction);
break;
......@@ -1552,7 +1552,7 @@ void NewCurveFunction (FunctyPersist * psFunctyData) {
int nPageRemoved;
int nPage;
psFunctyData->eNextFunctionType = FUNCTYPE_TUBE;
psFunctyData->eNextFunctionType = FUNCTYPE_CURVE;
psFunctyData->psFuncEdit = NULL;
psRadiusEdit = glade_xml_get_widget (psFunctyData->psXML, "RadiusEdit");
......
///////////////////////////////////////////////////////////////////
// Functy
// 3D graph drawing utility
//
// David Llewellyn-Jones
// http://www.flypig.co.uk
//
// Spring 2009
///////////////////////////////////////////////////////////////////
#ifndef TUBE_H
#define TUBE_H
///////////////////////////////////////////////////////////////////
// Includes
///////////////////////////////////////////////////////////////////
// Defines
///////////////////////////////////////////////////////////////////
// Structures and enumerations
typedef struct _TubePersist TubePersist;
///////////////////////////////////////////////////////////////////
// Global variables
///////////////////////////////////////////////////////////////////
// Function prototypes
TubePersist * NewTubePersist ();
void DeleteTubePersist (TubePersist * psTubeData);
void TubeSetFunction (char const * const szXFunction, char const * const szYFunction, char const * const szZFunction, char const * const szRadius, FuncPersist * psFuncData);
void TubeDeriveFunctions (FuncPersist * psFuncData);
void TubeSetFunctionColours (char const * const szRed, char const * const szGreen, char const * const szBlue, char const * const szAlpha, FuncPersist * psFuncData);
void TubePopulateVertices (FuncPersist * psFuncData);
void TubeGetVertexDimensions (int * pnAVertices, int * pnPVertices, FuncPersist * psFuncData);
void TubeGenerateVertices (FuncPersist * psFuncData);
char const * TubeGetXFunctionString (FuncPersist * psFuncData);
char const * TubeGetYFunctionString (FuncPersist * psFuncData);
char const * TubeGetZFunctionString (FuncPersist * psFuncData);
char const * TubeGetRadiusString (FuncPersist * psFuncData);
void TubeSetFunctionPosition (double fXMin, double fYMin, double fZMin, FuncPersist * psFuncData);
char * TubeGenerateVertexShader (FuncPersist * psFuncData);
char * TubeGenerateFragmentShader (FuncPersist * psFuncData);
void TubeInitShader (FuncPersist * psFuncData);
void TubeSetShaderActive (bool boActive, FuncPersist * psFuncData);
void TubeSetFunctionAccuracyRadius (double fAccuracy, FuncPersist * psFuncData);
double TubeGetFunctionAccuracyRadius (FuncPersist * psFuncData);
char const * TubeGetXCentreString (FuncPersist * psFuncData);
char const * TubeGetYCentreString (FuncPersist * psFuncData);
char const * TubeGetZCentreString (FuncPersist * psFuncData);
void TubeSetFunctionCentre (char const * const szXCentre, char const * const szYCentre, char const * const szZCentre, FuncPersist * psFuncData);
bool TubeGetCentreTimeDependent (FuncPersist * psFuncData);
void TubeGetCentre (double * afCentre, FuncPersist * psFuncData);
void TubeUpdateCentre (FuncPersist * psFuncData);
void TubeSetFunctionTime (double fTime, FuncPersist * psFuncData);
///////////////////////////////////////////////////////////////////
// Function definitions
#endif /* TUBE_H */
......@@ -25,7 +25,7 @@
#include "vis.h"
#include "textures.h"
#include "spherical.h"
#include "tube.h"
#include "curve.h"
///////////////////////////////////////////////////////////////////
// Defines
......@@ -438,9 +438,9 @@ void AnimateFunction (VisPersist * psVisData) {
SphericalSetFunctionTime (psVisData->fFunctionTime, psFuncData);
SphericalUpdateCentre (psFuncData);
break;
case FUNCTYPE_TUBE:
TubeSetFunctionTime (psVisData->fFunctionTime, psFuncData);
TubeUpdateCentre (psFuncData);
case FUNCTYPE_CURVE:
CurveSetFunctionTime (psVisData->fFunctionTime, psFuncData);
CurveUpdateCentre (psFuncData);
break;
default:
// Do nothing
......@@ -1082,7 +1082,7 @@ void DrawGraph (FuncPersist * psFuncData) {
ActivateFunctionShader (psFuncData);
if ((eFuncType == FUNCTYPE_SPHERICAL) || (eFuncType == FUNCTYPE_TUBE)) {
if ((eFuncType == FUNCTYPE_SPHERICAL) || (eFuncType == FUNCTYPE_CURVE)) {
// Enable the spherical clipping planes
glClipPlane (GL_CLIP_PLANE0, afClipEquations[0]);
glClipPlane (GL_CLIP_PLANE1, afClipEquations[1]);
......@@ -1150,7 +1150,7 @@ void DrawGraph (FuncPersist * psFuncData) {
glDisable (GL_BLEND);
}
if ((eFuncType == FUNCTYPE_SPHERICAL) || (eFuncType == FUNCTYPE_TUBE)) {
if ((eFuncType == FUNCTYPE_SPHERICAL) || (eFuncType == FUNCTYPE_CURVE)) {
// Disable the spherical clipping planes
glDisable (GL_CLIP_PLANE0);
glDisable (GL_CLIP_PLANE1);
......
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