X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=vg%2Fvg_m.h;h=a567092e79b130fa83dfe2234ead19aa95ad4d78;hb=c87000a5e48d2cf3afdf308189767951eb819c09;hp=9e70c9290ca48d859df9f9c054065c506040df23;hpb=7838efe822ca9336a69936004dd6d9bed70910fb;p=fishladder.git diff --git a/vg/vg_m.h b/vg/vg_m.h index 9e70c92..a567092 100644 --- a/vg/vg_m.h +++ b/vg/vg_m.h @@ -50,6 +50,26 @@ static inline void v2_copy( v2f a, v2f b ) b[0] = a[0]; b[1] = a[1]; } +static inline void v2i_copy( v2i a, v2i b ) +{ + b[0] = a[0]; b[1] = a[1]; +} + +static inline int v2i_eq( v2i a, v2i b ) +{ + return ((a[0] == b[0]) && (a[1] == b[1])); +} + +static inline void v2i_add( v2i a, v2i b, v2i d ) +{ + d[0] = a[0]+b[0]; d[1] = a[1]+b[1]; +} + +static inline void v2i_sub( v2i a, v2i b, v2i d ) +{ + d[0] = a[0]-b[0]; d[1] = a[1]-b[1]; +} + static inline void v2_minv( v2f a, v2f b, v2f dest ) { dest[0] = vg_minf(a[0], b[0]); @@ -125,6 +145,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 // ================================================================================================================== @@ -212,7 +238,7 @@ static inline void v3_normalize( v3f a ) v3_muls( a, 1.f / v3_length( a ), a ); } -static inline float csr_lerpf( float a, float b, float t ) +static inline float vg_lerpf( float a, float b, float t ) { return a + t*(b-a); }