Данный отчёт сгенерирован 04.04.2023 06:21:13 UTC.
HTML версия (этот сайт) сгенерирован 04.04.2023 06:21:31 UTC.
Коммит: [bfeb65b9] add automatic zip creation 04.04.2023 06:21:13
HTML версия (этот сайт) сгенерирован 04.04.2023 06:21:31 UTC.
Коммит: [bfeb65b9] add automatic zip creation 04.04.2023 06:21:13
Задача: Включення Точки
04.04.2023 06:21:13
Описание: Заданий клас "Базовий Прямокутник"
class BaseRect
{
protected double x;
protected double y;
protected double w;
protected double h;
public BaseRect(double x, double y, double w, double h)
{
this.x = x;
this.y = y;
this.h = h;
this.w = w;
}
}
Додайте в клас BaseRect метод bool Includes(double x, double y), який повертає true,
якщо точка (x, y) знаходиться усередині прямокутника.
04.04.2023 06:21:13
Решений: 68
04.04.2023 06:21:13
Включення Точки
04.04.2023 06:21:13
public bool Includes(double x, double y)
{
if (h / 2 == y || w/2 == x)
{
return true;
}
return false;
}
public bool Includes(double x, double y){
if (x >= this.x && x <= this.x + this.w && y >= this.y && y <= this.y + this.h)
{
return true;
}
else
{
return false;
}
}
public bool Includes(double x, double y)
{
if (x >= this.x && x <= this.x + this.w && y >= this.y && y <= this.y + this.h)
{
return true;
}
else
{
return false;
}
}
public bool Includes(double x, double y)
{
return x >= this.x && x <= this.x + w && y <= this.y && y >= this.y - h;
}
public bool Includes(double x, double y){
{
return (x >= this.x && x <= this.x + this.w && y >= this.y && y <= this.y + this.h);
}
}
public bool Includes(double x, double y)
{
return (x >= this.x && x <= this.x + this.w && y <= this.y && y >= this.y + this.h);
}
public bool Includes(double x, double y)
{
if (y == this.h/2 && x == this.w/2){
return true;
}
else{
return false;
}
}
public bool Includes(double x, double y){
if(x <= this.w && y <= this.h){
return true;
}
return false;
}
public bool Includes(double x, double y)
{
if (x >= this.x && x <= this.x + this.w && y >= this.y && y <= this.y + this.h)
{
return true;
}
else
{
return false;
}
}
public bool Includes(double x, double y)
{
return x >= this.x && x <= this.x + this.w
&& y >= this.y && y <= this.y + this.h;
}
public bool Includes(double x, double y)
{
return (x >= this.x && x <= (this.x + this.w) && y >= this.y && y <= (this.y + this.h));
}
public bool Includes(double x, double y) {
return (this.x <= x && x <= this.x + this.w && this.y <= y && y <= this.y + this.h);
}
public bool Includes(double x, double y)
{
return x > this.x && y > this.y && x < this.x+w && y < this.y+h;
}
public bool Includes(double x, double y){
if((x < w) && (y < h) && (x > this.x) && (y > this.y)){
return true;
}
return false;
}
public bool Includes(double x, double y)
{
if (x < w && y < h)
{
return true;
}
return false;
}
public bool Includes(double x, double y)
{
return (x >= this.x && x <= this.x + this.w) && (y <= this.y && y >= this.y - this.h);
}
public bool Includes(double x, double y)
{
if (x == w/2 && y == h/2)
{
return true;
}
else
{
return false;
}
}
public bool Includes(double x, double y) => (x >= this.x && y <= this.y) && y >= (this.y - h) && x <= (this.x + w);
public bool Includes(double x, double y) { return h/2 == x && w/2 == y ? true : false; }
public bool Includes(double x, double y)
{
if (x >= this.x && x <= this.x + this.w && y >= this.y && y <= this.y + this.h)
{
return true;
} else
{
return false;
}
}
public bool Includes(double x, double y)
{
return (x >= this.x && x <= this.x + h) && (y >= this.y && y <= this.y + w);
}
public bool Includes(double x, double y)
{
return ((0 <= this.x && this.x <= w) && (0 <= this.y && this.y <= h));
}
public bool Includes(double x, double y)
{
return w / 2 + this.x == x && this.y - h / 2 == y;
}
public bool Includes(double x, double y)
{
var _x = this.x;
var _y = this.y;
var a = new Point(_x, _y);
var b = new Point(_x - w, _y);
var c = new Point(_x - w, _y - h);
var d = new Point(_x, _y - h);
var target = new Point(x, y);
return Diff(a, b, target) > 0
&& Diff(b, c, target) > 0
&& Diff(c, d, target) > 0
&& Diff(a, c, target) > 0;
}
private double Diff(Point p1, Point p2, Point target)
{
return (p2.X - p1.X) * (target.Y - p1.Y) - (target.X - p1.X) * (p2.Y - p1.Y);
}
private class Point
{
public double X { get; set; }
public double Y { get; set; }
public Point(double x, double y)
{
X = x;
Y = y;
}
}
public bool Includes(double x, double y) => x >= this.x &&
x <= this.w &&
y >= this.y &&
y <= this.h;
public bool Includes(double x, double y)
{
return (x >= this.x && x <= (this.x + this.w) && y >= this.y && y <= (this.y + this.h));
}
public bool Includes(double x, double y)
{
return x >= x && x <= x + w && y >= y && y <= y + h;
}
public bool Includes(double x, double y){
if (x == w/2 && y== h/2)
{
return true;
}
else{
return false;
}
}
public bool Includes(double newX, double newY){
if (newX >= x && newX <= x + w && newY >= y && newY <= y + h){
return true;
}
else {
return false;
}
}
public bool Includes(double x, double y){
return (x > this.x & x < this.x + this.w ? true : false & y > this.y & x < this.y+ this.h ? true : false);
}
public bool Includes(double x, double y)
{
return (this.x + this.h - x) >= 0 && (this.y + this.w - y) >= 0;
}
public bool Includes(double x, double y)
{
return (this.h/2 == y && this.w/2 == x);
}
public bool Includes(double x, double y){return x>= this.x && x <= this.x+this.w && y >= this.y && y <= this.y + this.h;}
public bool Includes(double x, double y){
return this.x <= x && x <= this.x + this.w &&
this.y <= y && y <= this.y + this.h;
}
public bool Includes(double x, double y){
return (h/2 == x && w/2 == y) ? true : false;
}
public bool Includes(double x, double y){
if
((this.x+this.w+this.x)/2==x &&
(this.y+this.h+this.y)/2==y)
return true;
else return false;
}
public bool Includes(double x, double y)
{
return x > this.x && x < this.h+this.w &&
y > this.y && y < this.y+this.h;
}
public bool Includes(double x, double y) {
return x > this.x && y > this.y && x <= this.w && y <= this.h;
}
public bool Includes(double x, double y)
{
return (x >= this.x && x <= this.x + h &&
y >= this.y && y <= this.y + w) ;
}
public bool Includes(double x, double y)
{
if (x == w/2 && y == h/2)
return true;
else
return false;
}
public bool Includes(double x, double y)
{
return x > this.x && x < this.x + w && y > this.y && y < this.y + h;
}
public bool Includes(double x, double y)
{
return x >= this.x && x <= this.x + w && y >= this.y && y <= this.y + h;
}
public bool Includes(double x, double y){
double minX = this.x - this.w/2;
double maxX = this.x + this.w/2;
double minY = this.y - this.h/2;
double maxY = this.y + this.h/2;
if((minX< x) && (x< maxX)){
if((minY< y) && (y< maxY)) return true;
}
return false;
}
public bool Includes(double x, double y) => this.x<=x && x<=(this.x+this.w) && this.y<=y && y<=(this.y+this.h);
public bool Includes(double x, double y)
{
if (x == this.w / 2 && y == this.h / 2)
return true;
else
return false;
}
public bool Includes(double x, double y) {
return (x >= this.x && x <= this.x + this.w) && (y >= this.y && y <= this.y + this.h);
}
public bool Includes(double x, double y) {
if(x < this.x || x > this.x+this.w)
return false;
if(y < this.y || y > this.y+this.h)
return false;
return true;
}
public bool Includes(double x, double y)
{
if(x >= this.x && x <= this.x + this.w && y >= this.y && y <= this.y + this.h) return true;
return false;
}
public bool Includes(double x, double y)
{
if (x > w || y > h)
return false;
else
return true;
}
public bool Includes(double x, double y){
return false;
}
public bool Includes(double X, double Y)
{
if(X>this.x&&X< this.w&&Y>this.y&&Y< this.h) return true;
return false;
}
public bool Includes(double x, double y)
{
return x > this.x && y > this.y && x < this.x+w && y < this.y+h;
}
public bool Includes(double x, double y){
return x>=this.x&&x<=this.h+this.x&&y>=this.y&&y<=this.h+this.x;
}
public bool Includes(double x, double y) {
return x < w && x > this.x && y < h && y > this.y;
}
public bool Includes(double x, double y)
{
if (x >= this.x && x <= this.x + this.w && y >= this.y && y <= this.y + this.h)
return true;
return false;
}
public bool Includes(double x, double y){
if (x > this.x && x < this.x+ w && y > this.y && y < this.y+ h)
return true;
else
return false;
}
public bool Includes(double x, double y){
return x >= this.x && x <= this.x + this.w && y >= this.y && y <= this.y + this.h;
}
public bool Includes(double x, double y) {
double x1 = this.x;
double y1 = this.y;
double x2 = this.x + this.w;
double y2 = this.y + this.h;
return x >= x1 && x <= x2 && y >= y1 && y <= y2;
}
public bool Includes(double x, double y) => x > this.x && x < (this.x + w) && y < this.y && y > (this.y - h);
public bool Includes(double x, double y)
{
return (y <= this.y && y >= this.y - h) && (x >= this.x && x <= this.x + w);
}
public bool Includes(double x, double y)
{
if (x > this.x && x < this.x + this.w && y > this.y && y < this.y + this.h)
return true;
else
return false;
}
public bool Includes(double x, double y)
{
if (x > this.x && y > this.y && x < this.x + this.w && y < this.y + this.h)
return true;
else return false;
}
public bool Includes(double x, double y)
{
if (x > this.x && x < this.w &&
y > this.y && y < this.h)
{
return true;
}
return false;
}
public bool Includes(double x, double y){
return (x >= this.x && x <= this.x + this.w) && (y >= this.y && y <= this.y + this.h);
}
public bool Includes(double x, double y)
{
return x > this.x && x < this.x + this.w && y > this.y && y > this.y + this.h;
}
public bool Includes(double x1, double y1)=>x1>x&&x1< w&&y1>y&&y1< h;
public bool Includes(double x, double y)
{
return x <= this.x && y <= this.y && x >= this.x + w && y >= this.y + h;
}
public bool Includes(double x, double y)
{
return (x == (w + this.x) / 2 && y == (h + this.y) / 2);
}
{
if (h / 2 == y || w/2 == x)
{
return true;
}
return false;
}
if (x >= this.x && x <= this.x + this.w && y >= this.y && y <= this.y + this.h)
{
return true;
}
else
{
return false;
}
}
{
if (x >= this.x && x <= this.x + this.w && y >= this.y && y <= this.y + this.h)
{
return true;
}
else
{
return false;
}
}
{
return x >= this.x && x <= this.x + w && y <= this.y && y >= this.y - h;
}
{
return (x >= this.x && x <= this.x + this.w && y >= this.y && y <= this.y + this.h);
}
}
{
return (x >= this.x && x <= this.x + this.w && y <= this.y && y >= this.y + this.h);
}
{
if (y == this.h/2 && x == this.w/2){
return true;
}
else{
return false;
}
}
if(x <= this.w && y <= this.h){
return true;
}
return false;
}
{
if (x >= this.x && x <= this.x + this.w && y >= this.y && y <= this.y + this.h)
{
return true;
}
else
{
return false;
}
}
{
return x >= this.x && x <= this.x + this.w
&& y >= this.y && y <= this.y + this.h;
}
{
return (x >= this.x && x <= (this.x + this.w) && y >= this.y && y <= (this.y + this.h));
}
return (this.x <= x && x <= this.x + this.w && this.y <= y && y <= this.y + this.h);
}
{
return x > this.x && y > this.y && x < this.x+w && y < this.y+h;
}
if((x < w) && (y < h) && (x > this.x) && (y > this.y)){
return true;
}
return false;
}
{
if (x < w && y < h)
{
return true;
}
return false;
}
{
return (x >= this.x && x <= this.x + this.w) && (y <= this.y && y >= this.y - this.h);
}
{
if (x == w/2 && y == h/2)
{
return true;
}
else
{
return false;
}
}
{
if (x >= this.x && x <= this.x + this.w && y >= this.y && y <= this.y + this.h)
{
return true;
} else
{
return false;
}
}
{
return (x >= this.x && x <= this.x + h) && (y >= this.y && y <= this.y + w);
}
{
return ((0 <= this.x && this.x <= w) && (0 <= this.y && this.y <= h));
}
{
return w / 2 + this.x == x && this.y - h / 2 == y;
}
{
var _x = this.x;
var _y = this.y;
var a = new Point(_x, _y);
var b = new Point(_x - w, _y);
var c = new Point(_x - w, _y - h);
var d = new Point(_x, _y - h);
var target = new Point(x, y);
return Diff(a, b, target) > 0
&& Diff(b, c, target) > 0
&& Diff(c, d, target) > 0
&& Diff(a, c, target) > 0;
}
private double Diff(Point p1, Point p2, Point target)
{
return (p2.X - p1.X) * (target.Y - p1.Y) - (target.X - p1.X) * (p2.Y - p1.Y);
}
private class Point
{
public double X { get; set; }
public double Y { get; set; }
public Point(double x, double y)
{
X = x;
Y = y;
}
}
x <= this.w &&
y >= this.y &&
y <= this.h;
{
return (x >= this.x && x <= (this.x + this.w) && y >= this.y && y <= (this.y + this.h));
}
{
return x >= x && x <= x + w && y >= y && y <= y + h;
}
if (x == w/2 && y== h/2)
{
return true;
}
else{
return false;
}
}
if (newX >= x && newX <= x + w && newY >= y && newY <= y + h){
return true;
}
else {
return false;
}
}
return (x > this.x & x < this.x + this.w ? true : false & y > this.y & x < this.y+ this.h ? true : false);
}
{
return (this.x + this.h - x) >= 0 && (this.y + this.w - y) >= 0;
}
{
return (this.h/2 == y && this.w/2 == x);
}
return this.x <= x && x <= this.x + this.w &&
this.y <= y && y <= this.y + this.h;
}
return (h/2 == x && w/2 == y) ? true : false;
}
if
((this.x+this.w+this.x)/2==x &&
(this.y+this.h+this.y)/2==y)
return true;
else return false;
}
{
return x > this.x && x < this.h+this.w &&
y > this.y && y < this.y+this.h;
}
return x > this.x && y > this.y && x <= this.w && y <= this.h;
}
{
return (x >= this.x && x <= this.x + h &&
y >= this.y && y <= this.y + w) ;
}
{
if (x == w/2 && y == h/2)
return true;
else
return false;
}
{
return x > this.x && x < this.x + w && y > this.y && y < this.y + h;
}
{
return x >= this.x && x <= this.x + w && y >= this.y && y <= this.y + h;
}
double minX = this.x - this.w/2;
double maxX = this.x + this.w/2;
double minY = this.y - this.h/2;
double maxY = this.y + this.h/2;
if((minX< x) && (x< maxX)){
if((minY< y) && (y< maxY)) return true;
}
return false;
}
{
if (x == this.w / 2 && y == this.h / 2)
return true;
else
return false;
}
return (x >= this.x && x <= this.x + this.w) && (y >= this.y && y <= this.y + this.h);
}
if(x < this.x || x > this.x+this.w)
return false;
if(y < this.y || y > this.y+this.h)
return false;
return true;
}
{
if(x >= this.x && x <= this.x + this.w && y >= this.y && y <= this.y + this.h) return true;
return false;
}
{
if (x > w || y > h)
return false;
else
return true;
}
return false;
}
{
if(X>this.x&&X< this.w&&Y>this.y&&Y< this.h) return true;
return false;
}
{
return x > this.x && y > this.y && x < this.x+w && y < this.y+h;
}
return x>=this.x&&x<=this.h+this.x&&y>=this.y&&y<=this.h+this.x;
}
return x < w && x > this.x && y < h && y > this.y;
}
{
if (x >= this.x && x <= this.x + this.w && y >= this.y && y <= this.y + this.h)
return true;
return false;
}
if (x > this.x && x < this.x+ w && y > this.y && y < this.y+ h)
return true;
else
return false;
}
return x >= this.x && x <= this.x + this.w && y >= this.y && y <= this.y + this.h;
}
double x1 = this.x;
double y1 = this.y;
double x2 = this.x + this.w;
double y2 = this.y + this.h;
return x >= x1 && x <= x2 && y >= y1 && y <= y2;
}
{
return (y <= this.y && y >= this.y - h) && (x >= this.x && x <= this.x + w);
}
{
if (x > this.x && x < this.x + this.w && y > this.y && y < this.y + this.h)
return true;
else
return false;
}
{
if (x > this.x && y > this.y && x < this.x + this.w && y < this.y + this.h)
return true;
else return false;
}
{
if (x > this.x && x < this.w &&
y > this.y && y < this.h)
{
return true;
}
return false;
}
return (x >= this.x && x <= this.x + this.w) && (y >= this.y && y <= this.y + this.h);
}
{
return x > this.x && x < this.x + this.w && y > this.y && y > this.y + this.h;
}
{
return x <= this.x && y <= this.y && x >= this.x + w && y >= this.y + h;
}
{
return (x == (w + this.x) / 2 && y == (h + this.y) / 2);
}