Help please solve this problem in Pascal. Well, or you can on js.

My code (Pascal ABC):

program romb; uses crt, graphwpf; var x1,x2,x3,x4,y1,y2,y3,y4, scale, cx, cy: integer; a,b,c,d: real; begin SetMathematicCoords(-10,10,-9.2); drawgrid; cx := trunc(window.Width / 2); cy := trunc(window.Height / 2); Window.Title := 'Задача 1. Определение ромба по координатам'; write('Введите x1, y1: '); readln(x1, y1); write('Введите x2, y2: '); readln(x2, y2); write('Введите x3, y3: '); readln(x3, y3); write('Введите x4, y4: '); readln(x4, y4); if ((x1 <> 0) and (x2 <> 0) and (x3 <> 0) and (x4 <> 0)) then begin scale := 30; moveTo(cx,cy); Polygon(Arr((x1, y1),(x2 ,y2),(x3, y3), (x4, y4)),RGB(255,228,196)); a := trunc(sqrt(sqr(x2-x1)+sqr(y2-y1))); b := trunc(sqrt(sqr(x3-x2)+sqr(y3-y2))); c := trunc(sqrt(sqr(x4-x3)+sqr(y4-y3))); d := trunc(sqrt(sqr(x1-x4)+sqr(y1-y4))); write('A = ',a); write(' B = ',b); write(' C = ',c); write(' D = ',d); writeln(''); if ((a = b) and (b = c) and (c = d)) then if ((x1 <> x2) and (x3 <> x4)) then begin writeln('Это ромб!'); end else writeln('Это квадрат') else if ( ((x1 = x2) and (x2 = x3) and (x3 = x4)) or ((y1 = y2) and (y2 = y3) and (y3 = y4)) or ((x1 = y1) and (x2 = y2) and (x3 = y3) and (x4 = y4)) ) then begin textbackground(1); clrscr; writeln('Это прямая линия!':50) end else begin textbackground(5); clrscr; writeln('Это четырехугольник, но не РОМБ!'); writeln('Так как стороны не равны!'); end; end; readln; end. 

    1 answer 1

    As it is known, the vector product of vectors lying on parallel lines (or collinear) is zero, respectively, you need to check the vector products of vectors formed by opposite edges for equality to zero.

    Then you need to check the perpendicularity of the diagonals using the scalar product