| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -847,21 +847,44 @@ public void rotate(float theta) { | |||
| 847 | 847 | ||
| 848 | 848 | /** | |
| 849 | 849 | * Linear interpolate the vector to another vector | |
| 850 | - * @param PVector the vector to lerp to | ||
| 850 | + * @param v the vector to lerp to | ||
| 851 | 851 | * @param amt The amt parameter is the amount to interpolate between the two vectors where 1.0 equal to the new vector | |
| 852 | 852 | * 0.1 is very near the new vector, 0.5 is half-way in between. | |
| 853 | 853 | */ | |
| 854 | 854 | public void lerp(PVector v, float amt) { | |
| 855 | 855 | x = PApplet.lerp(x,v.x,amt); | |
| 856 | 856 | y = PApplet.lerp(y,v.y,amt); | |
| 857 | + z = PApplet.lerp(z,v.z,amt); | ||
| 858 | + } | ||
| 859 | + | ||
| 860 | + /** | ||
| 861 | + * Linear interpolate between two vectors (returns a new PVector object) | ||
| 862 | + * @param v1 the vector | ||
| 863 | + * @param v2 the vector to lerp to | ||
| 864 | + * @param amt The amt parameter is the amount to interpolate between the two vectors where 1.0 equal to the new vector | ||
| 865 | + * 0.1 is very near the new vector, 0.5 is half-way in between. | ||
| 866 | + * @return the resulting lerped PVector | ||
| 867 | + */ | ||
| 868 | + public static PVector lerp(PVector v1, PVector v2, float amt) { | ||
| 869 | + PVector v = v1.get(); | ||
| 870 | + v.lerp(v2, amt); | ||
| 871 | + return v; | ||
| 857 | 872 | } | |
| 858 | 873 | ||
| 874 | + /** | ||
| 875 | + * Linear interpolate the vector to x,y,z values | ||
| 876 | + * @param x the x component to lerp to | ||
| 877 | + * @param y the y component to lerp to | ||
| 878 | + * @param z the z component to lerp to | ||
| 879 | + * @param amt The amt parameter is the amount to interpolate between the two vectors where 1.0 equal to the new vector | ||
| 880 | + * 0.1 is very near the new vector, 0.5 is half-way in between. | ||
| 881 | + */ | ||
| 859 | 882 | public void lerp(float x, float y, float z, float amt) { | |
| 860 | 883 | this.x = PApplet.lerp(this.x,x,amt); | |
| 861 | 884 | this.y = PApplet.lerp(this.y,y,amt); | |
| 885 | + this.z = PApplet.lerp(this.z,z,amt); | ||
| 862 | 886 | } | |
| 863 | 887 | ||
| 864 | - | ||
| 865 | 888 | /** | |
| 866 | 889 | * ( begin auto-generated from PVector_angleBetween.xml ) | |
| 867 | 890 | * | |
| Back | FazBrowse Home | New Git URL |
0 commit comments