mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
implement add(x, y) and sub(x, y) in PVector (fixes #3593)
This commit is contained in:
@@ -460,6 +460,17 @@ public class PVector implements Serializable {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param x x component of the vector
|
||||
* @param y y component of the vector
|
||||
*/
|
||||
public PVector add(float x, float y) {
|
||||
this.x += x;
|
||||
this.y += y;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param x x component of the vector
|
||||
* @param y y component of the vector
|
||||
@@ -521,6 +532,17 @@ public class PVector implements Serializable {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param x the x component of the vector
|
||||
* @param y the y component of the vector
|
||||
*/
|
||||
public PVector sub(float x, float y) {
|
||||
this.x -= x;
|
||||
this.y -= y;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param x the x component of the vector
|
||||
* @param y the y component of the vector
|
||||
@@ -543,6 +565,7 @@ public class PVector implements Serializable {
|
||||
return sub(v1, v2, null);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Subtract one vector from another and store in another vector
|
||||
* @param v1 the x, y, and z components of a PVector object
|
||||
|
||||
@@ -5,6 +5,8 @@ X Zero length string passed to TextLayout constructor
|
||||
X https://github.com/processing/processing/issues/3487
|
||||
X improve speed of text(x, y, w, h) when using large strings with no spaces
|
||||
X https://github.com/processing/processing/issues/211
|
||||
X implement add(x, y) and sub(x, y) in PVector
|
||||
X https://github.com/processing/processing/issues/3593
|
||||
|
||||
earlier
|
||||
X are we clear on sketchPath() for OS X?
|
||||
|
||||
@@ -7,6 +7,8 @@ X canceling "create folder, move sketch, and continue?" will cause crash
|
||||
X throws an NPE and then forces a quit
|
||||
X https://github.com/processing/processing/issues/3586
|
||||
X also showError() there shouldn't die if other Java windows open
|
||||
_ move Platform into its own class?
|
||||
_ https://github.com/processing/processing/issues/2765
|
||||
|
||||
api changes
|
||||
X Make fields and functions in PdeKeywords protected
|
||||
@@ -45,8 +47,6 @@ _ mouse events (i.e. toggle breakpoint) seem to be firing twice
|
||||
|
||||
|
||||
3.0 final
|
||||
_ move Platform into its own class?
|
||||
_ https://github.com/processing/processing/issues/2765
|
||||
_ Contributions Manager UI design
|
||||
_ https://github.com/processing/processing/issues/3482
|
||||
_ Ready to add contributed example packages?
|
||||
|
||||
Reference in New Issue
Block a user