Restructure files, add new subsystems
This commit is contained in:
parent
3ef3fb1621
commit
b7d752ae20
@ -54,7 +54,7 @@ executable CG2
|
||||
main-is: Main.hs
|
||||
|
||||
-- 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.
|
||||
-- other-extensions:
|
||||
|
@ -12,8 +12,8 @@ module Diagram (t,
|
||||
import Defaults
|
||||
import Diagrams.Prelude
|
||||
import Diagrams.Backend.Cairo
|
||||
import Meshparser
|
||||
import Util
|
||||
import LinearAlgebra.Vector
|
||||
import Parser.Meshparser
|
||||
|
||||
|
||||
-- |Represents a Cairo Diagram. This allows us to create multiple
|
||||
|
3
Gtk.hs
3
Gtk.hs
@ -12,8 +12,7 @@ import Graphics.UI.Gtk
|
||||
import Graphics.UI.Gtk.Glade
|
||||
import System.Directory
|
||||
import Text.Read
|
||||
import Util
|
||||
|
||||
import OS.FileExt
|
||||
|
||||
-- |Monolithic object passed to various GUI functions in order
|
||||
-- to keep the API stable and not alter the parameters too much.
|
||||
|
27
LinearAlgebra/Vector.hs
Normal file
27
LinearAlgebra/Vector.hs
Normal 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
|
@ -1,17 +1,6 @@
|
||||
{-# OPTIONS_HADDOCK ignore-exports #-}
|
||||
|
||||
module Util 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
|
||||
module OS.FileExt where
|
||||
|
||||
|
||||
-- |Compare the extension of a file with the given String.
|
@ -1,6 +1,6 @@
|
||||
{-# OPTIONS_HADDOCK ignore-exports #-}
|
||||
|
||||
module Parser (Parser,
|
||||
module Parser.Core (Parser,
|
||||
runParser,
|
||||
satisfy,
|
||||
char,
|
@ -1,9 +1,9 @@
|
||||
{-# OPTIONS_HADDOCK ignore-exports #-}
|
||||
|
||||
module Meshparser (VTable, meshToArr) where
|
||||
module Parser.Meshparser (VTable, meshToArr) where
|
||||
|
||||
import Control.Applicative
|
||||
import Parser
|
||||
import Parser.Core
|
||||
|
||||
-- |The VTable is represented by a 'Double' tuple, 2-dimensional.
|
||||
type VTable = [(Double, Double)]
|
Loading…
Reference in New Issue
Block a user