-
Notifications
You must be signed in to change notification settings - Fork 240
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
Implementation of PVector.setHeading() #193
Comments
Adding it for parity with p5.js… Here's the full implementation from there: _main.default.Vector.prototype.setHeading = function setHeading(a) {
var m = this.mag();
this.x = m * Math.cos(a);
this.y = m * Math.sin(a);
return this;
}; |
Yes, and it was immediately fixed in the next commit. |
@benfry |
This issue has been automatically locked. To avoid confusion with reports that have already been resolved, closed issues are automatically locked 30 days after the last comment. Please open a new issue for related bugs. |
There's an method named
PVector.setHeading()
inp5.Vector
class of p5.js to set the direction of an vector to any given angle. But there's no such option in Processing. It can be settled down easily. But the function seems more self explanatory and easy to understand. It also goes well with thePVector.heading()
method already present in Processing.An implementation might look like the following :
The text was updated successfully, but these errors were encountered: