How to access hidden atan2 block

I was looking for atan2, and found this forum thread that mentions "these hidden blocks can be found with the relabel option of any dyadic arithmetic block". What does that mean, i.e. what do I click to un-hide atan2?

(Also @bh, you explain the arguments are dx, dy for clockwise from 'north/up' vs the traditional, but testing values, I'm pretty sure the implementation is traditional* atan2(y,x), but it just so happens that switching clockwise from north and counter-clockwise from east is effectively the same as swapping x<-->y.)

  • except returning degrees instead of radians

Right-click on any math operators that have two number inputs:
+, -, ×, /, ^, or mod
then click relabel...

Interesting, thanks.

ALSO, I found the doi answer to my own question, just go to the palette and search for atan2, and it shows up.

What is the purpose of relabeling? To make it easier to build complex formulas without so much long-distance drag&drop?

Yes, I think this is the reason.

In the past, it was an quick method of just easily changing between similar blocks as you and @snapenilk have said

But recently, it is being used to provide new primitive blocks without congesting the categories and to save us having to load in libraries

AFAIK This other facility is a bit experimental still but I love it :slight_smile:

Main "hidden" ones I use are
the max/min
image

and the >= <= and not equals
image

Recently we've been using it for functions that are useful but are also really important for students to write for themselves, especially ≤, ≥ and min, max. And also for things we don't want to scare beginners away, of which atan2 is an example.

Yes, that's what I meant.

Ah I get it. You didn't mean 'atan2 is normally implemented... but we implemented it... so we could use CW from North'; you meant 'atan2 is what it is. In the example I just gave I put x/y instead of y/x because Snap! uses CW from North'.

I've been testing, and relabeling shows up in a lot of useful places -- even with custom blocks (that have comparable argument lists)!

Yeah, I think the theory is that if you were using plain atan you'd (elsewhere) use y/x and so that's why they used the otherwise confusing order of arguments (y,x), to agree with that. So for us it's atan(x/y) and atan2(x,y).

One can easily recreate them as custom blocks as well

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.