<commit_before>{-# LANGUAGE RebindableSyntax  #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE PackageImports    #-}

module Internal.Picture where

import qualified "base" Prelude as P
import Internal.Num
import Internal.Text
import Internal.Color

type Point = (Number, Number)

type Vector = (Number, Number)

addVectors :: Vector -> Vector -> Vector
addVectors (x1,y1) (x2,y2) = (x1 + y1, x2 + y2)

scaleVector :: Number -> Vector -> Vector
scaleVector k (x,y) = (k*x, k*y)

rotateVector :: Number -> Vector -> Vector
rotateVector angle (x,y) = (x * cos angle - y * sin angle,
                            x * sin angle + y * cos angle)

data Picture = Polygon [Point]
             | Line [Point] Number
             | Arc Number Number Number Number
             | Text Text
             | Color Color Picture
             | Translate Number Number Picture
             | Scale Number Number Picture
             | Rotate Number Picture
             | Pictures [Picture]

instance P.Show Picture where show _ = "<<Picture>>"

-- A blank picture<commit_msg>Fix a bug in adding vectors.<commit_after>{-# LANGUAGE RebindableSyntax  #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE PackageImports    #-}

module Internal.Picture where

import qualified "base" Prelude as P
import Internal.Num
import Internal.Text
import Internal.Color

type Point = (Number, Number)

type Vector = (Number, Number)

addVectors :: Vector -> Vector -> Vector
addVectors (x1,y1) (x2,y2) = (x1 + x2, y1 + y2)

scaleVector :: Number -> Vector -> Vector
scaleVector k (x,y) = (k*x, k*y)

rotateVector :: Number -> Vector -> Vector
rotateVector angle (x,y) = (x * cos angle - y * sin angle,
                            x * sin angle + y * cos angle)

data Picture = Polygon [Point]
             | Line [Point] Number
             | Arc Number Number Number Number
             | Text Text
             | Color Color Picture
             | Translate Number Number Picture
             | Scale Number Number Picture
             | Rotate Number Picture
             | Pictures [Picture]

instance P.Show Picture where show _ = "<<Picture>>"

-- A blank picture
{'fraction_non_alphanumeric': 0.10509107893507706, 'fraction_numerical': 0.007473143390938813, 'mean_word_length': 2.3946117274167986, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '650101', 'n_tokens_mistral': 638, 'n_tokens_neox': 629, 'n_words': 220}