Skip to content
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

Tutorial wrong? pop_matrix() does nothing, but should be refered as reset_matrix() instead #180

Closed
ReneTC opened this issue Jun 7, 2020 · 3 comments

Comments

@ReneTC
Copy link
Contributor

ReneTC commented Jun 7, 2020

Describe the bug
The tutorial on readthedocs describes how pop_matrix() resets the coordinate system.

To Reproduce
The following should set a circle at position 100*100, since the translation should not do anything doesn't do anything between push and pop. (green circle in the image)

push_matrix()
translate(100,100)
pop_matrix()
circle((100,100),50)

However, a circle appears at position (200,200) not (100,100)

Expected behavior
I would expect pop_matrix() to call an error since it does not exist? seems that nothing happens. The correct way to do it is calling reset_matrix(). It does exactly what the tutorial describes. (yellow circle in the image)

push_matrix()
translate(100,100)
reset_matrix()
circle((100,100),50)

We should rename reset_matrix() to pop_matrix.
Or rename push_matrix() to save_matrix() or something.

I'm new to p5py but tried p5.js a little bit. This confused me a lot.

Screenshots
Green colour is circle with pop_matrix() - it does nothing.
Yellow colour is circle with reset_matrix(). Expected behavour with pop_matrix()
image

@ReneTC
Copy link
Contributor Author

ReneTC commented Jun 7, 2020

I'm not sure if reset_matrix() just resets everything no matter what. But there is no mention of the pop_matrix() on readthedocs

@arihantparsoya
Copy link
Member

arihantparsoya commented Jun 8, 2020

@ReneTC , please use

with push_matrix():
        ....Some Code.....

We are currently working on supporting both the syntaxes (#171 ).

#156

@ReneTC
Copy link
Contributor Author

ReneTC commented Jun 8, 2020

Thank you @parsoyaarihant . I see it's a duplicate of #156.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants