module Drasil.Projectile.Concepts where

import Language.Drasil
import Language.Drasil.Chunk.Concept.NamedCombinators
import qualified Language.Drasil.Sentence.Combinators as S

import Data.Drasil.Concepts.Documentation (constant)
import Data.Drasil.Concepts.Math (angle)
import Data.Drasil.Concepts.Physics (oneD, position, speed, motion, distance, iSpeed, time,
  rectilinear, velocity, acceleration)

concepts :: [IdeaDict]
concepts :: [IdeaDict]
concepts = forall c. Idea c => c -> IdeaDict
nw IdeaDict
projMotion forall a. a -> [a] -> [a]
: forall a b. (a -> b) -> [a] -> [b]
map forall c. Idea c => c -> IdeaDict
nw [IdeaDict
landingPosNC, IdeaDict
launchNC, IdeaDict
launchAngleNC, IdeaDict
launchSpeedNC, IdeaDict
offsetNC, IdeaDict
targetPosNC,
  IdeaDict
rectVel] forall a. [a] -> [a] -> [a]
++ forall a b. (a -> b) -> [a] -> [b]
map forall c. Idea c => c -> IdeaDict
nw [ConceptChunk]
defs

durationNC, flightDurNC, landingPosNC, launchNC, launchAngleNC, launchSpeedNC, offsetNC, targetPosNC,
  rectVel :: IdeaDict
durationNC :: IdeaDict
durationNC   = String -> NP -> IdeaDict
nc String
"duration" (String -> NP
nounPhraseSP String
"duration")
launchNC :: IdeaDict
launchNC     = String -> NP -> IdeaDict
nc String
"launch"   (String -> NP
nounPhraseSP String
"launch")
offsetNC :: IdeaDict
offsetNC     = String -> NP -> IdeaDict
nc String
"offset"   (Sentence -> NP
nounPhraseSent forall a b. (a -> b) -> a -> b
$ String -> Sentence
S String
"distance between the" Sentence -> Sentence -> Sentence
+:+ forall n. NounPhrase n => n -> Sentence
phraseNP (IdeaDict
targetPosNC forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`andThe` IdeaDict
landingPosNC))

flightDurNC :: IdeaDict
flightDurNC   = forall a b. (NamedIdea a, NamedIdea b) => a -> b -> IdeaDict
compoundNC (String -> NP -> IdeaDict
nc String
"flight"  (String -> NP
nounPhraseSP String
"flight" )) IdeaDict
durationNC
landingPosNC :: IdeaDict
landingPosNC  = forall a b. (NamedIdea a, NamedIdea b) => a -> b -> IdeaDict
compoundNC (String -> NP -> IdeaDict
nc String
"landing" (String -> NP
nounPhraseSP String
"landing")) ConceptChunk
position
launchAngleNC :: IdeaDict
launchAngleNC = forall a b. (NamedIdea a, NamedIdea b) => a -> b -> IdeaDict
compoundNC IdeaDict
launchNC ConceptChunk
angle
launchSpeedNC :: IdeaDict
launchSpeedNC = forall a b. (NamedIdea a, NamedIdea b) => a -> b -> IdeaDict
compoundNC IdeaDict
launchNC ConceptChunk
speed
targetPosNC :: IdeaDict
targetPosNC   = forall a b. (NamedIdea a, NamedIdea b) => a -> b -> IdeaDict
compoundNC ConceptChunk
target ConceptChunk
position
rectVel :: IdeaDict
rectVel       = forall a b. (NamedIdea a, NamedIdea b) => a -> b -> IdeaDict
compoundNC ConceptChunk
rectilinear ConceptChunk
velocity

projMotion :: IdeaDict
projMotion :: IdeaDict
projMotion = forall a b. (NamedIdea a, NamedIdea b) => a -> b -> IdeaDict
compoundNC ConceptChunk
projectile ConceptChunk
motion
---

defs :: [ConceptChunk]
defs :: [ConceptChunk]
defs = [ConceptChunk
launcher, ConceptChunk
projectile, ConceptChunk
target, ConceptChunk
projSpeed, ConceptChunk
projPos]

launcher, projectile, target, projSpeed, projPos :: ConceptChunk
launcher :: ConceptChunk
launcher   = String -> NP -> String -> ConceptChunk
dcc String
"launcher"   (String -> NP
nounPhraseSP String
"launcher")  (String
"where the projectile is launched from " forall a. [a] -> [a] -> [a]
++
                                                          String
"and the device that does the launching")
projectile :: ConceptChunk
projectile = String -> NP -> String -> ConceptChunk
dcc String
"projectile" (String -> NP
nounPhraseSP String
"projectile") String
"the object to be launched at the target"
target :: ConceptChunk
target     = String -> NP -> String -> ConceptChunk
dcc String
"target"     (String -> NP
nounPhraseSP String
"target")     String
"where the projectile should be launched to"

projSpeed :: ConceptChunk
projSpeed  = String -> NP -> Sentence -> ConceptChunk
dccWDS String
"projSpeed" (String -> NP
nounPhraseSP String
"1D speed")    (CI -> Sentence
getAcc CI
oneD Sentence -> Sentence -> Sentence
+:+ forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
speed Sentence -> Sentence -> Sentence
+:+ String -> Sentence
S String
"under" Sentence -> Sentence -> Sentence
+:+ forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
constant Sentence -> Sentence -> Sentence
+:+ forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
acceleration)
projPos :: ConceptChunk
projPos    = String -> NP -> Sentence -> ConceptChunk
dccWDS String
"projPos"   (String -> NP
nounPhraseSP String
"1D position") (CI -> Sentence
getAcc CI
oneD Sentence -> Sentence -> Sentence
+:+ forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
position Sentence -> Sentence -> Sentence
+:+ String -> Sentence
S String
"under" Sentence -> Sentence -> Sentence
+:+ forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
constant Sentence -> Sentence -> Sentence
+:+ forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
speed)

landPos, launAngle, launSpeed, offset, targPos, flightDur :: ConceptChunk
landPos :: ConceptChunk
landPos = forall c. Idea c => c -> Sentence -> ConceptChunk
cc' IdeaDict
landingPosNC
  ([Sentence] -> Sentence
foldlSent_ [forall n. NounPhrase n => n -> Sentence
phraseNP (forall t. NamedIdea t => t -> NP
the ConceptChunk
distance) Sentence -> Sentence -> Sentence
`S.fromThe` forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
launcher Sentence -> Sentence -> Sentence
`S.toThe`
            String -> Sentence
S String
"final", forall n. NounPhrase n => n -> Sentence
phraseNP (ConceptChunk
position forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`ofThe` ConceptChunk
projectile)])

launAngle :: ConceptChunk
launAngle = forall c. Idea c => c -> Sentence -> ConceptChunk
cc' IdeaDict
launchAngleNC
  ([Sentence] -> Sentence
foldlSent_ [forall n. NounPhrase n => n -> Sentence
phraseNP (forall t. NamedIdea t => t -> NP
the ConceptChunk
angle), String -> Sentence
S String
"between the", forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
launcher Sentence -> Sentence -> Sentence
`S.and_` String -> Sentence
S String
"a straight line"
             Sentence -> Sentence -> Sentence
`S.fromThe` forall n. NounPhrase n => n -> Sentence
phraseNP (ConceptChunk
launcher forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`toThe` ConceptChunk
target)])

launSpeed :: ConceptChunk
launSpeed = forall c. Idea c => c -> Sentence -> ConceptChunk
cc' IdeaDict
launchSpeedNC (forall n. NounPhrase n => n -> Sentence
phraseNP (ConceptChunk
iSpeed forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`the_ofThe` ConceptChunk
projectile) Sentence -> Sentence -> Sentence
+:+ String -> Sentence
S String
"when launched")
offset :: ConceptChunk
offset = forall c. Idea c => c -> Sentence -> ConceptChunk
cc' IdeaDict
offsetNC (String -> Sentence
S String
"the offset between the" Sentence -> Sentence -> Sentence
+:+ forall n. NounPhrase n => n -> Sentence
phraseNP (IdeaDict
targetPosNC forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`andThe` IdeaDict
landingPosNC))
targPos :: ConceptChunk
targPos = forall c. Idea c => c -> Sentence -> ConceptChunk
cc' IdeaDict
targetPosNC (forall n. NounPhrase n => n -> Sentence
phraseNP (forall t. NamedIdea t => t -> NP
the ConceptChunk
distance) Sentence -> Sentence -> Sentence
`S.fromThe` forall n. NounPhrase n => n -> Sentence
phraseNP (ConceptChunk
launcher forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`toThe` ConceptChunk
target))
flightDur :: ConceptChunk
flightDur = forall c. Idea c => c -> Sentence -> ConceptChunk
cc' IdeaDict
flightDurNC ([Sentence] -> Sentence
foldlSent_ [forall n. NounPhrase n => n -> Sentence
phraseNP (forall t. NamedIdea t => t -> NP
the ConceptChunk
time), String -> Sentence
S String
"when the", forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
projectile, String -> Sentence
S String
"lands"])