Масштабное переобозначение
Улучшение читаемости и понимания кода
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
Rectangle::Rectangle(double a, double b, double h_x, double h_y, bool excluded, int btype) : a_(a), b_(b), h_x_(h_x), h_y_(h_y) {
|
||||
excluded_ = excluded;
|
||||
_boundtype = btype;
|
||||
bound_type = btype;
|
||||
}
|
||||
|
||||
std::pair<double, double> Rectangle::missX(double y) {
|
||||
@@ -20,17 +20,17 @@ double Rectangle::Function(double x, double y) {
|
||||
return std::max(h_x_ * std::abs(x - a_), h_y_ * std::abs(y - b_));
|
||||
}
|
||||
|
||||
std::pair<double, double> Rectangle::Deriative(double x, double y) {
|
||||
std::pair<double, double> Rectangle::Second_Deriative(double x, double y) {
|
||||
return { (h_x_ / 2) * ((x - a_) / std::abs(x - a_)), (h_y_ / 2) * ((y - b_) / std::abs(y - b_)) };
|
||||
}
|
||||
|
||||
bool Rectangle::Inhere(double x, double y) {
|
||||
return Function(x, y) <= 0.5;
|
||||
return Function(x, y) <= EPS_RECTANGLE;
|
||||
}
|
||||
|
||||
Circle::Circle(double a, double b, double h_x, double h_y, bool excluded, int btype) : a_(a), b_(b), h_x_(h_x), h_y_(h_y) {
|
||||
excluded_ = excluded;
|
||||
_boundtype = btype;
|
||||
bound_type = btype;
|
||||
}
|
||||
|
||||
std::pair<double, double> Circle::missY(double x) {
|
||||
@@ -44,7 +44,7 @@ double Circle::Function(double x, double y) {
|
||||
return pow(h_x_ * (x - a_), 2) + pow(h_y_ * (y - b_), 2);
|
||||
}
|
||||
|
||||
std::pair<double, double> Circle::Deriative(double x, double y) {
|
||||
std::pair<double, double> Circle::Second_Deriative(double x, double y) {
|
||||
return { 2 * h_x_ * (x - a_), 2 * h_y_ * (y - b_) };
|
||||
}
|
||||
|
||||
@@ -53,12 +53,12 @@ std::pair<double, double> Circle::size() {
|
||||
}
|
||||
|
||||
bool Circle::Inhere(double x, double y) {
|
||||
return Function(x, y) <= 1;
|
||||
return Function(x, y) <= EPS_CIRCLE;
|
||||
}
|
||||
|
||||
Arc::Arc(double a, double b, double h_x, double h_y, bool excluded, int btype) : a_(a), b_(b), h_x_(h_x), h_y_(h_y) {
|
||||
excluded_ = excluded;
|
||||
_boundtype = btype;
|
||||
bound_type = btype;
|
||||
}
|
||||
|
||||
std::pair<double, double> Arc::missY(double x) {
|
||||
@@ -75,15 +75,15 @@ double Arc::Function(double x, double y) {
|
||||
return -1.0;
|
||||
}
|
||||
|
||||
std::pair<double, double> Arc::Deriative(double x, double y) {
|
||||
std::pair<double, double> Arc::Second_Deriative(double x, double y) {
|
||||
if (x >= a_ && y >= b_) {
|
||||
return { 2 * h_x_ * (x - a_), 2 * h_y_ * (y - b_) };
|
||||
}
|
||||
if (x < a_) {
|
||||
std::cout << "x < a\n";
|
||||
//std::cout << "x < a\n";
|
||||
}
|
||||
if (y < b_) {
|
||||
std::cout << "y < b\n";
|
||||
//std::cout << "y < b\n";
|
||||
}
|
||||
return { -1.0, -1.0 };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user