Skip to content

Commit e96e0b2

Browse files
committed
undo chaining operations b/c it breaks libs
1 parent 40dfdab commit e96e0b2

File tree

1 file changed

+16
-32
lines changed

1 file changed

+16
-32
lines changed

core/src/processing/core/PVector.java

Lines changed: 16 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -165,49 +165,45 @@ public PVector(float x, float y) {
165165
* @param z the z component of the vector
166166
* @brief Set the components of the vector
167167
*/
168-
public PVector set(float x, float y, float z) {
168+
public void set(float x, float y, float z) {
169169
this.x = x;
170170
this.y = y;
171171
this.z = z;
172-
return this;
173172
}
174173

175174

176175
/**
177176
* @param x the x component of the vector
178177
* @param y the y component of the vector
179178
*/
180-
public PVector set(float x, float y) {
179+
public void set(float x, float y) {
181180
this.x = x;
182181
this.y = y;
183-
return this;
184182
}
185183

186184

187185
/**
188186
* @param v any variable of type PVector
189187
*/
190-
public PVector set(PVector v) {
188+
public void set(PVector v) {
191189
x = v.x;
192190
y = v.y;
193191
z = v.z;
194-
return this;
195192
}
196193

197194

198195
/**
199196
* Set the x, y (and maybe z) coordinates using a float[] array as the source.
200197
* @param source array to copy from
201198
*/
202-
public PVector set(float[] source) {
199+
public void set(float[] source) {
203200
if (source.length >= 2) {
204201
x = source[0];
205202
y = source[1];
206203
}
207204
if (source.length >= 3) {
208205
z = source[2];
209206
}
210-
return this;
211207
}
212208

213209

@@ -457,11 +453,10 @@ public float magSq() {
457453
* @param v the vector to be added
458454
* @brief Adds x, y, and z components to a vector, one vector to another, or two independent vectors
459455
*/
460-
public PVector add(PVector v) {
456+
public void add(PVector v) {
461457
x += v.x;
462458
y += v.y;
463459
z += v.z;
464-
return this;
465460
}
466461

467462

@@ -470,11 +465,10 @@ public PVector add(PVector v) {
470465
* @param y y component of the vector
471466
* @param z z component of the vector
472467
*/
473-
public PVector add(float x, float y, float z) {
468+
public void add(float x, float y, float z) {
474469
this.x += x;
475470
this.y += y;
476471
this.z += z;
477-
return this;
478472
}
479473

480474

@@ -518,11 +512,10 @@ static public PVector add(PVector v1, PVector v2, PVector target) {
518512
* @param v any variable of type PVector
519513
* @brief Subtract x, y, and z components from a vector, one vector from another, or two independent vectors
520514
*/
521-
public PVector sub(PVector v) {
515+
public void sub(PVector v) {
522516
x -= v.x;
523517
y -= v.y;
524518
z -= v.z;
525-
return this;
526519
}
527520

528521

@@ -531,11 +524,10 @@ public PVector sub(PVector v) {
531524
* @param y the y component of the vector
532525
* @param z the z component of the vector
533526
*/
534-
public PVector sub(float x, float y, float z) {
527+
public void sub(float x, float y, float z) {
535528
this.x -= x;
536529
this.y -= y;
537530
this.z -= z;
538-
return this;
539531
}
540532

541533

@@ -576,11 +568,10 @@ static public PVector sub(PVector v1, PVector v2, PVector target) {
576568
* @brief Multiply a vector by a scalar
577569
* @param n the number to multiply with the vector
578570
*/
579-
public PVector mult(float n) {
571+
public void mult(float n) {
580572
x *= n;
581573
y *= n;
582574
z *= n;
583-
return this;
584575
}
585576

586577

@@ -618,11 +609,10 @@ static public PVector mult(PVector v, float n, PVector target) {
618609
* @brief Divide a vector by a scalar
619610
* @param n the number by which to divide the vector
620611
*/
621-
public PVector div(float n) {
612+
public void div(float n) {
622613
x /= n;
623614
y /= n;
624615
z /= n;
625-
return this;
626616
}
627617

628618

@@ -786,12 +776,11 @@ static public PVector cross(PVector v1, PVector v2, PVector target) {
786776
* @usage web_application
787777
* @brief Normalize the vector to a length of 1
788778
*/
789-
public PVector normalize() {
779+
public void normalize() {
790780
float m = mag();
791781
if (m != 0 && m != 1) {
792782
div(m);
793783
}
794-
return this;
795784
}
796785

797786

@@ -825,12 +814,11 @@ public PVector normalize(PVector target) {
825814
* @param max the maximum magnitude for the vector
826815
* @brief Limit the magnitude of the vector
827816
*/
828-
public PVector limit(float max) {
817+
public void limit(float max) {
829818
if (magSq() > max*max) {
830819
normalize();
831820
mult(max);
832821
}
833-
return this;
834822
}
835823

836824

@@ -846,10 +834,9 @@ public PVector limit(float max) {
846834
* @param len the new length for this vector
847835
* @brief Set the magnitude of the vector
848836
*/
849-
public PVector setMag(float len) {
837+
public void setMag(float len) {
850838
normalize();
851839
mult(len);
852-
return this;
853840
}
854841

855842

@@ -902,12 +889,11 @@ public float heading2D() {
902889
* @brief Rotate the vector by an angle (2D only)
903890
* @param theta the angle of rotation
904891
*/
905-
public PVector rotate(float theta) {
892+
public void rotate(float theta) {
906893
float temp = x;
907894
// Might need to check for rounding errors like with angleBetween function?
908895
x = x*PApplet.cos(theta) - y*PApplet.sin(theta);
909896
y = temp*PApplet.sin(theta) + y*PApplet.cos(theta);
910-
return this;
911897
}
912898

913899

@@ -925,11 +911,10 @@ public PVector rotate(float theta) {
925911
* @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.
926912
* @see PApplet#lerp(float, float, float)
927913
*/
928-
public PVector lerp(PVector v, float amt) {
914+
public void lerp(PVector v, float amt) {
929915
x = PApplet.lerp(x, v.x, amt);
930916
y = PApplet.lerp(y, v.y, amt);
931917
z = PApplet.lerp(z, v.z, amt);
932-
return this;
933918
}
934919

935920

@@ -951,11 +936,10 @@ public static PVector lerp(PVector v1, PVector v2, float amt) {
951936
* @param y the y component to lerp to
952937
* @param z the z component to lerp to
953938
*/
954-
public PVector lerp(float x, float y, float z, float amt) {
939+
public void lerp(float x, float y, float z, float amt) {
955940
this.x = PApplet.lerp(this.x, x, amt);
956941
this.y = PApplet.lerp(this.y, y, amt);
957942
this.z = PApplet.lerp(this.z, z, amt);
958-
return this;
959943
}
960944

961945

0 commit comments

Comments
 (0)