<commit_before>(import
  [pyglet.gl :as gl]
  [pyglet.graphics [vertex_list]]
  [pyglet.image]
  [pyglet.image.codecs.png [PNGImageDecoder]]
  [lib.windows [getRenderTexture :as _getRenderTexture]]
  [math [cos sin pi]]
  [time [time]]
  [lib.graphic.transforming [*]]
  [lib.graphic.coloring [*]])

(require hy.contrib.multi)


(defun time2rad [&optional [mult 1]]
  "trigonometric functions don't handle really hight numbers"
  (% (* mult (time)) (* 2 pi)))


(defclass _Entity []
  "
  Base class of drawing primitives
  "
  [[vertsGl None]
   [n 4]
   [slist []]
   [wlist []]

   [_definePolygon
     (with-decorator staticmethod (fn []))]

   [__init__
     (fn [self]
         (setv self.r 1)

         (setv [self.x self.y self.z]
               [0 0 0])

         (setv self.fill
               [1 1 1 1])
         (setv self.stroke
               [1 1 1 1])
         None)]

   [draw
     (fn [self])]])


(defclass _PolInt [_Entity]
  "
  Interface of polygon classes
  "
  [[_definePolygon
      (with-decorator staticmethod (fn [c n]
                                       (setv c.n n)))]

   [draw
     (fn [self]
         (when (!= self.r 0)  ; TODO do something else, please

           (gl.glTranslatef self.x
                            self.y
                            self.z)
           (gl.glScalef self.r
                        self.r
                        1)

           (unless self.wlist
             (setv self.wlist
                   (vertex_list self.n
                                (tuple ["v2f/static"
                                        (flatten
                                          (map (fn [i]
                                                   (setv theta
                                                         (-> (/ pi self.n)
                                                             (* 2 i)
                                                             (+ (/ pi -2))))
                                                   [(cos theta) (sin theta)])
                                               (range self.n)))])
                                (tuple ["c4f/stream"
                                        (* [1] 4
                                           self.n)]))))

           (unless self.slist
             (setv self.slist<commit_msg>fixed stroke-fill offset in triangles<commit_after>(import
  [pyglet.gl :as gl]
  [pyglet.graphics [vertex_list]]
  [pyglet.image]
  [pyglet.image.codecs.png [PNGImageDecoder]]
  [lib.windows [getRenderTexture :as _getRenderTexture]]
  [math [cos sin pi]]
  [time [time]]
  [lib.graphic.transforming [*]]
  [lib.graphic.coloring [*]])

(require hy.contrib.multi)


(defun time2rad [&optional [mult 1]]
  "trigonometric functions don't handle really hight numbers"
  (% (* mult (time)) (* 2 pi)))


(defclass _Entity []
  "
  Base class of drawing primitives
  "
  [[vertsGl None]
   [n 4]
   [slist []]
   [wlist []]

   [_definePolygon
     (with-decorator staticmethod (fn []))]

   [__init__
     (fn [self]
         (setv self.r 1)

         (setv [self.x self.y self.z]
               [0 0 0])

         (setv self.fill
               [1 1 1 1])
         (setv self.stroke
               [1 1 1 1])
         None)]

   [draw
     (fn [self])]])


(defclass _PolInt [_Entity]
  "
  Interface of polygon classes
  "
  [[_definePolygon
      (with-decorator staticmethod (fn [c n]
                                       (setv c.n n)))]

   [draw
     (fn [self]
         (when (!= self.r 0)  ; TODO do something else, please

           (gl.glTranslatef self.x
                            self.y
                            self.z)
           (gl.glScalef self.r
                        self.r
                        1)

           (unless self.wlist
             (setv self.wlist
                   (vertex_list self.n
                                (tuple ["v2f/static"
                                        (flatten
                                          (map (fn [i]
                                                   (setv theta
                                                         (-> (/ pi self.n)
                                                             (* 2 i)))
                                                   [(cos theta) (sin theta)])
                                               (range self.n)))])
                                (tuple ["c4f/stream"
                                        (* [1] 4
                                           self.n)]))))

           (unless self.slist
             (setv self.slist
{'fraction_non_alphanumeric': 0.10893916099275203, 'fraction_numerical': 0.010322864045684164, 'mean_word_length': 0.9321170980059398, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 38, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7279350', 'n_tokens_mistral': 1302, 'n_tokens_neox': 1205, 'n_words': 311}