module Drasil.Projectile.Concepts (
launcher, projectile, target, projMotion, defs, rectVel, ideaDicts,
flightDur, offset, landPos, launAngleTerm, launAngleDef, launSpeed, targPos, projSpeed, projPos
) where
import Drasil.Database (mkUid)
import Control.Lens ((^.))
import Language.Drasil
import Language.Drasil.Chunk.Concept.NamedCombinators
import qualified Language.Drasil.Development as D
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)
ideaDicts :: [IdeaDict]
ideaDicts :: [IdeaDict]
ideaDicts = [IdeaDict
projMotion, IdeaDict
launch, IdeaDict
rectVel]
launch :: IdeaDict
launch :: IdeaDict
launch = UID -> NPG Symbol -> IdeaDict
idea' (String -> UID
mkUid String
"launch") (String -> NPG Symbol
forall a. String -> NPG a
nounPhraseSP String
"launch")
rectVel :: IdeaDict
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]
launcher, projectile, target, projSpeed, projPos, landPos, launSpeed,
offset, targPos, flightDur :: ConceptChunk
launcher :: ConceptChunk
launcher = UID -> NPG Symbol -> Sentence -> ConceptChunk
cncpt''' (String -> UID
mkUid String
"launcher") (String -> NPG Symbol
forall a. String -> NPG a
nounPhraseSP String
"launcher")
(String -> Sentence
S String
"where the projectile is launched from and the device that does the launching")
projectile :: ConceptChunk
projectile = UID -> NPG Symbol -> Sentence -> ConceptChunk
cncpt''' (String -> UID
mkUid String
"projectile") (String -> NPG Symbol
forall a. String -> NPG a
nounPhraseSP String
"projectile")
(String -> Sentence
S String
"the object to be launched at the target")
target :: ConceptChunk
target = UID -> NPG Symbol -> Sentence -> ConceptChunk
cncpt''' (String -> UID
mkUid String
"target") (String -> NPG Symbol
forall a. String -> NPG a
nounPhraseSP String
"target")
(String -> Sentence
S String
"where the projectile should be launched to")
projSpeed :: ConceptChunk
projSpeed = UID -> NPG Symbol -> Sentence -> ConceptChunk
cncpt''' (String -> UID
mkUid String
"projSpeed") (String -> NPG Symbol
forall a. String -> NPG a
nounPhraseSP String
"1D speed")
(CI -> Sentence
forall c. Idea c => c -> Sentence
short 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 = UID -> NPG Symbol -> Sentence -> ConceptChunk
cncpt''' (String -> UID
mkUid String
"projPos") (String -> NPG Symbol
forall a. String -> NPG a
nounPhraseSP String
"1D position")
(CI -> Sentence
forall c. Idea c => c -> Sentence
short 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 :: ConceptChunk
landPos = UID -> NPG Symbol -> Sentence -> ConceptChunk
cncpt''' (String -> UID
mkUid String
"landingposition") (NPG Symbol -> NPG Symbol -> NPG Symbol
forall ta a tb.
(NounPhrase ta a, NounPhrase tb a) =>
ta -> tb -> NPG a
compoundPhrase (String -> NPG Symbol
forall a. String -> NPG a
nounPhraseSP String
"landing") (ConceptChunk
position ConceptChunk
-> Getting (NPG Symbol) ConceptChunk (NPG Symbol) -> NPG Symbol
forall s a. s -> Getting a s a -> a
^. Getting (NPG Symbol) ConceptChunk (NPG Symbol)
forall c. NamedIdea c => Lens' c (NPG Symbol)
Lens' ConceptChunk (NPG Symbol)
term))
([Sentence] -> Sentence
foldlSent_ [NPStruct -> Sentence
D.toSent (NPG Symbol -> NPStruct
forall n a. NounPhrase n a => n -> NPStructG a
phraseNP (ConceptChunk -> NPG Symbol
forall t. NamedIdea t => t -> NPG Symbol
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", NPStruct -> Sentence
D.toSent (NPStruct -> Sentence) -> NPStruct -> Sentence
forall a b. (a -> b) -> a -> b
$ NPG Symbol -> NPStruct
forall n a. NounPhrase n a => n -> NPStructG a
phraseNP (ConceptChunk
position ConceptChunk -> ConceptChunk -> NPG Symbol
forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NPG Symbol
`ofThe` ConceptChunk
projectile)])
launAngleTerm :: NP
launAngleTerm :: NPG Symbol
launAngleTerm = NPG Symbol -> NPG Symbol -> NPG Symbol
forall ta a tb.
(NounPhrase ta a, NounPhrase tb a) =>
ta -> tb -> NPG a
compoundPhrase (IdeaDict
launch IdeaDict
-> Getting (NPG Symbol) IdeaDict (NPG Symbol) -> NPG Symbol
forall s a. s -> Getting a s a -> a
^. Getting (NPG Symbol) IdeaDict (NPG Symbol)
forall c. NamedIdea c => Lens' c (NPG Symbol)
Lens' IdeaDict (NPG Symbol)
term) (ConceptChunk
angle ConceptChunk
-> Getting (NPG Symbol) ConceptChunk (NPG Symbol) -> NPG Symbol
forall s a. s -> Getting a s a -> a
^. Getting (NPG Symbol) ConceptChunk (NPG Symbol)
forall c. NamedIdea c => Lens' c (NPG Symbol)
Lens' ConceptChunk (NPG Symbol)
term)
launAngleDef :: Sentence
launAngleDef :: Sentence
launAngleDef = [Sentence] -> Sentence
foldlSent_ [NPStruct -> Sentence
D.toSent (NPStruct -> Sentence) -> NPStruct -> Sentence
forall a b. (a -> b) -> a -> b
$ NPG Symbol -> NPStruct
forall n a. NounPhrase n a => n -> NPStructG a
phraseNP (ConceptChunk -> NPG Symbol
forall t. NamedIdea t => t -> NPG Symbol
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` NPStruct -> Sentence
D.toSent (NPG Symbol -> NPStruct
forall n a. NounPhrase n a => n -> NPStructG a
phraseNP (ConceptChunk
launcher ConceptChunk -> ConceptChunk -> NPG Symbol
forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NPG Symbol
`toThe` ConceptChunk
target))]
launSpeed :: ConceptChunk
launSpeed = UID -> NPG Symbol -> Sentence -> ConceptChunk
cncpt''' (String -> UID
mkUid String
"launchspeed") (NPG Symbol -> NPG Symbol -> NPG Symbol
forall ta a tb.
(NounPhrase ta a, NounPhrase tb a) =>
ta -> tb -> NPG a
compoundPhrase (IdeaDict
launch IdeaDict
-> Getting (NPG Symbol) IdeaDict (NPG Symbol) -> NPG Symbol
forall s a. s -> Getting a s a -> a
^. Getting (NPG Symbol) IdeaDict (NPG Symbol)
forall c. NamedIdea c => Lens' c (NPG Symbol)
Lens' IdeaDict (NPG Symbol)
term) (ConceptChunk
speed ConceptChunk
-> Getting (NPG Symbol) ConceptChunk (NPG Symbol) -> NPG Symbol
forall s a. s -> Getting a s a -> a
^. Getting (NPG Symbol) ConceptChunk (NPG Symbol)
forall c. NamedIdea c => Lens' c (NPG Symbol)
Lens' ConceptChunk (NPG Symbol)
term))
(NPStruct -> Sentence
D.toSent (NPG Symbol -> NPStruct
forall n a. NounPhrase n a => n -> NPStructG a
phraseNP (ConceptChunk
iSpeed ConceptChunk -> ConceptChunk -> NPG Symbol
forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NPG Symbol
`the_ofThe` ConceptChunk
projectile)) Sentence -> Sentence -> Sentence
+:+ String -> Sentence
S String
"when launched")
offset :: ConceptChunk
offset = UID -> NPG Symbol -> Sentence -> ConceptChunk
cncpt''' (String -> UID
mkUid String
"offset") (NPG Symbol -> NPG Symbol -> NPG Symbol
forall ta a tb.
(NounPhrase ta a, NounPhrase tb a) =>
ta -> tb -> NPG a
compoundPhrase (String -> NPG Symbol
forall a. String -> NPG a
cn String
"distance between the") (ConceptChunk
targPos ConceptChunk -> ConceptChunk -> NPG Symbol
forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NPG Symbol
`andThe` ConceptChunk
landPos))
(String -> Sentence
S String
"the offset between the" Sentence -> Sentence -> Sentence
+:+ NPStruct -> Sentence
D.toSent (NPG Symbol -> NPStruct
forall n a. NounPhrase n a => n -> NPStructG a
phraseNP (ConceptChunk
targPos ConceptChunk -> ConceptChunk -> NPG Symbol
forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NPG Symbol
`andThe` ConceptChunk
landPos)))
targPos :: ConceptChunk
targPos = UID -> NPG Symbol -> Sentence -> ConceptChunk
cncpt''' (String -> UID
mkUid String
"targetposition") (NPG Symbol -> NPG Symbol -> NPG Symbol
forall ta a tb.
(NounPhrase ta a, NounPhrase tb a) =>
ta -> tb -> NPG a
compoundPhrase (ConceptChunk
target ConceptChunk
-> Getting (NPG Symbol) ConceptChunk (NPG Symbol) -> NPG Symbol
forall s a. s -> Getting a s a -> a
^. Getting (NPG Symbol) ConceptChunk (NPG Symbol)
forall c. NamedIdea c => Lens' c (NPG Symbol)
Lens' ConceptChunk (NPG Symbol)
term) (ConceptChunk
position ConceptChunk
-> Getting (NPG Symbol) ConceptChunk (NPG Symbol) -> NPG Symbol
forall s a. s -> Getting a s a -> a
^. Getting (NPG Symbol) ConceptChunk (NPG Symbol)
forall c. NamedIdea c => Lens' c (NPG Symbol)
Lens' ConceptChunk (NPG Symbol)
term))
(NPStruct -> Sentence
D.toSent (NPG Symbol -> NPStruct
forall n a. NounPhrase n a => n -> NPStructG a
phraseNP (ConceptChunk -> NPG Symbol
forall t. NamedIdea t => t -> NPG Symbol
the ConceptChunk
distance)) Sentence -> Sentence -> Sentence
`S.fromThe` NPStruct -> Sentence
D.toSent (NPG Symbol -> NPStruct
forall n a. NounPhrase n a => n -> NPStructG a
phraseNP (ConceptChunk
launcher ConceptChunk -> ConceptChunk -> NPG Symbol
forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NPG Symbol
`toThe` ConceptChunk
target)))
flightDur :: ConceptChunk
flightDur = UID -> NPG Symbol -> Sentence -> ConceptChunk
cncpt''' (String -> UID
mkUid String
"flightduration") (NPG Symbol -> NPG Symbol -> NPG Symbol
forall ta a tb.
(NounPhrase ta a, NounPhrase tb a) =>
ta -> tb -> NPG a
compoundPhrase (String -> NPG Symbol
forall a. String -> NPG a
nounPhraseSP String
"flight") (String -> NPG Symbol
forall a. String -> NPG a
nounPhraseSP String
"duration"))
([Sentence] -> Sentence
foldlSent_ [NPStruct -> Sentence
D.toSent (NPStruct -> Sentence) -> NPStruct -> Sentence
forall a b. (a -> b) -> a -> b
$ NPG Symbol -> NPStruct
forall n a. NounPhrase n a => n -> NPStructG a
phraseNP (ConceptChunk -> NPG Symbol
forall t. NamedIdea t => t -> NPG Symbol
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"])