mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-23 15:50:49 +01:00
[apps] Graph: In graphview, replace the type by a boolean to decide
wether to draw tangent
This commit is contained in:
committed by
EmilieNumworks
parent
cdfbc02499
commit
53b90034da
@@ -8,12 +8,12 @@ GraphView::GraphView(CartesianFunctionStore * functionStore, InteractiveCurveVie
|
||||
CurveViewCursor * cursor, BannerView * bannerView, View * cursorView) :
|
||||
FunctionGraphView(graphRange, cursor, bannerView, cursorView),
|
||||
m_functionStore(functionStore),
|
||||
m_type(Type::Default)
|
||||
m_tangent(false)
|
||||
{
|
||||
}
|
||||
|
||||
void GraphView::reload() {
|
||||
if (m_type == Type::Tangent) {
|
||||
if (m_tangent) {
|
||||
KDRect dirtyZone(KDRect(0, 0, bounds().width(), bounds().height()-m_bannerView->bounds().height()));
|
||||
markRectAsDirty(dirtyZone);
|
||||
}
|
||||
@@ -29,7 +29,7 @@ void GraphView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
Poincare::Context * c = (Poincare::Context *)context;
|
||||
return f->evaluateAtAbscissa(t, c);
|
||||
}, f, context(), f->color());
|
||||
if (m_type == Type::Tangent && f == m_selectedFunction) {
|
||||
if (m_tangent && f == m_selectedFunction) {
|
||||
float tangentParameter[2];
|
||||
tangentParameter[0] = f->approximateDerivative(m_curveViewCursor->x(), context());
|
||||
tangentParameter[1] = -tangentParameter[0]*m_curveViewCursor->x()+f->evaluateAtAbscissa(m_curveViewCursor->x(), context());
|
||||
|
||||
Reference in New Issue
Block a user