Commit 2b30ebfe authored by David Saxton's avatar David Saxton

Fix a couple of crashes in the function tools (using wrong function for...

Fix a couple of crashes in the function tools (using wrong function for getting value of differential equation, wasn't filtering on the function type).

svn path=/trunk/KDE/kdeedu/kmplot/; revision=569003
parent 4dbd59af
......@@ -121,9 +121,15 @@ void FunctionTools::updateEquationList()
m_widget->list->clear();
m_equations.clear();
// Can't e.g. calculate areas for parametric equations
bool onlyCartesianLike = (m_mode != CalculateY);
foreach ( Function * function, XParser::self()->m_ufkt )
{
if ( onlyCartesianLike && function->type() != Function::Cartesian && function->type() != Function::Differential )
continue;
QList<Plot> plots = function->plots();
for ( int i = 0; i < function->eq.size(); ++i )
......@@ -224,10 +230,9 @@ void FunctionTools::calculateY( const EquationPair & equation )
if ( !equation.first.function() )
return;
equation.first.updateFunction();
Equation * eq = equation.first.function()->eq[ equation.second ];
double result = View::self()->value( equation.first, equation.second, m_widget->xValue->value(), true );
double result = XParser::self()->fkt( eq, m_widget->xValue->value() );
Equation * eq = equation.first.function()->eq[ equation.second ];
m_widget->yResult->setText( QString( "%1(%2) = %3" )
.arg( eq->name() )
......
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