     [1  0  0  0]]))
 
 (defmethod line-points :ermit [{:keys [p1 p4 v1 v4]}]
-  (m/emap
-   floor
-   (m/mmul
-    (m/matrix
-     (map (fn [t] [(* t t t) (* t t) t 1]) (range 0 1 0.01)))
-    ermit-matrix
-    (m/matrix (list p1
-                    p4
-                    v1
-                    v4)))))
+    (linearise (get-form-points ermit-matrix [p1 p4 v1 v4])))
+
 (line-points (->Ermit [30 30] [240 300] [130 20] [200 400]))
 
 (defn ->Bezie [p1 p2 p3 p4]

    [1  0  0 0]]))

(defmethod line-points :bezie [{:keys [p1 p2 p3 p4]}]
  (m/emap
   floor
   (m/mmul
    (m/matrix
     (map (fn [t] [(* t t t) (* t t) t 1]) (range 0 1 0.01)))
    bezie-matrix
    (m/matrix (list p1
                    p2
                    p3
                    p4)))))

(defn ->Spline [& rest]
  {:type :spline :points (into [] (concat (list (first rest)) rest (take-last 1 rest)))})

(comment
  (->Spline [0 0] [100 100]))

(def b-spline-matrix
  (m/mul

(ns labs-4-cource.aproximation
  (:require [clojure.core.matrix :as m]
            [labs-4-cource.first-order-lines
             :refer
             [->BrezenhameLine floor line-points]]))

(defn get-form-points [matrix [p1 p2 p3 p4]]
    (m/emap
     floor
     (m/mmul
      (m/matrix
       (map (fn [t] [(* t t t) (* t t) t 1]) (range 0 1 0.05)))
      matrix
      (m/matrix (list p1
                      p2
                      p3
                      p4)))))

(defn linearise [points]
    (mapcat line-points
            (map (fn [[p1 p2]] (->BrezenhameLine p1 p2))
                 (partition 2 1 points))))

(defn ->Ermit [p1 p2 p3 p4]
  (let [[x1 y1] p1
