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

Investigate if necessary to cast integers as floats #1

Open
jansensan opened this issue Oct 10, 2018 · 0 comments
Open

Investigate if necessary to cast integers as floats #1

jansensan opened this issue Oct 10, 2018 · 0 comments
Labels
enhancement New feature or request

Comments

@jansensan
Copy link
Member

In the mousePressed() method, the mouseX and mouseY are divided respectively by width and height. All these are values provided by Processing, and are integers. However, in order to obtain a ratio, they would have to be floats. At this time, they are cast as floats so that the calculation works:

float ratioX = float(mouseX) / float(width);
float ratioY = float(mouseY) / float(height);

Investigate if there is a better way to obtain that ratio.

https://processing.org/reference/width.html
https://processing.org/reference/height.html
https://processing.org/reference/mouseX.html
https://processing.org/reference/mouseY.html

@jansensan jansensan added the enhancement New feature or request label Oct 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant