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 = IdeaDict -> IdeaDict
forall c. Idea c => c -> IdeaDict
nw IdeaDict
projMotion IdeaDict -> [IdeaDict] -> [IdeaDict]
forall a. a -> [a] -> [a]
: (IdeaDict -> IdeaDict) -> [IdeaDict] -> [IdeaDict]
forall a b. (a -> b) -> [a] -> [b]
map IdeaDict -> IdeaDict
forall c. Idea c => c -> IdeaDict
nw [IdeaDict
landingPosNC, IdeaDict
launchNC, IdeaDict
launchAngleNC, IdeaDict
launchSpeedNC, IdeaDict
offsetNC, IdeaDict
targetPosNC,
  IdeaDict
rectVel] [IdeaDict] -> [IdeaDict] -> [IdeaDict]
forall a. [a] -> [a] -> [a]
++ (ConceptChunk -> IdeaDict) -> [ConceptChunk] -> [IdeaDict]
forall a b. (a -> b) -> [a] -> [b]
map ConceptChunk -> IdeaDict
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 (Sentence -> NP) -> Sentence -> NP
forall a b. (a -> b) -> a -> b
$ String -> Sentence
S String
"distance between the" Sentence -> Sentence -> Sentence
+:+ NP -> Sentence
forall n. NounPhrase n => n -> Sentence
phraseNP (IdeaDict
targetPosNC IdeaDict -> IdeaDict -> NP
forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`andThe` IdeaDict
landingPosNC))

flightDurNC :: IdeaDict
flightDurNC   = IdeaDict -> IdeaDict -> IdeaDict
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  = IdeaDict -> ConceptChunk -> IdeaDict
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 = IdeaDict -> ConceptChunk -> IdeaDict
forall a b. (NamedIdea a, NamedIdea b) => a -> b -> IdeaDict
compoundNC IdeaDict
launchNC ConceptChunk
angle
launchSpeedNC :: IdeaDict
launchSpeedNC = IdeaDict -> ConceptChunk -> IdeaDict
forall a b. (NamedIdea a, NamedIdea b) => a -> b -> IdeaDict
compoundNC IdeaDict
launchNC ConceptChunk
speed
targetPosNC :: IdeaDict
targetPosNC   = ConceptChunk -> ConceptChunk -> IdeaDict
forall a b. (NamedIdea a, NamedIdea b) => a -> b -> IdeaDict
compoundNC ConceptChunk
target ConceptChunk
position
rectVel :: IdeaDict
rectVel       = ConceptChunk -> ConceptChunk -> IdeaDict
forall a b. (NamedIdea a, NamedIdea b) => a -> b -> IdeaDict
compoundNC ConceptChunk
rectilinear ConceptChunk
velocity

projMotion :: IdeaDict
projMotion :: IdeaDict
projMotion = ConceptChunk -> ConceptChunk -> IdeaDict
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 " String -> String -> String
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
+:+ ConceptChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
speed Sentence -> Sentence -> Sentence
+:+ String -> Sentence
S String
"under" Sentence -> Sentence -> Sentence
+:+ IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
constant Sentence -> Sentence -> Sentence
+:+ ConceptChunk -> 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
+:+ ConceptChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
position Sentence -> Sentence -> Sentence
+:+ String -> Sentence
S String
"under" Sentence -> Sentence -> Sentence
+:+ IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
constant Sentence -> Sentence -> Sentence
+:+ ConceptChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
speed)

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

launAngle :: ConceptChunk
launAngle = IdeaDict -> Sentence -> ConceptChunk
forall c. Idea c => c -> Sentence -> ConceptChunk
cc' IdeaDict
launchAngleNC
  ([Sentence] -> Sentence
foldlSent_ [NP -> Sentence
forall n. NounPhrase n => n -> Sentence
phraseNP (ConceptChunk -> NP
forall t. NamedIdea t => t -> NP
the ConceptChunk
angle), String -> Sentence
S String
"between the", ConceptChunk -> Sentence
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` NP -> Sentence
forall n. NounPhrase n => n -> Sentence
phraseNP (ConceptChunk
launcher ConceptChunk -> ConceptChunk -> NP
forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`toThe` ConceptChunk
target)])

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