-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modules/rune #80
Modules/rune #80
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job! I just have the following few queries, some of which requires prof's input, marked with (Require Prof's advice):
Major:
- (Require Prof's advice)
show(rune)
seems obsolete. It does nothing from what I see fromfunctions.ts
, and that tab is spawned and the rune is rendered as long as the last statement returns a rune.
However, it shouldn't be useless as assignment of variable does not return any value and hence, may be required when displaying runes that are assigned to a variable. For example,const a = circle; show(a);
.
I'm suggesting that it should be required for show to be the last statement for rune to be displayed.
Also, by makingshow(rune)
do nothing,show(show(...(show(rune)))
displays rune normally, where it shouldn't. stack_frac(frac, rune1, rune2)
is allowing frac argument to be <0 or >1, where logically and in documentation shouldn't. Same forbeside_frac
.overlay
andoverlay_frac
not working as expected. Example:overlay(circle, circle)
Expected:
Actual:
Minor:
gl.createShader(type)
seems to return a null value at times after prolong use of the playground. A developer stage error page will pop out, but I'm not sure if the problem will persist in production and crash SA. Since the functions are from the curve module and that there are yet to be reports on this for curve, I assume it should not persist.- (Require Prof's advice)
hollusion
seems to just move the rune left and right, is that the intended behaviour? I put it under minor as it seems to be so in the old js-slang library too, but the function doesn't seem to add any educational value. - (Require Prof's advice) I briefly remember there is a function to view 3D runes' overlays from the side. Not sure if that function is only available in one of the missions/quests. It may be useful for testing.
Regarding minor question 2: hollusion: This is for 3D runes, created by overlay and overlay_frac. The "move rune left and right" should have a 3D effect if you view the rune using hollusion. Can you verify that that's the case? |
Regarding minor question 3: 3D runes: No, the only way to see 3D runes is with hollusion (with the left-to-right shifting with 3D effect) and the show function. Note that "show" will use grey-scale. To answer your question on "view from the side": You memory is wrong: The instructions to the mission show a side-view for illustration, but the Source Academy does not support that. I forgot: We also have the function anaglyph, which uses cyan-magenta and is to be used with 3D-glasses. See here for the documentation: https://docs.sourceacademy.org/RUNES/index.html The reviewer needs to make sure that the full specs are implemented in the module. |
Regarding major question 1: In the following I'm referring to the documentation when I talk about "rune" and "picture": https://docs.sourceacademy.org/RUNES/global.html#show I'm ok with conflating the notions of "rune" and "picture" for the case of "show". That's consistent with the current specs. In that case, "show" is the identity function, and "hollusion" and "anaglyph" produce "more fancy versions" of the rune. |
Ahh ok, I asked the question as I couldn't find the function in the documentation. I did do a full spec review on everything that is implemented.
I have tested it on the current js-slang library and I get what you mean by 3D effect. // The current PR's implementation
hollusion(scale(0.1, overlay(blue(circle), overlay(circle, orange(circle)))));
// The current js-slang implementation
show(hollusion(scale(0.1, overlay(blue(circle), overlay(circle, orange(circle)))), 2)); However, this PR has yet to implement overlay correctly so I can't test if hollusion is implemented correctly too.
I am currently against this. Blurring the distinction between the two might have nonsensical implications on visualiser functions and is possibly much more challenging to implement. If a hollusion and anaglyph is treated as a rune, as it is currently in the PR, then the following will be allowed: beside(hollusion(scale(0.1, overlay(blue(circle), overlay(circle, orange(circle))))), circle);
beside(anaglyph(scale(0.1, overlay(blue(circle), overlay(circle, orange(circle))))), circle); However, the current implementation of |
Yes, makes sense. Let's not conflate the notions of "picture" and "rune". Let's stick to the current specs. @houruomu can you take another look? |
Major (1,2) fixed. Major (3) requires comment. Excited to introduce a new feature to use images to create runes:
|
Please help review, thanks. Major 1-3 fixed. Now should have feature parity. Known issue to be postponed in future PR:
Features postponed to future PR:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! All works as expected. I just have 2 comments but they rather minor, nothing breaking.
Minor:
anaglyph(show(scale(0.5, overlay(scale(0.25, orange(circle)), circle))));
shows error message "Error: show expects a rune as argument." instead of "Error: anaglyph expects a rune as argument."hollusion
is now much more subtle than it used to be. I personally prefer it to be drastic. What do prof think?
hollusion(overlay(scale(0.7, ribbon),
overlay(scale(0.8, blue(ribbon)),
overlay(scale(0.95, orange(ribbon)), ribbon))), 1);
Great. I'm merging and are making issues out of the comments by @ZhengHanLee |
@houruomu This is super nice! I was bitten by Question: in Chapter 2.2.4 of SICP, we apply some transformations like |
We havent ported the painter stuff to Source Academy yet. That may be something for Ruomu in the next couple of months if he has the time. But probably not in time for our book. I think we'll end up drawing these "by hand" as we've done in the past. |
OK, got it. (That was what I expected!)
När du har kontakt med oss på Uppsala universitet med e-post så innebär det att vi behandlar dina personuppgifter. För att läsa mer om hur vi gör det kan du läsa här: http://www.uu.se/om-uu/dataskydd-personuppgifter/
E-mailing Uppsala University means that we will process your personal data. For more information on how this is performed, please read here: http://www.uu.se/en/about-uu/data-protection-policy
|
Description
The rune library has been hard-coded into the frontend of Source Academy. This branch migrated the rune library to the 'rune' module that is fully compliance with the module specifications.
A refactoring and redesign of the code is done, and the current code follows KISS and DIY. It should make future development and maintenance easier.
Fixes # (issue)
Implementation of the 'rune' module
Notice that the z-axis interpretation is different from the previous library. Previously an orthogonal camera was used, and currently a perspective camera is used.
Please delete options that are not relevant.
How Has This Been Tested?
Checklist: