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

fix the behavior of the quad function. #5905

Merged
merged 1 commit into from
Dec 17, 2022
Merged

fix the behavior of the quad function. #5905

merged 1 commit into from
Dec 17, 2022

Conversation

inaridarkfox4231
Copy link
Contributor

The current definition of the quad function states that if there are 12 arguments, only the first 8 are used to specify the coordinates. I don't think this is the intended behavior, so I suggest changing it. It's easy to do, and it seems to be enough to remove the equals sign from the inequality sign.

Resolves #5807

Changes:
before

535    if (this._renderer.isP3D && args.length <= 12) {

after

535    if (this._renderer.isP3D && args.length < 12) {

here is sample code.
In the current definition, only the first eight arguments are used to specify the coordinates in this way.
By changing the definition in this way, if there are 12 arguments, 12 arguments will be used to specify the coordinates.

function setup() {
  createCanvas(400, 400, WEBGL);
}

function draw() {
  background(0);
  quad(-100,-100,0,100,-100,0,100,100,0,-100,100,0);
}

Screenshots of the change:
left: before. right:after.

sample3

PR Checklist

  • Core/Environment/Rendering
  • WEBGL

The current definition of the quad function states that if there are 12 arguments, only the first 8 are used to specify the coordinates. 
I don't think this is the intended behavior, so I suggest changing it. 
It's easy to do, and it seems to be enough to remove the equals sign from the inequality sign.
Copy link
Contributor

@davepagurek davepagurek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking into this! I love when fixes end up being a one character change 🙂

@davepagurek davepagurek merged commit 2639ff5 into processing:main Dec 17, 2022
@inaridarkfox4231 inaridarkfox4231 deleted the inaridarkfox4231-patch-2 branch December 17, 2022 03:21
@inaridarkfox4231
Copy link
Contributor Author

thanks very much for marge!('ω')

@inaridarkfox4231 inaridarkfox4231 changed the title change the behavior of the quad function. fix the behavior of the quad function. Jan 10, 2023
@smrghsh
Copy link
Contributor

smrghsh commented Jan 23, 2023

Hi! I am trying to run quad with the following code that you mentioned in this issue#5905 on the p5js editor.
I am running the following

function setup() {
  createCanvas(400, 400, WEBGL);
}
function draw() {
  background(0);
  quad(-100,-100,0,100,-100,0,100,100,0,-100,100,0);
}

12f89e0c6cf912ddfff0f14b48c1902d

Here is a screenshot of what's happening.
I'm not sure if this is a bug, or I'm doing something wrong.

@inaridarkfox4231
Copy link
Contributor Author

inaridarkfox4231 commented Jan 23, 2023

That issue has already been resolved. It is scheduled to be implemented in the next version, so it has not been fixed in 1.5.0 yet.
davePagurek made a build version that I can test the features that will be implemented in the next version. The next sketch should show a neat square.

p5.js/1.6.0/beta/quad
quad

This is a build version made by davepagurek. Not all features are implemented, but the quad() bug has been fixed. I fixed it.
The next version, 1.6.0, will be released in February, so please wait for a while.

Also, it seems that you are not familiar with the markdown notation, but when posting the source code, it is recommended to enclose it in quotation marks as shown below.

function setup() {
  createCanvas(400, 400, WEBGL);
}
function draw() {
  background(0);
  quad(-100,-100,0,100,-100,0,100,100,0,-100,100,0);
}

Already resolved, but thanks for the bug report. Thank you again. Please wait a moment now.

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

Successfully merging this pull request may close these issues.

3D quad(), triangle(), are broken
3 participants