This repository has been archived on 2022-05-15. You can view files and clone it, but cannot push or open issues or pull requests.
Files
Kollokvium0307/Ковтун Богдан/Kovtun Bogdan.rkt

29 lines
1.4 KiB
Racket

#lang racket/base
(define (coordinations x1 y1 x2 y2 x3 y3 x4 y4 x5 y5)
(define (square x) (* x x))
(if (equal? (* (- x1 x2) (- y2 y3)) (* (- y1 y2) (- x2 x3)))
(displayln "Points 1, 2 and 3 lie on a common line.")
(displayln "Points 1, 2 and 3 do not lie on a common line."))
(if (equal? (* (- x1 x2) (- y3 y4)) (* (- y1 y2) (- x3 x4)))
(displayln "Lines (1,2) and (3,4) are parallel.")
(displayln "Lines (1,2) and (3,4) are not parallel."))
(if (equal? (+ (* (- x1 x2) (- x3 x4)) (* (- y1 y2) (- y3 y4))) 0 )
(displayln "Lines (1,2) and (3,4) are perpendicular.")
(displayln "Lines (1,2) and (3,4) are not perpendicular."))
(if (equal? (+ (square(- x1 x2)) (square(- y1 y2))) (+ (square(- x3 x4)) (square(- y3 y4))))
(displayln "Lines (1,2) and (3,4) have the same length.")
(displayln "Lines (1,2) and (3,4) do not have the same length.."))
(if (and (equal? (* 2 x1) (+ x2 x3)) (equal? (* 2 y1) (+ y2 y3)))
(displayln "Point 1 is the midpoint of line (2,3).")
(displayln "Point 1 is not the midpoint of line (2,3)."))
(if (and (equal? (* (- x1 x2) (- y2 y3)) (* (- y1 y2) (- x2 x3)) )
(equal? (* (- x1 x4) (- y4 y5)) (* (- y1 y4) (- x4 x5)) ) )
(displayln "Lines (2,3) and (4,5) meet at point 1.")
(displayln "Lines (2,3) and (4,5) do not intersect at point 1."))
(if (and (equal? x1 x2) (equal? y1 y2))
(displayln "Points 1 and 2 are the same.")
(displayln "Points 1 and 2 are not the same."))
)
(coordinations 0 1 0 0 0 1 1 1 2 2)