Restructure files, add new subsystems

This commit is contained in:
hasufell 2014-10-07 19:12:07 +02:00
parent 3ef3fb1621
commit b7d752ae20
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020
7 changed files with 35 additions and 20 deletions

View File

@ -54,7 +54,7 @@ executable CG2
main-is: Main.hs main-is: Main.hs
-- Modules included in this executable, other than Main. -- Modules included in this executable, other than Main.
other-modules: Defaults Diagram Gtk Meshparser Parser Util other-modules: Defaults Diagram Gtk Parser.Meshparser Parser.Core OS.FileExt LinearAlgebra.Vector
-- LANGUAGE extensions used by modules in this package. -- LANGUAGE extensions used by modules in this package.
-- other-extensions: -- other-extensions:

View File

@ -12,8 +12,8 @@ module Diagram (t,
import Defaults import Defaults
import Diagrams.Prelude import Diagrams.Prelude
import Diagrams.Backend.Cairo import Diagrams.Backend.Cairo
import Meshparser import LinearAlgebra.Vector
import Util import Parser.Meshparser
-- |Represents a Cairo Diagram. This allows us to create multiple -- |Represents a Cairo Diagram. This allows us to create multiple

3
Gtk.hs
View File

@ -12,8 +12,7 @@ import Graphics.UI.Gtk
import Graphics.UI.Gtk.Glade import Graphics.UI.Gtk.Glade
import System.Directory import System.Directory
import Text.Read import Text.Read
import Util import OS.FileExt
-- |Monolithic object passed to various GUI functions in order -- |Monolithic object passed to various GUI functions in order
-- to keep the API stable and not alter the parameters too much. -- to keep the API stable and not alter the parameters too much.

27
LinearAlgebra/Vector.hs Normal file
View File

@ -0,0 +1,27 @@
{-# OPTIONS_HADDOCK ignore-exports #-}
module LinearAlgebra.Vector where
import Data.Vector.Class
type Angle = Double
-- |Checks whether the Coordinates are in a given dimension.
inRange :: (Double, Double) -- ^ X dimension
-> (Double, Double) -- ^ Y dimension
-> (Double, Double) -- ^ Coordinates
-> Bool -- ^ result
inRange (xlD, xuD) (ylD, yuD) (x,y)
= x <= xuD && x >= xlD && y <= yuD && y >= ylD
-- |Get the angle between two vectors in degrees.
getAngle :: (Vector v) => v -> v -> Angle
getAngle a b = (*) 180.0 .
flip (/) pi .
acos .
flip (/) (vmag a * vmag b) .
vdot a $
b

View File

@ -1,17 +1,6 @@
{-# OPTIONS_HADDOCK ignore-exports #-} {-# OPTIONS_HADDOCK ignore-exports #-}
module Util where module OS.FileExt where
-- |Checks whether the Coordinates are in a given dimension.
inRange :: (Double, Double) -- ^ X dimension
-> (Double, Double) -- ^ Y dimension
-> (Double, Double) -- ^ Coordinates
-> Bool -- ^ result
inRange (xlD, xuD) (ylD, yuD) (x,y)
| x <= xuD && x >= xlD &&
y <= yuD && y >= ylD = True
| otherwise = False
-- |Compare the extension of a file with the given String. -- |Compare the extension of a file with the given String.

View File

@ -1,6 +1,6 @@
{-# OPTIONS_HADDOCK ignore-exports #-} {-# OPTIONS_HADDOCK ignore-exports #-}
module Parser (Parser, module Parser.Core (Parser,
runParser, runParser,
satisfy, satisfy,
char, char,

View File

@ -1,9 +1,9 @@
{-# OPTIONS_HADDOCK ignore-exports #-} {-# OPTIONS_HADDOCK ignore-exports #-}
module Meshparser (VTable, meshToArr) where module Parser.Meshparser (VTable, meshToArr) where
import Control.Applicative import Control.Applicative
import Parser import Parser.Core
-- |The VTable is represented by a 'Double' tuple, 2-dimensional. -- |The VTable is represented by a 'Double' tuple, 2-dimensional.
type VTable = [(Double, Double)] type VTable = [(Double, Double)]