Old project I never made a topic about: reified 'motions'

This was a project I made a while ago which essentially turns 'motions' into a first-class value. A 'motion' is a combination of translation & rotation. You can think of them as the equivalent of Roblox's CFrames for 2D.

For example, if you want to move 10 steps forward, normally you would do:

move (10) steps

But, if you wanted to save that motion for later, there's a reporter like:

(moving (10) steps forward)

which basically turns the idea of moving 10 steps forward into a value that you can then apply with a perform () block.

You can combine motions without performing them. For example:

((turning cw (90) degrees) then
 (moving (10) steps forward))

returns a 'motion' value that does exactly what it says. And you can compare them to other motions constructed differently to confirm that they are equal. For example, the above is equal to:

((moving (10) steps to the right) then
 (turning cw (90) degrees))

(>_< They don't actually seem to compare equal due to floating point error, but you get the idea of what I was going for)

Probably the most interesting part of this is (reverse of ()), which takes a 'motion' and returns the opposite motion, such that composing the two together results in no motion. E.G.

(reverse of (moving (10) steps forward))

represents the motion of moving 10 steps backwards.

The goal behind this project was to see if I could develop an intuitive kind of 'vector'-like value that lets you sidestep having to learn trigonometry to perform rotations. Instead of using sin and cos to draw an arc, you can compose motions from something like ((turning cw (angle) degrees) then (moving (100) steps forward)) and apply them to the circle's centre location to get the right positions. Here's the project link:

https://snap.berkeley.edu/snap/snap.html#present:Username=rdococ&ProjectName=Reifying%20motion&editMode

Nice project!

How does this block only exist in other custom blocks and not in the palette?
Reifying motion script pic

You can hide custom blocks either by using the hide blocks dialog, or by right clicking the block prototype (in the edit block dialog) and toggling in palette.

image
image
image

:running_man::dash: