ts-aggregator/project_template/A.cpp
2022-12-13 12:36:06 +04:00

36 lines
719 B
C++

#include "StdAfx.h"
#include "A.h"
A::A() {
}
A::A(double left, double right) {
this->left = left;
this->right = right;
}
double A::getValue(double value) {
if (value == (right + left) / 2) {
return 1;
} else if ((value >= right) || (value <= left)) {
return 0;
} else if (value < (right + left) / 2) {
return (double)(value - left) / ((right + left) / 2 - left);
} else if (value > (right + left) / 2) {
return (double) -(value - right) / (right - (right + left) / 2);
}
}
double A::getValueAtTop() {
return (right + left) / 2;
}
double A::getLeft() {
return left;
}
double A::getRight() {
return right;
}