Replies: 2 comments 2 replies
-
Thank you for the summary @BilalM04. We now have a better idea of what has been done and what must be done. The display looks much nice in Projectile with the scalar multiple version of the equation. However, this appears to just be for the display. Do you have a variable of type vector in the revised Projectile? |
Beta Was this translation helpful? Give feedback.
-
UpdateIn Drasil, Instance Models get converted into Calculation functions. I found there to be some limitations in how the calculation functions are currently implemented. Drasil/code/drasil-code/lib/Language/Drasil/Code/Imperative/Modules.hs Lines 507 to 517 in eb5e8eb Drasil/code/drasil-code/lib/Language/Drasil/Chunk/CodeDefinition.hs Lines 13 to 14 in eb5e8eb In the code blocks above, there are two possible definition types, The limitation here is that, since vector operations are done across multiple lines (using for loops), we need to be able to create intermediary variables, perform operations, then return the result, which is not currently supported. There is a Drasil/code/drasil-code/lib/Language/Drasil/Code/Imperative/Modules.hs Lines 530 to 540 in eb5e8eb |
Beta Was this translation helpful? Give feedback.
-
Moving the vector content from #3892 here, so it doesn't get lost.
Current State of Vectors
There is currently some vector support in
drasil-lang
:vec2D
,rowVec
, andcolumnVec
.dim
,norm
,negVec
,cross
,vScale
,vAdd
,vSub
, anddot product
.There also seems to be some support for vectors in GOOL, implementing vectors and their operations. This vector test file shows that some vector features are operational in GOOL.
My Work
As a start, I changed the calculation of landing time instance model for projectile to use vectors. I changed it to the following:
From #3892, it was suggested to incorporate vector scaling:
My approach was to modify one of the instance models using the current vector support. Then, follow the propagation of errors in order to find where it is lacking. I ran into problems at
convExpr
, which convertsExpr
s to GOOL values. Here, column vectors and vector operations error out.From speaking with @B-rando1, my understanding is that GOOL (somewhat?) supports vectors; however, we are lacking the support for converting vectors to GOOL. Additionally
convExpr
convertsExpr
s toSValue
; however, the vector operations in GOOL expect vectors to be of typeVSThunk
, which I'm not entirely sure what it is, it has something to do with variables. It doesn't seem to be used for anything in GOOL other than vectors.Question
How should I go about converting vectors and vector operations into GOOL's representation of them?
Beta Was this translation helpful? Give feedback.
All reactions