Actually, I see that it is implemented in the github 1.4.8 version. How do I get Processing's Javascript mode to use that version rather than the 1.4.1 it seems to currently be using?
public void rotate(float theta) {
float temp = x;
// Might need to check for rounding errors like with angleBetween function?
x = x*PApplet.cos(theta) - y*PApplet.sin(theta);
y = temp*PApplet.sin(theta) + y*PApplet.cos(theta);
}
public PVector rotate(float theta) {float temp = x;// Might need to check for rounding errors like with angleBetween function?x = x*PApplet.cos(theta) - y*PApplet.sin(theta);y = temp*PApplet.sin(theta) + y*PApplet.cos(theta);return this;}
Answers
Actually, I see that it is implemented in the github 1.4.8 version. How do I get Processing's Javascript mode to use that version rather than the 1.4.1 it seems to currently be using?
<Sketchbook Location>/modes/JavaScriptMode/template/processing.js
Some warnings though:
At least, we can peek at Java Mode's own rotate() implementation source code:
https://github.com/processing/processing/blob/master/core/src/processing/core/PVector.java#L892
I've got an online example which uses either PVector's rotate() or a "manual" approach to it:
http://studio.processingtogether.com/sp/pad/export/ro.91nVQMnL$v06L/latest
Thanks. I will probable go the manual way as you suggest.
PVector rotate(float theta)
public PVector rotate(float theta) {
float temp = x;
// Might need to check for rounding errors like with angleBetween function?
x = x*PApplet.cos(theta) - y*PApplet.sin(theta);
y = temp*PApplet.sin(theta) + y*PApplet.cos(theta);
return this;
}