X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=vg%2Fvg_m.h;h=577138fb12e575698d1c941e15958f05a898beeb;hb=aa435c13e7184bcd2034b8af1b20db1063baf9ec;hp=6276edb814bdb23bb0b83e036698ebf4b9d9513a;hpb=28aab72fdfe826c78edd61a9956da0190c183c2e;p=fishladder.git diff --git a/vg/vg_m.h b/vg/vg_m.h index 6276edb..577138f 100644 --- a/vg/vg_m.h +++ b/vg/vg_m.h @@ -110,7 +110,8 @@ static inline void v2_divs( v2f a, float s, v2f d ) static inline void v2_mul( v2f a, v2f b, v2f d ) { - d[0] = a[0]*b[0]; d[1] = a[1]*b[1]; + d[0] = a[0]*b[0]; + d[1] = a[1]*b[1]; } static inline void v2_div( v2f a, v2f b, v2f d ) @@ -118,9 +119,16 @@ static inline void v2_div( v2f a, v2f b, v2f d ) d[0] = a[0]/b[0]; d[1] = a[1]/b[1]; } +static inline void v2_muladd( v2f a, v2f b, v2f s, v2f d ) +{ + d[0] = a[0]+b[0]*s[0]; + d[1] = a[1]+b[1]*s[1]; +} + static inline void v2_muladds( v2f a, v2f b, float s, v2f d ) { - d[0] = a[0]+b[0]*s; d[1] = a[1]+b[1]*s; + d[0] = a[0]+b[0]*s; + d[1] = a[1]+b[1]*s; } static inline float v2_length2( v2f a ) @@ -145,6 +153,12 @@ static inline float v2_dist( v2f a, v2f b ) return sqrtf( v2_dist2( a, b ) ); } +static inline void v2_lerp( v2f a, v2f b, float t, v2f d ) +{ + d[0] = a[0] + t*(b[0]-a[0]); + d[1] = a[1] + t*(b[1]-a[1]); +} + // Vector 3 // ==================================================================================================================