Size: a a a

2ch /pr/ #staythefuckhome

2020 June 02

К

Коля🤔🎭 in 2ch /pr/ #staythefuckhome
Чо это?
источник

К

Коля🤔🎭 in 2ch /pr/ #staythefuckhome
Я худышка, но не далбаеб
источник

P

PRISE in 2ch /pr/ #staythefuckhome
смотрите
источник

P

PRISE in 2ch /pr/ #staythefuckhome
топ5 решение
источник

P

PRISE in 2ch /pr/ #staythefuckhome
import math


def find_slope(x1, y1, x2, y2):
   """ Returns a slope of line formed by the points in the format (deltaX, deltaY).
   """
   dy, dx = y2 - y1, x2 - x1
   if dx < 0:  # keep minus sign(if any) with dy
       dx *= -1
       dy *= -1
   g = math.gcd(dy, dx)
   return (dy // g, dx // g)


def is_right_angle(s1, s2):
   """ Returns True if angle formed by 2 lines with slopes s1 and s2 is 90.
   """
   dy1, dx1 = s1
   dy2, dx2 = s2
   dy, dx = dy1 * dy2, dx1 * dx2
   if dy == 0 and dx == 0:
       return True
   g = math.gcd(dy, dx)
   dy //= g
   dx //= g
   return dy < 0 and abs(dy) == dx == 1


def isRectangle(points):
   s1 = find_slope(*points[0], *points[1])
   s2 = find_slope(*points[3], *points[2])
   s3 = find_slope(*points[0], *points[3])
   s4 = find_slope(*points[1], *points[2])
   # check that lines are parallel and one of the angles is 90
   if s1 != s2 or s3 != s4 or not is_right_angle(s1, s3):
       return False
   return True
источник

К

Коля🤔🎭 in 2ch /pr/ #staythefuckhome
источник

P

PRISE in 2ch /pr/ #staythefuckhome
PRISE
import math


def find_slope(x1, y1, x2, y2):
   """ Returns a slope of line formed by the points in the format (deltaX, deltaY).
   """
   dy, dx = y2 - y1, x2 - x1
   if dx < 0:  # keep minus sign(if any) with dy
       dx *= -1
       dy *= -1
   g = math.gcd(dy, dx)
   return (dy // g, dx // g)


def is_right_angle(s1, s2):
   """ Returns True if angle formed by 2 lines with slopes s1 and s2 is 90.
   """
   dy1, dx1 = s1
   dy2, dx2 = s2
   dy, dx = dy1 * dy2, dx1 * dx2
   if dy == 0 and dx == 0:
       return True
   g = math.gcd(dy, dx)
   dy //= g
   dx //= g
   return dy < 0 and abs(dy) == dx == 1


def isRectangle(points):
   s1 = find_slope(*points[0], *points[1])
   s2 = find_slope(*points[3], *points[2])
   s3 = find_slope(*points[0], *points[3])
   s4 = find_slope(*points[1], *points[2])
   # check that lines are parallel and one of the angles is 90
   if s1 != s2 or s3 != s4 or not is_right_angle(s1, s3):
       return False
   return True
double det(double x1,double y1, double x2,double y2) {
   return x1*y2 - x2*y1;
}
bool isRectangle(std::vector<std::vector<int>> points) {
   swap(points[1],points[3]);

   double A = points[0][1] - points[1][1];
   double B = points[1][0] - points[0][0];
   double C = det(points[0][0],points[0][1],points[1][0],points[1][1]);

   double A2 = points[1][1] - points[2][1];
   double B2 = points[2][0] - points[1][0];
   double C2 = det(points[1][0],points[1][1],points[2][0],points[2][1]);

   double A3 = points[2][1] - points[3][1];
   double B3 = points[3][0] - points[2][0];
   double C3 = det(points[2][0],points[2][1],points[3][0],points[3][1]);

   double A4 = points[3][1] - points[0][1];
   double B4 = points[0][0] - points[3][0];
   double C4 = det(points[3][0],points[3][1],points[0][0],points[0][1]);


   double angle = (points[0][0]-points[1][0])*(points[2][0]-points[1][0])
                + (points[0][1]-points[1][1])*(points[2][1]-points[1][1]);
   if(angle != 0) return false;

   return det(A,B,A3,B3) == 0 && det(A2,B2,A4,B4) == 0;
}
источник

P

PRISE in 2ch /pr/ #staythefuckhome
PRISE
double det(double x1,double y1, double x2,double y2) {
   return x1*y2 - x2*y1;
}
bool isRectangle(std::vector<std::vector<int>> points) {
   swap(points[1],points[3]);

   double A = points[0][1] - points[1][1];
   double B = points[1][0] - points[0][0];
   double C = det(points[0][0],points[0][1],points[1][0],points[1][1]);

   double A2 = points[1][1] - points[2][1];
   double B2 = points[2][0] - points[1][0];
   double C2 = det(points[1][0],points[1][1],points[2][0],points[2][1]);

   double A3 = points[2][1] - points[3][1];
   double B3 = points[3][0] - points[2][0];
   double C3 = det(points[2][0],points[2][1],points[3][0],points[3][1]);

   double A4 = points[3][1] - points[0][1];
   double B4 = points[0][0] - points[3][0];
   double C4 = det(points[3][0],points[3][1],points[0][0],points[0][1]);


   double angle = (points[0][0]-points[1][0])*(points[2][0]-points[1][0])
                + (points[0][1]-points[1][1])*(points[2][1]-points[1][1]);
   if(angle != 0) return false;

   return det(A,B,A3,B3) == 0 && det(A2,B2,A4,B4) == 0;
}
и вот гений прайз
источник

К

Коля🤔🎭 in 2ch /pr/ #staythefuckhome
Пуйтан
источник

P

PRISE in 2ch /pr/ #staythefuckhome
PRISE
double det(double x1,double y1, double x2,double y2) {
   return x1*y2 - x2*y1;
}
bool isRectangle(std::vector<std::vector<int>> points) {
   swap(points[1],points[3]);

   double A = points[0][1] - points[1][1];
   double B = points[1][0] - points[0][0];
   double C = det(points[0][0],points[0][1],points[1][0],points[1][1]);

   double A2 = points[1][1] - points[2][1];
   double B2 = points[2][0] - points[1][0];
   double C2 = det(points[1][0],points[1][1],points[2][0],points[2][1]);

   double A3 = points[2][1] - points[3][1];
   double B3 = points[3][0] - points[2][0];
   double C3 = det(points[2][0],points[2][1],points[3][0],points[3][1]);

   double A4 = points[3][1] - points[0][1];
   double B4 = points[0][0] - points[3][0];
   double C4 = det(points[3][0],points[3][1],points[0][0],points[0][1]);


   double angle = (points[0][0]-points[1][0])*(points[2][0]-points[1][0])
                + (points[0][1]-points[1][1])*(points[2][1]-points[1][1]);
   if(angle != 0) return false;

   return det(A,B,A3,B3) == 0 && det(A2,B2,A4,B4) == 0;
}
тока нахуя я С считал
источник

P

PRISE in 2ch /pr/ #staythefuckhome
щас удалю
источник

К

Коля🤔🎭 in 2ch /pr/ #staythefuckhome
PRISE
double det(double x1,double y1, double x2,double y2) {
   return x1*y2 - x2*y1;
}
bool isRectangle(std::vector<std::vector<int>> points) {
   swap(points[1],points[3]);

   double A = points[0][1] - points[1][1];
   double B = points[1][0] - points[0][0];
   double C = det(points[0][0],points[0][1],points[1][0],points[1][1]);

   double A2 = points[1][1] - points[2][1];
   double B2 = points[2][0] - points[1][0];
   double C2 = det(points[1][0],points[1][1],points[2][0],points[2][1]);

   double A3 = points[2][1] - points[3][1];
   double B3 = points[3][0] - points[2][0];
   double C3 = det(points[2][0],points[2][1],points[3][0],points[3][1]);

   double A4 = points[3][1] - points[0][1];
   double B4 = points[0][0] - points[3][0];
   double C4 = det(points[3][0],points[3][1],points[0][0],points[0][1]);


   double angle = (points[0][0]-points[1][0])*(points[2][0]-points[1][0])
                + (points[0][1]-points[1][1])*(points[2][1]-points[1][1]);
   if(angle != 0) return false;

   return det(A,B,A3,B3) == 0 && det(A2,B2,A4,B4) == 0;
}
О, плюсы
источник

P

PRISE in 2ch /pr/ #staythefuckhome
источник

К

Коля🤔🎭 in 2ch /pr/ #staythefuckhome
Уважаю
источник

P

PRISE in 2ch /pr/ #staythefuckhome
Коля🤔🎭
Уважаю
double det(double x1,double y1, double x2,double y2) {
   return x1*y2 - x2*y1;
}
bool isRectangle(std::vector<std::vector<int>> points) {
   swap(points[1],points[3]);

   double A = points[0][1] - points[1][1];
   double B = points[1][0] - points[0][0];

   double A2 = points[1][1] - points[2][1];
   double B2 = points[2][0] - points[1][0];

   double A3 = points[2][1] - points[3][1];
   double B3 = points[3][0] - points[2][0];

   double A4 = points[3][1] - points[0][1];
   double B4 = points[0][0] - points[3][0];


   double angle = (points[0][0]-points[1][0])*(points[2][0]-points[1][0])
                + (points[0][1]-points[1][1])*(points[2][1]-points[1][1]);
   if(angle != 0) return false;

   return det(A,B,A3,B3) == 0 && det(A2,B2,A4,B4) == 0;
}
источник

P

PRISE in 2ch /pr/ #staythefuckhome
и скажи, не гений ли после такого прайз
источник

P

PRISE in 2ch /pr/ #staythefuckhome
источник

К

Коля🤔🎭 in 2ch /pr/ #staythefuckhome
О, детерминант
источник

К

Коля🤔🎭 in 2ch /pr/ #staythefuckhome
Гуглил?))))
источник

P

PRISE in 2ch /pr/ #staythefuckhome
Коля🤔🎭
О, детерминант
хуя, ты такие слова знаешь?
источник