You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -814,11 +820,12 @@ public PVector normalize(PVector target) {
814
820
* @param max the maximum magnitude for the vector
815
821
* @brief Limit the magnitude of the vector
816
822
*/
817
-
publicvoidlimit(floatmax) {
823
+
publicPVectorlimit(floatmax) {
818
824
if (magSq() > max*max) {
819
825
normalize();
820
826
mult(max);
821
827
}
828
+
returnthis;
822
829
}
823
830
824
831
@@ -834,9 +841,10 @@ public void limit(float max) {
834
841
* @param len the new length for this vector
835
842
* @brief Set the magnitude of the vector
836
843
*/
837
-
publicvoidsetMag(floatlen) {
844
+
publicPVectorsetMag(floatlen) {
838
845
normalize();
839
846
mult(len);
847
+
returnthis;
840
848
}
841
849
842
850
@@ -889,11 +897,12 @@ public float heading2D() {
889
897
* @brief Rotate the vector by an angle (2D only)
890
898
* @param theta the angle of rotation
891
899
*/
892
-
publicvoidrotate(floattheta) {
900
+
publicPVectorrotate(floattheta) {
893
901
floattemp = x;
894
902
// Might need to check for rounding errors like with angleBetween function?
895
903
x = x*PApplet.cos(theta) - y*PApplet.sin(theta);
896
904
y = temp*PApplet.sin(theta) + y*PApplet.cos(theta);
905
+
returnthis;
897
906
}
898
907
899
908
@@ -911,10 +920,11 @@ public void rotate(float theta) {
911
920
* @param amt The amount of interpolation; some value between 0.0 (old vector) and 1.0 (new vector). 0.1 is very near the new vector. 0.5 is halfway in between.
0 commit comments