本文整理汇总了C++中Sequence::evaluateAtAbscissa方法的典型用法代码示例。如果您正苦于以下问题:C++ Sequence::evaluateAtAbscissa方法的具体用法?C++ Sequence::evaluateAtAbscissa怎么用?C++ Sequence::evaluateAtAbscissa使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sequence
的用法示例。
在下文中一共展示了Sequence::evaluateAtAbscissa方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: check_sequences_defined_by
void check_sequences_defined_by(double result[2][10], Sequence::Type typeU, const char * definitionU, const char * conditionU1 = nullptr, const char * conditionU2 = nullptr, Sequence::Type typeV = Sequence::Type::Explicit, const char * definitionV = nullptr, const char * conditionV1 = nullptr, const char * conditionV2 = nullptr) {
GlobalContext globalContext;
SequenceStore store;
SequenceContext sequenceContext(&globalContext, &store);
Sequence * u = nullptr;
Sequence * v = nullptr;
if (definitionU) {
u = store.addEmptyFunction();
assert(u->name()[0] == 'u');
u->setType(typeU);
u->setContent(definitionU);
if (conditionU1) {
u->setFirstInitialConditionContent(conditionU1);
}
if (conditionU2) {
u->setSecondInitialConditionContent(conditionU2);
}
}
if (definitionV) {
if (store.numberOfFunctions() == 0) {
Sequence * tempU = store.addEmptyFunction();
v = store.addEmptyFunction();
store.removeFunction(tempU);
v = store.functionAtIndex(0);
} else {
assert(store.numberOfFunctions() == 1);
v = store.addEmptyFunction();
}
v->setType(typeV);
v->setContent(definitionV);
if (conditionV1) {
v->setFirstInitialConditionContent(conditionV1);
}
if (conditionV2) {
v->setSecondInitialConditionContent(conditionV2);
}
}
for (int j = 0; j < 10; j++) {
if (u && u->isDefined()) {
double un = u->evaluateAtAbscissa((double)j, &sequenceContext);
assert((std::isnan(un) && std::isnan(result[0][j])) || (un == result[0][j]));
}
if (v && v->isDefined()) {
double vn = v->evaluateAtAbscissa((double)j, &sequenceContext);
assert((std::isnan(vn) && std::isnan(result[1][j])) || (vn == result[1][j]));
}
}
}
示例2: initCursorParameters
void GraphController::initCursorParameters() {
double x = std::round((interactiveCurveViewRange()->xMin()+interactiveCurveViewRange()->xMax())/2.0);
selectFunctionWithCursor(0);
TextFieldDelegateApp * myApp = (TextFieldDelegateApp *)app();
int functionIndex = 0;
double y = 0;
do {
Sequence * firstFunction = m_sequenceStore->activeFunctionAtIndex(functionIndex++);
y = firstFunction->evaluateAtAbscissa(x, myApp->localContext());
} while (std::isnan(y) && functionIndex < m_sequenceStore->numberOfActiveFunctions());
m_cursor->moveTo(x, y);
m_graphRange->panToMakePointVisible(x, y, k_cursorTopMarginRatio, k_cursorRightMarginRatio, k_cursorBottomMarginRatio, k_cursorLeftMarginRatio);
}
示例3: moveCursorHorizontally
bool GraphController::moveCursorHorizontally(int direction) {
double xCursorPosition = std::round(m_cursor->x());
if (direction < 0 && xCursorPosition <= 0) {
return false;
}
/* The cursor moves by step of at minimum 1. If the windowRange is to large
* compared to the resolution, the cursor takes bigger round step to cross
* the window in approximatively resolution steps. */
double step = std::ceil((interactiveCurveViewRange()->xMax()-interactiveCurveViewRange()->xMin())/m_view.resolution());
step = step < 1.0 ? 1.0 : step;
double x = direction > 0 ? xCursorPosition + step:
xCursorPosition - step;
if (x < 0.0) {
return false;
}
Sequence * s = m_sequenceStore->activeFunctionAtIndex(indexFunctionSelectedByCursor());
TextFieldDelegateApp * myApp = (TextFieldDelegateApp *)app();
double y = s->evaluateAtAbscissa(x, myApp->localContext());
m_cursor->moveTo(x, y);
m_graphRange->panToMakePointVisible(x, y, k_cursorTopMarginRatio, k_cursorRightMarginRatio, k_cursorBottomMarginRatio, k_cursorLeftMarginRatio);
return true;
}