Skip to content

Investigate if necessary to cast integers as floats #1

Description

@jansensan

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions